[jbpm-commits] JBoss JBPM SVN: r6154 - in jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn: parser and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Feb 2 07:00:19 EST 2010
Author: jbarrez
Date: 2010-02-02 07:00:18 -0500 (Tue, 02 Feb 2010)
New Revision: 6154
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/SubProcessActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
Log:
JBPM-2740: added parallel test case +impl
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2010-02-01 21:48:29 UTC (rev 6153)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2010-02-02 12:00:18 UTC (rev 6154)
@@ -70,7 +70,7 @@
*/
protected void proceed(ExecutionImpl execution, List<Transition> transitions) {
if (LOG.isDebugEnabled()) {
- LOG.debug("Proceeding from execution " + execution.getActivityName());
+ LOG.debug("Proceeding from execution in " + execution.getActivityName());
}
Activity activity = execution.getActivity();
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/SubProcessActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/SubProcessActivity.java 2010-02-01 21:48:29 UTC (rev 6153)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/SubProcessActivity.java 2010-02-02 12:00:18 UTC (rev 6154)
@@ -29,6 +29,9 @@
import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.model.Activity;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
/**
@@ -38,26 +41,18 @@
public class SubProcessActivity extends BpmnExternalActivity {
private static final long serialVersionUID = 1L;
+
+ private static final Log LOG = Log.getLog(SubProcessActivity.class.getName());
public void execute(ExecutionImpl execution) {
List<Activity> startActivities = findStartActivities(execution);
- if (startActivities.size() == 1) {
-
- execution.execute(startActivities.get(0));
-
- } else if (startActivities.size() > 1) {
-
- ExecutionImpl concurrentRoot = null;
- if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
- concurrentRoot = execution;
- } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
- concurrentRoot = execution.getParent();
- } else {
- throw new JbpmException("illegal state for execution :" + execution.getState());
- }
-
+
+ if (!startActivities.isEmpty()) {
+ ExecutionImpl parent = execution.createScope(execution.getActivity());
+
for (Activity startActivity: startActivities) {
- ExecutionImpl concurrentExecution = concurrentRoot.createExecution();
+ parent.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
+ ExecutionImpl concurrentExecution = parent.createExecution();
concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
concurrentExecution.execute(startActivity);
}
@@ -84,9 +79,32 @@
return startActivities;
}
- public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
- ExecutionImpl executionImpl = (ExecutionImpl) execution;
- proceed(executionImpl, findOutgoingSequenceFlow(executionImpl, CONDITIONS_CHECKED));
+ public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
+ ActivityImpl activity = (ActivityImpl) execution.getActivity();
+
+ ExecutionImpl scopedExecution = (ExecutionImpl) execution.getParent();
+
+ // If there are still active paths in the sub-process
+ if ( (scopedExecution.getExecutions() != null)
+ && (scopedExecution.getExecutions().size() > 1) ) { // not > 0 -> current execution is still a child
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Scoped execution " + scopedExecution.getId() + " has active child executions." +
+ "Ending current execution, but scoped execution is not yet continued");
+ }
+ execution.end();
+
+ // If no other paths are active in the sub-process
+ } else {
+
+ ExecutionImpl parent = scopedExecution.destroyScope(activity); // child execution will be ended automatically when parent ends
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Scoped execution " + scopedExecution.getId() + " has no active child executions." +
+ "Destroying scope and proceeding from parent execution " + parent.getId());
+ }
+ proceed(parent, findOutgoingSequenceFlow(parent, CONDITIONS_CHECKED));
+
+ }
}
}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2010-02-01 21:48:29 UTC (rev 6153)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2010-02-02 12:00:18 UTC (rev 6154)
@@ -257,7 +257,7 @@
// Parse attributes
String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
- String transitionId = XmlUtil.attribute(transitionElement, "id", false, parse);
+ String transitionId = XmlUtil.attribute(transitionElement, "id", true, parse);
String sourceRef = XmlUtil.attribute(transitionElement, "sourceRef", true, parse);
String targetRef = XmlUtil.attribute(transitionElement, "targetRef", true, parse);
More information about the jbpm-commits
mailing list