[jboss-svn-commits] JBL Code SVN: r19433 - in labs/jbossrules/trunk/drools-compiler: src/main/java/org/drools/compiler and 17 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Apr 6 19:49:40 EDT 2008
Author: KrisVerlaenen
Date: 2008-04-06 19:49:40 -0400 (Sun, 06 Apr 2008)
New Revision: 19433
Added:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcessDumper.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/AbstractNodeHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ConstraintHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/JoinNodeHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/MappingHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/MilestoneNodeHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ParameterHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/RuleSetNodeHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/SplitNodeHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/SubProcessNodeHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/TimerNodeHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/TypeHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ValueHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/VariableHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/WorkHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/WorkItemNodeHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-processes-4.0.xsd
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELFaultExceptionHandler.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELFaultHandler.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELExceptionHandlerInstance.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELExceptionScopeInstance.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/processes/XMLPersistenceTest.java
labs/jbossrules/trunk/drools-compiler/src/test/resources/META-INF/bpelProcessContextInstanceFactory.conf
Removed:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcesDumper.java
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rf
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow_old.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow_old.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rf
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rf
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rf
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rfm
Modified:
labs/jbossrules/trunk/drools-compiler/.classpath
labs/jbossrules/trunk/drools-compiler/.project
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/DroolsError.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/process/builder/SplitNodeBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ActionBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessBuildData.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessSemanticModule.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlProcessReader.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ActionNodeHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ConnectionHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/EndNodeHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ImportHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ProcessHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/StartNodeHandler.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELProcess.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELReply.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELInvokeInstance.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELReceiveInstance.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/test/BPELTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/testframework/MockWorkingMemory.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/StoreHandler.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/TestXml.java
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlDslTest.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlTest.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml
Log:
JBRULES-1548: ePDL: XML-based process definition language
- Ruleflow processes now stored using nicer XML format
JBRULES-1549: Workflow Context
- Context as the basis for grouping nodes
JBRULES-1550: Workflow timer
- Timer node + service
JBRULES-1551: Workflow human tasks
- Added initial implementation for integration human tasks
Modified: labs/jbossrules/trunk/drools-compiler/.classpath
===================================================================
--- labs/jbossrules/trunk/drools-compiler/.classpath 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/.classpath 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,16 +1,16 @@
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
- <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
- <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/com/thoughtworks/xstream/xstream/1.2.2/xstream-1.2.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.0/antlr-runtime-3.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/xpp3/xpp3_min/1.1.3.4.O/xpp3_min-1.1.3.4.O.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/mvel/mvel/2.0-alpha2-dp3-java1.5/mvel-2.0-alpha2-dp3-java1.5.jar"/>
- <classpathentry kind="src" path="/drools-core"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/janino/janino/2.5.10/janino-2.5.10.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.3.v_686_R32x/core-3.2.3.v_686_R32x.jar"/>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+ <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+ <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/com/thoughtworks/xstream/xstream/1.2.2/xstream-1.2.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xpp3/xpp3_min/1.1.3.4.O/xpp3_min-1.1.3.4.O.jar"/>
+ <classpathentry kind="var" path="M2_REPO/janino/janino/2.5.10/janino-2.5.10.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.0/antlr-runtime-3.0.jar"/>
+ <classpathentry kind="src" path="/drools-core"/>
+ <classpathentry kind="var" path="M2_REPO/org/mvel/mvel/2.0-SNAPSHOT/mvel-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.3.v_686_R32x/core-3.2.3.v_686_R32x.jar"/>
</classpath>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/.project
===================================================================
--- labs/jbossrules/trunk/drools-compiler/.project 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/.project 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,15 +1,15 @@
-<projectDescription>
- <name>drools-compiler</name>
- <comment>A rule production system</comment>
- <projects>
- <project>drools-core</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
+<projectDescription>
+ <name>drools-compiler</name>
+ <comment>A rule production system</comment>
+ <projects>
+ <project>drools-core</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
</projectDescription>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/DroolsError.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/DroolsError.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/DroolsError.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -29,4 +29,8 @@
* @return
*/
public abstract int[] getErrorLines();
+
+ public String toString() {
+ return getClass().getName() + ": " + getMessage();
+ }
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -212,7 +212,7 @@
}
/**
- * Add a ruleflow (.rt) asset to this package.
+ * Add a ruleflow (.rfm) asset to this package.
*/
public void addRuleFlow(Reader processSource) {
ProcessBuilder processBuilder = new ProcessBuilder( this );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -43,9 +43,8 @@
import org.drools.workflow.core.impl.WorkflowProcessImpl;
import org.drools.workflow.core.node.MilestoneNode;
import org.drools.workflow.core.node.Split;
+import org.drools.xml.XmlProcessReader;
-import com.thoughtworks.xstream.XStream;
-
/**
* A ProcessBuilder can be used to build processes based on XML files
* containing a process definition.
@@ -162,13 +161,14 @@
}
public void addProcessFromFile(final Reader reader) throws Exception {
- final XStream stream = new XStream();
- stream.setMode( XStream.ID_REFERENCES );
+ PackageBuilderConfiguration configuration = new PackageBuilderConfiguration();
+ XmlProcessReader xmlReader = new XmlProcessReader( configuration.getSemanticModules() );
+
final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
final ClassLoader newLoader = this.getClass().getClassLoader();
try {
Thread.currentThread().setContextClassLoader( newLoader );
- final WorkflowProcess process = (WorkflowProcess) stream.fromXML( reader );
+ Process process = xmlReader.read(reader);
buildProcess( process );
} finally {
Thread.currentThread().setContextClassLoader( oldLoader );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/process/builder/SplitNodeBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/process/builder/SplitNodeBuilder.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/process/builder/SplitNodeBuilder.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -11,20 +11,19 @@
import org.drools.process.core.Process;
import org.drools.rule.builder.ProcessBuildContext;
import org.drools.workflow.core.Connection;
+import org.drools.workflow.core.Constraint;
import org.drools.workflow.core.Node;
import org.drools.workflow.core.impl.ConstraintImpl;
import org.drools.workflow.core.node.Split;
import org.drools.workflow.instance.impl.ReturnValueConstraintEvaluator;
import org.drools.workflow.instance.impl.RuleConstraintEvaluator;
-public class SplitNodeBuilder
- implements
- ProcessNodeBuilder {
+public class SplitNodeBuilder implements ProcessNodeBuilder {
public void build(Process process,
- ProcessDescr processDescr,
- ProcessBuildContext context,
- Node node) {
+ ProcessDescr processDescr,
+ ProcessBuildContext context,
+ Node node) {
Split splitNode = ( Split ) node;
if ( splitNode.getType() == Split.TYPE_AND ) {
@@ -32,26 +31,35 @@
return;
}
// we need to clone the map, so we can update the original while iterating.
- Map map = new HashMap( splitNode.getConstraints() );
- for ( Iterator it = map.entrySet().iterator(); it.hasNext(); ) {
- Entry entry = (Entry) it.next();
- Connection connection = (Connection) entry.getKey();
+ Map<Split.ConnectionRef, Constraint> map = new HashMap<Split.ConnectionRef, Constraint>( splitNode.getConstraints() );
+ for ( Iterator<Map.Entry<Split.ConnectionRef, Constraint>> it = map.entrySet().iterator(); it.hasNext(); ) {
+ Map.Entry<Split.ConnectionRef, Constraint> entry = it.next();
+ Split.ConnectionRef connection = entry.getKey();
ConstraintImpl constraint = (ConstraintImpl) entry.getValue();
-
+ Connection outgoingConnection = null;
+ for (Connection out: splitNode.getDefaultOutgoingConnections()) {
+ if (out.getToType().equals(connection.getToType())
+ && out.getTo().getId() == connection.getNodeId()) {
+ outgoingConnection = out;
+ }
+ }
+ if (outgoingConnection == null) {
+ throw new IllegalArgumentException("Could not find outgoing connection");
+ }
if ( "rule".equals( constraint.getType() )) {
RuleConstraintEvaluator ruleConstraint = new RuleConstraintEvaluator();
ruleConstraint.setDialect( constraint.getDialect() );
ruleConstraint.setName( constraint.getName() );
ruleConstraint.setPriority( constraint.getPriority() );
ruleConstraint.setPriority( constraint.getPriority() );
- splitNode.setConstraint( connection, ruleConstraint );
+ splitNode.setConstraint( outgoingConnection, ruleConstraint );
} else if ( "code".equals( constraint.getType() ) ) {
ReturnValueConstraintEvaluator returnValueConstraint = new ReturnValueConstraintEvaluator();
returnValueConstraint.setDialect( constraint.getDialect() );
returnValueConstraint.setName( constraint.getName() );
returnValueConstraint.setPriority( constraint.getPriority() );
returnValueConstraint.setPriority( constraint.getPriority() );
- splitNode.setConstraint( connection, returnValueConstraint );
+ splitNode.setConstraint( outgoingConnection, returnValueConstraint );
ReturnValueDescr returnValueDescr = new ReturnValueDescr();
returnValueDescr.setText( constraint.getConstraint() );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ActionBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ActionBuilder.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ActionBuilder.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,6 +1,7 @@
package org.drools.rule.builder;
import org.drools.lang.descr.ActionDescr;
+import org.drools.process.core.context.variable.VariableScope;
import org.drools.workflow.core.node.ActionNode;
public interface ActionBuilder {
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -23,6 +23,7 @@
import org.drools.compiler.Dialect;
import org.drools.lang.descr.ActionDescr;
+import org.drools.process.core.context.variable.VariableScope;
import org.drools.rule.builder.ActionBuilder;
import org.drools.rule.builder.PackageBuildContext;
import org.drools.rule.builder.ProcessBuildContext;
@@ -42,6 +43,15 @@
public void build(final PackageBuildContext context,
final ActionNode actionNode,
final ActionDescr actionDescr) {
+ build( context,
+ actionNode,
+ actionDescr,
+ null );
+ }
+ public void build(final PackageBuildContext context,
+ final ActionNode actionNode,
+ final ActionDescr actionDescr,
+ final VariableScope variableScope) {
final String className = "action" + context.getNextId();
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessBuildData.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessBuildData.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessBuildData.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -10,8 +10,9 @@
import org.drools.workflow.core.Node;
public class ProcessBuildData {
+
private Process process;
- private Map<String, Node> nodes = new HashMap<String, Node>();
+ private Map<Long, Node> nodes = new HashMap<Long, Node>();
public Process getProcess() {
return process;
@@ -21,15 +22,14 @@
this.process = process;
}
- public Map<String, Node> getNodes() {
+ public Map<Long, Node> getNodes() {
return nodes;
}
public boolean addNode(Node node) {
- return( this.nodes.put( node.getName(),
- node ) != null );
+ return( this.nodes.put( node.getId(), node ) != null );
}
- public Node getNode(String name) {
- return this.nodes.get( name );
+ public Node getNode(Long id) {
+ return this.nodes.get( id );
}
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessSemanticModule.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessSemanticModule.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessSemanticModule.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -2,11 +2,25 @@
import org.drools.xml.processes.ActionNodeHandler;
import org.drools.xml.processes.ConnectionHandler;
+import org.drools.xml.processes.ConstraintHandler;
import org.drools.xml.processes.EndNodeHandler;
import org.drools.xml.processes.GlobalHandler;
import org.drools.xml.processes.ImportHandler;
+import org.drools.xml.processes.JoinNodeHandler;
+import org.drools.xml.processes.MappingHandler;
+import org.drools.xml.processes.MilestoneNodeHandler;
+import org.drools.xml.processes.ParameterHandler;
import org.drools.xml.processes.ProcessHandler;
+import org.drools.xml.processes.RuleSetNodeHandler;
+import org.drools.xml.processes.SplitNodeHandler;
import org.drools.xml.processes.StartNodeHandler;
+import org.drools.xml.processes.SubProcessNodeHandler;
+import org.drools.xml.processes.TimerNodeHandler;
+import org.drools.xml.processes.TypeHandler;
+import org.drools.xml.processes.ValueHandler;
+import org.drools.xml.processes.VariableHandler;
+import org.drools.xml.processes.WorkHandler;
+import org.drools.xml.processes.WorkItemNodeHandler;
public class ProcessSemanticModule extends DefaultSemanticModule implements SemanticModule {
public ProcessSemanticModule() {
@@ -20,11 +34,39 @@
new EndNodeHandler() );
addHandler( "action",
new ActionNodeHandler() );
+ addHandler( "ruleSet",
+ new RuleSetNodeHandler() );
+ addHandler( "subProcess",
+ new SubProcessNodeHandler() );
+ addHandler( "workItem",
+ new WorkItemNodeHandler() );
+ addHandler( "split",
+ new SplitNodeHandler() );
+ addHandler( "join",
+ new JoinNodeHandler() );
+ addHandler( "milestone",
+ new MilestoneNodeHandler() );
+ addHandler( "timer",
+ new TimerNodeHandler() );
addHandler( "connection",
new ConnectionHandler() );
addHandler( "import",
new ImportHandler() );
addHandler( "global",
new GlobalHandler() );
+ addHandler( "variable",
+ new VariableHandler() );
+ addHandler( "type",
+ new TypeHandler() );
+ addHandler( "value",
+ new ValueHandler() );
+ addHandler( "work",
+ new WorkHandler() );
+ addHandler( "parameter",
+ new ParameterHandler() );
+ addHandler( "mapping",
+ new MappingHandler() );
+ addHandler( "constraint",
+ new ConstraintHandler() );
}
}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlProcessReader.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlProcessReader.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlProcessReader.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -31,7 +31,7 @@
}
/**
- * Read a <code>RuleSet</code> from a <code>Reader</code>.
+ * Read a <code>Process</code> from a <code>Reader</code>.
*
* @param reader
* The reader containing the rule-set.
@@ -45,7 +45,7 @@
}
/**
- * Read a <code>RuleSet</code> from an <code>InputStream</code>.
+ * Read a <code>Process</code> from an <code>InputStream</code>.
*
* @param inputStream
* The input-stream containing the rule-set.
@@ -59,7 +59,7 @@
}
/**
- * Read a <code>RuleSet</code> from an <code>InputSource</code>.
+ * Read a <code>Process</code> from an <code>InputSource</code>.
*
* @param in
* The rule-set input-source.
Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcesDumper.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcesDumper.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcesDumper.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,108 +0,0 @@
-package org.drools.xml;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.drools.ruleflow.core.RuleFlowProcess;
-import org.drools.workflow.core.Connection;
-import org.drools.workflow.core.Node;
-import org.drools.workflow.core.impl.DroolsConsequenceAction;
-import org.drools.workflow.core.node.ActionNode;
-import org.drools.workflow.core.node.EndNode;
-import org.drools.workflow.core.node.StartNode;
-
-public class XmlRuleFlowProcesDumper {
-
- // TODO writing out should also be part of the NodeHandler ?
-
- private final static String EOL = System.getProperty( "line.separator" );
-
- private StringBuffer xmlDump;
-
- public synchronized String dump(RuleFlowProcess process) {
- this.xmlDump = new StringBuffer();
- visitProcess(process);
- return this.xmlDump.toString();
- }
-
- private void visitProcess(RuleFlowProcess process) {
- xmlDump.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?> " + EOL
- + "<process xmlns=\"http://drools.org/drools-4.0/process\"" + EOL
- + " xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"" + EOL
- + " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"" + EOL
- + " name=\"" + process.getName() + "\" id=\"" + process.getId() + "\" type=\"RuleFlow\" package-name=\"" + process.getPackageName() + "\" >" + EOL + EOL);
- visitHeader(process);
- visitNodes(process);
- visitConnections(process);
- xmlDump.append("</process>");
- }
-
- private void visitHeader(RuleFlowProcess process) {
- xmlDump.append(" <header>" + EOL);
- visitImports(process.getImports());
- visitGlobals(process.getGlobals());
- xmlDump.append(" </header>" + EOL + EOL);
- }
-
- private void visitImports(List<String> imports) {
- xmlDump.append(" <imports>" + EOL);
- for (String importString: imports) {
- xmlDump.append(" <import name=\"" + importString + "\" />" + EOL);
- }
- xmlDump.append(" </imports>" + EOL);
- }
-
- private void visitGlobals(Map<String, String> globals) {
- xmlDump.append(" <globals>" + EOL);
- for (Map.Entry<String, String> global: globals.entrySet()) {
- xmlDump.append(" <global identifier=\"" + global.getKey() + "\" type=\"" + global.getValue() + "\" />" + EOL);
- }
- xmlDump.append(" </globals>" + EOL);
- }
-
- private void visitNodes(RuleFlowProcess process) {
- xmlDump.append(" <nodes>" + EOL);
- for (Node node: process.getNodes()) {
- if (node instanceof StartNode) {
- visitStartNode((StartNode) node);
- } else if (node instanceof EndNode) {
- visitEndNode((EndNode) node);
- } else if (node instanceof ActionNode) {
- visitActionNode((ActionNode) node);
- } else {
- throw new IllegalArgumentException(
- "Unknown node type: " + node);
- }
- }
- xmlDump.append(" </nodes>" + EOL + EOL);
- }
-
- private void visitStartNode(StartNode startNode) {
- xmlDump.append(" <start name=\"" + startNode.getName() + "\" />" + EOL);
- }
-
- private void visitEndNode(EndNode endNode) {
- xmlDump.append(" <end name=\"" + endNode.getName() + "\" />" + EOL);
- }
-
- private void visitActionNode(ActionNode actionNode) {
- DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
- xmlDump.append(" <action name=\"" + actionNode.getName()
- + "\" dialect=\"" + action.getDialect() + "\">"
- + action.getConsequence() + "</action>" + EOL);
- }
-
- private void visitConnections(RuleFlowProcess process) {
- List<Connection> connections = new ArrayList<Connection>();
- for (Node node: process.getNodes()) {
- connections.addAll(node.getIncomingConnections(Node.CONNECTION_DEFAULT_TYPE));
- }
- xmlDump.append(" <connections>" + EOL);
- for (Connection connection: connections) {
- xmlDump.append(" <connection from=\"" + connection.getFrom().getName() + "\" to=\"" + connection.getTo().getName() + "\"/>" + EOL);
- }
- xmlDump.append(" </connections>" + EOL + EOL);
- }
-
-}
Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcessDumper.java (from rev 18471, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcesDumper.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcessDumper.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcessDumper.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,394 @@
+package org.drools.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.process.core.ParameterDefinition;
+import org.drools.process.core.Work;
+import org.drools.process.core.context.variable.Variable;
+import org.drools.process.core.datatype.DataType;
+import org.drools.process.core.timer.Timer;
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.workflow.core.Connection;
+import org.drools.workflow.core.Constraint;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.DroolsConsequenceAction;
+import org.drools.workflow.core.impl.NodeImpl;
+import org.drools.workflow.core.node.ActionNode;
+import org.drools.workflow.core.node.EndNode;
+import org.drools.workflow.core.node.Join;
+import org.drools.workflow.core.node.MilestoneNode;
+import org.drools.workflow.core.node.RuleSetNode;
+import org.drools.workflow.core.node.Split;
+import org.drools.workflow.core.node.StartNode;
+import org.drools.workflow.core.node.SubProcessNode;
+import org.drools.workflow.core.node.TimerNode;
+import org.drools.workflow.core.node.WorkItemNode;
+
+public class XmlRuleFlowProcessDumper {
+
+ // TODO writing out should also be part of the NodeHandler ?
+
+ private final static String EOL = System.getProperty( "line.separator" );
+
+ private StringBuffer xmlDump;
+
+ public String dump(RuleFlowProcess process) {
+ return dump(process, true);
+ }
+
+ public synchronized String dump(RuleFlowProcess process, boolean includeMeta) {
+ this.xmlDump = new StringBuffer();
+ visitProcess(process, includeMeta);
+ return this.xmlDump.toString();
+ }
+
+ private void visitProcess(RuleFlowProcess process, boolean includeMeta) {
+ xmlDump.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?> " + EOL
+ + "<process xmlns=\"http://drools.org/drools-4.0/process\"" + EOL
+ + " xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"" + EOL
+ + " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"" + EOL
+ + " type=\"RuleFlow\" ");
+ if (process.getName() != null) {
+ xmlDump.append("name=\"" + process.getName() + "\" ");
+ }
+ if (process.getId() != null) {
+ xmlDump.append("id=\"" + process.getId() + "\" ");
+ }
+ if (process.getPackageName() != null) {
+ xmlDump.append("package-name=\"" + process.getPackageName() + "\" ");
+ }
+ if (process.getVersion() != null) {
+ xmlDump.append("version=\"" + process.getVersion() + "\" ");
+ }
+ if (includeMeta) {
+ Integer routerLayout = (Integer) process.getMetaData("routerLayout");
+ if (routerLayout != null && routerLayout != 0) {
+ xmlDump.append("routerLayout=\"" + routerLayout + "\" ");
+ }
+ }
+ xmlDump.append(">" + EOL + EOL);
+ visitHeader(process, includeMeta);
+ visitNodes(process, includeMeta);
+ visitConnections(process, includeMeta);
+ xmlDump.append("</process>");
+ }
+
+ private void visitHeader(RuleFlowProcess process, boolean includeMeta) {
+ xmlDump.append(" <header>" + EOL);
+ visitImports(process.getImports());
+ visitGlobals(process.getGlobals());
+ visitVariables(process.getVariableScope().getVariables());
+ xmlDump.append(" </header>" + EOL + EOL);
+ }
+
+ private void visitImports(List<String> imports) {
+ if (imports != null && imports.size() > 0) {
+ xmlDump.append(" <imports>" + EOL);
+ for (String importString: imports) {
+ xmlDump.append(" <import name=\"" + importString + "\" />" + EOL);
+ }
+ xmlDump.append(" </imports>" + EOL);
+ }
+ }
+
+ private void visitGlobals(Map<String, String> globals) {
+ if (globals != null && globals.size() > 0) {
+ xmlDump.append(" <globals>" + EOL);
+ for (Map.Entry<String, String> global: globals.entrySet()) {
+ xmlDump.append(" <global identifier=\"" + global.getKey() + "\" type=\"" + global.getValue() + "\" />" + EOL);
+ }
+ xmlDump.append(" </globals>" + EOL);
+ }
+ }
+
+ private void visitVariables(List<Variable> variables) {
+ if (variables != null && variables.size() > 0) {
+ xmlDump.append(" <variables>" + EOL);
+ for (Variable variable: variables) {
+ xmlDump.append(" <variable name=\"" + variable.getName() + "\" >" + EOL);
+ visitDataType(variable.getType());
+ Object value = variable.getValue();
+ if (value != null) {
+ visitValue(variable.getValue());
+ }
+ xmlDump.append(" </variable>" + EOL);
+ }
+ xmlDump.append(" </variables>" + EOL);
+ }
+ }
+
+ private void visitDataType(DataType dataType) {
+ xmlDump.append(" <type name=\"" + dataType.getClass().getName() + "\" />" + EOL);
+ }
+
+ private void visitValue(Object value) {
+ xmlDump.append(" <value>" + value + "</value>" + EOL);
+ }
+
+ private void visitNodes(RuleFlowProcess process, boolean includeMeta) {
+ xmlDump.append(" <nodes>" + EOL);
+ StartNode startNode = process.getStart();
+ if (startNode != null) {
+ visitStartNode(startNode, includeMeta);
+ }
+ for (Node node: process.getNodes()) {
+ if (node instanceof StartNode) {
+ // Do nothing, start node already added
+ } else if (node instanceof EndNode) {
+ visitEndNode((EndNode) node, includeMeta);
+ } else if (node instanceof ActionNode) {
+ visitActionNode((ActionNode) node, includeMeta);
+ } else if (node instanceof RuleSetNode) {
+ visitRuleSetNode((RuleSetNode) node, includeMeta);
+ } else if (node instanceof SubProcessNode) {
+ visitSubProcessNode((SubProcessNode) node, includeMeta);
+ } else if (node instanceof WorkItemNode) {
+ visitWorkItemNode((WorkItemNode) node, includeMeta);
+ } else if (node instanceof Join) {
+ visitJoinNode((Join) node, includeMeta);
+ } else if (node instanceof Split) {
+ visitSplitNode((Split) node, includeMeta);
+ } else if (node instanceof MilestoneNode) {
+ visitMileStoneNode((MilestoneNode) node, includeMeta);
+ } else if (node instanceof TimerNode) {
+ visitTimerNode((TimerNode) node, includeMeta);
+ } else {
+ throw new IllegalArgumentException(
+ "Unknown node type: " + node);
+ }
+ }
+ xmlDump.append(" </nodes>" + EOL + EOL);
+ }
+
+ private void visitNode(String name, Node node, boolean includeMeta) {
+ xmlDump.append(" <" + name + " id=\"" + node.getId() + "\" ");
+ if (node.getName() != null) {
+ xmlDump.append("name=\"" + node.getName() + "\" ");
+ }
+ if (includeMeta) {
+ Integer x = (Integer) node.getMetaData("x");
+ Integer y = (Integer) node.getMetaData("y");
+ Integer width = (Integer) node.getMetaData("width");
+ Integer height = (Integer) node.getMetaData("height");
+ if (x != null && x != 0) {
+ xmlDump.append("x=\"" + x + "\" ");
+ }
+ if (y != null && y != 0) {
+ xmlDump.append("y=\"" + y + "\" ");
+ }
+ if (width != null && width != -1) {
+ xmlDump.append("width=\"" + width + "\" ");
+ }
+ if (height != null && height != -1) {
+ xmlDump.append("height=\"" + height + "\" ");
+ }
+ }
+ }
+
+ private void endElement() {
+ xmlDump.append("/>" + EOL);
+ }
+
+ private void endElement(String name) {
+ xmlDump.append(" </" + name + ">" + EOL);
+ }
+
+ private void visitStartNode(StartNode startNode, boolean includeMeta) {
+ visitNode("start", startNode, includeMeta);
+ endElement();
+ }
+
+ private void visitEndNode(EndNode endNode, boolean includeMeta) {
+ visitNode("end", endNode, includeMeta);
+ endElement();
+ }
+
+ private void visitActionNode(ActionNode actionNode, boolean includeMeta) {
+ visitNode("action", actionNode, includeMeta);
+ DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
+ if (action != null) {
+ String dialect = action.getDialect();
+ if (dialect != null) {
+ xmlDump.append("dialect=\"" + action.getDialect() + "\" ");
+ }
+ String consequence = action.getConsequence();
+ if (consequence == null) {
+ endElement();
+ } else {
+ xmlDump.append(">" + consequence.trim() + "</action>" + EOL);
+ }
+ } else {
+ endElement();
+ }
+ }
+
+ private void visitRuleSetNode(RuleSetNode ruleSetNode, boolean includeMeta) {
+ visitNode("ruleSet", ruleSetNode, includeMeta);
+ String ruleFlowGroup = ruleSetNode.getRuleFlowGroup();
+ if (ruleFlowGroup != null) {
+ xmlDump.append("ruleFlowGroup=\"" + ruleFlowGroup + "\" ");
+ }
+ endElement();
+ }
+
+ private void visitSubProcessNode(SubProcessNode subProcessNode, boolean includeMeta) {
+ visitNode("subProcess", subProcessNode, includeMeta);
+ String processId = subProcessNode.getProcessId();
+ if (processId != null) {
+ xmlDump.append("processId=\"" + processId + "\" ");
+ }
+ if (!subProcessNode.isWaitForCompletion()) {
+ xmlDump.append("waitForCompletion=\"false\" ");
+ }
+ endElement();
+ }
+
+ private void visitJoinNode(Join joinNode, boolean includeMeta) {
+ visitNode("join", joinNode, includeMeta);
+ int type = joinNode.getType();
+ if (type != 0) {
+ xmlDump.append("type=\"" + type + "\" ");
+ }
+ endElement();
+ }
+
+ private void visitSplitNode(Split splitNode, boolean includeMeta) {
+ visitNode("split", splitNode, includeMeta);
+ int type = splitNode.getType();
+ if (type != 0) {
+ xmlDump.append("type=\"" + type + "\" ");
+ }
+ if (splitNode.getConstraints().isEmpty()) {
+ endElement();
+ } else {
+ xmlDump.append(">" + EOL);
+ xmlDump.append(" <constraints>" + EOL);
+ for (Map.Entry<Split.ConnectionRef, Constraint> entry: splitNode.getConstraints().entrySet()) {
+ Split.ConnectionRef connection = entry.getKey();
+ Constraint constraint = entry.getValue();
+ xmlDump.append(" <constraint "
+ + "toNodeId=\"" + connection.getNodeId() + "\" "
+ + "toType=\"" + connection.getToType() + "\" ");
+ String name = constraint.getName();
+ if (name != null && !"".equals(name)) {
+ xmlDump.append("name=\"" + constraint.getName() + "\" ");
+ }
+ int priority = constraint.getPriority();
+ if (priority != 0) {
+ xmlDump.append("priority=\"" + constraint.getPriority() + "\" ");
+ }
+ xmlDump.append("type=\"" + constraint.getType() + "\" ");
+ String dialect = constraint.getDialect();
+ if (dialect != null && !"".equals(dialect)) {
+ xmlDump.append("dialect=\"" + dialect + "\" ");
+ }
+ String constraintString = constraint.getConstraint();
+ if (constraintString != null) {
+ xmlDump.append(">" + constraintString + "</constraint>" + EOL);
+ } else {
+ xmlDump.append("/>" + EOL);
+ }
+ }
+ xmlDump.append(" </constraints>" + EOL);
+ endElement("split");
+ }
+ }
+
+ private void visitMileStoneNode(MilestoneNode milestoneNode, boolean includeMeta) {
+ visitNode("milestone", milestoneNode, includeMeta);
+ String constraint = milestoneNode.getConstraint();
+ if (constraint != null) {
+ xmlDump.append(">" + constraint.trim() + "</milestone>" + EOL);
+ } else {
+ endElement();
+ }
+ }
+
+ private void visitWorkItemNode(WorkItemNode workItemNode, boolean includeMeta) {
+ visitNode("workItem", workItemNode, includeMeta);
+ if (!workItemNode.isWaitForCompletion()) {
+ xmlDump.append("waitForCompletion=\"false\" ");
+ }
+ xmlDump.append(">" + EOL);
+ Work work = workItemNode.getWork();
+ if (work != null) {
+ visitWork(work, includeMeta);
+ }
+ Map<String, String> inMappings = workItemNode.getInMappings();
+ for (Map.Entry<String, String> inMapping: inMappings.entrySet()) {
+ xmlDump.append(
+ " <mapping type=\"in\" "
+ + "parameterName=\"" + inMapping.getKey() + "\" "
+ + "variableName=\"" + inMapping.getValue() + "\" />" + EOL);
+ }
+ Map<String, String> outMappings = workItemNode.getOutMappings();
+ for (Map.Entry<String, String> outMapping: outMappings.entrySet()) {
+ xmlDump.append(
+ " <mapping type=\"out\" "
+ + "parameterName=\"" + outMapping.getKey() + "\" "
+ + "variableName=\"" + outMapping.getValue() + "\" />" + EOL);
+ }
+ endElement("workItem");
+ }
+
+ private void visitWork(Work work, boolean includeMeta) {
+ xmlDump.append(" <work name=\"" + work.getName() + "\" >" + EOL);
+ for (ParameterDefinition paramDefinition: work.getParameterDefinitions()) {
+ if (paramDefinition == null) {
+ throw new IllegalArgumentException(
+ "Could not find parameter definition " + paramDefinition.getName()
+ + " for work " + work.getName());
+ }
+ xmlDump.append(" <parameter name=\"" + paramDefinition.getName() + "\" " +
+ "type=\"" + paramDefinition.getType().getClass().getName() + "\" ");
+ Object value = work.getParameter(paramDefinition.getName());
+ if (value == null) {
+ xmlDump.append("/>" + EOL);
+ } else {
+ xmlDump.append(">" + value + "</parameter>" + EOL);
+ }
+ }
+ xmlDump.append(" </work>" + EOL);
+ }
+
+ private void visitTimerNode(TimerNode timerNode, boolean includeMeta) {
+ visitNode("timer", timerNode, includeMeta);
+ Timer timer = timerNode.getTimer();
+ if (timer != null) {
+ xmlDump.append("delay=\"" + timer.getDelay() + "\" ");
+ if (timer.getPeriod() > 0) {
+ xmlDump.append(" period=\"" + timer.getPeriod() + "\" ");
+ }
+ }
+ endElement();
+ }
+
+ private void visitConnections(RuleFlowProcess process, boolean includeMeta) {
+ List<Connection> connections = new ArrayList<Connection>();
+ for (Node node: process.getNodes()) {
+ connections.addAll(node.getIncomingConnections(Node.CONNECTION_DEFAULT_TYPE));
+ }
+ xmlDump.append(" <connections>" + EOL);
+ for (Connection connection: connections) {
+ xmlDump.append(" <connection from=\"" + connection.getFrom().getId() + "\" ");
+ if (!NodeImpl.CONNECTION_DEFAULT_TYPE.equals(connection.getFromType())) {
+ xmlDump.append("fromType=\"" + connection.getFromType() + "\" ");
+ }
+ xmlDump.append("to=\"" + connection.getTo().getId() + "\" ");
+ if (!NodeImpl.CONNECTION_DEFAULT_TYPE.equals(connection.getToType())) {
+ xmlDump.append("toType=\"" + connection.getToType() + "\" ");
+ }
+ if (includeMeta) {
+ String bendpoints = (String) connection.getMetaData("bendpoints");
+ if (bendpoints != null) {
+ xmlDump.append("bendpoints=\"" + bendpoints + "\" ");
+ }
+ }
+ xmlDump.append("/>" + EOL);
+ }
+ xmlDump.append(" </connections>" + EOL + EOL);
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/AbstractNodeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/AbstractNodeHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/AbstractNodeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,101 @@
+package org.drools.xml.processes;
+
+import java.util.HashSet;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.NodeContainer;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.drools.xml.ProcessBuildData;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public abstract class AbstractNodeHandler extends BaseAbstractHandler implements
+ Handler {
+
+ public AbstractNodeHandler() {
+ initValidParents();
+ initValidPeers();
+ this.allowNesting = false;
+ }
+
+ protected void initValidParents() {
+ this.validParents = new HashSet();
+ this.validParents.add(NodeContainer.class);
+ }
+
+ protected void initValidPeers() {
+ this.validPeers = new HashSet();
+ this.validPeers.add(Node.class);
+ }
+
+ public Object start(final String uri, final String localName, final Attributes attrs,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.startConfiguration(localName, attrs);
+
+ NodeContainer nodeContainer = (NodeContainer) parser.getParent();
+
+ final Node node = createNode();
+
+ final String id = attrs.getValue("id");
+ node.setId(new Long(id));
+
+ final String name = attrs.getValue("name");
+ node.setName(name);
+
+ nodeContainer.addNode(node);
+ ((ProcessBuildData) parser.getData()).addNode(node);
+
+ return node;
+ }
+
+ protected abstract Node createNode();
+
+ public Object end(final String uri, final String localName,
+ final ExtensibleXmlParser parser) throws SAXException {
+ final Configuration config = parser.endConfiguration();
+ Node node = (Node) parser.getCurrent();
+ handleNode(node, config, uri, localName, parser);
+ return node;
+ }
+
+ protected void handleNode(final Node node, final Configuration config, final String uri,
+ final String localName, final ExtensibleXmlParser parser) throws SAXException {
+ final String x = config.getAttribute("x");
+ if (x != null && !"".equals(x)) {
+ try {
+ node.setMetaData("x", new Integer(x));
+ } catch (NumberFormatException exc) {
+ throw new SAXParseException("<" + localName + "> requires an Integer 'x' attribute", parser.getLocator());
+ }
+ }
+ final String y = config.getAttribute("y");
+ if (y != null && !"".equals(y)) {
+ try {
+ node.setMetaData("y", new Integer(y));
+ } catch (NumberFormatException exc) {
+ throw new SAXParseException("<" + localName + "> requires an Integer 'y' attribute", parser.getLocator());
+ }
+ }
+ final String width = config.getAttribute("width");
+ if (width != null && !"".equals(width)) {
+ try {
+ node.setMetaData("width", new Integer(width));
+ } catch (NumberFormatException exc) {
+ throw new SAXParseException("<" + localName + "> requires an Integer 'width' attribute", parser.getLocator());
+ }
+ }
+ final String height = config.getAttribute("height");
+ if (height != null && !"".equals(height)) {
+ try {
+ node.setMetaData("height", new Integer(height));
+ } catch (NumberFormatException exc) {
+ throw new SAXParseException("<" + localName + "> requires an Integer 'height' attribute", parser.getLocator());
+ }
+ }
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ActionNodeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ActionNodeHandler.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ActionNodeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,86 +1,37 @@
package org.drools.xml.processes;
-import java.util.HashSet;
-
-import org.drools.process.core.Process;
+import org.drools.workflow.core.Node;
import org.drools.workflow.core.impl.DroolsConsequenceAction;
-import org.drools.workflow.core.impl.WorkflowProcessImpl;
import org.drools.workflow.core.node.ActionNode;
-import org.drools.workflow.core.node.StartNode;
-import org.drools.xml.BaseAbstractHandler;
import org.drools.xml.Configuration;
import org.drools.xml.ExtensibleXmlParser;
-import org.drools.xml.Handler;
-import org.drools.xml.ProcessBuildData;
-import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-public class ActionNodeHandler extends BaseAbstractHandler
- implements
- Handler {
- public ActionNodeHandler() {
- if ( (this.validParents == null) && (this.validPeers == null) ) {
- this.validParents = new HashSet();
- this.validParents.add( Process.class );
+public class ActionNodeHandler extends AbstractNodeHandler {
- this.validPeers = new HashSet();
- this.validPeers.add( StartNode.class );
- this.validPeers.add( ActionNode.class );
-
- this.allowNesting = false;
- }
+ protected Node createNode() {
+ return new ActionNode();
}
-
-
- public Object start(final String uri,
- final String localName,
- final Attributes attrs,
- final ExtensibleXmlParser parser) throws SAXException {
- parser.startConfiguration( localName,
- attrs );
-
- WorkflowProcessImpl process = ( WorkflowProcessImpl ) parser.getParent();
-
- ActionNode actionNode = new ActionNode();
-
- final String name = attrs.getValue( "name" );
- emptyAttributeCheck( localName, "name", name, parser );
- actionNode.setName( name );
-
- process.addNode( actionNode );
- ((ProcessBuildData)parser.getData()).addNode( actionNode );
-
- return actionNode;
- }
-
- public Object end(final String uri,
- final String localName,
- final ExtensibleXmlParser parser) throws SAXException {
- final Configuration config = parser.endConfiguration();
- WorkflowProcessImpl process = ( WorkflowProcessImpl ) parser.getParent();
-
- ActionNode actionNode = ( ActionNode ) parser.getCurrent();
-
+ public void handleNode(final Node node, final Configuration config, final String uri,
+ final String localName, final ExtensibleXmlParser parser)
+ throws SAXException {
+ super.handleNode(node, config, uri, localName, parser);
+ ActionNode actionNode = (ActionNode) node;
String text = config.getText();
- if ( text == null ) {
- throw new SAXParseException( "<action-node> requires content",
- parser.getLocator() );
+ if (text != null) {
+ text.trim();
+ if ("".equals(text)) {
+ text = null;
+ }
}
-
- final String dialect = config.getAttribute( "dialect" );
- emptyAttributeCheck( localName, "dialect", dialect, parser );
-
- DroolsConsequenceAction actionText = new DroolsConsequenceAction( dialect, text);
-
- actionNode.setAction( actionText );
-
- return actionNode;
+ final String dialect = config.getAttribute("dialect");
+ DroolsConsequenceAction actionText = new DroolsConsequenceAction(dialect, text);
+ actionNode.setAction(actionText);
}
public Class generateNodeFor() {
return ActionNode.class;
- }
+ }
}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ConnectionHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ConnectionHandler.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ConnectionHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -40,25 +40,27 @@
parser.startConfiguration( localName,
attrs );
- String fromName = attrs.getValue( "from" );
- String toName = attrs.getValue( "to" );
- emptyAttributeCheck( localName, "from", fromName, parser );
- emptyAttributeCheck( localName, "to", toName, parser );
+ String fromId = attrs.getValue( "from" );
+ emptyAttributeCheck( localName, "from", fromId, parser );
+ String toId = attrs.getValue( "to" );
+ emptyAttributeCheck( localName, "to", toId, parser );
+ String bendpoints = attrs.getValue( "bendpoints" );
- ProcessBuildData buildData = (ProcessBuildData)parser.getData();
- Node fromNode = buildData.getNode( fromName );
- Node toNode = buildData.getNode( toName );
+ ProcessBuildData buildData = (ProcessBuildData) parser.getData();
+ Node fromNode = buildData.getNode( new Long(fromId) );
+ Node toNode = buildData.getNode( new Long(toId) );
if ( fromNode == null ) {
- throw new SAXParseException( "from Node connection name '" + fromName + "' cannot be found",
+ throw new SAXParseException( "Node '" + fromId + "' cannot be found",
parser.getLocator() );
}
if ( toNode == null ) {
- throw new SAXParseException( "from Node connection name '" + toName + "' cannot be found",
+ throw new SAXParseException( "Node '" + toId + "' cannot be found",
parser.getLocator() );
- }
+ }
ConnectionImpl connection = new ConnectionImpl(fromNode, Node.CONNECTION_DEFAULT_TYPE, toNode, Node.CONNECTION_DEFAULT_TYPE);
+ connection.setMetaData("bendpoints", bendpoints);
return connection;
}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ConstraintHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ConstraintHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ConstraintHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,76 @@
+package org.drools.xml.processes;
+
+import java.util.HashSet;
+
+import org.drools.workflow.core.Constraint;
+import org.drools.workflow.core.impl.ConstraintImpl;
+import org.drools.workflow.core.node.Split;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class ConstraintHandler extends BaseAbstractHandler implements Handler {
+
+ public ConstraintHandler() {
+ if ((this.validParents == null) && (this.validPeers == null)) {
+ this.validParents = new HashSet();
+ this.validParents.add(Split.class);
+
+ this.validPeers = new HashSet();
+ this.validPeers.add(null);
+
+ this.allowNesting = false;
+ }
+ }
+
+ public Object start(final String uri,
+ final String localName,
+ final Attributes attrs,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.startConfiguration(localName, attrs);
+ return null;
+ }
+
+ public Object end(final String uri,
+ final String localName,
+ final ExtensibleXmlParser parser) throws SAXException {
+ Configuration config = parser.endConfiguration();
+ Split splitNode = (Split) parser.getParent();
+ final String toNodeIdString = config.getAttribute("toNodeId");
+ emptyAttributeCheck(localName, "toNodeId", toNodeIdString, parser);
+ int toNodeId = new Integer(toNodeIdString);
+ final String toType = config.getAttribute("toType");
+ emptyAttributeCheck(localName, "toType", toType, parser);
+ Split.ConnectionRef connectionRef = new Split.ConnectionRef(toNodeId, toType);
+ Constraint constraint = new ConstraintImpl();
+
+ final String name = config.getAttribute("name");
+ constraint.setName(name);
+ final String priority = config.getAttribute("priority");
+ if (priority != null) {
+ constraint.setPriority(new Integer(priority));
+ }
+ final String type = config.getAttribute("type");
+ constraint.setType(type);
+ final String dialect = config.getAttribute("dialect");
+ constraint.setDialect(dialect);
+ String text = config.getText();
+ if (text != null) {
+ text.trim();
+ if ("".equals(text)) {
+ text = null;
+ }
+ }
+ constraint.setConstraint(text);
+ splitNode.internalSetConstraint(connectionRef, constraint);
+ return null;
+ }
+
+ public Class generateNodeFor() {
+ return Constraint.class;
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/EndNodeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/EndNodeHandler.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/EndNodeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,69 +1,16 @@
package org.drools.xml.processes;
-import java.util.HashSet;
-
-import org.drools.process.core.Process;
-import org.drools.workflow.core.impl.WorkflowProcessImpl;
-import org.drools.workflow.core.node.ActionNode;
+import org.drools.workflow.core.Node;
import org.drools.workflow.core.node.EndNode;
-import org.drools.workflow.core.node.StartNode;
-import org.drools.xml.BaseAbstractHandler;
-import org.drools.xml.Configuration;
-import org.drools.xml.ExtensibleXmlParser;
-import org.drools.xml.Handler;
-import org.drools.xml.ProcessBuildData;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-public class EndNodeHandler extends BaseAbstractHandler
- implements
- Handler {
- public EndNodeHandler() {
- if ( (this.validParents == null) && (this.validPeers == null) ) {
- this.validParents = new HashSet();
- this.validParents.add( Process.class );
+public class EndNodeHandler extends AbstractNodeHandler {
- this.validPeers = new HashSet();
-
- this.validPeers.add( ActionNode.class );
- this.validPeers.add( StartNode.class );
-
- this.allowNesting = false;
- }
+ protected Node createNode() {
+ return new EndNode();
}
-
-
- public Object start(final String uri,
- final String localName,
- final Attributes attrs,
- final ExtensibleXmlParser parser) throws SAXException {
- parser.startConfiguration( localName,
- attrs );
-
- WorkflowProcessImpl process = ( WorkflowProcessImpl ) parser.getParent();
-
- final EndNode endNode = new EndNode();
-
- final String name = attrs.getValue( "name" );
- emptyAttributeCheck( localName, "name", name, parser );
- endNode.setName( name );
-
- process.addNode( endNode );
- ((ProcessBuildData)parser.getData()).addNode( endNode );
-
- return endNode;
- }
-
- public Object end(final String uri,
- final String localName,
- final ExtensibleXmlParser parser) throws SAXException {
- final Configuration config = parser.endConfiguration();
- return parser.getCurrent();
- }
-
public Class generateNodeFor() {
return EndNode.class;
- }
+ }
}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ImportHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ImportHandler.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ImportHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -22,7 +22,6 @@
this.validPeers = new HashSet();
this.validPeers.add( null );
- //this.validPeers.add( ImportDescr.class );
this.allowNesting = false;
}
@@ -42,7 +41,7 @@
final String name = attrs.getValue( "name" );
emptyAttributeCheck( localName, "name", name, parser );
- java.util.List<String> list =process.getImports();
+ java.util.List<String> list = process.getImports();
if ( list == null ) {
list = new ArrayList<String>();
process.setImports( list );
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/JoinNodeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/JoinNodeHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/JoinNodeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,30 @@
+package org.drools.xml.processes;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.node.Join;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.xml.sax.SAXException;
+
+public class JoinNodeHandler extends AbstractNodeHandler {
+
+ protected Node createNode() {
+ return new Join();
+ }
+
+ public void handleNode(final Node node, final Configuration config, final String uri,
+ final String localName, final ExtensibleXmlParser parser)
+ throws SAXException {
+ super.handleNode(node, config, uri, localName, parser);
+ Join joinNode = (Join) node;
+ String type = config.getAttribute("type");
+ if (type != null) {
+ joinNode.setType(new Integer(type));
+ }
+ }
+
+ public Class generateNodeFor() {
+ return Join.class;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/MappingHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/MappingHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/MappingHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,64 @@
+package org.drools.xml.processes;
+
+import java.util.HashSet;
+
+import org.drools.workflow.core.node.WorkItemNode;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class MappingHandler extends BaseAbstractHandler
+ implements
+ Handler {
+ public MappingHandler() {
+ if ( (this.validParents == null) && (this.validPeers == null) ) {
+ this.validParents = new HashSet();
+ this.validParents.add( WorkItemNode.class );
+
+ this.validPeers = new HashSet();
+ this.validPeers.add( null );
+
+ this.allowNesting = false;
+ }
+ }
+
+
+
+ public Object start(final String uri,
+ final String localName,
+ final Attributes attrs,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.startConfiguration(localName, attrs);
+ WorkItemNode workItemNode = (WorkItemNode) parser.getParent();
+ final String type = attrs.getValue("type");
+ emptyAttributeCheck(localName, "type", type, parser);
+ final String parameterName = attrs.getValue("parameterName");
+ emptyAttributeCheck(localName, "parameterName", parameterName, parser);
+ final String variableName = attrs.getValue("variableName");
+ emptyAttributeCheck(localName, "variableName", variableName, parser);
+ if ("in".equals(type)) {
+ workItemNode.addInMapping(parameterName, variableName);
+ } else if ("out".equals(type)) {
+ workItemNode.addOutMapping(parameterName, variableName);
+ } else {
+ throw new SAXParseException(
+ "Unknown mapping type " + type, parser.getLocator());
+ }
+ return null;
+ }
+
+ public Object end(final String uri,
+ final String localName,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.endConfiguration();
+ return null;
+ }
+
+ public Class generateNodeFor() {
+ return null;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/MilestoneNodeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/MilestoneNodeHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/MilestoneNodeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,34 @@
+package org.drools.xml.processes;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.node.MilestoneNode;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.xml.sax.SAXException;
+
+public class MilestoneNodeHandler extends AbstractNodeHandler {
+
+ protected Node createNode() {
+ return new MilestoneNode();
+ }
+
+ public void handleNode(final Node node, final Configuration config, final String uri,
+ final String localName, final ExtensibleXmlParser parser)
+ throws SAXException {
+ super.handleNode(node, config, uri, localName, parser);
+ MilestoneNode milestone = (MilestoneNode) node;
+ String text = config.getText();
+ if (text != null) {
+ text.trim();
+ if ("".equals(text)) {
+ text = null;
+ }
+ }
+ milestone.setConstraint(text);
+ }
+
+ public Class generateNodeFor() {
+ return MilestoneNode.class;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ParameterHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ParameterHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ParameterHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,109 @@
+package org.drools.xml.processes;
+
+import java.io.Serializable;
+import java.util.HashSet;
+
+import org.drools.process.core.ParameterDefinition;
+import org.drools.process.core.Work;
+import org.drools.process.core.datatype.DataType;
+import org.drools.process.core.datatype.impl.type.BooleanDataType;
+import org.drools.process.core.datatype.impl.type.FloatDataType;
+import org.drools.process.core.datatype.impl.type.IntegerDataType;
+import org.drools.process.core.datatype.impl.type.StringDataType;
+import org.drools.process.core.impl.ParameterDefinitionImpl;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class ParameterHandler extends BaseAbstractHandler
+ implements
+ Handler {
+ public ParameterHandler() {
+ if ( (this.validParents == null) && (this.validPeers == null) ) {
+ this.validParents = new HashSet();
+ this.validParents.add( Work.class );
+
+ this.validPeers = new HashSet();
+ this.validPeers.add( null );
+
+ this.allowNesting = false;
+ }
+ }
+
+
+
+ public Object start(final String uri,
+ final String localName,
+ final Attributes attrs,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.startConfiguration(localName, attrs);
+ return null;
+ }
+
+ public Object end(final String uri,
+ final String localName,
+ final ExtensibleXmlParser parser) throws SAXException {
+ Configuration config = parser.endConfiguration();
+ Work work = (Work) parser.getParent();
+ final String name = config.getAttribute("name");
+ emptyAttributeCheck(localName, "name", name, parser);
+ final String type = config.getAttribute("type");
+ emptyAttributeCheck(localName, "type", type, parser);
+ DataType dataType = null;
+ try {
+ dataType = (DataType) Class.forName(type).newInstance();
+ } catch (ClassNotFoundException e) {
+ throw new SAXParseException(
+ "Could not find datatype " + name, parser.getLocator());
+ } catch (InstantiationException e) {
+ throw new SAXParseException(
+ "Could not instantiate datatype " + name, parser.getLocator());
+ } catch (IllegalAccessException e) {
+ throw new SAXParseException(
+ "Could not access datatype " + name, parser.getLocator());
+ }
+ String text = config.getText();
+ if (text != null) {
+ text.trim();
+ if ("".equals(text)) {
+ text = null;
+ }
+ }
+ Object value = restoreValue(text, dataType, parser);
+ ParameterDefinition parameterDefinition = new ParameterDefinitionImpl(name, dataType);
+ work.addParameterDefinition(parameterDefinition);
+ work.setParameter(name, value);
+ return null;
+ }
+
+ private Serializable restoreValue(String text, DataType dataType, ExtensibleXmlParser parser) throws SAXException {
+ if (text == null || "".equals(text)) {
+ return null;
+ }
+ if (dataType == null) {
+ throw new SAXParseException(
+ "Null datatype", parser.getLocator());
+ }
+ if (dataType instanceof StringDataType) {
+ return text;
+ } else if (dataType instanceof IntegerDataType) {
+ return new Integer(text);
+ } else if (dataType instanceof FloatDataType) {
+ return new Float(text);
+ } else if (dataType instanceof BooleanDataType) {
+ return new Boolean(text);
+ } else {
+ throw new SAXParseException(
+ "Unknown datatype " + dataType, parser.getLocator());
+ }
+ }
+
+ public Class generateNodeFor() {
+ return null;
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ProcessHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ProcessHandler.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ProcessHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -11,9 +11,8 @@
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
-public class ProcessHandler extends BaseAbstractHandler
- implements
- Handler {
+public class ProcessHandler extends BaseAbstractHandler implements Handler {
+
public ProcessHandler() {
if ( (this.validParents == null) && (this.validPeers == null) ) {
this.validParents = new HashSet();
@@ -26,8 +25,6 @@
}
}
-
-
public Object start(final String uri,
final String localName,
final Attributes attrs,
@@ -40,19 +37,17 @@
final String version = attrs.getValue( "version" );
final String type = attrs.getValue( "type" );
final String packageName = attrs.getValue( "package-name" );
+ final String routerLayout = attrs.getValue( "routerLayout" );
- emptyAttributeCheck( localName, "id", name, parser );
- emptyAttributeCheck( localName, "name", name, parser );
- //emptyAttributeCheck( localName, "version", version, parser );
- emptyAttributeCheck( localName, "package-name", packageName, parser );
-
-
RuleFlowProcess process = new RuleFlowProcess();
process.setId( id );
process.setName( name );
process.setVersion( version );
process.setType( type );
process.setPackageName( packageName );
+ if (routerLayout != null) {
+ process.setMetaData("routerLayout", new Integer(routerLayout));
+ }
((ProcessBuildData)parser.getData()).setProcess( process );
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/RuleSetNodeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/RuleSetNodeHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/RuleSetNodeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,28 @@
+package org.drools.xml.processes;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.node.RuleSetNode;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.xml.sax.SAXException;
+
+public class RuleSetNodeHandler extends AbstractNodeHandler {
+
+ protected Node createNode() {
+ return new RuleSetNode();
+ }
+
+ public void handleNode(final Node node, final Configuration config, final String uri,
+ final String localName, final ExtensibleXmlParser parser)
+ throws SAXException {
+ super.handleNode(node, config, uri, localName, parser);
+ RuleSetNode ruleSetNode = (RuleSetNode) node;
+ String ruleFlowGroup = config.getAttribute("ruleFlowGroup");
+ ruleSetNode.setRuleFlowGroup(ruleFlowGroup);
+ }
+
+ public Class generateNodeFor() {
+ return RuleSetNode.class;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/SplitNodeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/SplitNodeHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/SplitNodeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,30 @@
+package org.drools.xml.processes;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.node.Split;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.xml.sax.SAXException;
+
+public class SplitNodeHandler extends AbstractNodeHandler {
+
+ protected Node createNode() {
+ return new Split();
+ }
+
+ public void handleNode(final Node node, final Configuration config, final String uri,
+ final String localName, final ExtensibleXmlParser parser)
+ throws SAXException {
+ super.handleNode(node, config, uri, localName, parser);
+ Split splitNode = (Split) node;
+ String type = config.getAttribute("type");
+ if (type != null) {
+ splitNode.setType(new Integer(type));
+ }
+ }
+
+ public Class generateNodeFor() {
+ return Split.class;
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/StartNodeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/StartNodeHandler.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/StartNodeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -2,63 +2,20 @@
import java.util.HashSet;
-import org.drools.process.core.Process;
-import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.workflow.core.Node;
import org.drools.workflow.core.node.StartNode;
-import org.drools.xml.BaseAbstractHandler;
-import org.drools.xml.Configuration;
-import org.drools.xml.ExtensibleXmlParser;
-import org.drools.xml.Handler;
-import org.drools.xml.ProcessBuildData;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-public class StartNodeHandler extends BaseAbstractHandler
- implements
- Handler {
- public StartNodeHandler() {
- if ( (this.validParents == null) && (this.validPeers == null) ) {
- this.validParents = new HashSet();
- this.validParents.add( Process.class );
-
- this.validPeers = new HashSet();
- this.validPeers.add( null );
-
- this.allowNesting = false;
- }
+public class StartNodeHandler extends AbstractNodeHandler {
+
+ protected Node createNode() {
+ return new StartNode();
}
-
- public Object start(final String uri,
- final String localName,
- final Attributes attrs,
- final ExtensibleXmlParser parser) throws SAXException {
- parser.startConfiguration( localName,
- attrs );
-
- WorkflowProcessImpl process = (WorkflowProcessImpl) parser.getParent();
-
- final StartNode startNode = new StartNode();
-
- final String name = attrs.getValue( "name" );
- emptyAttributeCheck( localName,
- "name",
- name,
- parser );
- startNode.setName( name );
-
- process.addNode( startNode );
- ((ProcessBuildData) parser.getData()).addNode( startNode );
-
- return startNode;
+
+ protected void initValidPeers() {
+ this.validPeers = new HashSet();
+ this.validPeers.add(null);
}
- public Object end(final String uri,
- final String localName,
- final ExtensibleXmlParser parser) throws SAXException {
- final Configuration config = parser.endConfiguration();
- return parser.getCurrent();
- }
-
public Class generateNodeFor() {
return StartNode.class;
}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/SubProcessNodeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/SubProcessNodeHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/SubProcessNodeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,30 @@
+package org.drools.xml.processes;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.node.SubProcessNode;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.xml.sax.SAXException;
+
+public class SubProcessNodeHandler extends AbstractNodeHandler {
+
+ protected Node createNode() {
+ return new SubProcessNode();
+ }
+
+ public void handleNode(final Node node, final Configuration config, final String uri,
+ final String localName, final ExtensibleXmlParser parser)
+ throws SAXException {
+ super.handleNode(node, config, uri, localName, parser);
+ SubProcessNode subProcessNode = (SubProcessNode) node;
+ String processId = config.getAttribute("processId");
+ subProcessNode.setProcessId(processId);
+ String waitForCompletion = config.getAttribute("waitForCompletion");
+ subProcessNode.setWaitForCompletion(!"false".equals(waitForCompletion));
+ }
+
+ public Class generateNodeFor() {
+ return SubProcessNode.class;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/TimerNodeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/TimerNodeHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/TimerNodeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,42 @@
+package org.drools.xml.processes;
+
+import org.drools.process.core.timer.Timer;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.node.TimerNode;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.xml.sax.SAXException;
+
+public class TimerNodeHandler extends AbstractNodeHandler {
+
+ protected Node createNode() {
+ return new TimerNode();
+ }
+
+ public void handleNode(final Node node, final Configuration config, final String uri,
+ final String localName, final ExtensibleXmlParser parser)
+ throws SAXException {
+ super.handleNode(node, config, uri, localName, parser);
+ TimerNode timerNode = (TimerNode) node;
+ String delay = config.getAttribute("delay");
+ String period = config.getAttribute("period");
+ if (delay != null || period != null) {
+ Timer timer = timerNode.getTimer();
+ if (timer == null) {
+ timer = new Timer();
+ timerNode.setTimer(timer);
+ }
+ if (delay != null) {
+ timer.setDelay(new Long(delay));
+ }
+ if (period != null) {
+ timer.setPeriod(new Long(period));
+ }
+ }
+ }
+
+ public Class generateNodeFor() {
+ return TimerNode.class;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/TypeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/TypeHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/TypeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,73 @@
+package org.drools.xml.processes;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.drools.process.core.Process;
+import org.drools.process.core.context.variable.Variable;
+import org.drools.process.core.context.variable.VariableScope;
+import org.drools.process.core.datatype.DataType;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class TypeHandler extends BaseAbstractHandler
+ implements
+ Handler {
+ public TypeHandler() {
+ if ( (this.validParents == null) && (this.validPeers == null) ) {
+ this.validParents = new HashSet();
+ this.validParents.add( Variable.class );
+
+ this.validPeers = new HashSet();
+ this.validPeers.add( null );
+
+ this.allowNesting = false;
+ }
+ }
+
+
+
+ public Object start(final String uri,
+ final String localName,
+ final Attributes attrs,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.startConfiguration(localName, attrs);
+ Variable variable = (Variable) parser.getParent();
+ final String name = attrs.getValue("name");
+ emptyAttributeCheck(localName, "name", name, parser);
+ DataType dataType = null;
+ try {
+ dataType = (DataType) Class.forName(name).newInstance();
+ } catch (ClassNotFoundException e) {
+ throw new SAXParseException(
+ "Could not find datatype " + name, parser.getLocator());
+ } catch (InstantiationException e) {
+ throw new SAXParseException(
+ "Could not instantiate datatype " + name, parser.getLocator());
+ } catch (IllegalAccessException e) {
+ throw new SAXParseException(
+ "Could not access datatype " + name, parser.getLocator());
+ }
+
+ variable.setType(dataType);
+ return dataType;
+ }
+
+ public Object end(final String uri,
+ final String localName,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.endConfiguration();
+ return null;
+ }
+
+ public Class generateNodeFor() {
+ return DataType.class;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ValueHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ValueHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/ValueHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,88 @@
+package org.drools.xml.processes;
+
+import java.io.Serializable;
+import java.util.HashSet;
+
+import org.drools.process.core.context.variable.Variable;
+import org.drools.process.core.datatype.DataType;
+import org.drools.process.core.datatype.impl.type.BooleanDataType;
+import org.drools.process.core.datatype.impl.type.FloatDataType;
+import org.drools.process.core.datatype.impl.type.IntegerDataType;
+import org.drools.process.core.datatype.impl.type.StringDataType;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class ValueHandler extends BaseAbstractHandler
+ implements
+ Handler {
+ public ValueHandler() {
+ if ( (this.validParents == null) && (this.validPeers == null) ) {
+ this.validParents = new HashSet();
+ this.validParents.add( Variable.class );
+
+ this.validPeers = new HashSet();
+ this.validPeers.add( null );
+
+ this.allowNesting = false;
+ }
+ }
+
+
+
+ public Object start(final String uri,
+ final String localName,
+ final Attributes attrs,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.startConfiguration(localName, attrs);
+ return null;
+ }
+
+ public Object end(final String uri,
+ final String localName,
+ final ExtensibleXmlParser parser) throws SAXException {
+ Configuration config = parser.endConfiguration();
+ Variable variable = (Variable) parser.getParent();
+ String text = config.getText();
+ if (text != null) {
+ text.trim();
+ if ("".equals(text)) {
+ text = null;
+ }
+ }
+ Serializable value = restoreValue(text, variable.getType(), parser);
+ variable.setValue(value);
+ return null;
+ }
+
+ private Serializable restoreValue(String text, DataType dataType, ExtensibleXmlParser parser) throws SAXException {
+ if (text == null || "".equals(text)) {
+ return null;
+ }
+ if (dataType == null) {
+ throw new SAXParseException(
+ "Null datatype", parser.getLocator());
+ }
+ if (dataType instanceof StringDataType) {
+ return text;
+ } else if (dataType instanceof IntegerDataType) {
+ return new Integer(text);
+ } else if (dataType instanceof FloatDataType) {
+ return new Float(text);
+ } else if (dataType instanceof BooleanDataType) {
+ return new Boolean(text);
+ } else {
+ throw new SAXParseException(
+ "Unknown datatype " + dataType, parser.getLocator());
+ }
+ }
+
+ public Class generateNodeFor() {
+ return null;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/VariableHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/VariableHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/VariableHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,74 @@
+package org.drools.xml.processes;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.drools.process.core.Process;
+import org.drools.process.core.context.variable.Variable;
+import org.drools.process.core.context.variable.VariableScope;
+import org.drools.workflow.core.impl.WorkflowProcessImpl;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class VariableHandler extends BaseAbstractHandler
+ implements
+ Handler {
+ public VariableHandler() {
+ if ( (this.validParents == null) && (this.validPeers == null) ) {
+ this.validParents = new HashSet();
+ this.validParents.add( Process.class );
+
+ this.validPeers = new HashSet();
+ this.validPeers.add( null );
+
+ this.allowNesting = false;
+ }
+ }
+
+
+
+ public Object start(final String uri,
+ final String localName,
+ final Attributes attrs,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.startConfiguration(localName, attrs);
+ WorkflowProcessImpl process = (WorkflowProcessImpl) parser.getParent();
+ final String name = attrs.getValue("name");
+ emptyAttributeCheck(localName, "name", name, parser);
+
+ VariableScope variableScope = (VariableScope)
+ process.getDefaultContext(VariableScope.VARIABLE_SCOPE);
+ Variable variable = new Variable();
+ if (variableScope != null) {
+ variable.setName(name);
+ List<Variable> variables = variableScope.getVariables();
+ if (variables == null) {
+ variables = new ArrayList<Variable>();
+ variableScope.setVariables(variables);
+ }
+ variables.add(variable);
+ } else {
+ throw new SAXParseException(
+ "Could not find default variable scope.", parser.getLocator());
+ }
+
+ return variable;
+ }
+
+ public Object end(final String uri,
+ final String localName,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.endConfiguration();
+ return null;
+ }
+
+ public Class generateNodeFor() {
+ return Variable.class;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/WorkHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/WorkHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/WorkHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,53 @@
+package org.drools.xml.processes;
+
+import java.util.HashSet;
+
+import org.drools.process.core.Work;
+import org.drools.process.core.impl.WorkImpl;
+import org.drools.workflow.core.node.WorkItemNode;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class WorkHandler extends BaseAbstractHandler implements Handler {
+
+ public WorkHandler() {
+ if ((this.validParents == null) && (this.validPeers == null)) {
+ this.validParents = new HashSet();
+ this.validParents.add(WorkItemNode.class);
+
+ this.validPeers = new HashSet();
+ this.validPeers.add(null);
+
+ this.allowNesting = false;
+ }
+ }
+
+ public Object start(final String uri,
+ final String localName,
+ final Attributes attrs,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.startConfiguration(localName, attrs);
+ WorkItemNode workItemNode = (WorkItemNode) parser.getParent();
+ final String name = attrs.getValue("name");
+ emptyAttributeCheck(localName, "name", name, parser);
+ Work work = new WorkImpl();
+ work.setName(name);
+ workItemNode.setWork(work);
+ return work;
+ }
+
+ public Object end(final String uri,
+ final String localName,
+ final ExtensibleXmlParser parser) throws SAXException {
+ parser.endConfiguration();
+ return null;
+ }
+
+ public Class generateNodeFor() {
+ return Work.class;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/WorkItemNodeHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/WorkItemNodeHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/processes/WorkItemNodeHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,28 @@
+package org.drools.xml.processes;
+
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.node.WorkItemNode;
+import org.drools.xml.Configuration;
+import org.drools.xml.ExtensibleXmlParser;
+import org.xml.sax.SAXException;
+
+public class WorkItemNodeHandler extends AbstractNodeHandler {
+
+ public void handleNode(final Node node, final Configuration config, final String uri,
+ final String localName, final ExtensibleXmlParser parser)
+ throws SAXException {
+ super.handleNode(node, config, uri, localName, parser);
+ WorkItemNode workItemNode = (WorkItemNode) node;
+ final String waitForCompletion = config.getAttribute("waitForCompletion");
+ workItemNode.setWaitForCompletion(!"false".equals(waitForCompletion));
+ }
+
+ protected Node createNode() {
+ return new WorkItemNode();
+ }
+
+ public Class generateNodeFor() {
+ return WorkItemNode.class;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-processes-4.0.xsd
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-processes-4.0.xsd (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-processes-4.0.xsd 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,282 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:drools="http://drools.org/drools-4.0/process" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://drools.org/drools-4.0/process" elementFormDefault="qualified">
+ <xs:element name="process">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="drools:header"/>
+ <xs:element ref="drools:nodes"/>
+ <xs:element ref="drools:connections"/>
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="type" type="xs:string"/>
+ <xs:attribute name="id" type="xs:string"/>
+ <xs:attribute name="package-name" type="xs:string"/>
+ <xs:attribute name="version" type="xs:string"/>
+ <xs:attribute name="routerLayout" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="header">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="drools:imports"/>
+ <xs:element ref="drools:globals"/>
+ <xs:element ref="drools:variables"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="imports">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="drools:import"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="import">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="globals">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="drools:global"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="global">
+ <xs:complexType>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="variables">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="drools:variable"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="variable">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="drools:type"/>
+ <xs:element ref="drools:value"/>
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="type">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="value">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string"/>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="nodes">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="drools:start"/>
+ <xs:element ref="drools:end"/>
+ <xs:element ref="drools:action"/>
+ <xs:element ref="drools:ruleSet"/>
+ <xs:element ref="drools:split"/>
+ <xs:element ref="drools:join"/>
+ <xs:element ref="drools:milestone"/>
+ <xs:element ref="drools:subProcess"/>
+ <xs:element ref="drools:workItem"/>
+ <xs:element ref="drools:timer"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="start">
+ <xs:complexType>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="x" type="xs:string"/>
+ <xs:attribute name="y" type="xs:string"/>
+ <xs:attribute name="width" type="xs:string"/>
+ <xs:attribute name="height" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="end">
+ <xs:complexType>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="x" type="xs:string"/>
+ <xs:attribute name="y" type="xs:string"/>
+ <xs:attribute name="width" type="xs:string"/>
+ <xs:attribute name="height" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="action">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="x" type="xs:string"/>
+ <xs:attribute name="y" type="xs:string"/>
+ <xs:attribute name="width" type="xs:string"/>
+ <xs:attribute name="height" type="xs:string"/>
+ <xs:attribute name="dialect" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ruleSet">
+ <xs:complexType>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="x" type="xs:string"/>
+ <xs:attribute name="y" type="xs:string"/>
+ <xs:attribute name="width" type="xs:string"/>
+ <xs:attribute name="height" type="xs:string"/>
+ <xs:attribute name="ruleFlowGroup" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="split">
+ <xs:complexType>
+ <xs:sequence minOccurs="0">
+ <xs:element ref="drools:constraints"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="x" type="xs:string"/>
+ <xs:attribute name="y" type="xs:string"/>
+ <xs:attribute name="width" type="xs:string"/>
+ <xs:attribute name="height" type="xs:string"/>
+ <xs:attribute name="type" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="constraints">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="drools:constraint"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="constraint">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="toNodeId" type="xs:string" use="required"/>
+ <xs:attribute name="toType" type="xs:string"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="priority" type="xs:string"/>
+ <xs:attribute name="type" type="xs:string"/>
+ <xs:attribute name="dialect" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="join">
+ <xs:complexType>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="x" type="xs:string"/>
+ <xs:attribute name="y" type="xs:string"/>
+ <xs:attribute name="width" type="xs:string"/>
+ <xs:attribute name="height" type="xs:string"/>
+ <xs:attribute name="type" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="milestone">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="x" type="xs:string"/>
+ <xs:attribute name="y" type="xs:string"/>
+ <xs:attribute name="width" type="xs:string"/>
+ <xs:attribute name="height" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="subProcess">
+ <xs:complexType>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="x" type="xs:string"/>
+ <xs:attribute name="y" type="xs:string"/>
+ <xs:attribute name="width" type="xs:string"/>
+ <xs:attribute name="height" type="xs:string"/>
+ <xs:attribute name="processId" type="xs:string"/>
+ <xs:attribute name="waitForCompletion" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="workItem">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="drools:work"/>
+ <xs:element ref="drools:mapping"/>
+ </xs:choice>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="x" type="xs:string"/>
+ <xs:attribute name="y" type="xs:string"/>
+ <xs:attribute name="width" type="xs:string"/>
+ <xs:attribute name="height" type="xs:string"/>
+ <xs:attribute name="waitForCompletion" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="work">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="drools:parameter"/>
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="parameter">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="mapping">
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ <xs:attribute name="parameterName" type="xs:string" use="required"/>
+ <xs:attribute name="variableName" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="timer">
+ <xs:complexType>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="x" type="xs:string"/>
+ <xs:attribute name="y" type="xs:string"/>
+ <xs:attribute name="width" type="xs:string"/>
+ <xs:attribute name="height" type="xs:string"/>
+ <xs:attribute name="delay" type="xs:string"/>
+ <xs:attribute name="period" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="connections">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="drools:connection"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="connection">
+ <xs:complexType>
+ <xs:attribute name="from" type="xs:string" use="required"/>
+ <xs:attribute name="to" type="xs:string" use="required"/>
+ <xs:attribute name="fromType" type="xs:string"/>
+ <xs:attribute name="toType" type="xs:string"/>
+ <xs:attribute name="bendpoints" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELFaultExceptionHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELFaultExceptionHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELFaultExceptionHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,21 @@
+package org.drools.bpel.core;
+
+import org.drools.process.core.context.exception.ExceptionHandler;
+
+public class BPELFaultExceptionHandler implements ExceptionHandler {
+
+ private String faultName;
+
+ public String getFaultName() {
+ return faultName;
+ }
+
+ public void setFaultName(String faultName) {
+ this.faultName = faultName;
+ }
+
+ public void handleException(String exception, Object params) {
+
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELFaultHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELFaultHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELFaultHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,41 @@
+package org.drools.bpel.core;
+
+import org.drools.process.core.context.exception.ExceptionHandler;
+
+/**
+ * A BPEL FaultHandler.
+ * A catchAll faultHandler has a null faultName.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class BPELFaultHandler implements ExceptionHandler {
+
+ private String faultName;
+ private String faultVariable;
+ private BPELActivity activity;
+
+ public String getFaultName() {
+ return faultName;
+ }
+
+ public void setFaultName(String faultName) {
+ this.faultName = faultName;
+ }
+
+ public String getFaultVariable() {
+ return faultVariable;
+ }
+
+ public void setFaultVariable(String faultVariable) {
+ this.faultVariable = faultVariable;
+ }
+
+ public BPELActivity getActivity() {
+ return activity;
+ }
+
+ public void setActivity(BPELActivity activity) {
+ this.activity = activity;
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELProcess.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELProcess.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELProcess.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,5 +1,9 @@
package org.drools.bpel.core;
+import java.util.List;
+
+import org.drools.process.core.context.exception.ExceptionScope;
+import org.drools.process.core.context.variable.VariableScope;
import org.drools.workflow.core.Node;
import org.drools.workflow.core.impl.ConnectionImpl;
import org.drools.workflow.core.impl.WorkflowProcessImpl;
@@ -16,19 +20,29 @@
public static final String BPEL_TYPE = "BPEL";
+ private BPELActivity activity;
+
public BPELProcess() {
setType(BPEL_TYPE);
+ VariableScope variableScope = new VariableScope();
+ addContext(variableScope);
+ setDefaultContext(variableScope);
}
+ public VariableScope getVariableScope() {
+ return (VariableScope) getDefaultContext(VariableScope.VARIABLE_SCOPE);
+ }
+
public void setActivity(BPELActivity activity) {
if (activity == null) {
throw new IllegalArgumentException(
"The activity of a BPEL process may not be null!");
}
- if (getActivity() != null) {
+ if (this.activity != null) {
throw new IllegalArgumentException(
"The activity of this BPEL process has already been set!");
}
+ this.activity = activity;
addNode(activity);
EndNode end = new EndNode();
addNode(end);
@@ -38,11 +52,18 @@
}
public BPELActivity getActivity() {
- Node[] nodes = getNodes();
- if (nodes == null || nodes.length == 0) {
- return null;
+ return activity;
+ }
+
+ public void setFaultHandlers(List<BPELFaultHandler> faultHandlers) {
+ ExceptionScope exceptionScope = new ExceptionScope();
+ addContext(exceptionScope);
+ setDefaultContext(exceptionScope);
+ for (BPELFaultHandler faultHandler: faultHandlers) {
+ addNode(faultHandler.getActivity());
+ exceptionScope.setExceptionHandler(faultHandler.getFaultName(), faultHandler);
}
- return (BPELActivity) nodes[0];
+ // TODO: process should end once fault handler has been executed
}
}
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELReply.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELReply.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/core/BPELReply.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -16,6 +16,7 @@
private static final String PORT_TYPE = "Porttype";
private static final String OPERATION = "Operation";
private static final String INPUT = "Message";
+ private static final String FAULT_NAME = "FaultName";
private String[] sourceLinks;
private String[] targetLinks;
@@ -54,6 +55,14 @@
public String getVariable() {
return getInMapping(INPUT);
}
+
+ public void setFaultName(String faultName) {
+ getWork().setParameter(FAULT_NAME, faultName);
+ }
+
+ public String getFaultName() {
+ return (String) getWork().getParameter(FAULT_NAME);
+ }
public void setVariable(String variable) {
addInMapping(INPUT, variable);
Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELExceptionHandlerInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELExceptionHandlerInstance.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELExceptionHandlerInstance.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,57 @@
+package org.drools.bpel.instance;
+
+import org.drools.bpel.core.BPELFaultHandler;
+import org.drools.process.core.context.variable.VariableScope;
+import org.drools.process.instance.context.exception.ExceptionHandlerInstance;
+import org.drools.process.instance.context.variable.VariableScopeInstance;
+import org.drools.workflow.instance.NodeInstance;
+import org.drools.workflow.instance.NodeInstanceContainer;
+import org.drools.workflow.instance.impl.NodeInstanceImpl;
+
+public class BPELExceptionHandlerInstance implements ExceptionHandlerInstance {
+
+ private BPELFaultHandler faultHandler;
+ private NodeInstanceContainer nodeInstanceContainer;
+
+ public BPELFaultHandler getFaultHandler() {
+ return faultHandler;
+ }
+
+ public void setFaultHandler(BPELFaultHandler faultHandler) {
+ this.faultHandler = faultHandler;
+ }
+
+ public NodeInstanceContainer getNodeInstanceContainer() {
+ return nodeInstanceContainer;
+ }
+
+ public void setNodeInstanceContainer(NodeInstanceContainer nodeInstanceContainer) {
+ this.nodeInstanceContainer = nodeInstanceContainer;
+ }
+
+ public void handleException(String exception, Object param) {
+ if (exception == null) {
+ throw new IllegalArgumentException(
+ "Exception is null!");
+ }
+ if (!(faultHandler.getFaultName() == null || exception.equals(faultHandler.getFaultName()))) {
+ throw new IllegalArgumentException(
+ "Cannot handle exception: " + exception);
+ }
+ NodeInstance nodeInstance = nodeInstanceContainer.getNodeInstance(faultHandler.getActivity());
+ String faultVariable = faultHandler.getFaultVariable();
+ if (faultVariable != null) {
+ VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
+ ((NodeInstanceImpl) nodeInstance).resolveContextInstance(VariableScope.VARIABLE_SCOPE, faultHandler.getFaultVariable());
+ if (variableScopeInstance != null) {
+ variableScopeInstance.setVariable(faultVariable, (String) param);
+ } else {
+ System.err.println("Could not find variable scope for variable " + faultVariable);
+ System.err.println("when trying handle fault " + exception);
+ System.err.println("Continuing without setting variable.");
+ }
+ }
+ nodeInstance.trigger(null, null);
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELExceptionScopeInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELExceptionScopeInstance.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELExceptionScopeInstance.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,31 @@
+package org.drools.bpel.instance;
+
+import org.drools.bpel.core.BPELFaultHandler;
+import org.drools.process.core.context.exception.ExceptionHandler;
+import org.drools.process.instance.context.exception.ExceptionHandlerInstance;
+import org.drools.process.instance.context.exception.ExceptionScopeInstance;
+import org.drools.workflow.instance.NodeInstanceContainer;
+import org.drools.workflow.instance.context.WorkflowContextInstance;
+
+public class BPELExceptionScopeInstance extends ExceptionScopeInstance implements WorkflowContextInstance {
+
+ private static final long serialVersionUID = 400L;
+
+ private NodeInstanceContainer nodeInstanceContainer;
+
+ protected ExceptionHandlerInstance getExceptionHandlerInstance(ExceptionHandler exceptionHandler) {
+ BPELExceptionHandlerInstance handlerInstance = new BPELExceptionHandlerInstance();
+ handlerInstance.setFaultHandler((BPELFaultHandler) exceptionHandler);
+ handlerInstance.setNodeInstanceContainer(getNodeInstanceContainer());
+ return handlerInstance;
+ }
+
+ public NodeInstanceContainer getNodeInstanceContainer() {
+ return nodeInstanceContainer;
+ }
+
+ public void setNodeInstanceContainer(NodeInstanceContainer nodeInstanceContainer) {
+ this.nodeInstanceContainer = nodeInstanceContainer;
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELInvokeInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELInvokeInstance.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELInvokeInstance.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,7 +1,8 @@
package org.drools.bpel.instance;
-import org.drools.bpel.core.BPELActivity;
+import org.drools.process.core.context.exception.ExceptionScope;
import org.drools.process.instance.WorkItem;
+import org.drools.process.instance.context.exception.ExceptionScopeInstance;
import org.drools.workflow.instance.NodeInstance;
import org.drools.workflow.instance.node.WorkItemNodeInstance;
@@ -25,19 +26,11 @@
super.triggerCompleted(workItem);
BPELLinkManager.activateTargetLinks(this);
} else {
- String faultMessage = (String) workItem.getResult("Message");
- getFaultHandler(faultName, faultMessage);
+ String faultMessage = (String) workItem.getResult("Result");
+ ExceptionScopeInstance exceptionScopeInstance = (ExceptionScopeInstance)
+ resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, faultName);
+ exceptionScopeInstance.handleException(faultName, faultMessage);
}
}
- private BPELActivity getFaultHandler(String faultName, String faultMessage) {
- // TODO check activity itself for fault handler
-// NodeInstanceContainer parent = getNodeInstanceContainer();
-// while (!(parent instanceof BPELFaultHandlerContainer)
-// || ((BPELFaultHandlerContainer) parent).get)) {
-// parent = ((NodeInstance) parent).getNodeInstanceContainer();
-// }
- return null;
- }
-
}
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELReceiveInstance.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELReceiveInstance.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/instance/BPELReceiveInstance.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,6 +1,8 @@
package org.drools.bpel.instance;
import org.drools.bpel.core.BPELReceive;
+import org.drools.process.core.context.variable.VariableScope;
+import org.drools.process.instance.context.variable.VariableScopeInstance;
import org.drools.workflow.core.Connection;
import org.drools.workflow.instance.NodeInstance;
import org.drools.workflow.instance.impl.NodeInstanceImpl;
@@ -26,7 +28,12 @@
public void triggerCompleted(String message) {
String variable = getBPELReceive().getVariable();
if (variable != null) {
- getProcessInstance().setVariable(variable, message);
+ VariableScopeInstance variableScope = (VariableScopeInstance) resolveContextInstance(VariableScope.VARIABLE_SCOPE, variable);
+ if (variableScope == null) {
+ throw new IllegalArgumentException(
+ "Variable " + variable + " not found!");
+ }
+ variableScope.setVariable(variable, message);
}
Connection to = getBPELReceive().getTo();
getNodeInstanceContainer().removeNodeInstance(this);
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/test/BPELTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/test/BPELTest.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/bpel/test/BPELTest.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -14,6 +14,7 @@
import org.drools.audit.WorkingMemoryFileLogger;
import org.drools.bpel.core.BPELActivity;
import org.drools.bpel.core.BPELAssign;
+import org.drools.bpel.core.BPELFaultHandler;
import org.drools.bpel.core.BPELFlow;
import org.drools.bpel.core.BPELInvoke;
import org.drools.bpel.core.BPELProcess;
@@ -23,11 +24,13 @@
import org.drools.bpel.instance.BPELProcessInstance;
import org.drools.bpel.instance.BPELProcessInstanceFactory;
import org.drools.common.AbstractRuleBase;
-import org.drools.common.InternalRuleBase;
import org.drools.common.InternalWorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.drools.compiler.PackageBuilderConfiguration;
import org.drools.compiler.ProcessBuilder;
+import org.drools.process.core.context.variable.Variable;
+import org.drools.process.core.context.variable.VariableScope;
+import org.drools.process.core.datatype.impl.type.StringDataType;
import org.drools.process.instance.WorkItem;
import org.drools.process.instance.WorkItemHandler;
import org.drools.process.instance.WorkItemManager;
@@ -35,79 +38,57 @@
public class BPELTest {
- public static void main1(String[] args) {
+ public static BPELProcess getProcess() {
BPELProcess process = new BPELProcess();
- process.setName("TestProcess");
- process.setId("1");
-
- // flow
- BPELFlow flow = new BPELFlow();
- flow.setName("flow");
- process.setActivity(flow);
- List<BPELActivity> flowActivities = new ArrayList<BPELActivity>();
-
- // invoke1
- BPELInvoke invoke1 = new BPELInvoke();
- invoke1.setName("invoke1");
- flowActivities.add(invoke1);
-
- // invoke2
- BPELInvoke invoke2 = new BPELInvoke();
- invoke2.setName("invoke2");
- flowActivities.add(invoke2);
-
- flow.setActivities(flowActivities);
-
- // execute
- InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, (InternalRuleBase) RuleBaseFactory.newRuleBase());
- WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(workingMemory);
- BPELProcessInstance processInstance = new BPELProcessInstance();
- processInstance.setProcess(process);
- processInstance.setWorkingMemory(workingMemory);
- processInstance.start();
- logger.writeToDisk();
- }
-
- public static void main2(String[] args) {
- BPELProcess process = new BPELProcess();
- process.setName("TestProcess");
- process.setId("1");
-
- // sequence
- BPELSequence sequence = new BPELSequence();
- sequence.setName("sequence");
- List<BPELActivity> sequenceActivities = new ArrayList<BPELActivity>();
-
- // invoke1
- BPELInvoke invoke1 = new BPELInvoke();
- invoke1.setName("invoke1");
- sequenceActivities.add(invoke1);
-
- // invoke2
- BPELInvoke invoke2 = new BPELInvoke();
- invoke2.setName("invoke2");
- sequenceActivities.add(invoke2);
-
- sequence.setActivities(sequenceActivities);
- process.setActivity(sequence);
-
- // execute
- InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, (InternalRuleBase) RuleBaseFactory.newRuleBase());
- WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(workingMemory);
- BPELProcessInstance processInstance = new BPELProcessInstance();
- processInstance.setProcess(process);
- processInstance.setWorkingMemory(workingMemory);
- processInstance.start();
- logger.writeToDisk();
- }
-
- public static void main(String[] args) {
- BPELProcess process = new BPELProcess();
process.setName("Purchase Order Process");
process.setId("1");
process.setVersion("1");
process.setPackageName("org.drools.bpel.test");
+ // variables
+ VariableScope variableScope = process.getVariableScope();
+ List<Variable> variables = new ArrayList<Variable>();
+ Variable variable = new Variable();
+ variable.setName("PO");
+ variable.setType(new StringDataType());
+ variables.add(variable);
+ variable = new Variable();
+ variable.setName("Invoice");
+ variable.setType(new StringDataType());
+ variables.add(variable);
+ variable = new Variable();
+ variable.setName("POFault");
+ variable.setType(new StringDataType());
+ variables.add(variable);
+ variable = new Variable();
+ variable.setName("shippingRequest");
+ variable.setType(new StringDataType());
+ variables.add(variable);
+ variable = new Variable();
+ variable.setName("shippingInfo");
+ variable.setType(new StringDataType());
+ variables.add(variable);
+ variable = new Variable();
+ variable.setName("shippingSchedule");
+ variable.setType(new StringDataType());
+ variables.add(variable);
+ variableScope.setVariables(variables);
+
+ // faultHandler
+ List<BPELFaultHandler> faultHandlers = new ArrayList<BPELFaultHandler>();
+ BPELFaultHandler faultHandler = new BPELFaultHandler();
+ faultHandler.setFaultName("cannotCompleteOrder");
+ faultHandler.setFaultVariable("POFault");
+ BPELReply reply = new BPELReply();
+ reply.setPartnerLink("purchasing");
+ reply.setPortType("lns:purchaseOrderPT");
+ reply.setOperation("sendPurchaseOrder");
+ reply.setVariable("POFault");
+ reply.setFaultName("cannotCompleteOrder");
+ faultHandler.setActivity(reply);
+ faultHandlers.add(faultHandler);
+ process.setFaultHandlers(faultHandlers);
+
// sequence
BPELSequence sequence = new BPELSequence();
sequence.setName("sequence");
@@ -233,7 +214,7 @@
sequenceActivities.add(flow);
// reply
- BPELReply reply = new BPELReply();
+ reply = new BPELReply();
reply.setName("Invoice Processing");
reply.setPartnerLink("purchasing");
reply.setPortType("lns:purchaseOrderPT");
@@ -250,10 +231,16 @@
PackageBuilder packageBuilder = new PackageBuilder(packageConf);
ProcessBuilder processBuilder = new ProcessBuilder(packageBuilder);
processBuilder.buildProcess(process);
-
+ return process;
+ }
+
+ // normal execution
+ public static void main1(String[] args) {
+ BPELProcess process = getProcess();
// execute
- properties = new Properties();
+ Properties properties = new Properties();
properties.put( "processNodeInstanceFactoryRegistry", "bpelProcessNodeInstanceFactory.conf" );
+ properties.put( "processContextInstanceFactoryRegistry", "bpelProcessContextInstanceFactory.conf" );
RuleBaseConfiguration ruleBaseConf = new RuleBaseConfiguration( properties );
AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase(ruleBaseConf);
ruleBase.addProcess(process);
@@ -292,6 +279,40 @@
logger.writeToDisk();
}
+ // shipping returns fault
+ public static void main(String[] args) {
+ BPELProcess process = getProcess();
+ // execute
+ Properties properties = new Properties();
+ properties.put( "processNodeInstanceFactoryRegistry", "bpelProcessNodeInstanceFactory.conf" );
+ properties.put( "processContextInstanceFactoryRegistry", "bpelProcessContextInstanceFactory.conf" );
+ RuleBaseConfiguration ruleBaseConf = new RuleBaseConfiguration( properties );
+ AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase(ruleBaseConf);
+ ruleBase.addProcess(process);
+ InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, ruleBase);
+ workingMemory.registerProcessInstanceFactory(
+ BPELProcess.BPEL_TYPE, new BPELProcessInstanceFactory());
+ WorkItemHandler handler = new WebServiceInvocationHandler();
+ workingMemory.getWorkItemManager().registerWorkItemHandler("WebServiceInvocation", handler);
+ WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(workingMemory);
+ BPELProcessInstance processInstance = (BPELProcessInstance) workingMemory.startProcess("1");
+
+ // start process
+ webServiceInvocation(processInstance, "purchasing", "lns:purchaseOrderPT", "sendPurchaseOrder", "PURCHASE ORDER");
+
+ // reply to web service invocations
+ WorkItem workItem = findWebServiceInvocation(workingMemory, "scheduling", "lns:schedulingPT", "requestProductionScheduling");
+ replyWebServiceInvocation(workingMemory, workItem, null);
+
+ workItem = findWebServiceInvocation(workingMemory, "invoicing", "lns:computePricePT", "initiatePriceCalculation");
+ replyWebServiceInvocation(workingMemory, workItem, null);
+
+ workItem = findWebServiceInvocation(workingMemory, "shipping", "lns:shippingPT", "requestShipping");
+ replyWebServiceInvocationFault(workingMemory, workItem, "cannotCompleteOrder", "SHIPPING FAULT");
+
+ logger.writeToDisk();
+ }
+
private static WorkItem findWebServiceInvocation(WorkingMemory workingMemory, String partnerLink, String portType, String operation) {
Set<WorkItem> workItems = workingMemory.getWorkItemManager().getWorkItems();
for (Iterator<WorkItem> iterator = workItems.iterator(); iterator.hasNext(); ) {
@@ -318,6 +339,20 @@
workingMemory.getWorkItemManager().completeWorkItem(workItem.getId(), results);
}
+ private static void replyWebServiceInvocationFault(WorkingMemory workingMemory, WorkItem workItem, String faultName, String result) {
+ System.out.println("Replying to web service invocation "
+ + workItem.getParameter("PartnerLink") + " "
+ + workItem.getParameter("PortType") + " "
+ + workItem.getParameter("Operation") + ", faultName = "
+ + workItem.getParameter("FaultName") + ", message = "
+ + workItem.getParameter("Message") + ": "
+ + result);
+ Map<String, Object> results = new HashMap<String, Object>();
+ results.put("Result", result);
+ results.put("FaultName", faultName);
+ workingMemory.getWorkItemManager().completeWorkItem(workItem.getId(), results);
+ }
+
private static void webServiceInvocation(BPELProcessInstance processInstance, String partnerLink, String portType, String operation, String result) {
System.out.println("Web service invocation "
+ partnerLink + " "
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -65,8 +65,9 @@
import org.drools.lang.descr.RuleDescr;
import org.drools.lang.descr.TypeDeclarationDescr;
import org.drools.lang.descr.VariableRestrictionDescr;
+import org.drools.process.core.Context;
import org.drools.process.core.Process;
-import org.drools.process.core.Variable;
+import org.drools.process.core.context.variable.Variable;
import org.drools.reteoo.ReteooRuleBase;
import org.drools.rule.Declaration;
import org.drools.rule.EvalCondition;
@@ -1314,6 +1315,38 @@
public void setVariables(List<Variable> variables) {
}
+ public Variable findVariable(String variableName) {
+ return null;
+ }
+
+ public void addContext(Context context) {
+ }
+
+ public List<Context> getContexts(String contextId) {
+ return null;
+ }
+
+ public Context getDefaultContext(String contextId) {
+ return null;
+ }
+
+ public void setDefaultContext(Context context) {
+ }
+
+ public Context getContext(String contextType, long id) {
+ return null;
+ }
+
+ public Object getMetaData(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setMetaData(String name, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
}
class MockActivation
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/testframework/MockWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/testframework/MockWorkingMemory.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/testframework/MockWorkingMemory.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -35,6 +35,7 @@
import org.drools.process.instance.ProcessInstance;
import org.drools.process.instance.ProcessInstanceFactory;
import org.drools.process.instance.WorkItemManager;
+import org.drools.process.instance.timer.TimerManager;
import org.drools.reteoo.LIANodePropagation;
import org.drools.reteoo.ObjectTypeConf;
import org.drools.rule.EntryPoint;
@@ -433,6 +434,11 @@
}
+ public void addProcessInstance(ProcessInstance processInstance) {
+ // TODO Auto-generated method stub
+
+ }
+
public void removeProcessInstance(ProcessInstance processInstance) {
// TODO Auto-generated method stub
@@ -505,4 +511,9 @@
}
+ public TimerManager getTimerManager() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/StoreHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/StoreHandler.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/StoreHandler.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -43,6 +43,10 @@
emptyAttributeCheck( localName, "name", name, xmlPackageReader );
actionNode.setName( name );
+ final String id = attrs.getValue( "id" );
+ emptyAttributeCheck( localName, "id", name, xmlPackageReader );
+ actionNode.setId( new Long(id) );
+
process.addNode( actionNode );
((ProcessBuildData)xmlPackageReader.getData()).addNode( actionNode );
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/TestXml.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/TestXml.java 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/TestXml.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -17,7 +17,7 @@
RuleFlowProcess process = (RuleFlowProcess) reader.getProcess();
assertNotNull(process);
- XmlRuleFlowProcesDumper dumper = new XmlRuleFlowProcesDumper();
+ XmlRuleFlowProcessDumper dumper = new XmlRuleFlowProcessDumper();
String output = dumper.dump(process);
System.out.println(output);
reader = new XmlProcessReader(new SemanticModules());
Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/processes/XMLPersistenceTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/processes/XMLPersistenceTest.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/processes/XMLPersistenceTest.java 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,274 @@
+package org.drools.xml.processes;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.process.core.ParameterDefinition;
+import org.drools.process.core.Work;
+import org.drools.process.core.context.variable.Variable;
+import org.drools.process.core.datatype.impl.type.IntegerDataType;
+import org.drools.process.core.datatype.impl.type.StringDataType;
+import org.drools.process.core.impl.ParameterDefinitionImpl;
+import org.drools.process.core.impl.WorkImpl;
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.workflow.core.Connection;
+import org.drools.workflow.core.Constraint;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.ConnectionImpl;
+import org.drools.workflow.core.impl.ConstraintImpl;
+import org.drools.workflow.core.impl.DroolsConsequenceAction;
+import org.drools.workflow.core.node.ActionNode;
+import org.drools.workflow.core.node.EndNode;
+import org.drools.workflow.core.node.Join;
+import org.drools.workflow.core.node.MilestoneNode;
+import org.drools.workflow.core.node.RuleSetNode;
+import org.drools.workflow.core.node.Split;
+import org.drools.workflow.core.node.StartNode;
+import org.drools.workflow.core.node.SubProcessNode;
+import org.drools.workflow.core.node.WorkItemNode;
+import org.drools.xml.XmlProcessReader;
+import org.drools.xml.XmlRuleFlowProcessDumper;
+
+public class XMLPersistenceTest extends TestCase {
+
+ public void testPersistenceOfEmptyNodes() throws Exception {
+ RuleFlowProcess process = new RuleFlowProcess() {
+ private static final long serialVersionUID = 400L;
+ int id = 0;
+ public void addNode(Node node) {
+ node.setId(++id);
+ super.addNode(node);
+ }
+ };
+ process.addNode(new StartNode());
+ process.addNode(new EndNode());
+ process.addNode(new ActionNode());
+ process.addNode(new Split());
+ process.addNode(new Join());
+ process.addNode(new MilestoneNode());
+ process.addNode(new RuleSetNode());
+ process.addNode(new SubProcessNode());
+ process.addNode(new WorkItemNode());
+
+ XmlRuleFlowProcessDumper dumper = new XmlRuleFlowProcessDumper();
+
+ String xml = dumper.dump(process, false);
+ if (xml == null) {
+ throw new IllegalArgumentException("Failed to persist empty nodes!");
+ }
+
+// System.out.println(xml);
+
+ XmlProcessReader reader = new XmlProcessReader(
+ new PackageBuilderConfiguration().getSemanticModules());
+ process = (RuleFlowProcess) reader.read(new StringReader(xml));
+ if (process == null) {
+ throw new IllegalArgumentException("Failed to reload process!");
+ }
+
+ assertEquals(9, process.getNodes().length);
+
+// System.out.println("************************************");
+
+ String xml2 = dumper.dump(process, false);
+ if (xml2 == null) {
+ throw new IllegalArgumentException("Failed to persist empty nodes!");
+ }
+
+// System.out.println(xml2);
+
+ assertEquals(xml, xml2);
+ }
+
+ public void testPersistenceOfFullNodes() throws Exception {
+ RuleFlowProcess process = new RuleFlowProcess() {
+ private static final long serialVersionUID = 400L;
+ int id = 0;
+ public void addNode(Node node) {
+ node.setId(++id);
+ super.addNode(node);
+ }
+ };
+ process.setMetaData("routerLayout", 1);
+
+ List<String> imports = new ArrayList<String>();
+ imports.add("import1");
+ imports.add("import2");
+ process.setImports(imports);
+
+ Map<String, String> globals = new HashMap<String, String>();
+ globals.put("name1", "type1");
+ globals.put("name2", "type2");
+ process.setGlobals(globals);
+
+ List<Variable> variables = new ArrayList<Variable>();
+ Variable variable = new Variable();
+ variable.setName("variable1");
+ variable.setType(new StringDataType());
+ variable.setValue("value");
+ variables.add(variable);
+ variable = new Variable();
+ variable.setName("variable2");
+ variable.setType(new IntegerDataType());
+ variable.setValue(2);
+ variables.add(variable);
+ process.getVariableScope().setVariables(variables);
+
+ StartNode startNode = new StartNode();
+ startNode.setName("start");
+ startNode.setMetaData("x", 1);
+ startNode.setMetaData("y", 2);
+ startNode.setMetaData("width", 3);
+ startNode.setMetaData("height", 4);
+ process.addNode(startNode);
+
+ ActionNode actionNode = new ActionNode();
+ actionNode.setName("action");
+ actionNode.setMetaData("x", 1);
+ actionNode.setMetaData("y", 2);
+ actionNode.setMetaData("width", 3);
+ actionNode.setMetaData("height", 4);
+ DroolsConsequenceAction action = new DroolsConsequenceAction("dialect", "consequence");
+ actionNode.setAction(action);
+ process.addNode(actionNode);
+
+ RuleSetNode ruleSetNode = new RuleSetNode();
+ ruleSetNode.setName("action");
+ ruleSetNode.setMetaData("x", 1);
+ ruleSetNode.setMetaData("y", 2);
+ ruleSetNode.setMetaData("width", 3);
+ ruleSetNode.setMetaData("height", 4);
+ ruleSetNode.setRuleFlowGroup("ruleFlowGroup");
+ process.addNode(ruleSetNode);
+
+ Split split = new Split();
+ split.setName("split");
+ split.setMetaData("x", 1);
+ split.setMetaData("y", 2);
+ split.setMetaData("width", 3);
+ split.setMetaData("height", 4);
+ split.setType(Split.TYPE_XOR);
+ Connection connection = new ConnectionImpl(split, Node.CONNECTION_DEFAULT_TYPE, actionNode, Node.CONNECTION_DEFAULT_TYPE);
+ Constraint constraint = new ConstraintImpl();
+ constraint.setName("constraint1");
+ constraint.setPriority(1);
+ constraint.setDialect("dialect1");
+ constraint.setType("type1");
+ constraint.setConstraint("constraint-text1");
+ split.setConstraint(connection, constraint);
+ connection = new ConnectionImpl(split, Node.CONNECTION_DEFAULT_TYPE, ruleSetNode, Node.CONNECTION_DEFAULT_TYPE);
+ constraint = new ConstraintImpl();
+ constraint.setName("constraint2");
+ constraint.setPriority(2);
+ constraint.setDialect("dialect2");
+ constraint.setType("type2");
+ constraint.setConstraint("constraint-text2");
+ split.setConstraint(connection, constraint);
+ process.addNode(split);
+ new ConnectionImpl(startNode, Node.CONNECTION_DEFAULT_TYPE, split, Node.CONNECTION_DEFAULT_TYPE);
+
+ Join join = new Join();
+ join.setName("join");
+ join.setMetaData("x", 1);
+ join.setMetaData("y", 2);
+ join.setMetaData("width", 3);
+ join.setMetaData("height", 4);
+ join.setType(Join.TYPE_XOR);
+ process.addNode(join);
+ new ConnectionImpl(actionNode, Node.CONNECTION_DEFAULT_TYPE, join, Node.CONNECTION_DEFAULT_TYPE);
+ new ConnectionImpl(ruleSetNode, Node.CONNECTION_DEFAULT_TYPE, join, Node.CONNECTION_DEFAULT_TYPE);
+
+
+ MilestoneNode milestone = new MilestoneNode();
+ milestone.setName("milestone");
+ milestone.setMetaData("x", 1);
+ milestone.setMetaData("y", 2);
+ milestone.setMetaData("width", 3);
+ milestone.setMetaData("height", 4);
+ milestone.setConstraint("constraint");
+ process.addNode(milestone);
+ connection = new ConnectionImpl(join, Node.CONNECTION_DEFAULT_TYPE, milestone, Node.CONNECTION_DEFAULT_TYPE);
+ connection.setMetaData("bendpoints", "[10,10;20;20]");
+
+ SubProcessNode subProcess = new SubProcessNode();
+ subProcess.setName("subProcess");
+ subProcess.setMetaData("x", 1);
+ subProcess.setMetaData("y", 2);
+ subProcess.setMetaData("width", 3);
+ subProcess.setMetaData("height", 4);
+ subProcess.setProcessId("processId");
+ subProcess.setWaitForCompletion(false);
+ process.addNode(subProcess);
+ connection = new ConnectionImpl(milestone, Node.CONNECTION_DEFAULT_TYPE, subProcess, Node.CONNECTION_DEFAULT_TYPE);
+ connection.setMetaData("bendpoints", "[10,10]");
+
+ WorkItemNode workItemNode = new WorkItemNode();
+ Work work = new WorkImpl();
+ work.setName("workname");
+ Set<ParameterDefinition> parameterDefinitions = new HashSet<ParameterDefinition>();
+ ParameterDefinition parameterDefinition = new ParameterDefinitionImpl("param1", new StringDataType());
+ parameterDefinitions.add(parameterDefinition);
+ parameterDefinition = new ParameterDefinitionImpl("param2", new IntegerDataType());
+ parameterDefinitions.add(parameterDefinition);
+ work.setParameterDefinitions(parameterDefinitions);
+ work.setParameter("param1", "value1");
+ work.setParameter("param2", 1);
+ workItemNode.setWork(work);
+ workItemNode.setWaitForCompletion(false);
+ workItemNode.addInMapping("param1", "var1");
+ workItemNode.addOutMapping("param2", "var2");
+ process.addNode(workItemNode);
+ connection = new ConnectionImpl(subProcess, Node.CONNECTION_DEFAULT_TYPE, workItemNode, Node.CONNECTION_DEFAULT_TYPE);
+ connection.setMetaData("bendpoints", "[]");
+
+ EndNode endNode = new EndNode();
+ endNode.setName("end");
+ endNode.setMetaData("x", 1);
+ endNode.setMetaData("y", 2);
+ endNode.setMetaData("width", 3);
+ endNode.setMetaData("height", 4);
+ process.addNode(endNode);
+ new ConnectionImpl(workItemNode, Node.CONNECTION_DEFAULT_TYPE, endNode, Node.CONNECTION_DEFAULT_TYPE);
+
+ XmlRuleFlowProcessDumper dumper = new XmlRuleFlowProcessDumper();
+
+ String xml = dumper.dump(process, true);
+ if (xml == null) {
+ throw new IllegalArgumentException("Failed to persist empty nodes!");
+ }
+
+ System.out.println(xml);
+
+ XmlProcessReader reader = new XmlProcessReader(
+ new PackageBuilderConfiguration().getSemanticModules());
+ process = (RuleFlowProcess) reader.read(new StringReader(xml));
+ if (process == null) {
+ throw new IllegalArgumentException("Failed to reload process!");
+ }
+
+ assertEquals(9, process.getNodes().length);
+
+// System.out.println("************************************");
+
+ String xml2 = dumper.dump(process, true);
+ if (xml2 == null) {
+ throw new IllegalArgumentException("Failed to persist empty nodes!");
+ }
+
+ System.out.println(xml2);
+
+ assertEquals(xml, xml2);
+ }
+
+ public void testSpecialCharacters() {
+ // TODO
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/test/resources/META-INF/bpelProcessContextInstanceFactory.conf
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/META-INF/bpelProcessContextInstanceFactory.conf (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/META-INF/bpelProcessContextInstanceFactory.conf 2008-04-06 23:49:40 UTC (rev 19433)
@@ -0,0 +1,8 @@
+// we use MVEL to configure our nodes, simply populate a map, which will be added to the main registry
+import org.drools.process.core.context.exception.ExceptionScope;
+import org.drools.bpel.instance.BPELExceptionScopeInstance;
+import org.drools.workflow.instance.context.WorkflowReuseContextInstanceFactory;
+
+[
+ ExceptionScope : new WorkflowReuseContextInstanceFactory( BPELExceptionScopeInstance ),
+]
Deleted: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rf
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rf 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rf 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,118 +0,0 @@
-<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
- <default>
- <elements id="2">
- <entry>
- <string>2-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper id="3" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="4">
- <x>179</x>
- <y>100</y>
- <width>80</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.EndNode" id="5">
- <id>2</id>
- <name>End</name>
- <incomingConnections id="6">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="7">
- <org.drools.workflow.core.impl.ConnectionImpl id="8">
- <from class="org.drools.workflow.core.node.StartNode" id="9">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="10"/>
- <outgoingConnections id="11">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="12">
- <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" id="13">
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="14">
- <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
- <nodes id="15">
- <entry>
- <long>1</long>
- <org.drools.workflow.core.node.StartNode reference="9"/>
- </entry>
- <entry>
- <long>2</long>
- <org.drools.workflow.core.node.EndNode reference="5"/>
- </entry>
- </nodes>
- <lastNodeId>2</lastNodeId>
- </nodeContainer>
- <id>com.sample.ruleflow</id>
- <name>empty_ruleflow</name>
- <version>1.0</version>
- <type>RuleFlow</type>
- <packageName>com.empty</packageName>
- <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="16">
- <variables id="17"/>
- </variableScope>
- </nodeContainer>
- </from>
- <to class="org.drools.workflow.core.node.EndNode" reference="5"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="18"/>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
- </element>
- <incomingConnections id="19">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="20" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <bendpoints id="21"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="22" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="23">
- <x>34</x>
- <y>100</y>
- <width>80</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.StartNode" reference="9"/>
- <incomingConnections id="24"/>
- <outgoingConnections id="25">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="20"/>
- </outgoingConnections>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </source>
- <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" reference="3"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection reference="8"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </incomingConnections>
- <outgoingConnections id="26"/>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper>
- </entry>
- <entry>
- <string>1-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="22"/>
- </entry>
- </elements>
- <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
- <routerLayout>2</routerLayout>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
-</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,55 +1,19 @@
-<org.drools.ruleflow.core.RuleFlowProcess id="1">
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
- <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- <nodes id="3">
- <entry>
- <long>1</long>
- <org.drools.workflow.core.node.StartNode id="4">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="5"/>
- <outgoingConnections id="6">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="7">
- <org.drools.workflow.core.impl.ConnectionImpl id="8">
- <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
- <to class="org.drools.workflow.core.node.EndNode" id="9">
- <id>2</id>
- <name>End</name>
- <incomingConnections id="10">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="11">
- <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="12"/>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </org.drools.workflow.core.node.StartNode>
- </entry>
- <entry>
- <long>2</long>
- <org.drools.workflow.core.node.EndNode reference="9"/>
- </entry>
- </nodes>
- <lastNodeId>2</lastNodeId>
- </nodeContainer>
- <id>com.sample.ruleflow</id>
- <name>empty_ruleflow</name>
- <version>1.0</version>
- <type>RuleFlow</type>
- <packageName>com.empty</packageName>
- <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="13">
- <variables id="14"/>
- </variableScope>
-</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<process xmlns="http://drools.org/drools-4.0/process"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+ xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ type="RuleFlow" name="empty_ruleflow" id="empty_ruleflow" package-name="com.empty" >
+
+ <header>
+ </header>
+
+ <nodes>
+ <start id="1" name="Start" />
+ <end id="2" name="End" />
+ </nodes>
+
+ <connections>
+ <connection from="1" to="2"/>
+ </connections>
+
+</process>
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow_old.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow_old.rfm 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow_old.rfm 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,46 +0,0 @@
-<org.drools.ruleflow.core.impl.RuleFlowProcessImpl id="1">
- <nodes id="2">
- <entry>
- <long>1</long>
- <org.drools.ruleflow.core.impl.StartNodeImpl id="3">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="4"/>
- <outgoingConnections id="5">
- <org.drools.ruleflow.core.impl.ConnectionImpl id="6">
- <type>1</type>
- <from class="org.drools.ruleflow.core.impl.StartNodeImpl" reference="3"/>
- <to class="org.drools.ruleflow.core.impl.EndNodeImpl" id="7">
- <id>4</id>
- <name>End</name>
- <incomingConnections id="8">
- <org.drools.ruleflow.core.impl.ConnectionImpl reference="6"/>
- </incomingConnections>
- <outgoingConnections id="9"/>
- </to>
- </org.drools.ruleflow.core.impl.ConnectionImpl>
- </outgoingConnections>
- </org.drools.ruleflow.core.impl.StartNodeImpl>
- </entry>
- <entry>
- <long>4</long>
- <org.drools.ruleflow.core.impl.EndNodeImpl reference="7"/>
- </entry>
- </nodes>
- <variables id="10"/>
- <lastNodeId>9</lastNodeId>
- <imports id="11">
- <string>com.sample.Property</string>
- </imports>
- <globals id="12">
- <entry>
- <string>property</string>
- <string>Property</string>
- </entry>
- </globals>
- <id>com.sample.ruleflow</id>
- <name>Ruleflow</name>
- <version>1.0</version>
- <type>RuleFlow</type>
- <packageName>com.empty</packageName>
-</org.drools.ruleflow.core.impl.RuleFlowProcessImpl>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,54 +1,19 @@
-<org.drools.ruleflow.core.RuleFlowProcess id="1">
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
- <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- <nodes id="3">
- <entry>
- <long>1</long>
- <org.drools.workflow.core.node.StartNode id="4">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="5"/>
- <outgoingConnections id="6">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="7">
- <org.drools.workflow.core.impl.ConnectionImpl id="8">
- <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
- <to class="org.drools.workflow.core.node.EndNode" id="9">
- <id>2</id>
- <name>End</name>
- <incomingConnections id="10">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="11">
- <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="12"/>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </org.drools.workflow.core.node.StartNode>
- </entry>
- <entry>
- <long>2</long>
- <org.drools.workflow.core.node.EndNode reference="9"/>
- </entry>
- </nodes>
- <lastNodeId>2</lastNodeId>
- </nodeContainer>
- <id>com.sample.ruleflow</id>
- <name>empty_ruleflow</name>
- <version>1.0</version>
- <type>RuleFlow</type>
- <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="13">
- <variables id="14"/>
- </variableScope>
-</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<process xmlns="http://drools.org/drools-4.0/process"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+ xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ type="RuleFlow" name="empty_ruleflow" id="empty_ruleflow" >
+
+ <header>
+ </header>
+
+ <nodes>
+ <start id="1" name="Start" />
+ <end id="2" name="End" />
+ </nodes>
+
+ <connections>
+ <connection from="1" to="2"/>
+ </connections>
+
+</process>
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow_old.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow_old.rfm 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow_old.rfm 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,45 +0,0 @@
-<org.drools.ruleflow.core.impl.RuleFlowProcessImpl id="1">
- <nodes id="2">
- <entry>
- <long>1</long>
- <org.drools.ruleflow.core.impl.StartNodeImpl id="3">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="4"/>
- <outgoingConnections id="5">
- <org.drools.ruleflow.core.impl.ConnectionImpl id="6">
- <type>1</type>
- <from class="org.drools.ruleflow.core.impl.StartNodeImpl" reference="3"/>
- <to class="org.drools.ruleflow.core.impl.EndNodeImpl" id="7">
- <id>4</id>
- <name>End</name>
- <incomingConnections id="8">
- <org.drools.ruleflow.core.impl.ConnectionImpl reference="6"/>
- </incomingConnections>
- <outgoingConnections id="9"/>
- </to>
- </org.drools.ruleflow.core.impl.ConnectionImpl>
- </outgoingConnections>
- </org.drools.ruleflow.core.impl.StartNodeImpl>
- </entry>
- <entry>
- <long>4</long>
- <org.drools.ruleflow.core.impl.EndNodeImpl reference="7"/>
- </entry>
- </nodes>
- <variables id="10"/>
- <lastNodeId>9</lastNodeId>
- <imports id="11">
- <string>com.sample.Property</string>
- </imports>
- <globals id="12">
- <entry>
- <string>property</string>
- <string>Property</string>
- </entry>
- </globals>
- <id>com.sample.ruleflow</id>
- <name>Ruleflow</name>
- <version>1.0</version>
- <type>RuleFlow</type>
-</org.drools.ruleflow.core.impl.RuleFlowProcessImpl>
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rf
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rf 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rf 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,540 +0,0 @@
-<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
- <default>
- <elements id="2">
- <entry>
- <string>4-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper id="3" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="4">
- <x>462</x>
- <y>103</y>
- <width>56</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.EndNode" id="5">
- <id>4</id>
- <name>End</name>
- <incomingConnections id="6">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="7">
- <org.drools.workflow.core.impl.ConnectionImpl id="8">
- <from class="org.drools.workflow.core.node.RuleSetNode" id="9">
- <ruleFlowGroup>flowgroup-4</ruleFlowGroup>
- <id>9</id>
- <name>RuleSet4</name>
- <incomingConnections id="10">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="11">
- <org.drools.workflow.core.impl.ConnectionImpl id="12">
- <from class="org.drools.workflow.core.node.Join" id="13">
- <type>1</type>
- <id>6</id>
- <name>Join</name>
- <incomingConnections id="14">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="15">
- <org.drools.workflow.core.impl.ConnectionImpl id="16">
- <from class="org.drools.workflow.core.node.RuleSetNode" id="17">
- <ruleFlowGroup>flowgroup-2</ruleFlowGroup>
- <id>10</id>
- <name>RuleSet2</name>
- <incomingConnections id="18">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="19">
- <org.drools.workflow.core.impl.ConnectionImpl id="20">
- <from class="org.drools.workflow.core.node.Split" id="21">
- <type>1</type>
- <constraints id="22"/>
- <id>5</id>
- <name>Split</name>
- <incomingConnections id="23">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="24">
- <org.drools.workflow.core.impl.ConnectionImpl id="25">
- <from class="org.drools.workflow.core.node.RuleSetNode" id="26">
- <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
- <id>2</id>
- <name>RuleSet1</name>
- <incomingConnections id="27">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="28">
- <org.drools.workflow.core.impl.ConnectionImpl id="29">
- <from class="org.drools.workflow.core.node.StartNode" id="30">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="31"/>
- <outgoingConnections id="32">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="33">
- <org.drools.workflow.core.impl.ConnectionImpl reference="29"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" id="34">
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="35">
- <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
- <nodes id="36">
- <entry>
- <long>1</long>
- <org.drools.workflow.core.node.StartNode reference="30"/>
- </entry>
- <entry>
- <long>2</long>
- <org.drools.workflow.core.node.RuleSetNode reference="26"/>
- </entry>
- <entry>
- <long>4</long>
- <org.drools.workflow.core.node.EndNode reference="5"/>
- </entry>
- <entry>
- <long>5</long>
- <org.drools.workflow.core.node.Split reference="21"/>
- </entry>
- <entry>
- <long>6</long>
- <org.drools.workflow.core.node.Join reference="13"/>
- </entry>
- <entry>
- <long>9</long>
- <org.drools.workflow.core.node.RuleSetNode reference="9"/>
- </entry>
- <entry>
- <long>10</long>
- <org.drools.workflow.core.node.RuleSetNode reference="17"/>
- </entry>
- <entry>
- <long>11</long>
- <org.drools.workflow.core.node.RuleSetNode id="37">
- <ruleFlowGroup>flowgroup-3</ruleFlowGroup>
- <id>11</id>
- <name>RuleSet3</name>
- <incomingConnections id="38">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="39">
- <org.drools.workflow.core.impl.ConnectionImpl id="40">
- <from class="org.drools.workflow.core.node.Split" reference="21"/>
- <to class="org.drools.workflow.core.node.RuleSetNode" reference="37"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="41">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="42">
- <org.drools.workflow.core.impl.ConnectionImpl id="43">
- <from class="org.drools.workflow.core.node.RuleSetNode" reference="37"/>
- <to class="org.drools.workflow.core.node.Join" reference="13"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
- </org.drools.workflow.core.node.RuleSetNode>
- </entry>
- </nodes>
- <lastNodeId>11</lastNodeId>
- </nodeContainer>
- <id>0</id>
- <name>ruleflow</name>
- <version>1</version>
- <type>RuleFlow</type>
- <packageName>com.sample</packageName>
- <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="44">
- <variables id="45"/>
- </variableScope>
- </nodeContainer>
- </from>
- <to class="org.drools.workflow.core.node.RuleSetNode" reference="26"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="46">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="47">
- <org.drools.workflow.core.impl.ConnectionImpl reference="25"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
- </from>
- <to class="org.drools.workflow.core.node.Split" reference="21"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="48">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="49">
- <org.drools.workflow.core.impl.ConnectionImpl reference="20"/>
- <org.drools.workflow.core.impl.ConnectionImpl reference="40"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
- </from>
- <to class="org.drools.workflow.core.node.RuleSetNode" reference="17"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="50">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="51">
- <org.drools.workflow.core.impl.ConnectionImpl reference="16"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
- </from>
- <to class="org.drools.workflow.core.node.Join" reference="13"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- <org.drools.workflow.core.impl.ConnectionImpl reference="43"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="52">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="53">
- <org.drools.workflow.core.impl.ConnectionImpl reference="12"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
- </from>
- <to class="org.drools.workflow.core.node.RuleSetNode" reference="9"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="54">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="55">
- <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
- </from>
- <to class="org.drools.workflow.core.node.EndNode" reference="5"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="56"/>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
- </element>
- <incomingConnections id="57">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="58" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <bendpoints id="59"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" id="60" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="61">
- <x>366</x>
- <y>103</y>
- <width>80</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.RuleSetNode" reference="9"/>
- <incomingConnections id="62">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="63" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <bendpoints id="64"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" id="65" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="66">
- <x>309</x>
- <y>104</y>
- <width>40</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.Join" reference="13"/>
- <incomingConnections id="67">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="68" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <bendpoints id="69"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" id="70" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="71">
- <x>218</x>
- <y>46</y>
- <width>80</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.RuleSetNode" reference="17"/>
- <incomingConnections id="72">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="73" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <bendpoints id="74"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" id="75" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="76">
- <x>166</x>
- <y>104</y>
- <width>38</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.Split" reference="21"/>
- <incomingConnections id="77">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="78" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <bendpoints id="79"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" id="80" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="81">
- <x>86</x>
- <y>104</y>
- <width>63</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.RuleSetNode" reference="26"/>
- <incomingConnections id="82">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="83" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <bendpoints id="84"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="85" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="86">
- <x>13</x>
- <y>104</y>
- <width>59</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.StartNode" reference="30"/>
- <incomingConnections id="87"/>
- <outgoingConnections id="88">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="83"/>
- </outgoingConnections>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </source>
- <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="80"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection reference="29"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </incomingConnections>
- <outgoingConnections id="89">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="78"/>
- </outgoingConnections>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </source>
- <target class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="75"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection reference="25"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </incomingConnections>
- <outgoingConnections id="90">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="73"/>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="91" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <bendpoints id="92"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="75"/>
- <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" id="93" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="94">
- <x>221</x>
- <y>158</y>
- <width>80</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.RuleSetNode" reference="37"/>
- <incomingConnections id="95">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="91"/>
- </incomingConnections>
- <outgoingConnections id="96">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="97" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <bendpoints id="98"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="93"/>
- <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="65"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection reference="43"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </outgoingConnections>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </target>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection reference="40"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </outgoingConnections>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
- <default/>
- </org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
- </source>
- <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="70"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection reference="20"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </incomingConnections>
- <outgoingConnections id="99">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="68"/>
- </outgoingConnections>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </source>
- <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="65"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection reference="16"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="97"/>
- </incomingConnections>
- <outgoingConnections id="100">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="63"/>
- </outgoingConnections>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </source>
- <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="60"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection reference="12"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </incomingConnections>
- <outgoingConnections id="101">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="58"/>
- </outgoingConnections>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </source>
- <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" reference="3"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection reference="8"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </incomingConnections>
- <outgoingConnections id="102"/>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper>
- </entry>
- <entry>
- <string>9-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper reference="60"/>
- </entry>
- <entry>
- <string>2-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper reference="80"/>
- </entry>
- <entry>
- <string>11-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper reference="93"/>
- </entry>
- <entry>
- <string>10-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper reference="70"/>
- </entry>
- <entry>
- <string>1-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="85"/>
- </entry>
- <entry>
- <string>6-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.JoinWrapper reference="65"/>
- </entry>
- <entry>
- <string>5-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.SplitWrapper reference="75"/>
- </entry>
- </elements>
- <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="34"/>
- <routerLayout>2</routerLayout>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
-</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rfm 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rfm 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,243 +1,32 @@
-<org.drools.ruleflow.core.RuleFlowProcess id="1">
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
- <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- <nodes id="3">
- <entry>
- <long>1</long>
- <org.drools.workflow.core.node.StartNode id="4">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="5"/>
- <outgoingConnections id="6">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="7">
- <org.drools.workflow.core.impl.ConnectionImpl id="8">
- <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
- <to class="org.drools.workflow.core.node.RuleSetNode" id="9">
- <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
- <id>2</id>
- <name>RuleSet1</name>
- <incomingConnections id="10">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="11">
- <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="12">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="13">
- <org.drools.workflow.core.impl.ConnectionImpl id="14">
- <from class="org.drools.workflow.core.node.RuleSetNode" reference="9"/>
- <to class="org.drools.workflow.core.node.Split" id="15">
- <type>1</type>
- <constraints id="16"/>
- <id>5</id>
- <name>Split</name>
- <incomingConnections id="17">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="18">
- <org.drools.workflow.core.impl.ConnectionImpl reference="14"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="19">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="20">
- <org.drools.workflow.core.impl.ConnectionImpl id="21">
- <from class="org.drools.workflow.core.node.Split" reference="15"/>
- <to class="org.drools.workflow.core.node.RuleSetNode" id="22">
- <ruleFlowGroup>flowgroup-2</ruleFlowGroup>
- <id>10</id>
- <name>RuleSet2</name>
- <incomingConnections id="23">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="24">
- <org.drools.workflow.core.impl.ConnectionImpl reference="21"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="25">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="26">
- <org.drools.workflow.core.impl.ConnectionImpl id="27">
- <from class="org.drools.workflow.core.node.RuleSetNode" reference="22"/>
- <to class="org.drools.workflow.core.node.Join" id="28">
- <type>1</type>
- <id>6</id>
- <name>Join</name>
- <incomingConnections id="29">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="30">
- <org.drools.workflow.core.impl.ConnectionImpl reference="27"/>
- <org.drools.workflow.core.impl.ConnectionImpl id="31">
- <from class="org.drools.workflow.core.node.RuleSetNode" id="32">
- <ruleFlowGroup>flowgroup-3</ruleFlowGroup>
- <id>11</id>
- <name>RuleSet3</name>
- <incomingConnections id="33">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="34">
- <org.drools.workflow.core.impl.ConnectionImpl id="35">
- <from class="org.drools.workflow.core.node.Split" reference="15"/>
- <to class="org.drools.workflow.core.node.RuleSetNode" reference="32"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="36">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="37">
- <org.drools.workflow.core.impl.ConnectionImpl reference="31"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </from>
- <to class="org.drools.workflow.core.node.Join" reference="28"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="38">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="39">
- <org.drools.workflow.core.impl.ConnectionImpl id="40">
- <from class="org.drools.workflow.core.node.Join" reference="28"/>
- <to class="org.drools.workflow.core.node.RuleSetNode" id="41">
- <ruleFlowGroup>flowgroup-4</ruleFlowGroup>
- <id>9</id>
- <name>RuleSet4</name>
- <incomingConnections id="42">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="43">
- <org.drools.workflow.core.impl.ConnectionImpl reference="40"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="44">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="45">
- <org.drools.workflow.core.impl.ConnectionImpl id="46">
- <from class="org.drools.workflow.core.node.RuleSetNode" reference="41"/>
- <to class="org.drools.workflow.core.node.EndNode" id="47">
- <id>4</id>
- <name>End</name>
- <incomingConnections id="48">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="49">
- <org.drools.workflow.core.impl.ConnectionImpl reference="46"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="50"/>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- <org.drools.workflow.core.impl.ConnectionImpl reference="35"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </org.drools.workflow.core.node.StartNode>
- </entry>
- <entry>
- <long>2</long>
- <org.drools.workflow.core.node.RuleSetNode reference="9"/>
- </entry>
- <entry>
- <long>4</long>
- <org.drools.workflow.core.node.EndNode reference="47"/>
- </entry>
- <entry>
- <long>5</long>
- <org.drools.workflow.core.node.Split reference="15"/>
- </entry>
- <entry>
- <long>6</long>
- <org.drools.workflow.core.node.Join reference="28"/>
- </entry>
- <entry>
- <long>9</long>
- <org.drools.workflow.core.node.RuleSetNode reference="41"/>
- </entry>
- <entry>
- <long>10</long>
- <org.drools.workflow.core.node.RuleSetNode reference="22"/>
- </entry>
- <entry>
- <long>11</long>
- <org.drools.workflow.core.node.RuleSetNode reference="32"/>
- </entry>
- </nodes>
- <lastNodeId>11</lastNodeId>
- </nodeContainer>
- <id>0</id>
- <name>ruleflow</name>
- <version>1</version>
- <type>RuleFlow</type>
- <packageName>com.sample</packageName>
- <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="51">
- <variables id="52"/>
- </variableScope>
-</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<process xmlns="http://drools.org/drools-4.0/process"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+ xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ type="RuleFlow" name="ruleflow" id="0" package-name="com.sample" >
+
+ <header>
+ </header>
+
+ <nodes>
+ <start id="1" name="Start" />
+ <ruleSet id="2" name="RuleSet1" ruleFlowGroup="flowgroup-1" />
+ <split id="3" name="Split" type="1" />
+ <ruleSet id="4" name="RuleSet2" ruleFlowGroup="flowgroup-2" />
+ <ruleSet id="5" name="RuleSet3" ruleFlowGroup="flowgroup-3" />
+ <join id="6" name="Join" type="1" />
+ <ruleSet id="7" name="RuleSet4" ruleFlowGroup="flowgroup-4" />
+ <end id="8" name="End" />
+ </nodes>
+
+ <connections>
+ <connection from="1" to="2"/>
+ <connection from="2" to="3"/>
+ <connection from="3" to="4"/>
+ <connection from="3" to="5"/>
+ <connection from="4" to="6"/>
+ <connection from="5" to="6"/>
+ <connection from="6" to="7"/>
+ <connection from="7" to="8"/>
+ </connections>
+
+</process>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,129 +1,29 @@
-<org.drools.ruleflow.core.RuleFlowProcess id="1">
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
- <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- <nodes id="3">
- <entry>
- <long>1</long>
- <org.drools.workflow.core.node.StartNode id="4">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="5"/>
- <outgoingConnections id="6">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="7">
- <org.drools.workflow.core.impl.ConnectionImpl id="8">
- <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
- <to class="org.drools.workflow.core.node.ActionNode" id="9">
- <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="10">
- <dialect>mvel</dialect>
- <consequence>list.add("mvel was here")</consequence>
- </action>
- <id>2</id>
- <name>mvel</name>
- <incomingConnections id="11">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="12">
- <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="13">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="14">
- <org.drools.workflow.core.impl.ConnectionImpl id="15">
- <from class="org.drools.workflow.core.node.ActionNode" reference="9"/>
- <to class="org.drools.workflow.core.node.ActionNode" id="16">
- <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="17">
- <dialect>java</dialect>
- <consequence>list.add( "java was here" );</consequence>
- </action>
- <id>3</id>
- <name>java</name>
- <incomingConnections id="18">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="19">
- <org.drools.workflow.core.impl.ConnectionImpl reference="15"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="20">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="21">
- <org.drools.workflow.core.impl.ConnectionImpl id="22">
- <from class="org.drools.workflow.core.node.ActionNode" reference="16"/>
- <to class="org.drools.workflow.core.node.EndNode" id="23">
- <id>4</id>
- <name>End</name>
- <incomingConnections id="24">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="25">
- <org.drools.workflow.core.impl.ConnectionImpl reference="22"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="26"/>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </org.drools.workflow.core.node.StartNode>
- </entry>
- <entry>
- <long>2</long>
- <org.drools.workflow.core.node.ActionNode reference="9"/>
- </entry>
- <entry>
- <long>3</long>
- <org.drools.workflow.core.node.ActionNode reference="16"/>
- </entry>
- <entry>
- <long>4</long>
- <org.drools.workflow.core.node.EndNode reference="23"/>
- </entry>
- </nodes>
- <lastNodeId>4</lastNodeId>
- </nodeContainer>
- <imports id="27">
- <string>java.util.List</string>
- </imports>
- <globals id="28">
- <entry>
- <string>list</string>
- <string>List</string>
- </entry>
- </globals>
- <id>ActionDialects</id>
- <name>ActionDialects</name>
- <type>RuleFlow</type>
- <packageName>org.drools.test</packageName>
- <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="29">
- <variables id="30"/>
- </variableScope>
-</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<process xmlns="http://drools.org/drools-4.0/process"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+ xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ type="RuleFlow" name="ActionDialects" id="ActionDialects" package-name="org.drools.test" >
+
+ <header>
+ <imports>
+ <import name="java.util.List" />
+ </imports>
+ <globals>
+ <global identifier="list" type="List" />
+ </globals>
+ </header>
+
+ <nodes>
+ <start id="1" name="Start" />
+ <action id="2" name="mvel" dialect="mvel" >list.add("mvel was here")</action>
+ <action id="3" name="java" dialect="java" >list.add("java was here");</action>
+ <end id="4" name="End" />
+ </nodes>
+
+ <connections>
+ <connection from="1" to="2"/>
+ <connection from="2" to="3"/>
+ <connection from="3" to="4"/>
+ </connections>
+
+</process>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,324 +1,50 @@
-<org.drools.ruleflow.core.RuleFlowProcess id="1">
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
- <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- <nodes id="3">
- <entry>
- <long>1</long>
- <org.drools.workflow.core.node.StartNode id="4">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="5"/>
- <outgoingConnections id="6">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="7">
- <org.drools.workflow.core.impl.ConnectionImpl id="8">
- <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
- <to class="org.drools.workflow.core.node.Split" id="9">
- <type>3</type>
- <constraints id="10">
- <entry>
- <org.drools.workflow.core.impl.ConnectionImpl id="11">
- <from class="org.drools.workflow.core.node.Split" reference="9"/>
- <to class="org.drools.workflow.core.node.ActionNode" id="12">
- <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="13">
- <dialect>mvel</dialect>
- <consequence>outList.add("MVELRuleConstraint was here");</consequence>
- </action>
- <id>6</id>
- <name>MVELRuleConstraintAction</name>
- <incomingConnections id="14">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="15">
- <org.drools.workflow.core.impl.ConnectionImpl reference="11"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="16">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="17">
- <org.drools.workflow.core.impl.ConnectionImpl id="18">
- <from class="org.drools.workflow.core.node.ActionNode" reference="12"/>
- <to class="org.drools.workflow.core.node.Join" id="19">
- <type>1</type>
- <id>7</id>
- <name>Join</name>
- <incomingConnections id="20">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="21">
- <org.drools.workflow.core.impl.ConnectionImpl reference="18"/>
- <org.drools.workflow.core.impl.ConnectionImpl id="22">
- <from class="org.drools.workflow.core.node.ActionNode" id="23">
- <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="24">
- <dialect>java</dialect>
- <consequence>outList.add("JavaRuleConstraint was here");</consequence>
- </action>
- <id>5</id>
- <name>JavaRuleConstraintAction</name>
- <incomingConnections id="25">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="26">
- <org.drools.workflow.core.impl.ConnectionImpl id="27">
- <from class="org.drools.workflow.core.node.Split" reference="9"/>
- <to class="org.drools.workflow.core.node.ActionNode" reference="23"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="28">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="29">
- <org.drools.workflow.core.impl.ConnectionImpl reference="22"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </from>
- <to class="org.drools.workflow.core.node.Join" reference="19"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- <org.drools.workflow.core.impl.ConnectionImpl id="30">
- <from class="org.drools.workflow.core.node.ActionNode" id="31">
- <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="32">
- <dialect>mvel</dialect>
- <consequence>outList.add("JavaCodeConstraint was here");</consequence>
- </action>
- <id>4</id>
- <name>JavaCodeConstraintAction</name>
- <incomingConnections id="33">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="34">
- <org.drools.workflow.core.impl.ConnectionImpl id="35">
- <from class="org.drools.workflow.core.node.Split" reference="9"/>
- <to class="org.drools.workflow.core.node.ActionNode" reference="31"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="36">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="37">
- <org.drools.workflow.core.impl.ConnectionImpl reference="30"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </from>
- <to class="org.drools.workflow.core.node.Join" reference="19"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- <org.drools.workflow.core.impl.ConnectionImpl id="38">
- <from class="org.drools.workflow.core.node.ActionNode" id="39">
- <action class="org.drools.workflow.core.impl.DroolsConsequenceAction" id="40">
- <dialect>mvel</dialect>
- <consequence>outList.add("MVELCodeConstraint was here");</consequence>
- </action>
- <id>3</id>
- <name>MVELCodeConstraintAction</name>
- <incomingConnections id="41">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="42">
- <org.drools.workflow.core.impl.ConnectionImpl id="43">
- <from class="org.drools.workflow.core.node.Split" reference="9"/>
- <to class="org.drools.workflow.core.node.ActionNode" reference="39"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="44">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="45">
- <org.drools.workflow.core.impl.ConnectionImpl reference="38"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </from>
- <to class="org.drools.workflow.core.node.Join" reference="19"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="46">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="47">
- <org.drools.workflow.core.impl.ConnectionImpl id="48">
- <from class="org.drools.workflow.core.node.Join" reference="19"/>
- <to class="org.drools.workflow.core.node.EndNode" id="49">
- <id>8</id>
- <name>End</name>
- <incomingConnections id="50">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="51">
- <org.drools.workflow.core.impl.ConnectionImpl reference="48"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="52"/>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- <org.drools.workflow.core.impl.ConstraintImpl id="53">
- <name>MVELRuleConstraint</name>
- <constraint>list : List()
+<?xml version="1.0" encoding="UTF-8"?>
+<process xmlns="http://drools.org/drools-4.0/process"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+ xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ type="RuleFlow" name="ConstraintDialects" id="ConstraintDialects" package-name="org.drools.test" >
+
+ <header>
+ <imports>
+ <import name="java.util.List" />
+ </imports>
+ <globals>
+ <global identifier="inList" type="List" />
+ <global identifier="outList" type="List" />
+ </globals>
+ </header>
+
+ <nodes>
+ <start id="1" name="Start" />
+ <split id="2" name="Split" type="3">
+ <constraints>
+ <constraint toNodeId="3" toType="DROOLS_DEFAULT" name="MVELRuleConstraint" priority="6" type="rule" dialect="mvel" >list : List();
eval( list.contains( 6 ) )</constraint>
- <priority>6</priority>
- <dialect>mvel</dialect>
- <type>rule</type>
- </org.drools.workflow.core.impl.ConstraintImpl>
- </entry>
- <entry>
- <org.drools.workflow.core.impl.ConnectionImpl reference="43"/>
- <org.drools.workflow.core.impl.ConstraintImpl id="54">
- <name>MVELCodeConstraint</name>
- <constraint>return inList.contains( 1 );</constraint>
- <priority>1</priority>
- <dialect>mvel</dialect>
- <type>code</type>
- </org.drools.workflow.core.impl.ConstraintImpl>
- </entry>
- <entry>
- <org.drools.workflow.core.impl.ConnectionImpl reference="27"/>
- <org.drools.workflow.core.impl.ConstraintImpl id="55">
- <name>JavaRuleConstraint</name>
- <constraint>list : List()
+ <constraint toNodeId="4" toType="DROOLS_DEFAULT" name="JavaRuleConstraint" priority="6" type="rule" dialect="java" >list : List();
eval( list.contains( 25 ) )</constraint>
- <priority>25</priority>
- <dialect>java</dialect>
- <type>rule</type>
- </org.drools.workflow.core.impl.ConstraintImpl>
- </entry>
- <entry>
- <org.drools.workflow.core.impl.ConnectionImpl reference="35"/>
- <org.drools.workflow.core.impl.ConstraintImpl id="56">
- <name>JavaCodeConstraint</name>
- <constraint>return inList.contains( 3 );</constraint>
- <priority>3</priority>
- <dialect>java</dialect>
- <type>code</type>
- </org.drools.workflow.core.impl.ConstraintImpl>
- </entry>
- </constraints>
- <id>2</id>
- <name>Split</name>
- <incomingConnections id="57">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="58">
- <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="59">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="60">
- <org.drools.workflow.core.impl.ConnectionImpl reference="43"/>
- <org.drools.workflow.core.impl.ConnectionImpl reference="35"/>
- <org.drools.workflow.core.impl.ConnectionImpl reference="27"/>
- <org.drools.workflow.core.impl.ConnectionImpl reference="11"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </org.drools.workflow.core.node.StartNode>
- </entry>
- <entry>
- <long>2</long>
- <org.drools.workflow.core.node.Split reference="9"/>
- </entry>
- <entry>
- <long>3</long>
- <org.drools.workflow.core.node.ActionNode reference="39"/>
- </entry>
- <entry>
- <long>4</long>
- <org.drools.workflow.core.node.ActionNode reference="31"/>
- </entry>
- <entry>
- <long>5</long>
- <org.drools.workflow.core.node.ActionNode reference="23"/>
- </entry>
- <entry>
- <long>6</long>
- <org.drools.workflow.core.node.ActionNode reference="12"/>
- </entry>
- <entry>
- <long>7</long>
- <org.drools.workflow.core.node.Join reference="19"/>
- </entry>
- <entry>
- <long>8</long>
- <org.drools.workflow.core.node.EndNode reference="49"/>
- </entry>
- </nodes>
- <lastNodeId>8</lastNodeId>
- </nodeContainer>
- <imports id="61">
- <string>java.util.List</string>
- </imports>
- <globals id="62">
- <entry>
- <string>inList</string>
- <string>List</string>
- </entry>
- <entry>
- <string>outList</string>
- <string>List</string>
- </entry>
- </globals>
- <id>ConstraintDialects</id>
- <name>ConstraintDialects</name>
- <type>RuleFlow</type>
- <packageName>org.drools.test</packageName>
- <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="63">
- <variables id="64"/>
- </variableScope>
-</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file
+ <constraint toNodeId="5" toType="DROOLS_DEFAULT" name="MVELCodeConstraint" priority="1" type="code" dialect="mvel" >return inList.contains( 1 );</constraint>
+ <constraint toNodeId="6" toType="DROOLS_DEFAULT" name="JavaCodeConstraint" priority="3" type="code" dialect="java" >return inList.contains( 3 );</constraint>
+ </constraints>
+ </split>
+ <action id="3" name="MVELRuleConstraintAction" dialect="mvel" >outList.add("MVELRuleConstraint was here");</action>
+ <action id="4" name="JavaRuleConstraintAction" dialect="java" >outList.add("JavaRuleConstraint was here");</action>
+ <action id="5" name="MVELCodeConstraintAction" dialect="mvel" >outList.add("MVELCodeConstraint was here");</action>
+ <action id="6" name="JavaCodeConstraintAction" dialect="java" >outList.add("JavaCodeConstraint was here");</action>
+ <join id="7" name="Join" type="1" />
+ <end id="8" name="End" />
+ </nodes>
+
+ <connections>
+ <connection from="1" to="2"/>
+ <connection from="2" to="3"/>
+ <connection from="2" to="4"/>
+ <connection from="2" to="5"/>
+ <connection from="2" to="6"/>
+ <connection from="3" to="7"/>
+ <connection from="4" to="7"/>
+ <connection from="5" to="7"/>
+ <connection from="6" to="7"/>
+ <connection from="7" to="8"/>
+ </connections>
+
+</process>
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rf
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rf 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rf 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,183 +0,0 @@
-<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
- <default>
- <elements id="2">
- <entry>
- <string>3-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper id="3" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="4">
- <x>151</x>
- <y>98</y>
- <width>80</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.RuleSetNode" id="5">
- <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
- <id>3</id>
- <name>flowgroup-1</name>
- <incomingConnections id="6">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="7">
- <org.drools.workflow.core.impl.ConnectionImpl id="8">
- <from class="org.drools.workflow.core.node.StartNode" id="9">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="10"/>
- <outgoingConnections id="11">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="12">
- <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" id="13">
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="14">
- <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
- <nodes id="15">
- <entry>
- <long>1</long>
- <org.drools.workflow.core.node.StartNode reference="9"/>
- </entry>
- <entry>
- <long>2</long>
- <org.drools.workflow.core.node.EndNode id="16">
- <id>2</id>
- <name>End</name>
- <incomingConnections id="17">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="18">
- <org.drools.workflow.core.impl.ConnectionImpl id="19">
- <from class="org.drools.workflow.core.node.RuleSetNode" reference="5"/>
- <to class="org.drools.workflow.core.node.EndNode" reference="16"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="20"/>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
- </org.drools.workflow.core.node.EndNode>
- </entry>
- <entry>
- <long>3</long>
- <org.drools.workflow.core.node.RuleSetNode reference="5"/>
- </entry>
- </nodes>
- <lastNodeId>3</lastNodeId>
- </nodeContainer>
- <id>ruleFlowClear</id>
- <name>test_ruleflowClear</name>
- <type>RuleFlow</type>
- <packageName>com.sample</packageName>
- <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="21">
- <variables id="22"/>
- </variableScope>
- </nodeContainer>
- </from>
- <to class="org.drools.workflow.core.node.RuleSetNode" reference="5"/>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="23">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="24">
- <org.drools.workflow.core.impl.ConnectionImpl reference="19"/>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
- </element>
- <incomingConnections id="25">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="26" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <bendpoints id="27"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="28" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="29">
- <x>32</x>
- <y>99</y>
- <width>80</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.StartNode" reference="9"/>
- <incomingConnections id="30"/>
- <outgoingConnections id="31">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="26"/>
- </outgoingConnections>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </source>
- <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="3"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection reference="8"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </incomingConnections>
- <outgoingConnections id="32">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="33" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <bendpoints id="34"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="3"/>
- <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" id="35" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="36">
- <x>260</x>
- <y>98</y>
- <width>80</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.workflow.core.node.EndNode" reference="16"/>
- <incomingConnections id="37">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="33"/>
- </incomingConnections>
- <outgoingConnections id="38"/>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </target>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection reference="19"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </outgoingConnections>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper>
- </entry>
- <entry>
- <string>2-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper reference="35"/>
- </entry>
- <entry>
- <string>1-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="28"/>
- </entry>
- </elements>
- <process class="org.drools.ruleflow.core.RuleFlowProcess" reference="13"/>
- <routerLayout>2</routerLayout>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
-</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,84 +1,21 @@
-<org.drools.ruleflow.core.RuleFlowProcess id="1">
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess$WorkflowProcessNodeContainer" id="2">
- <outer-class class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- <nodes id="3">
- <entry>
- <long>1</long>
- <org.drools.workflow.core.node.StartNode id="4">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="5"/>
- <outgoingConnections id="6">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="7">
- <org.drools.workflow.core.impl.ConnectionImpl id="8">
- <from class="org.drools.workflow.core.node.StartNode" reference="4"/>
- <to class="org.drools.workflow.core.node.RuleSetNode" id="9">
- <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
- <id>3</id>
- <name>flowgroup-1</name>
- <incomingConnections id="10">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="11">
- <org.drools.workflow.core.impl.ConnectionImpl reference="8"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="12">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="13">
- <org.drools.workflow.core.impl.ConnectionImpl id="14">
- <from class="org.drools.workflow.core.node.RuleSetNode" reference="9"/>
- <to class="org.drools.workflow.core.node.EndNode" id="15">
- <id>2</id>
- <name>End</name>
- <incomingConnections id="16">
- <entry>
- <string>DROOLS_DEFAULT</string>
- <list id="17">
- <org.drools.workflow.core.impl.ConnectionImpl reference="14"/>
- </list>
- </entry>
- </incomingConnections>
- <outgoingConnections id="18"/>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </to>
- <fromType>DROOLS_DEFAULT</fromType>
- <toType>DROOLS_DEFAULT</toType>
- </org.drools.workflow.core.impl.ConnectionImpl>
- </list>
- </entry>
- </outgoingConnections>
- <nodeContainer class="org.drools.ruleflow.core.RuleFlowProcess" reference="1"/>
- </org.drools.workflow.core.node.StartNode>
- </entry>
- <entry>
- <long>2</long>
- <org.drools.workflow.core.node.EndNode reference="15"/>
- </entry>
- <entry>
- <long>3</long>
- <org.drools.workflow.core.node.RuleSetNode reference="9"/>
- </entry>
- </nodes>
- <lastNodeId>3</lastNodeId>
- </nodeContainer>
- <id>ruleFlowClear</id>
- <name>test_ruleflowClear</name>
- <type>RuleFlow</type>
- <packageName>com.sample</packageName>
- <variableScope class="org.drools.process.core.impl.VariableScopeImpl" id="19">
- <variables id="20"/>
- </variableScope>
-</org.drools.ruleflow.core.RuleFlowProcess>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<process xmlns="http://drools.org/drools-4.0/process"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+ xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ type="RuleFlow" name="test_ruleflowClear" id="ruleFlowClear" package-name="com.sample" >
+
+ <header>
+ </header>
+
+ <nodes>
+ <start id="1" name="Start" />
+ <ruleSet id="2" name="RuleSet1" ruleFlowGroup="flowgroup-1" />
+ <end id="3" name="End" />
+ </nodes>
+
+ <connections>
+ <connection from="1" to="2"/>
+ <connection from="2" to="3"/>
+ </connections>
+
+</process>
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rf
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rf 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rf 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,154 +0,0 @@
-<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
- <default>
- <elements id="2">
- <entry>
- <string>2-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper id="3" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="4">
- <x>530</x>
- <y>111</y>
- <width>80</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.ruleflow.core.impl.EndNodeImpl" id="5">
- <id>2</id>
- <name>End</name>
- <incomingConnections id="6">
- <org.drools.ruleflow.core.impl.ConnectionImpl id="7">
- <type>1</type>
- <from class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" id="8">
- <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
- <id>3</id>
- <name>flowgroup-1</name>
- <incomingConnections id="9">
- <org.drools.ruleflow.core.impl.ConnectionImpl id="10">
- <type>1</type>
- <from class="org.drools.ruleflow.core.impl.StartNodeImpl" id="11">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="12"/>
- <outgoingConnections id="13">
- <org.drools.ruleflow.core.impl.ConnectionImpl reference="10"/>
- </outgoingConnections>
- </from>
- <to class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" reference="8"/>
- </org.drools.ruleflow.core.impl.ConnectionImpl>
- </incomingConnections>
- <outgoingConnections id="14">
- <org.drools.ruleflow.core.impl.ConnectionImpl reference="7"/>
- </outgoingConnections>
- </from>
- <to class="org.drools.ruleflow.core.impl.EndNodeImpl" reference="5"/>
- </org.drools.ruleflow.core.impl.ConnectionImpl>
- </incomingConnections>
- <outgoingConnections id="15"/>
- </element>
- <incomingConnections id="16">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="17" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <type>1</type>
- <bendpoints id="18"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" id="19" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="20">
- <x>297</x>
- <y>112</y>
- <width>80</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" reference="8"/>
- <incomingConnections id="21">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="22" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <default>
- <type>1</type>
- <bendpoints id="23"/>
- <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="24" serialization="custom">
- <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- <default>
- <constraint id="25">
- <x>100</x>
- <y>100</y>
- <width>80</width>
- <height>40</height>
- </constraint>
- <element class="org.drools.ruleflow.core.impl.StartNodeImpl" reference="11"/>
- <incomingConnections id="26"/>
- <outgoingConnections id="27">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="22"/>
- </outgoingConnections>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </source>
- <target class="org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper" reference="19"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="10"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </incomingConnections>
- <outgoingConnections id="28">
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="17"/>
- </outgoingConnections>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </source>
- <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" reference="3"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ElementConnection>
- <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- <default>
- <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="7"/>
- </default>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
- </incomingConnections>
- <outgoingConnections id="29"/>
- <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
- </default>
- </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
- </org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper>
- </entry>
- <entry>
- <string>3-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper reference="19"/>
- </entry>
- <entry>
- <string>1-Wrapper</string>
- <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="24"/>
- </entry>
- </elements>
- <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" id="30">
- <nodes id="31">
- <entry>
- <long>2</long>
- <org.drools.ruleflow.core.impl.EndNodeImpl reference="5"/>
- </entry>
- <entry>
- <long>1</long>
- <org.drools.ruleflow.core.impl.StartNodeImpl reference="11"/>
- </entry>
- <entry>
- <long>3</long>
- <org.drools.ruleflow.core.impl.RuleSetNodeImpl reference="8"/>
- </entry>
- </nodes>
- <variables id="32"/>
- <lastNodeId>3</lastNodeId>
- <id>ruleFlowClear</id>
- <name>test_ruleflowClear</name>
- <type>RuleFlow</type>
- </process>
- <routerLayout>2</routerLayout>
- </default>
- </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
-</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rfm 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear_old.rfm 2008-04-06 23:49:40 UTC (rev 19433)
@@ -1,54 +0,0 @@
-<org.drools.ruleflow.core.impl.RuleFlowProcessImpl id="1">
- <nodes id="2">
- <entry>
- <long>2</long>
- <org.drools.ruleflow.core.impl.EndNodeImpl id="3">
- <id>2</id>
- <name>End</name>
- <incomingConnections id="4">
- <org.drools.ruleflow.core.impl.ConnectionImpl id="5">
- <type>1</type>
- <from class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" id="6">
- <ruleFlowGroup>flowgroup-1</ruleFlowGroup>
- <id>3</id>
- <name>flowgroup-1</name>
- <incomingConnections id="7">
- <org.drools.ruleflow.core.impl.ConnectionImpl id="8">
- <type>1</type>
- <from class="org.drools.ruleflow.core.impl.StartNodeImpl" id="9">
- <id>1</id>
- <name>Start</name>
- <incomingConnections id="10"/>
- <outgoingConnections id="11">
- <org.drools.ruleflow.core.impl.ConnectionImpl reference="8"/>
- </outgoingConnections>
- </from>
- <to class="org.drools.ruleflow.core.impl.RuleSetNodeImpl" reference="6"/>
- </org.drools.ruleflow.core.impl.ConnectionImpl>
- </incomingConnections>
- <outgoingConnections id="12">
- <org.drools.ruleflow.core.impl.ConnectionImpl reference="5"/>
- </outgoingConnections>
- </from>
- <to class="org.drools.ruleflow.core.impl.EndNodeImpl" reference="3"/>
- </org.drools.ruleflow.core.impl.ConnectionImpl>
- </incomingConnections>
- <outgoingConnections id="13"/>
- </org.drools.ruleflow.core.impl.EndNodeImpl>
- </entry>
- <entry>
- <long>1</long>
- <org.drools.ruleflow.core.impl.StartNodeImpl reference="9"/>
- </entry>
- <entry>
- <long>3</long>
- <org.drools.ruleflow.core.impl.RuleSetNodeImpl reference="6"/>
- </entry>
- </nodes>
- <variables id="14"/>
- <lastNodeId>3</lastNodeId>
- <id>ruleFlowClear</id>
- <name>test_ruleflowClear</name>
- <type>RuleFlow</type>
- <packageName>com.sample</packageName>
-</org.drools.ruleflow.core.impl.RuleFlowProcessImpl>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlDslTest.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlDslTest.xml 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlDslTest.xml 2008-04-06 23:49:40 UTC (rev 19433)
@@ -15,19 +15,19 @@
</header>
<nodes>
- <start name="start node" />
+ <start id="1" name="start node" />
- <action name="action node" dialect="java">list.add( "action node was here" );</action>
+ <action id="2" name="action node" dialect="java">list.add( "action node was here" );</action>
- <mydsl:store name="store node">dsl was here</mydsl:store>
+ <mydsl:store id="3" name="store node">dsl was here</mydsl:store>
- <end name="end node" />
+ <end id="4" name="end node" />
</nodes>
<connections>
- <connection from="start node" to="action node" />
- <connection from="action node" to="store node" />
- <connection from="store node" to="end node" />
+ <connection from="1" to="2" />
+ <connection from="2" to="3" />
+ <connection from="3" to="4" />
</connections>
</process>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlTest.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlTest.xml 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlTest.xml 2008-04-06 23:49:40 UTC (rev 19433)
@@ -14,16 +14,16 @@
</header>
<nodes>
- <start name="start node" />
+ <start id="1" name="start node" />
- <action name="action node" dialect="java">list.add( "action node was here" );</action>
+ <action id="2" name="action node" dialect="java">list.add( "action node was here" );</action>
- <end name="end node" />
+ <end id="3" name="end node" />
</nodes>
<connections>
- <connection from="start node" to="action node" />
- <connection from="action node" to="end node" />
+ <connection from="1" to="2" />
+ <connection from="2" to="3" />
</connections>
</process>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml 2008-04-06 23:48:41 UTC (rev 19432)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml 2008-04-06 23:49:40 UTC (rev 19433)
@@ -13,19 +13,13 @@
</header>
<nodes>
- <start name="start node">
- </start>
-
- <action name="action node" dialect="java">
- list.add( "action node was here" );
- </action>
-
- <end name="end node">
- </end>
+ <start id="1" name="start node" />
+ <action id="2" name="action node" dialect="java">list.add( "action node was here" );</action>
+ <end id="3" name="end node" />
</nodes>
<connections>
- <connection from="start node" to="action node" />
- <connection from="action node" to="end node" />
+ <connection from="1" to="2" />
+ <connection from="2" to="3" />
</connections>
</process>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list