Permalink
Browse files

Small parser improvements

  • Loading branch information...
1 parent a107e68 commit c7de15630478cf2f84d81808d714563d548959fa @krisv krisv committed Jan 25, 2012
@@ -32,6 +32,7 @@
import org.jbpm.bpmn2.core.ItemDefinition;
import org.jbpm.bpmn2.core.Message;
import org.jbpm.compiler.xml.ProcessBuildData;
+import org.jbpm.ruleflow.core.RuleFlowProcess;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -53,6 +54,8 @@ public DataStoreHandler() {
this.validPeers.add(Interface.class);
this.validPeers.add(Escalation.class);
this.validPeers.add(Error.class);
+ this.validPeers.add(DataStore.class);
+ this.validPeers.add(RuleFlowProcess.class);
this.allowNesting = false;
}
@@ -31,6 +31,7 @@
import org.jbpm.bpmn2.core.ItemDefinition;
import org.jbpm.bpmn2.core.Message;
import org.jbpm.compiler.xml.ProcessBuildData;
+import org.jbpm.ruleflow.core.RuleFlowProcess;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -50,6 +51,7 @@ public ErrorHandler() {
this.validPeers.add(Escalation.class);
this.validPeers.add(Error.class);
this.validPeers.add(DataStore.class);
+ this.validPeers.add(RuleFlowProcess.class);
this.allowNesting = false;
}
@@ -30,6 +30,7 @@
import org.jbpm.bpmn2.core.ItemDefinition;
import org.jbpm.bpmn2.core.Message;
import org.jbpm.compiler.xml.ProcessBuildData;
+import org.jbpm.ruleflow.core.RuleFlowProcess;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -49,6 +50,7 @@ public EscalationHandler() {
this.validPeers.add(Escalation.class);
this.validPeers.add(Error.class);
this.validPeers.add(DataStore.class);
+ this.validPeers.add(RuleFlowProcess.class);
this.allowNesting = false;
}
@@ -30,6 +30,7 @@
import org.jbpm.bpmn2.core.ItemDefinition;
import org.jbpm.bpmn2.core.Message;
import org.jbpm.compiler.xml.ProcessBuildData;
+import org.jbpm.ruleflow.core.RuleFlowProcess;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -49,6 +50,7 @@ public InterfaceHandler() {
this.validPeers.add(Escalation.class);
this.validPeers.add(Error.class);
this.validPeers.add(DataStore.class);
+ this.validPeers.add(RuleFlowProcess.class);
this.allowNesting = false;
}
@@ -30,6 +30,7 @@
import org.jbpm.bpmn2.core.ItemDefinition;
import org.jbpm.bpmn2.core.Message;
import org.jbpm.compiler.xml.ProcessBuildData;
+import org.jbpm.ruleflow.core.RuleFlowProcess;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -49,6 +50,7 @@ public ItemDefinitionHandler() {
this.validPeers.add(Escalation.class);
this.validPeers.add(Error.class);
this.validPeers.add(DataStore.class);
+ this.validPeers.add(RuleFlowProcess.class);
this.allowNesting = false;
}
@@ -30,6 +30,7 @@
import org.jbpm.bpmn2.core.ItemDefinition;
import org.jbpm.bpmn2.core.Message;
import org.jbpm.compiler.xml.ProcessBuildData;
+import org.jbpm.ruleflow.core.RuleFlowProcess;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -49,6 +50,7 @@ public MessageHandler() {
this.validPeers.add(Escalation.class);
this.validPeers.add(Error.class);
this.validPeers.add(DataStore.class);
+ this.validPeers.add(RuleFlowProcess.class);
this.allowNesting = false;
}
@@ -20,9 +20,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
import org.drools.process.core.Work;
import org.drools.process.core.datatype.DataType;
@@ -53,8 +50,7 @@ protected Node createNode(Attributes attrs) {
return new WorkItemNode();
}
- @SuppressWarnings("unchecked")
- public Class generateNodeFor() {
+ public Class<?> generateNodeFor() {
return Node.class;
}
@@ -129,28 +125,30 @@ protected void readDataInputAssociation(org.w3c.dom.Node xmlNode, WorkItemNode w
String to = subNode.getTextContent();
// assignment
subNode = subNode.getNextSibling();
- org.w3c.dom.Node subSubNode = subNode.getFirstChild();
- NodeList nl = subSubNode.getChildNodes();
- if (nl.getLength() > 1) {
- // not supported ?
- workItemNode.getWork().setParameter(dataInputs.get(to), subSubNode.getTextContent());
- return;
- } else if (nl.getLength() == 0) {
- return;
- }
- Object result = null;
- Object from = nl.item(0);
- if (from instanceof Text) {
- String text = ((Text) from).getTextContent();
- if (text.startsWith("\"") && text.endsWith("\"")) {
- result = text.substring(1, text.length() -1);
- } else {
- result = text;
- }
- } else {
- result = nl.item(0);
+ if (subNode != null) {
+ org.w3c.dom.Node subSubNode = subNode.getFirstChild();
+ NodeList nl = subSubNode.getChildNodes();
+ if (nl.getLength() > 1) {
+ // not supported ?
+ workItemNode.getWork().setParameter(dataInputs.get(to), subSubNode.getTextContent());
+ return;
+ } else if (nl.getLength() == 0) {
+ return;
+ }
+ Object result = null;
+ Object from = nl.item(0);
+ if (from instanceof Text) {
+ String text = ((Text) from).getTextContent();
+ if (text.startsWith("\"") && text.endsWith("\"")) {
+ result = text.substring(1, text.length() -1);
+ } else {
+ result = text;
+ }
+ } else {
+ result = nl.item(0);
+ }
+ workItemNode.getWork().setParameter(dataInputs.get(to), result);
}
- workItemNode.getWork().setParameter(dataInputs.get(to), result);
}
}
@@ -234,6 +232,7 @@ protected void handleForEachNode(final Node node, final Element element, final S
}
}
+ @SuppressWarnings("unchecked")
protected void readMultiInstanceLoopCharacteristics(org.w3c.dom.Node xmlNode, ForEachNode forEachNode, ExtensibleXmlParser parser) {
// sourceRef
org.w3c.dom.Node subNode = xmlNode.getFirstChild();
@@ -13,7 +13,9 @@
<process processType="Private" isExecutable="true" id="OnEntryExitScriptProcess" name="On-Entry / On-Exit Script Process" >
- <tns:global identifier="list" type="java.util.List" />
+ <extensionElements>
+ <tns:global identifier="list" type="java.util.List" />
+ </extensionElements>
<!-- nodes -->
<startEvent id="_1" name="StartProcess" />
@@ -655,7 +655,7 @@ void setFaultContentId(long faultContentId) {
* @param comment comment to add
*/
public void addComment(Comment comment) {
- if (comments == null || comments == Collections.<Comment>emptyList()) {
+ if (comments == null || comments.size() == 0) {
comments = new ArrayList<Comment>();
}

0 comments on commit c7de156

Please sign in to comment.