[jbpm-commits] JBoss JBPM SVN: r5428 - in jbpm4/trunk/modules/bpmn/src: main/java/org/jbpm/bpmn/model and 6 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Aug 4 19:31:40 EDT 2009
Author: kukeltje
Date: 2009-08-04 19:31:39 -0400 (Tue, 04 Aug 2009)
New Revision: 5428
Added:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ActivityResource.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/Resource.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ResourceParameter.java
jbpm4/trunk/modules/bpmn/src/main/resources/META-INF/
jbpm4/trunk/modules/bpmn/src/main/resources/META-INF/services/
jbpm4/trunk/modules/bpmn/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskGroup.bpmn.xml
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSequenceFlowCondition.bpmn.xml
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlowCondition.bpmn.xml
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/scriptTask.bpmn.xml
Log:
- Initial Resources
- Group assignment
- conditionExpression on userTask (uncontrolled flow)
- user jbpm_outcome as condition on userTask
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java 2009-08-04 21:29:31 UTC (rev 5427)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractTaskBinding.java 2009-08-04 23:31:39 UTC (rev 5428)
@@ -1,20 +1,28 @@
package org.jbpm.bpmn.flownodes;
+import java.util.List;
+
+import org.jbpm.bpmn.model.BpmnProcessDefinition;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
/**
- * The AbstractTask is the task superclass and doesn't define own
- * Behavior.
+ * The AbstractTask is the task superclass and doesn't define own Behavior.
*
- * Spec: A Task which is not further specified is called Abstract
- * Task (this was referred to as the None Task in BPMN 1.2).
+ * Spec: A Task which is not further specified is called Abstract Task (this was
+ * referred to as the None Task in BPMN 1.2).
*
* @author bernd.ruecker at camunda.com
*/
public class AbstractTaskBinding extends BpmnBinding {
+ protected static final String HUMAN_PERFORMER = "humanPerformer";
+ protected static final String PERFORMER = "performer";
+ protected static final String POTENTIAL_OWNER = "potentialOwner";
+
public AbstractTaskBinding(String tagName) {
super(tagName);
}
@@ -23,5 +31,53 @@
return new ManualTaskActivity();
}
+ protected void addActivityResources(TaskDefinitionImpl taskDefinition, BpmnActivity taskActivity, Element element, Parse parse) {
+ Element performer = XmlUtil.element(element, PERFORMER, false, parse);
+ if (performer != null) {
+ taskActivity.addActivityResource(addPerformer(taskDefinition, PERFORMER, performer, parse));
+ }
+ // Overrides 'performer'
+ Element humanPerformer = XmlUtil.element(element, HUMAN_PERFORMER, false, parse);
+ if (humanPerformer != null) {
+ taskActivity.addActivityResource(addPerformer(taskDefinition, HUMAN_PERFORMER, humanPerformer, parse));
+ }
+
+ List<Element> potentialOwners = XmlUtil.elements(element, "potentialOwner");
+ for (Element potentialOwner : potentialOwners) {
+ taskActivity.addActivityResource(addPerformer(taskDefinition, POTENTIAL_OWNER, potentialOwner, parse));
+ }
+ }
+
+ private ActivityResource addPerformer(TaskDefinitionImpl taskDefinition, String type, Element performer, Parse parse) {
+
+ String resourceRef = XmlUtil.attribute(performer, "resourceRef", true, parse);
+
+ BpmnProcessDefinition bpmnProcessDefinition = parse.findObject(BpmnProcessDefinition.class);
+
+ ActivityResource activityResource = new ActivityResource();
+ activityResource.setResourceRef(bpmnProcessDefinition.getResource(resourceRef));
+
+ String scope = XmlUtil.attribute(performer, "type", false, parse);
+
+ Element rae = XmlUtil.element(performer, "resourceAssignmentExpression", false, parse);
+ if (rae != null) {
+ String formalExpression = XmlUtil.element(rae, "formalExpression", true, parse).getTextContent().trim();
+ String lang = XmlUtil.attribute(rae, "language", false, parse);
+ if (PERFORMER.equals(type) || HUMAN_PERFORMER.equals(type)) {
+ taskDefinition.setAssigneeExpression(formalExpression);
+ taskDefinition.setAssigneeExpressionLanguage(lang);
+ } else if (POTENTIAL_OWNER.equals(type) && "group".equals(scope)) {
+ taskDefinition.setCandidateGroupsExpression(formalExpression);
+ taskDefinition.setCandidateGroupsExpressionLanguage(lang);
+ } else {
+ taskDefinition.setCandidateUsersExpression(formalExpression);
+ taskDefinition.setCandidateUsersExpressionLanguage(lang);
+ }
+ }
+
+ return activityResource;
+
+ }
+
}
\ No newline at end of file
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ActivityResource.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ActivityResource.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ActivityResource.java 2009-08-04 23:31:39 UTC (rev 5428)
@@ -0,0 +1,36 @@
+package org.jbpm.bpmn.flownodes;
+
+import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
+
+public class ActivityResource {
+
+ String id;
+ Resource resourceRef;
+ ExpressionEvaluatorDescriptor resourceAssignmentExpression;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public Resource getResourceRef() {
+ return resourceRef;
+ }
+
+ public void setResourceRef(Resource resourceRef) {
+ this.resourceRef = resourceRef;
+ }
+
+
+ public ExpressionEvaluatorDescriptor getResourceAssignmentExpression() {
+ return resourceAssignmentExpression;
+ }
+
+ public void setResourceAssignmentExpression(ExpressionEvaluatorDescriptor resourceAssignmentExpression) {
+ this.resourceAssignmentExpression = resourceAssignmentExpression;
+ }
+
+}
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 2009-08-04 21:29:31 UTC (rev 5427)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2009-08-04 23:31:39 UTC (rev 5428)
@@ -24,8 +24,6 @@
import java.util.ArrayList;
import java.util.List;
-import javax.xml.xpath.XPathFactory;
-
import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityBehaviour;
@@ -35,6 +33,7 @@
import org.jbpm.pvm.internal.model.Condition;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.Transition;
+import org.jbpm.pvm.internal.model.TransitionImpl;
/**
* Basic activity for BPMN activities (tasks, gateways and event)
@@ -53,9 +52,9 @@
private static final boolean CONDITIONS_CHECKED = true;
private static final boolean CONDITIONS_IGNORED = !CONDITIONS_CHECKED;
- private final XPathFactory xpathFactory = XPathFactory.newInstance();
+ //protected String default_;
+ protected List<ActivityResource> activvityResources = new ArrayList();
-
protected void leaveBpmnActivity(ExecutionImpl execution) {
proceedForkedIfAllowed(execution, FORK_ALLOWED, CONDITIONS_CHECKED, null);
@@ -81,9 +80,6 @@
private void proceedForkedIfAllowed(ExecutionImpl execution, boolean forkAllowed, boolean checkConditions, String default_) {
log.debug("Proceeding");
Activity activity = execution.getActivity();
-
-// xpathFactory.setXPathFunctionResolver(new BpmnFunctionResolver());
-// xpath
// evaluate the conditions and find the transitions that should be forked
List<Transition> forkingTransitions = new ArrayList<Transition>();
@@ -165,4 +161,18 @@
return forkingTransitions;
}
+
+// public String getDefault_ () {
+// return this.default_;
+// }
+//
+// public void setDefault_ (String default_) {
+// this.default_ = default_;
+// }
+
+ public void addActivityResource(ActivityResource activityResource) {
+ this.activvityResources.add(activityResource);
+ }
+
+
}
\ No newline at end of file
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/Resource.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/Resource.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/Resource.java 2009-08-04 23:31:39 UTC (rev 5428)
@@ -0,0 +1,35 @@
+package org.jbpm.bpmn.flownodes;
+
+import java.util.Map;
+
+public class Resource {
+
+ String id;
+ String name;
+ Map<String, ResourceParameter> parameters;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Map<String, ResourceParameter> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map<String, ResourceParameter> parameters) {
+ this.parameters = parameters;
+ }
+
+}
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ResourceParameter.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ResourceParameter.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ResourceParameter.java 2009-08-04 23:31:39 UTC (rev 5428)
@@ -0,0 +1,37 @@
+package org.jbpm.bpmn.flownodes;
+
+import javax.xml.namespace.QName;
+
+import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
+
+
+public class ResourceParameter extends VariableDefinitionImpl {
+
+ String id;
+ QName type;
+ boolean required;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public QName getType() {
+ return type;
+ }
+
+ public void setType(QName type) {
+ this.type = type;
+ }
+
+ public boolean isRequired() {
+ return required;
+ }
+
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java 2009-08-04 21:29:31 UTC (rev 5427)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java 2009-08-04 23:31:39 UTC (rev 5428)
@@ -32,7 +32,9 @@
import org.jbpm.pvm.internal.history.HistoryEvent;
import org.jbpm.pvm.internal.history.events.TaskActivityStart;
import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.Condition;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ExpressionEvaluator;
import org.jbpm.pvm.internal.model.Transition;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.task.ParticipationImpl;
@@ -40,21 +42,22 @@
import org.jbpm.pvm.internal.task.SwimlaneImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
-
/**
* @author Tom Baeyens
*/
public class UserTaskActivity extends BpmnExternalActivity {
private static final long serialVersionUID = 1L;
-
+
private static final Log log = Log.getLog(UserTaskActivity.class.getName());
protected TaskDefinitionImpl taskDefinition;
-
+
public void execute(ActivityExecution execution) {
- execute((ExecutionImpl)execution);
+ execute((ExecutionImpl) execution);
}
public void execute(ExecutionImpl execution) {
@@ -64,9 +67,16 @@
task.setExecution(execution);
task.setProcessInstance(execution.getProcessInstance());
task.setSignalling(true);
-
+
+ if (taskDefinition.getAssigneeExpression() != null) {
+ ExpressionEvaluatorDescriptor eed = new ExpressionEvaluatorDescriptor(taskDefinition.getAssigneeExpression(), taskDefinition
+ .getAssigneeExpressionLanguage());
+ ExpressionEvaluator ee = (ExpressionEvaluator) WireContext.create(eed);
+ task.setAssignee((String) ee.evaluateExpression(execution));
+ }
+
// initialize the name
- if (taskDefinition.getName()!=null) {
+ if (taskDefinition.getName() != null) {
task.setName(taskDefinition.getName());
} else {
task.setName(execution.getActivityName());
@@ -75,71 +85,49 @@
task.setDescription(taskDefinition.getDescription());
task.setPriority(taskDefinition.getPriority());
task.setFormResourceName(taskDefinition.getFormResourceName());
-
- // save task so that TaskDbSession.findTaskByExecution works for assign event listeners
+
+ // save task so that TaskDbSession.findTaskByExecution works for assign
+ // event listeners
dbSession.save(task);
- SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
- if (swimlaneDefinition!=null) {
- SwimlaneImpl swimlane = execution.getInitializedSwimlane(swimlaneDefinition);
- task.setSwimlane(swimlane);
-
- // copy the swimlane assignments to the task
- task.setAssignee(swimlane.getAssignee());
- for (ParticipationImpl participant: swimlane.getParticipations()) {
- task.addParticipation(participant.getUserId(), participant.getGroupId(), participant.getType());
- }
- }
+// SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
+// if (swimlaneDefinition != null) {
+// SwimlaneImpl swimlane = execution.getInitializedSwimlane(swimlaneDefinition);
+// task.setSwimlane(swimlane);
+//
+// // copy the swimlane assignments to the task
+// task.setAssignee(swimlane.getAssignee());
+// for (ParticipationImpl participant : swimlane.getParticipations()) {
+// task.addParticipation(participant.getUserId(), participant.getGroupId(), participant.getType());
+// }
+// }
execution.initializeAssignments(taskDefinition, task);
-
+
HistoryEvent.fire(new TaskActivityStart(task), execution);
execution.waitForSignal();
}
-
- public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
- signal((ExecutionImpl)execution, signalName, parameters);
+ public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
+ signal((ExecutionImpl) execution, signalName, parameters);
}
- public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
+ public void signal(ExecutionImpl execution, String signalName, Map<String, ? > parameters) throws Exception {
Activity activity = execution.getActivity();
-
- if (parameters!=null) {
+
+ if (parameters != null) {
execution.setVariables(parameters);
}
-
+
execution.fire(signalName, activity);
- DbSession taskDbSession = Environment
- .getFromCurrent(DbSession.class);
+ DbSession taskDbSession = Environment.getFromCurrent(DbSession.class);
TaskImpl task = (TaskImpl) taskDbSession.findTaskByExecution(execution);
task.setSignalling(false);
+
+ execution.setVariable("jbpm_outcome", signalName);
+ leaveBpmnActivity(execution);
- Transition transition = null;
- List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
- if ( (outgoingTransitions!=null)
- && (!outgoingTransitions.isEmpty())
- ) {
- transition = activity.findOutgoingTransition(signalName);
- if (transition==null) {
- if (Task.STATE_COMPLETED.equals(signalName)) {
- if (outgoingTransitions.size()==1) {
- transition = outgoingTransitions.get(0);
- } else {
- transition = activity.getDefaultOutgoingTransition();
- }
- } else {
- // if a user specified outcome was provided and it doesn't
- // match with an outgoing transition name, then an exception is
- // thrown since this is likely a programmatic error.
- throw new JbpmException("No outcome named '" + signalName + "' was found.");
- }
- }
- if (transition!=null) {
- execution.take(transition);
- }
- }
}
public TaskDefinitionImpl getTaskDefinition() {
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java 2009-08-04 21:29:31 UTC (rev 5427)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java 2009-08-04 23:31:39 UTC (rev 5428)
@@ -21,15 +21,20 @@
*/
package org.jbpm.bpmn.flownodes;
+import java.util.List;
+
+import org.jbpm.bpmn.model.BpmnProcessDefinition;
import org.jbpm.bpmn.parser.BpmnParser;
import org.jbpm.pvm.internal.model.ScopeElementImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
/**
* @author Tom Baeyens
+ * @author Ronald van Kuijk (kukeltje)
*/
public class UserTaskBinding extends AbstractTaskBinding {
@@ -44,8 +49,21 @@
ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
TaskDefinitionImpl taskDefinition = BpmnParser.parseTaskDefinition(element, parse, scopeElement);
+
+ BpmnProcessDefinition bpmnProcessDefinition = parse.findObject(BpmnProcessDefinition.class);
+
+ //bpmnProcessDefinition.getResource(ref)
+ addActivityResources(taskDefinition, taskActivity, element, parse);
+
+ Element rendering = XmlUtil.element(element, "rendering", false, parse);
+ if (rendering != null) {
+ Element jBPMForm = XmlUtil.element(rendering, "form", false, parse);
+ taskDefinition.setFormResourceName(jBPMForm != null ? jBPMForm.getTextContent().trim() : null);
+ }
+
taskActivity.setTaskDefinition(taskDefinition);
return taskActivity;
}
+
}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java 2009-08-04 21:29:31 UTC (rev 5427)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java 2009-08-04 23:31:39 UTC (rev 5428)
@@ -26,6 +26,7 @@
import java.util.List;
import java.util.Map;
+import org.jbpm.bpmn.flownodes.Resource;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
@@ -34,38 +35,42 @@
public class BpmnProcessDefinition extends ProcessDefinitionImpl {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- Map<String, TaskDefinitionImpl> taskDefinitions = new HashMap<String, TaskDefinitionImpl>();
- List<VariableDefinitionImpl> processVariableDefinitions = new ArrayList<VariableDefinitionImpl>();
- Map<String, Element> messages = new HashMap<String, Element>();
- Map<String, String> itemDefinitions = new HashMap<String, String>();
- Map<String, Element> interfaces = new HashMap<String, Element>();
- Map<String, String> resources = new HashMap<String, String>();
+ Map<String, TaskDefinitionImpl> taskDefinitions = new HashMap<String, TaskDefinitionImpl>();
+ List<VariableDefinitionImpl> processVariableDefinitions = new ArrayList<VariableDefinitionImpl>();
+ Map<String, Element> messages = new HashMap<String, Element>();
+ Map<String, String> itemDefinitions = new HashMap<String, String>();
+ Map<String, Element> interfaces = new HashMap<String, Element>();
+ Map<String, Resource> resources = new HashMap<String, Resource>();
- protected ExecutionImpl newProcessInstance() {
- return new ExecutionImpl();
- }
+ protected ExecutionImpl newProcessInstance() {
+ return new ExecutionImpl();
+ }
- public TaskDefinitionImpl createTaskDefinition(String name) {
- TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
- taskDefinitions.put(name, taskDefinition);
- return taskDefinition;
- }
+ public TaskDefinitionImpl createTaskDefinition(String name) {
+ TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+ taskDefinitions.put(name, taskDefinition);
+ return taskDefinition;
+ }
- public Map<String, TaskDefinitionImpl> getTaskDefinitions() {
- return taskDefinitions;
- }
+ public Map<String, TaskDefinitionImpl> getTaskDefinitions() {
+ return taskDefinitions;
+ }
- public String getType(String typeRef) {
- return itemDefinitions.get(typeRef);
- }
+ public String getType(String typeRef) {
+ return itemDefinitions.get(typeRef);
+ }
- public void setVariableDefinition(List<VariableDefinitionImpl> variableDefinitions) {
- this.processVariableDefinitions = variableDefinitions;
- }
+ public void setVariableDefinition(List<VariableDefinitionImpl> variableDefinitions) {
+ this.processVariableDefinitions = variableDefinitions;
+ }
- public String getResource(String ref) {
- return resources.get(ref);
- }
+ public Resource getResource(String ref) {
+ return resources.get(ref);
+ }
+
+ public Map<String, Resource> getResources() {
+ return resources;
+ }
}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-08-04 21:29:31 UTC (rev 5427)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-08-04 23:31:39 UTC (rev 5428)
@@ -26,11 +26,20 @@
import java.util.Enumeration;
import java.util.List;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.dom4j.DocumentFactory;
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.bpmn.flownodes.BpmnBinding;
+import org.jbpm.bpmn.flownodes.ExclusiveGatewayActivity;
+import org.jbpm.bpmn.flownodes.Resource;
+import org.jbpm.bpmn.flownodes.ResourceParameter;
import org.jbpm.bpmn.model.BpmnProcessDefinition;
-import org.jbpm.internal.log.Log; //import org.jbpm.jpdl.internal.activity.JpdlBinding;
-//import org.jbpm.jpdl.internal.xml.BindingsParser;
+
+import org.jbpm.internal.log.Log;
+
+import org.jbpm.pvm.internal.model.Activity;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.CompositeElementImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
@@ -49,6 +58,7 @@
import org.jbpm.pvm.internal.xml.Bindings;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
@@ -111,6 +121,9 @@
processDefinition.setDescription(description);
}
+ // TODO: hack, should be done in a different way
+ parseResources(processElement, parse, processDefinition);
+
parseDataObjects(processElement, parse, processDefinition);
// activities
@@ -211,22 +224,30 @@
log.trace(transitionId + ": " + sourceRef + " -> " + targetRef);
Element conditionElement = XmlUtil.element(transitionElement, "conditionExpression");
log.trace(" with " + ((conditionElement == null) ? "0" : "1") + " conditionExpression");
-
+
TransitionImpl transition = compositeElement.findActivity(sourceRef).createOutgoingTransition();
-
+// Activity a = compositeElement.findActivity(sourceRef);
+// if (a.getType().equals("exclusiveGateway")) {
+// if (transitionId.equals(((ExclusiveGatewayActivity) a).getDefault())) {
+// compositeElement.findActivity(sourceRef).setDefaultOutgoingTransition(transition);
+// }
+// }
+
// 8.2.5 of the spec document
if (conditionElement != null) {
String type = conditionElement.getAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "type");
if ("bpmn:tFormalExpression".equals(type)) {
-
+
String expr = conditionElement.getTextContent();
String lang = XmlUtil.attribute(conditionElement, "language");
- // TODO: add looking up the default language in the document if lang is null.
+ // TODO: add looking up the default language in the document if lang
+ // is null.
ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
transition.setConditionDescriptor(expressionDescriptor);
-
+
} else {
- parse.addProblem("Type of the conditionExpression on sequenceFlow with id=" + transitionId + " is of onsupported type 'bpmn:tExpression'", transitionElement);
+ parse.addProblem("Type of the conditionExpression on sequenceFlow with id=" + transitionId + " is of onsupported type 'bpmn:tExpression'",
+ transitionElement);
}
}
@@ -241,7 +262,7 @@
parseItemDefinitions(documentElement, parse);
parseMessages(documentElement, parse);
parseInterfaces(documentElement, parse);
- parseResources(documentElement, parse);
+ // parseResources(documentElement, parse);
}
// public static void parseAssignmentAttributes(Element element,
@@ -304,13 +325,37 @@
if (potentialOwner != null) {
String potentialOwnerRef = XmlUtil.attribute(potentialOwner, "resourceRef");
// set to fixed expression, more evaluation needed for real BPMN 2.0
- taskDefinition.setCandidateGroupsExpression(processDefinition.getResource(potentialOwnerRef));
+ // taskDefinition.setCandidateGroupsExpression(processDefinition.getResource(potentialOwnerRef));
}
return taskDefinition;
}
- private void parseResources(Element documentElement, Parse parse) {
+ // private void parseDataObjects(Element element, Parse parse,
+ // BpmnProcessDefinition processDefinition) {
+ private void parseResources(Element documentElement, Parse parse, BpmnProcessDefinition processDefinition) {
+ List<Resource> resources = new ArrayList<Resource>();
+
+ for (Element resourceElement : XmlUtil.elements(documentElement, "resource")) {
+
+ Resource resource = new Resource();
+
+ resource.setId(XmlUtil.attribute(resourceElement, "id"));
+ resource.setName(XmlUtil.attribute(resourceElement, "name"));
+
+ for (Element resourceParameterElement : XmlUtil.elements(documentElement, "resourceParameter")) {
+
+ ResourceParameter resourceParameter = new ResourceParameter();
+ resourceParameter.setId(XmlUtil.attribute(resourceParameterElement, "id"));
+ resourceParameter.setName(XmlUtil.attribute(resourceParameterElement, "name"));
+ resourceParameter.setType(QName.valueOf(XmlUtil.attribute(resourceParameterElement, "name")));
+
+ resource.getParameters().put(XmlUtil.attribute(resourceParameterElement, "name"), resourceParameter);
+ }
+
+ processDefinition.getResources().put(resource.getName(), resource);
+ }
+
}
private void parseInterfaces(Element documentElement, Parse parse) {
Added: jbpm4/trunk/modules/bpmn/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory 2009-08-04 23:31:39 UTC (rev 5428)
@@ -0,0 +1 @@
+com.sun.script.xpath.XPathScriptEngineFactory
\ No newline at end of file
Modified: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java 2009-08-04 21:29:31 UTC (rev 5427)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java 2009-08-04 23:31:39 UTC (rev 5428)
@@ -21,7 +21,9 @@
*/
package org.jbpm.bpmn.flownodes;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.TaskQuery;
@@ -38,99 +40,213 @@
*/
public class UserTaskTest extends JbpmTestCase {
- static BpmnParser bpmnParser = new BpmnParser();
+ static BpmnParser bpmnParser = new BpmnParser();
- public void testParsing() {
- Parse parse = bpmnParser.createParse().setResource("org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml").execute();
+ public void testParsing() {
+ Parse parse = bpmnParser.createParse().setResource("org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml").execute();
- if (!parse.getProblems().isEmpty()) {
- fail("No problems should have occured. Problems: " + parse.getProblems());
- }
+ if (!parse.getProblems().isEmpty()) {
+ fail("No problems should have occured. Problems: " + parse.getProblems());
+ }
- List<BpmnProcessDefinition> processDefinitions = (List<BpmnProcessDefinition>) parse.getDocumentObject();
+ List<BpmnProcessDefinition> processDefinitions = (List<BpmnProcessDefinition>) parse.getDocumentObject();
- assertEquals(1, processDefinitions.size());
+ assertEquals(1, processDefinitions.size());
- BpmnProcessDefinition pd = processDefinitions.get(0);
- assertNotNull(pd);
- assertEquals("UserTaskSimpleProcess", pd.getKey());
+ BpmnProcessDefinition pd = processDefinitions.get(0);
+ assertNotNull(pd);
+ assertEquals("UserTaskSimpleProcess", pd.getKey());
+ }
+
+ public void testNormalUserAssignment() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml").deploy();
+
+ try {
+ Map variables = new HashMap();
+ variables.put("assignedUser", "User1");
+ ProcessInstance pi = executionService.startProcessInstanceByKey("UserTaskSimpleProcess", variables);
+ assertEquals("UserTask", ((ExecutionImpl) pi).getActivityName());
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+ assertEquals(1, allTasks.size());
+ assertEquals("UserTask", allTasks.get(0).getActivityName());
+ assertEquals("User1", allTasks.get(0).getAssignee());
+ assertEquals("MyForm.ftl", allTasks.get(0).getFormResourceName());
+
+ // speciifiing a transition is unnecessary, BPMN has outgoing AND
+ // semantic!
+ // TODO: fix
+ taskService.completeTask(allTasks.get(0).getId(), "flow2");
+
+ assertEquals(0, taskQuery.list().size());
+
+ // process instance is ended
+ pi = executionService.findProcessInstanceById(pi.getId());
+ // One way or another I would also expect this to work... pi is gone from
+ // database immediately when ended. Only in History DB
+ // assertEquals(true, pi.isEnded());
+ assertNull(pi);
+ } finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
}
+ }
- public void testNormal() {
- String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml").deploy();
+ public void testNormalGroupAssignment() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/UserTaskGroup.bpmn.xml").deploy();
- try {
- ProcessInstance pi = executionService.startProcessInstanceByKey("UserTaskSimpleProcess");
- assertEquals("UserTask", ((ExecutionImpl)pi).getActivityName());
-
- TaskQuery taskQuery = taskService.createTaskQuery();
- List<Task> allTasks = taskQuery.list();
- assertEquals(1, allTasks.size());
- assertEquals("UserTask", allTasks.get(0).getActivityName());
-// assertEquals("UserTask", allTasks.get(0));
-//
-//
-// List<Task> groupTasks = taskService.findGroupTasks("sampleResource");
-// assertEquals(1, groupTasks.size());
-// assertEquals("UserTask", groupTasks.get(0).getActivityName());
-
- // speciifiing a transition is unnecessary, BPMN has outgoing AND semantic!
- // TODO: fix
- taskService.completeTask( allTasks.get(0).getId(), "flow2" );
+ try {
+ Map variables = new HashMap();
+ variables.put("assignedGroup", "Group1");
+ ProcessInstance pi = executionService.startProcessInstanceByKey("UserTaskGroupProcess", variables);
- assertEquals(0, taskQuery.list().size());
-
- // process instance is ended
- pi = executionService.findProcessInstanceById(pi.getId());
- // One way or another I would also expect this to work... pi is gone from database immediately when ended. Only in History DB
- //assertEquals(true, pi.isEnded());
- assertNull(pi);
- }
- finally {
- repositoryService.deleteDeploymentCascade(deploymentId);
- }
+ assertEquals("UserTask", ((ExecutionImpl) pi).getActivityName());
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+ assertEquals(1, allTasks.size());
+
+ List<Task> groupTasks = taskService.findGroupTasks("Group1");
+ assertEquals(1, groupTasks.size());
+ assertEquals("UserTask", groupTasks.get(0).getActivityName());
+
+ assertEquals("UserTask", allTasks.get(0).getActivityName());
+
+ assertNull(allTasks.get(0).getAssignee());
+
+ taskService.takeTask(allTasks.get(0).getId(), "User1");
+
+ groupTasks = taskService.findGroupTasks("Group1");
+ assertEquals(0, groupTasks.size());
+
+ List<Task> userTasks = taskService.findPersonalTasks("User1");
+ assertEquals(1, userTasks.size());
+ assertEquals("UserTask", userTasks.get(0).getActivityName());
+
+ taskService.completeTask(userTasks.get(0).getId(), "flow2");
+
+ assertEquals(0, taskQuery.list().size());
+
+ // process instance is ended
+ pi = executionService.findProcessInstanceById(pi.getId());
+ assertNull(pi);
+ } finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
}
-
- /**
- * check that multiple outgoing sequence flows will be handled as fork, like specified in BPMN
- *
- * Check with user tasks, sicne the engine stops there for sure.
- */
- public void testUncontrolledSequenceFlowAsFork() {
- String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml").deploy();
+ }
- try {
- ProcessInstance pi = executionService.startProcessInstanceByKey("ForkWithUncontrolledSequenceFlowProcess");
-
- String pid = pi.getId();
-
- TaskQuery taskQuery = taskService.createTaskQuery();
- List<Task> allTasks = taskQuery.list();
+ public void testNormalSequenceFlowCondition() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/UserTaskSequenceFlowCondition.bpmn.xml").deploy();
- // since the uncontrolled sequence flow OUT of the activity behaves as a fork
- // we now have two tasks
- assertEquals(2, allTasks.size());
- assertEquals("UserTaskLeg1", allTasks.get(0).getActivityName());
- assertEquals("UserTaskLeg2", allTasks.get(1).getActivityName());
-
- // specifying a transition is unnecessary, BPMN has outgoing AND semantic!
- // TODO: fix
- // Currently not passing any 'outcome'
- taskService.completeTask( allTasks.get(0).getId()); // define output / flow?
- taskService.completeTask( allTasks.get(1).getId());
+ try {
+ Map variables = new HashMap();
+ ProcessInstance pi = executionService.startProcessInstanceByKey("UserTaskSequenceFlowConditionProcess");
- assertEquals(0, taskQuery.list().size());
-
- pi = executionService.findProcessInstanceById(pid);
- // process instance is ended
- assertNull(pi);
-
-
- }
- finally {
- repositoryService.deleteDeploymentCascade(deploymentId);
- }
+ assertEquals("UserTask", ((ExecutionImpl) pi).getActivityName());
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+ assertEquals(1, allTasks.size());
+
+ // Flow does not exist so task should be ended hence process endded since it is the only execution
+ taskService.completeTask(allTasks.get(0).getId(), "NoFlow");
+
+ assertEquals(0, taskQuery.list().size());
+
+ // process instance is ended
+ pi = executionService.findProcessInstanceById(pi.getId());
+ assertNull(pi);
+ } finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
}
+
+
+ /**
+ * check that multiple outgoing sequence flows will be handled as fork, like
+ * specified in BPMN
+ *
+ * Check with user tasks, sicne the engine stops there for sure.
+ */
+ public void testUncontrolledSequenceFlowAsFork() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml")
+ .deploy();
+
+ try {
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ForkWithUncontrolledSequenceFlowProcess");
+
+ String pid = pi.getId();
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+
+ // since the uncontrolled sequence flow OUT of the activity behaves as a
+ // fork
+ // we now have two tasks
+ assertEquals(2, allTasks.size());
+ assertEquals("UserTaskLeg1", allTasks.get(0).getActivityName());
+ assertEquals("UserTaskLeg2", allTasks.get(1).getActivityName());
+
+ // specifying a transition is unnecessary, BPMN has outgoing AND semantic!
+ // TODO: fix
+ // Currently not passing any 'outcome'
+ taskService.completeTask(allTasks.get(0).getId()); // define output /
+ // flow?
+ taskService.completeTask(allTasks.get(1).getId());
+
+ assertEquals(0, taskQuery.list().size());
+
+ pi = executionService.findProcessInstanceById(pid);
+ // process instance is ended
+ assertNull(pi);
+
+ } finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+
+ }
+
+ /**
+ * check that multiple outgoing sequence flows will be handled as fork, like
+ * specified in BPMN
+ *
+ * Check with user tasks, sicne the engine stops there for sure.
+ */
+ public void testUncontrolledSequenceFlowConditionAsFork() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlowCondition.bpmn.xml")
+ .deploy();
+
+ try {
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ForkWithUncontrolledSequenceFlowConditionProcess");
+
+ String pid = pi.getId();
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+
+ assertEquals(1, allTasks.size());
+ assertEquals("forkingTask", allTasks.get(0).getActivityName());
+ taskService.completeTask(allTasks.get(0).getId(), "NoFlow");
+
+ // Even though the 'uncontrolled sequence flow' OUT of the activity behaves as a
+ // fork we now have one task since one sequenceflow has a condition that evaluates to false
+
+ allTasks = taskQuery.list();
+ assertEquals(1, allTasks.size());
+ assertEquals("UserTaskLeg2", allTasks.get(0).getActivityName());
+ taskService.completeTask(allTasks.get(0).getId());
+
+ pi = executionService.findProcessInstanceById(pid);
+ // process instance is ended
+ assertNull(pi);
+
+ } finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+
+ }
+
}
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskGroup.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskGroup.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskGroup.bpmn.xml 2009-08-04 23:31:39 UTC (rev 5428)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="UserTaskGroup"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/"
+ xmlns:jbpm="jbpm.org:bpmn:form">
+
+ <bpmn:resource name="sampleHumanResource" />
+
+ <bpmn:process id="UserTaskGroupProcess" name="Simple process with user task for group">
+
+
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" name="fromStartToUserTask"
+ sourceRef="Start" targetRef="UserTask" />
+
+ <bpmn:userTask id="UserTask" name="user task"
+ implementation="other">
+ <!-- use jbpm internal task management -->
+ <bpmn:potentialOwner id="myPerformer" resourceRef="sampleResource" jbpm:type="group">
+ <bpmn:resourceAssignmentExpression
+ id="rae">
+ <bpmn:formalExpression language="juel">
+ ${assignedGroup}</bpmn:formalExpression>
+ </bpmn:resourceAssignmentExpression>
+ </bpmn:potentialOwner>
+ <bpmn:potentialOwner id="myPerformer2" resourceRef="sampleResource">
+ <bpmn:resourceAssignmentExpression
+ id="rae2">
+ <bpmn:formalExpression language="juel">
+ ${assignedGroup}</bpmn:formalExpression>
+ </bpmn:resourceAssignmentExpression>
+ </bpmn:potentialOwner>
+ <bpmn:rendering id="myRendering">
+ <jbpm:form>MyForm.ftl</jbpm:form>
+ </bpmn:rendering>
+ </bpmn:userTask>
+
+ <bpmn:sequenceFlow id="flow2" name="fromUserTaskToEnd"
+ sourceRef="UserTask" targetRef="End" />
+
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSequenceFlowCondition.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSequenceFlowCondition.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSequenceFlowCondition.bpmn.xml 2009-08-04 23:31:39 UTC (rev 5428)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="UserTaskSequenceFlowCondition"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/"
+ xmlns:jbpm="jbpm.org:bpmn:form">
+
+ <bpmn:resource name="sampleHumanResource" />
+
+ <bpmn:process id="UserTaskSequenceFlowConditionProcess"
+ name="Simple process with user task and condition on sequenceFlow">
+
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" name="fromStartToUserTask"
+ sourceRef="Start" targetRef="UserTask" />
+
+ <bpmn:userTask id="UserTask" name="user task"
+ implementation="other">
+ <!-- use jbpm internal task management -->
+ <bpmn:performer id="myPerformer" resourceRef="sampleResource" />
+ </bpmn:userTask>
+
+ <bpmn:sequenceFlow id="flow2" name="fromUserTaskToUSerTask2"
+ sourceRef="UserTask" targetRef="UserTask2">
+ <bpmn:conditionExpression id="flow2Cond"
+ xsi:type="bpmn:tFormalExpression">${jbpm_outcome == 'flow'}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="UserTask2" name="another user task"
+ implementation="other">
+ <!-- use jbpm internal task management -->
+ <bpmn:performer id="myPerformer2" resourceRef="sampleResource" />
+ </bpmn:userTask>
+
+ <bpmn:sequenceFlow id="flow3" name="fromUserTask2ToEnd"
+ sourceRef="UserTask2" targetRef="End">
+ </bpmn:sequenceFlow>
+
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Modified: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml 2009-08-04 21:29:31 UTC (rev 5427)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml 2009-08-04 23:31:39 UTC (rev 5428)
@@ -2,28 +2,36 @@
<bpmn:definitions id="UserTaskSimple"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
- xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0"
- typeLanguage="http://www.w3.org/2001/XMLSchema"
- expressionLanguage="http://www.w3.org/1999/XPath"
- targetNamespace="http://sample.bpmn.camunda.com/">
-
- <bpmn:resource name="sampleResource" />
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/"
+ xmlns:jbpm="jbpm.org:bpmn:form">
+ <bpmn:resource name="sampleHumanResource" />
+
<bpmn:process id="UserTaskSimpleProcess" name="Simple process with user task">
+
<bpmn:startEvent id="Start" />
- <bpmn:sequenceFlow id="flow1" name="fromStartToUserTask"
- sourceRef="Start"
- targetRef="UserTask" />
+ <bpmn:sequenceFlow id="flow1" name="fromStartToUserTask"
+ sourceRef="Start" targetRef="UserTask" />
- <bpmn:userTask id="UserTask" name="user task" implementation="other"> <!-- use jbpm internal task management -->
- <bpmn:potentialOwner resourceRef="sampleResource">
- </bpmn:potentialOwner>
+ <bpmn:userTask id="UserTask" name="user task"
+ implementation="other">
+ <!-- use jbpm internal task management -->
+ <bpmn:performer id="myPerformer" resourceRef="sampleResource">
+ <bpmn:resourceAssignmentExpression
+ id="rae">
+ <bpmn:formalExpression language="juel">
+ ${assignedUser}</bpmn:formalExpression>
+ </bpmn:resourceAssignmentExpression>
+ </bpmn:performer>
+ <bpmn:rendering id="myRendering">
+ <jbpm:form>MyForm.ftl</jbpm:form>
+ </bpmn:rendering>
</bpmn:userTask>
- <bpmn:sequenceFlow id="flow2" name="fromUserTaskToEnd"
- sourceRef="UserTask"
- targetRef="End" />
+ <bpmn:sequenceFlow id="flow2" name="fromUserTaskToEnd"
+ sourceRef="UserTask" targetRef="End" />
<bpmn:endEvent id="End" name="End" />
</bpmn:process>
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlowCondition.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlowCondition.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlowCondition.bpmn.xml 2009-08-04 23:31:39 UTC (rev 5428)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ForkWithUncontrolledSequenceFlowCondition"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:resource name="sampleResource" />
+
+ <bpmn:process id="ForkWithUncontrolledSequenceFlowConditionProcess"
+ name="ForkWithUncontrolledSequenceFlowCondition">
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" name="fromStartToForkingTask"
+ sourceRef="Start" targetRef="forkingTask" />
+
+ <bpmn:userTask id="forkingTask" name="The Fork" />
+
+ <bpmn:sequenceFlow id="flow2a" name="Leg 1"
+ sourceRef="forkingTask" targetRef="UserTaskLeg1">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${jbpm_outcome == 'flow'}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="UserTaskLeg1" name="user task leg1"
+ implementation="other">
+ <bpmn:potentialOwner resourceRef="sampleResource" />
+ </bpmn:userTask>
+
+ <bpmn:sequenceFlow id="flow2b" name="Leg 1 -> Join"
+ sourceRef="UserTaskLeg1" targetRef="parallelGatewayJoin" />
+
+ <bpmn:sequenceFlow id="flow3a" name="Leg 2"
+ sourceRef="forkingTask" targetRef="UserTaskLeg2" />
+ <bpmn:userTask id="UserTaskLeg2" name="user task leg2"
+ implementation="other">
+ <bpmn:potentialOwner resourceRef="sampleResource" />
+ </bpmn:userTask>
+
+ <bpmn:sequenceFlow id="flow3b" name="Leg 2 -> Join"
+ sourceRef="UserTaskLeg2" targetRef="parallelGatewayJoin" />
+
+
+ <bpmn:parallelGateway id="parallelGatewayJoin"
+ name="The Join" gatewayDirection="converging" />
+ <bpmn:sequenceFlow id="flow4" sourceRef="parallelGatewayJoin"
+ targetRef="End">
+ </bpmn:sequenceFlow>
+
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Modified: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/scriptTask.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/scriptTask.bpmn.xml 2009-08-04 21:29:31 UTC (rev 5427)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/scriptTask.bpmn.xml 2009-08-04 23:31:39 UTC (rev 5428)
@@ -5,6 +5,8 @@
xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+
<bpmn:process id="ScriptTask" name="ScriptTask">
<!-- Start-Event -->
<bpmn:startEvent id="Start" />
@@ -13,7 +15,7 @@
targetRef="scriptTask" name="Start->ScriptTask" />
<bpmn:scriptTask id="scriptTask" name="Script Task"
- scriptLanguage="bsh">
+ scriptLanguage="bsh" >
<bpmn:script><![CDATA[
for(int i=0;i<5;i++){
System.out.println((i+1) + test[i] + " universe");
More information about the jbpm-commits
mailing list