Author: tom.baeyens(a)jboss.com
Date: 2009-07-23 05:21:53 -0400 (Thu, 23 Jul 2009)
New Revision: 5340
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/test/ShipmentTest.java
jbpm4/trunk/modules/bpmn/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
Log:
bpmn parsing fixes
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-07-22
20:44:20 UTC (rev 5339)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-07-23
09:21:53 UTC (rev 5340)
@@ -24,6 +24,9 @@
import java.util.ArrayList;
import java.util.List;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.SAXParserFactory;
+
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Parse;
Modified: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/test/ShipmentTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/test/ShipmentTest.java 2009-07-22
20:44:20 UTC (rev 5339)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/test/ShipmentTest.java 2009-07-23
09:21:53 UTC (rev 5340)
@@ -30,10 +30,10 @@
public class ShipmentTest extends JbpmTestCase {
public void testShipment() {
- repositoryService.createDeployment()
+ String deploymentId = repositoryService.createDeployment()
.addResourceFromClasspath("org/jbpm/bpmn/test/shipment.bpmn.xml")
.deploy();
- // todo
+ repositoryService.deleteDeploymentCascade(deploymentId);
}
}
Modified: jbpm4/trunk/modules/bpmn/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/jbpm.cfg.xml 2009-07-22 20:44:20 UTC (rev
5339)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/jbpm.cfg.xml 2009-07-23 09:21:53 UTC (rev
5340)
@@ -5,7 +5,6 @@
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.tx.hibernate.cfg.xml" />
- <import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<process-engine-context>
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
---
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-07-22
20:44:20 UTC (rev 5339)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-07-23
09:21:53 UTC (rev 5340)
@@ -163,12 +163,16 @@
}
public Object parseDocumentElement(Element documentElement, Parse parse) {
+ List<ProcessDefinitionImpl> processDefinitions = new
ArrayList<ProcessDefinitionImpl>();
+
JpdlProcessDefinition processDefinition = (JpdlProcessDefinition)
parse.getDocumentObject();
if (processDefinition==null) {
processDefinition = new JpdlProcessDefinition();
parse.setDocumentObject(processDefinition);
}
+ processDefinitions.add(processDefinition);
+
parse.pushObject(processDefinition);
try {
// process attribues
@@ -225,7 +229,7 @@
parse.addProblem("no start activity in process", documentElement);
}
- return processDefinition;
+ return processDefinitions;
}
protected void resolveTransitionDestinations(Parse parse, JpdlProcessDefinition
processDefinition, UnresolvedTransitions unresolvedTransitions) {
Modified:
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java
===================================================================
---
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java 2009-07-22
20:44:20 UTC (rev 5339)
+++
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java 2009-07-23
09:21:53 UTC (rev 5340)
@@ -25,6 +25,7 @@
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.client.ClientProcessDefinition;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.xml.Problem;
import org.jbpm.test.BaseJbpmTestCase;
@@ -51,11 +52,17 @@
public ClientProcessDefinition parse(String xmlString) {
JpdlParser jpdlParser = new JpdlParser();
- return (ClientProcessDefinition) jpdlParser.createParse()
+ List<ProcessDefinitionImpl> processDefinitions =
(List<ProcessDefinitionImpl>) jpdlParser.createParse()
.setString(xmlString)
.execute()
.checkErrors("process definition xml string")
.getDocumentObject();
+ if ( (processDefinitions==null)
+ || (processDefinitions.isEmpty())
+ ) {
+ return null;
+ }
+ return processDefinitions.get(0);
}
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java 2009-07-22
20:44:20 UTC (rev 5339)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/ProcessDeployer.java 2009-07-23
09:21:53 UTC (rev 5340)
@@ -61,38 +61,40 @@
parse.setProblems(deployment.getProblems());
parse.setInputStream(inputStream);
parse.execute();
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
parse.getDocumentObject();
- if ((processDefinition != null) && (processDefinition.getName() != null))
{
- String processDefinitionName = processDefinition.getName();
-
- processDefinition.setSuspended(deployment.isSuspended());
-
- String imageResourceName = resourceName.substring(0,
resourceName.lastIndexOf(extension))+".png";
- if (deployment.getResourceNames().contains(imageResourceName)) {
- processDefinition.setImageResourceName(imageResourceName);
- }
+ List<ProcessDefinitionImpl> processDefinitions =
(List<ProcessDefinitionImpl>) parse.getDocumentObject();
+ for (ProcessDefinitionImpl processDefinition: processDefinitions) {
+ if ((processDefinition != null) && (processDefinition.getName() !=
null)) {
+ String processDefinitionName = processDefinition.getName();
+
+ processDefinition.setSuspended(deployment.isSuspended());
+
+ String imageResourceName = resourceName.substring(0,
resourceName.lastIndexOf(extension))+".png";
+ if (deployment.getResourceNames().contains(imageResourceName)) {
+ processDefinition.setImageResourceName(imageResourceName);
+ }
- processDefinition.setDeploymentDbid(deployment.getDbid());
+ processDefinition.setDeploymentDbid(deployment.getDbid());
- if (deployment.hasObjectProperties(processDefinitionName)) {
- String key = deployment.getProcessDefinitionKey(processDefinitionName);
- String id = deployment.getProcessDefinitionId(processDefinitionName);
- Long version =
deployment.getProcessDefinitionVersion(processDefinitionName);
- processDefinition.setId(id);
- processDefinition.setKey(key);
- processDefinition.setVersion(version.intValue());
+ if (deployment.hasObjectProperties(processDefinitionName)) {
+ String key = deployment.getProcessDefinitionKey(processDefinitionName);
+ String id = deployment.getProcessDefinitionId(processDefinitionName);
+ Long version =
deployment.getProcessDefinitionVersion(processDefinitionName);
+ processDefinition.setId(id);
+ processDefinition.setKey(key);
+ processDefinition.setVersion(version.intValue());
- } else {
- checkKey(processDefinition, deployment);
- checkVersion(processDefinition, deployment);
- checkId(processDefinition, deployment);
+ } else {
+ checkKey(processDefinition, deployment);
+ checkVersion(processDefinition, deployment);
+ checkId(processDefinition, deployment);
- deployment.setProcessDefinitionId(processDefinitionName,
processDefinition.getId());
- deployment.setProcessDefinitionKey(processDefinitionName,
processDefinition.getKey());
- deployment.setProcessDefinitionVersion(processDefinitionName, new
Long(processDefinition.getVersion()));
+ deployment.setProcessDefinitionId(processDefinitionName,
processDefinition.getId());
+ deployment.setProcessDefinitionKey(processDefinitionName,
processDefinition.getKey());
+ deployment.setProcessDefinitionVersion(processDefinitionName, new
Long(processDefinition.getVersion()));
+ }
+
+ deployment.addObject(processDefinitionName, processDefinition);
}
-
- deployment.addObject(processDefinitionName, processDefinition);
}
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2009-07-22
20:44:20 UTC (rev 5339)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2009-07-23
09:21:53 UTC (rev 5340)
@@ -286,10 +286,12 @@
public void initializeDocumentBuilderFactory() {
documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ documentBuilderFactory.setNamespaceAware(true);
}
public void initializeSaxParserFactory() {
saxParserFactory = SAXParserFactory.newInstance();
+ saxParserFactory.setNamespaceAware(true);
}
// document builder methods /////////////////////////////////////////////////
Show replies by date