Author: tom.baeyens(a)jboss.com
Date: 2009-05-19 04:31:00 -0400 (Tue, 19 May 2009)
New Revision: 4840
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
Log:
JBPM-2221 upon completion, a task activity must take the single transition if there is
only one, even if the transition name doesn't match.
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java 2009-05-19
07:26:59 UTC (rev 4839)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java 2009-05-19
08:31:00 UTC (rev 4840)
@@ -167,5 +167,7 @@
/** retrieves a map of variables */
Map<String, Object> getVariables(long taskDbid, Set<String>
variableNames);
-
+
+ /** the set of possible valid outcomes for this task */
+ // Set<String> getOutcomes(long taskDbid);
}
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
===================================================================
---
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java 2009-05-19
07:26:59 UTC (rev 4839)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java 2009-05-19
08:31:00 UTC (rev 4840)
@@ -21,9 +21,9 @@
*/
package org.jbpm.jpdl.internal.activity;
+import java.util.List;
import java.util.Map;
-import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.env.Environment;
import org.jbpm.api.model.Activity;
@@ -73,11 +73,18 @@
TaskHandler taskHandler = task.getTaskHandler();
taskHandler.executionSignal(task);
- Transition transition = activity.findOutgoingTransition(signalName);
+ Transition transition = null;
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ if (outgoingTransitions!=null) {
+ if (outgoingTransitions.size()==1) {
+ transition = outgoingTransitions.get(0);
+ } else {
+ transition = activity.findOutgoingTransition(signalName);
+ }
+ }
+
if (transition!=null) {
execution.take(transition);
- } else {
- throw new JbpmException("task outcome '"+signalName+"'
doesn't match with the an outgoing transition
"+activity.getOutgoingTransitions());
}
}
@@ -87,4 +94,4 @@
public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
this.taskDefinition = taskDefinition;
}
-}
\ No newline at end of file
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-05-19
08:31:00 UTC (rev 4840)
@@ -64,11 +64,9 @@
private static final TaskHandler DEFAULT_TASK_HANDLER = new TaskHandler();
- public static final String STATE_CREATED = "created";
- public static final String STATE_ASSIGNED = "assigned";
+ public static final String STATE_OPEN = "open";
public static final String STATE_COMPLETED = "completed";
public static final String STATE_SUSPENDED = "suspended";
- public static final String STATE_ACTIVE = "active";
protected String name;
protected String description;
@@ -87,7 +85,7 @@
protected int priority = Priority.NORMAL;
- protected String state = STATE_ACTIVE;
+ protected String state = STATE_OPEN;
protected String taskDefinitionName;
protected TaskDefinitionImpl taskDefinition;
@@ -195,7 +193,7 @@
// completion ///////////////////////////////////////////////////////////////
public void complete() {
- complete(null);
+ complete(STATE_COMPLETED);
}
public void complete(String outcome) {
@@ -219,7 +217,12 @@
if (STATE_COMPLETED.equals(state)) {
return true;
}
- return false;
+ if ( (STATE_OPEN.equals(state))
+ || (STATE_SUSPENDED.equals(state))
+ ) {
+ return false;
+ }
+ return true;
}
// variables ////////////////////////////////////////////////////////////////