Index: modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeobject/SubProcessOutcomeObjectTest.java
===================================================================
--- modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeobject/SubProcessOutcomeObjectTest.java (revision 0)
+++ modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeobject/SubProcessOutcomeObjectTest.java (revision 0)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.subprocess.outcomeobject;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.collections.map.HashedMap;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessOutcomeObjectTest extends JbpmTestCase {
+
+ String subProcessReviewDeploymentId;
+ String subProcessDocumentDeploymentId;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ subProcessReviewDeploymentId = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/subprocess/outcomeobject/SubProcessReview.jpdl.xml")
+ .deploy();
+
+ subProcessDocumentDeploymentId = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/subprocess/outcomeobject/SubProcessDocument.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(subProcessReviewDeploymentId);
+ repositoryService.deleteDeploymentCascade(subProcessDocumentDeploymentId);
+
+ super.tearDown();
+ }
+
+ public void testSubProcessResultOk() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List taskList = taskService.findPersonalTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the result variable is set in the task
+ Map variables = new HashMap();
+ variables.put("result", 100);
+ taskService.setVariables(task.getId(), variables);
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getId());
+
+ // we check that the process instance has moved to the next step
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("next step"));
+ }
+
+ public void testSubProcessResultNok() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List taskList = taskService.findPersonalTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the result variable is set in the task
+ Map variables = new HashMap();
+ variables.put("result", 200);
+ taskService.setVariables(task.getId(), variables);
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getId());
+
+ // we check that the process instance has moved to update
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("update"));
+ }
+
+ public void testSubProcessResultReject() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List taskList = taskService.findPersonalTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the result variable is set in the task
+ Map variables = new HashMap();
+ variables.put("result", 300);
+ taskService.setVariables(task.getId(), variables);
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getId());
+
+ // we check that the process instance has moved to close
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("close"));
+ }
+}
Index: modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml
===================================================================
--- modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml (revision 6367)
+++ modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml (working copy)
@@ -1,22 +1,20 @@
+
-
-
-
-
-
-
+
+
+
+
-
+ assignee="johndoe"
+ g="107,97,127,52">
+
-
-
+
+
-
-
+
\ No newline at end of file
Index: modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessDocument.jpdl.xml
===================================================================
--- modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessDocument.jpdl.xml (revision 0)
+++ modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessDocument.jpdl.xml (revision 0)
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessReview.jpdl.xml
===================================================================
--- modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessReview.jpdl.xml (revision 0)
+++ modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessReview.jpdl.xml (revision 0)
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml
===================================================================
--- modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml (revision 6367)
+++ modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml (working copy)
@@ -1,18 +1,17 @@
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+ assignee="johndoe"
+ g="96,16,127,52">
+
+
+
+
+
+
\ No newline at end of file
Index: modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml
===================================================================
--- modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml (revision 6367)
+++ modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml (working copy)
@@ -1,18 +1,17 @@
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+ assignee="johndoe"
+ g="96,16,127,52">
+
+
+
+
+
+
\ No newline at end of file
Index: modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
===================================================================
--- modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java (revision 6367)
+++ modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java (working copy)
@@ -1,164 +1,165 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.el.Expression;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.xml.WireParser;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SubProcessBinding extends JpdlBinding {
-
- public SubProcessBinding() {
- super("sub-process");
- }
-
- public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
- SubProcessActivity subProcessActivity = new SubProcessActivity();
-
- String subProcessKey = XmlUtil.attribute(element, "sub-process-key");
- subProcessActivity.setSubProcessKey(subProcessKey);
-
- String subProcessId = XmlUtil.attribute(element, "sub-process-id");
- subProcessActivity.setSubProcessId(subProcessId);
-
- List inParameters = new ArrayList();
- for (Element inElement: XmlUtil.elements(element, "parameter-in")) {
- SubProcessInParameterImpl inParameter = new SubProcessInParameterImpl();
- parseParameter(inElement, inParameter);
- inParameters.add(inParameter);
-
- if (inParameter.getSubVariableName()==null) {
- parse.addProblem("no 'subvar' specified for parameter-in", element);
- }
- if ( (inParameter.getExpression()==null)
- && (inParameter.getVariableName()==null)
- ) {
- parse.addProblem("no 'expr' or 'variable' specified for parameter-in '"+inParameter.getSubVariableName()+"'", element);
- }
- if ( (inParameter.getExpression()!=null)
- && (inParameter.getVariableName()!=null)
- ) {
- parse.addProblem("attributes 'expr' and 'variable' are mutually exclusive on parameter-in", element);
- }
- }
- subProcessActivity.setInParameters(inParameters);
-
- List outParameters = new ArrayList();
- for (Element outElement: XmlUtil.elements(element, "parameter-out")) {
- SubProcessOutParameterImpl outParameter = new SubProcessOutParameterImpl();
- parseParameter(outElement, outParameter);
- outParameters.add(outParameter);
-
- if (outParameter.getVariableName()==null) {
- parse.addProblem("no 'variable' specified for parameter-in", element);
- }
- if ( (outParameter.getExpression()==null)
- && (outParameter.getSubVariableName()==null)
- ) {
- parse.addProblem("no 'expr' or 'subvar' specified for parameter-out '"+outParameter.getVariableName()+"'", element);
- }
- if ( (outParameter.getExpression()!=null)
- && (outParameter.getSubVariableName()!=null)
- ) {
- parse.addProblem("attributes 'expr' and 'subvar' are mutually exclusive on parameter-out '"+outParameter.getVariableName()+"'", element);
- }
- }
- subProcessActivity.setOutParameters(outParameters);
-
- Map swimlaneMappings = parseSwimlaneMappings(element, parse);
- subProcessActivity.setSwimlaneMappings(swimlaneMappings);
-
- Map