JBoss JBPM SVN: r6209 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src: main/java/org/jbpm/graph/def and 8 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-03-04 08:17:09 -0500 (Thu, 04 Mar 2010)
New Revision: 6209
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2784/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2784/JBPM2784Test.java
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableContainer.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Transition.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/graph/node/JpdlDbTest.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/el/DecisionExpressionTest.java
Log:
JBPM-2784: accept condition attribute in transition element
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableContainer.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableContainer.java 2010-03-04 07:33:35 UTC (rev 6208)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableContainer.java 2010-03-04 13:17:09 UTC (rev 6209)
@@ -155,34 +155,29 @@
VariableInstance variableInstance = getVariableInstance(name);
// if there is already a variable instance
- // and it doesn't support the current value
+ // and it does not support the new value
if (variableInstance != null && !variableInstance.supports(value)) {
// delete the old variable instance
- log.debug("variable type change, deleting '" + name + "' from "
- + getToken());
+ log.debug(variableInstance.getToken() + " unsets '" + name + "' due to type change");
deleteVariableInstance(name);
variableInstance = null;
}
- if (variableInstance == null) {
- Token token = getToken();
- log.debug("create variable '" + name + "' for " + token + " with value: "
- + value);
- variableInstance = VariableInstance.create(token, name, value);
- addVariableInstance(variableInstance);
+ if (variableInstance != null) {
+ log.debug(variableInstance.getToken() + " sets '" + name + "' to " + value);
+ variableInstance.setValue(value);
}
else {
- log.debug("update variable '" + name + "' for "
- + variableInstance.getToken() + " to value: " + value);
- variableInstance.setValue(value);
+ Token token = getToken();
+ log.debug(token + " initializes '" + name + "' to " + value);
+ addVariableInstance(VariableInstance.create(token, name, value));
}
}
// local variable instances /////////////////////////////////////////////////
public VariableInstance getVariableInstance(String name) {
- return variableInstances != null ? (VariableInstance) variableInstances.get(name)
- : null;
+ return variableInstances != null ? (VariableInstance) variableInstances.get(name) : null;
}
public Map getVariableInstances() {
@@ -200,8 +195,7 @@
public void deleteVariableInstance(String name) {
if (variableInstances != null) {
- VariableInstance variableInstance =
- (VariableInstance) variableInstances.remove(name);
+ VariableInstance variableInstance = (VariableInstance) variableInstances.remove(name);
if (variableInstance != null) {
getToken().addLog(new VariableDeleteLog(variableInstance));
variableInstance.removeReferences();
@@ -228,8 +222,7 @@
return null;
}
- public static Collection getUpdatedVariableContainers(
- ProcessInstance processInstance) {
+ public static Collection getUpdatedVariableContainers(ProcessInstance processInstance) {
return processInstance.getContextInstance().updatedVariableContainers;
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java 2010-03-04 07:33:35 UTC (rev 6208)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java 2010-03-04 13:17:09 UTC (rev 6209)
@@ -89,7 +89,7 @@
};
protected List leavingTransitions;
- transient Map leavingTransitionMap;
+ private transient Map leavingTransitionMap;
protected Set arrivingTransitions;
protected Action action;
protected SuperState superState;
@@ -108,15 +108,20 @@
}
// event types //////////////////////////////////////////////////////////////
+
+ private static final String[] EVENT_TYPES = {
+ Event.EVENTTYPE_NODE_ENTER, Event.EVENTTYPE_NODE_LEAVE, Event.EVENTTYPE_BEFORE_SIGNAL,
+ Event.EVENTTYPE_AFTER_SIGNAL
+ };
- public static final String[] supportedEventTypes =
- { Event.EVENTTYPE_NODE_ENTER,
- Event.EVENTTYPE_NODE_LEAVE,
- Event.EVENTTYPE_BEFORE_SIGNAL,
- Event.EVENTTYPE_AFTER_SIGNAL };
+ /**
+ * @deprecated arrays are mutable and thus vulnerable to external manipulation.
+ * use {@link #getSupportedEventTypes()} instead
+ */
+ public static final String[] supportedEventTypes = (String[]) EVENT_TYPES.clone();
public String[] getSupportedEventTypes() {
- return supportedEventTypes;
+ return (String[]) EVENT_TYPES.clone();
}
// constructors /////////////////////////////////////////////////////////////
@@ -163,8 +168,7 @@
if (leavingTransitionMap == null && leavingTransitions != null) {
// initialize the cached leaving transition map
leavingTransitionMap = new HashMap();
- ListIterator iter =
- leavingTransitions.listIterator(leavingTransitions.size());
+ ListIterator iter = leavingTransitions.listIterator(leavingTransitions.size());
while (iter.hasPrevious()) {
Transition leavingTransition = (Transition) iter.previous();
leavingTransitionMap.put(leavingTransition.getName(), leavingTransition);
@@ -200,8 +204,7 @@
if (leavingTransition == null) {
throw new IllegalArgumentException("leaving transition is null");
}
- if (leavingTransitions != null
- && leavingTransitions.remove(leavingTransition)) {
+ if (leavingTransitions != null && leavingTransitions.remove(leavingTransition)) {
leavingTransition.from = null;
leavingTransitionMap = null;
}
@@ -264,8 +267,8 @@
boolean containsName(List leavingTransitions, String name) {
for (Iterator iter = leavingTransitions.iterator(); iter.hasNext();) {
Transition transition = (Transition) iter.next();
- if (name != null ? name.equals(transition.getName())
- : transition.getName() == null) return true;
+ if (name != null ? name.equals(transition.getName()) : transition.getName() == null)
+ return true;
}
return false;
}
@@ -340,8 +343,7 @@
if (arrivingTransition == null) {
throw new IllegalArgumentException("arriving transition is null");
}
- if (arrivingTransitions != null
- && arrivingTransitions.remove(arrivingTransition)) {
+ if (arrivingTransitions != null && arrivingTransitions.remove(arrivingTransition)) {
arrivingTransition.to = null;
}
}
@@ -385,10 +387,7 @@
// execute the node
if (isAsync) {
ExecuteNodeJob job = createAsyncContinuationJob(token);
- executionContext.getJbpmContext()
- .getServices()
- .getMessageService()
- .send(job);
+ executionContext.getJbpmContext().getServices().getMessageService().send(job);
token.lock(job.toString());
}
else {
@@ -442,8 +441,7 @@
*/
public void leave(ExecutionContext executionContext, String transitionName) {
Transition transition = getLeavingTransition(transitionName);
- if (transition == null)
- throw new JbpmException("no such transition: " + transitionName);
+ if (transition == null) throw new JbpmException("no such transition: " + transitionName);
leave(executionContext, transition);
}
@@ -482,8 +480,7 @@
// ///////////////////////////////////////////////////////////////////////////
public ProcessDefinition getProcessDefinition() {
- return superState != null ? superState.getProcessDefinition()
- : processDefinition;
+ return superState != null ? superState.getProcessDefinition() : processDefinition;
}
// change the name of a node ////////////////////////////////////////////////
@@ -496,7 +493,7 @@
if (superState != null) {
if (superState.hasNode(name)) {
throw new IllegalArgumentException("cannot rename " + this
- + ", superstate already has a node named " + name);
+ + " because " + superState + " already has a node named " + name);
}
Map nodes = superState.getNodesMap();
nodes.remove(oldName);
@@ -505,7 +502,7 @@
else if (processDefinition != null) {
if (processDefinition.hasNode(name)) {
throw new IllegalArgumentException("cannot rename " + this
- + ", process definition already has a node named " + name);
+ + " because " + processDefinition + " already has a node named " + name);
}
Map nodeMap = processDefinition.getNodesMap();
nodeMap.remove(oldName);
@@ -523,8 +520,7 @@
* the slash separated name that includes all the superstate names.
*/
public String getFullyQualifiedName() {
- return superState != null ? superState.getFullyQualifiedName() + '/' + name
- : name;
+ return superState != null ? superState.getFullyQualifiedName() + '/' + name : name;
}
/** indicates wether this node is a superstate. */
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java 2010-03-04 07:33:35 UTC (rev 6208)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java 2010-03-04 13:17:09 UTC (rev 6209)
@@ -63,8 +63,8 @@
protected Map definitions;
// event types //////////////////////////////////////////////////////////////
-
- public static final String[] supportedEventTypes = {
+
+ private static final String[] EVENT_TYPES = {
Event.EVENTTYPE_PROCESS_START, Event.EVENTTYPE_PROCESS_END, Event.EVENTTYPE_NODE_ENTER,
Event.EVENTTYPE_NODE_LEAVE, Event.EVENTTYPE_TASK_CREATE, Event.EVENTTYPE_TASK_ASSIGN,
Event.EVENTTYPE_TASK_START, Event.EVENTTYPE_TASK_END, Event.EVENTTYPE_TRANSITION,
@@ -73,8 +73,14 @@
Event.EVENTTYPE_SUBPROCESS_CREATED, Event.EVENTTYPE_SUBPROCESS_END, Event.EVENTTYPE_TIMER
};
+ /**
+ * @deprecated arrays are mutable and thus vulnerable to external manipulation.
+ * use {@link #getSupportedEventTypes()} instead
+ */
+ public static final String[] supportedEventTypes = (String[]) EVENT_TYPES.clone();
+
public String[] getSupportedEventTypes() {
- return supportedEventTypes;
+ return (String[]) EVENT_TYPES.clone();
}
// constructors /////////////////////////////////////////////////////////////
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Transition.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Transition.java 2010-03-04 07:33:35 UTC (rev 6208)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Transition.java 2010-03-04 13:17:09 UTC (rev 6209)
@@ -44,11 +44,18 @@
// event types //////////////////////////////////////////////////////////////
- public static final String[] supportedEventTypes =
- { Event.EVENTTYPE_TRANSITION };
+ private static final String[] EVENT_TYPES = {
+ Event.EVENTTYPE_TRANSITION
+ };
+ /**
+ * @deprecated arrays are mutable and thus vulnerable to external
+ * manipulation. use {@link #getSupportedEventTypes()} instead
+ */
+ public static final String[] supportedEventTypes = (String[]) EVENT_TYPES.clone();
+
public String[] getSupportedEventTypes() {
- return supportedEventTypes;
+ return (String[]) EVENT_TYPES.clone();
}
// constructors /////////////////////////////////////////////////////////////
@@ -117,25 +124,21 @@
Token token = executionContext.getToken();
if (condition != null && isConditionEnforced) {
- Object result =
- JbpmExpressionEvaluator.evaluate(condition, executionContext);
+ Object result = JbpmExpressionEvaluator.evaluate(condition, executionContext);
if (result == null) {
- throw new JbpmException("transition condition " + condition
- + " evaluated to null");
+ throw new JbpmException("condition evaluated to null: " + condition);
}
else if (!(result instanceof Boolean)) {
- throw new JbpmException("transition condition " + condition
- + " evaluated to non-boolean: " + result.getClass().getName());
+ throw new JbpmException("condition result is not boolean: " + condition);
}
else if (((Boolean) result).booleanValue() == false) {
- throw new JbpmException("transition condition " + condition
- + " evaluated to 'false'");
+ throw new JbpmException("condition is false: " + condition);
}
}
// start the transition log
- TransitionLog transitionLog =
- new TransitionLog(this, executionContext.getTransitionSource());
+ TransitionLog transitionLog = new TransitionLog(this, executionContext
+ .getTransitionSource());
token.startCompositeLog(transitionLog);
try {
// fire leave events for superstates (if any)
@@ -162,15 +165,12 @@
Node destination = to;
while (destination != null && destination.isSuperStateNode()) {
List nodes = destination.getNodes();
- destination =
- nodes != null && !nodes.isEmpty() ? (Node) nodes.get(0) : null;
+ destination = nodes != null && !nodes.isEmpty() ? (Node) nodes.get(0) : null;
}
if (destination == null) {
- String transitionName =
- name != null ? '\'' + name + '\'' : "in node '" + from + '\'';
- throw new JbpmException("transition " + transitionName
- + " has no destination");
+ String transitionName = name != null ? '\'' + name + '\'' : "in node '" + from + '\'';
+ throw new JbpmException("transition " + transitionName + " has no destination");
}
// optimisation: check if there is a candidate superstate to be entered
@@ -180,9 +180,8 @@
// reverse order so that events fire from outer to inner superstates
Collections.reverse(leavingSuperStates);
// fire a superstate-enter event for all superstates being left
- fireSuperStateEvents(leavingSuperStates,
- Event.EVENTTYPE_SUPERSTATE_ENTER,
- executionContext);
+ fireSuperStateEvents(leavingSuperStates, Event.EVENTTYPE_SUPERSTATE_ENTER,
+ executionContext);
}
return destination;
@@ -192,12 +191,11 @@
// optimisation: check if there is a candidate superstate to be left
if (executionContext.getTransitionSource().getSuperState() != null) {
// collect all the superstates being left
- List leavingSuperStates =
- collectAllSuperStates(executionContext.getTransitionSource(), to);
+ List leavingSuperStates = collectAllSuperStates(executionContext.getTransitionSource(),
+ to);
// fire a node-leave event for all superstates being left
- fireSuperStateEvents(leavingSuperStates,
- Event.EVENTTYPE_SUPERSTATE_LEAVE,
- executionContext);
+ fireSuperStateEvents(leavingSuperStates, Event.EVENTTYPE_SUPERSTATE_LEAVE,
+ executionContext);
}
}
@@ -223,7 +221,7 @@
* fires the give event on all the superstates in the list.
*/
void fireSuperStateEvents(List superStates, String eventType,
- ExecutionContext executionContext) {
+ ExecutionContext executionContext) {
for (Iterator iter = superStates.iterator(); iter.hasNext();) {
SuperState leavingSuperState = (SuperState) iter.next();
leavingSuperState.fireEvent(eventType, executionContext);
@@ -239,8 +237,7 @@
Transition other = (Transition) o;
if (id != 0 && id == other.getId()) return true;
- return (name != null ? name.equals(other.getName())
- : other.getName() == null)
+ return (name != null ? name.equals(other.getName()) : other.getName() == null)
&& from != null && from.equals(other.getFrom());
}
@@ -258,12 +255,8 @@
public void setName(String name) {
if (from != null) {
if (from.hasLeavingTransition(name)) {
- throw new IllegalArgumentException(
- "couldn't set name '"
- + name
- + "' on transition '"
- + this
- + "'cause the from-node of this transition has already another leaving transition with the same name");
+ throw new IllegalArgumentException("cannot rename " + this
+ + " because " + from + " already has a transition named " + name);
}
Map fromLeavingTransitions = from.getLeavingTransitionsMap();
fromLeavingTransitions.put(name, this);
@@ -276,9 +269,9 @@
if (from.equals(to)) return from.getParent();
for (GraphElement fromParent = from; fromParent != null; fromParent =
- fromParent.getParent()) {
+ fromParent.getParent()) {
for (GraphElement toParent = to; toParent != null; toParent =
- toParent.getParent()) {
+ toParent.getParent()) {
if (fromParent.equals(toParent)) return fromParent;
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Decision.java 2010-03-04 07:33:35 UTC (rev 6208)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Decision.java 2010-03-04 13:17:09 UTC (rev 6209)
@@ -43,12 +43,11 @@
*/
public class Decision extends Node implements Parsable {
- static final String DECISION_CONDITION_RESULT = "decision_condition_result";
- static final long serialVersionUID = 1L;
+ private List decisionConditions;
+ private Delegation decisionDelegation;
+ private String decisionExpression;
- List decisionConditions = null;
- Delegation decisionDelegation = null;
- String decisionExpression = null;
+ private static final long serialVersionUID = 1L;
public Decision() {
}
@@ -75,107 +74,107 @@
}
public void execute(ExecutionContext executionContext) {
- Transition transition = null;
- ClassLoader surroundingClassLoader = Thread.currentThread().getContextClassLoader();
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
- // set context class loader correctly for delegation class (https://jira.jboss.org/jira/browse/JBPM-1448)
- Thread.currentThread().setContextClassLoader(
- JbpmConfiguration.getProcessClassLoader(executionContext.getProcessDefinition()));
+ // set context class loader correctly for delegation class
+ // https://jira.jboss.org/jira/browse/JBPM-1448
+ ClassLoader processClassLoader = JbpmConfiguration.getProcessClassLoader(executionContext
+ .getProcessDefinition());
+ Thread.currentThread().setContextClassLoader(processClassLoader);
+ Transition transition = null;
try {
if (decisionDelegation != null) {
DecisionHandler decisionHandler = (DecisionHandler) decisionDelegation.getInstance();
- if (decisionHandler == null)
- decisionHandler = (DecisionHandler) decisionDelegation.instantiate();
-
String transitionName = decisionHandler.decide(executionContext);
transition = getLeavingTransition(transitionName);
if (transition == null) {
- throw new JbpmException("decision '"
- + name
- + "' selected non existing transition '"
- + transitionName
- + "'");
+ throw new JbpmException("no such transition: " + transitionName);
}
}
else if (decisionExpression != null) {
- Object result = JbpmExpressionEvaluator.evaluate(decisionExpression, executionContext);
+ Object result = JbpmExpressionEvaluator
+ .evaluate(decisionExpression, executionContext);
if (result == null) {
- throw new JbpmException("decision expression '"
- + decisionExpression
- + "' returned null");
+ throw new JbpmException("expression evaluated to null: " + decisionExpression);
}
String transitionName = result.toString();
transition = getLeavingTransition(transitionName);
if (transition == null) {
- throw new JbpmException("decision '"
- + name
- + "' selected non existing transition '"
- + transitionName
- + "'");
+ throw new JbpmException("no such transition: " + transitionName);
}
}
else if (decisionConditions != null && !decisionConditions.isEmpty()) {
- // backwards compatible mode based on separate DecisionCondition's
- Iterator iter = decisionConditions.iterator();
- while (iter.hasNext() && (transition == null)) {
+ // backwards compatible mode based on separate DecisionConditions
+ for (Iterator iter = decisionConditions.iterator(); iter.hasNext();) {
DecisionCondition decisionCondition = (DecisionCondition) iter.next();
- Object result = JbpmExpressionEvaluator.evaluate(decisionCondition.getExpression(),
- executionContext);
+ // evaluate condition
+ String expression = decisionCondition.getExpression();
+ Object result = JbpmExpressionEvaluator.evaluate(expression, executionContext);
+ // if condition was true
if (Boolean.TRUE.equals(result)) {
+ // fetch name associated to condition
String transitionName = decisionCondition.getTransitionName();
+ // select transition by name
transition = getLeavingTransition(transitionName);
if (transition != null) {
transition.removeConditionEnforcement();
+ break;
}
}
}
}
else {
// new mode based on conditions in the transition itself
- Iterator iter = leavingTransitions.iterator();
- while (iter.hasNext() && (transition == null)) {
+ for (Iterator iter = leavingTransitions.iterator(); iter.hasNext();) {
Transition candidate = (Transition) iter.next();
-
- String conditionExpression = candidate.getCondition();
- if (conditionExpression != null) {
- Object result = JbpmExpressionEvaluator.evaluate(conditionExpression,
- executionContext);
+ // evaluate condition if present
+ String condition = candidate.getCondition();
+ if (condition != null) {
+ Object result = JbpmExpressionEvaluator.evaluate(condition, executionContext);
+ // if condition was true
if (Boolean.TRUE.equals(result)) {
+ // select transition associated to condition
transition = candidate;
+ break;
}
}
}
}
-
- if (transition == null) transition = getDefaultLeavingTransition();
-
- if (transition == null)
- throw new IllegalStateException("decision cannot select transition: " + this);
-
- log.debug("decision didn't select transition, taking default " + transition);
-
- // since the decision node evaluates condition expressions,
- // the condition of the taken transition will always be met.
- // therefore we can safely turn off the standard condition enforcement
- // in the transitions after a decision node.
- transition.removeConditionEnforcement();
}
catch (Exception exception) {
raiseException(exception, executionContext);
}
+
+ // if no transition was selected, just take the default
+ if (transition == null) {
+ transition = getDefaultLeavingTransition();
+ // if there is no default transition, complain
+ if (transition == null) throw new JbpmException(this + " has no default transition");
+ }
+
+ // since the decision node evaluates transition conditions,
+ // the condition of the taken transition will always be met.
+ // therefore we can safely turn off the standard condition enforcement
+ // in the transitions after a decision node.
+ transition.removeConditionEnforcement();
+
+ log.debug(executionContext.getToken() + " leaves " + this + " over " + transition);
+ executionContext.leaveNode(transition);
}
finally {
- Thread.currentThread().setContextClassLoader(surroundingClassLoader);
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
}
- log.debug("decision " + name + " is taking '" + transition + "'");
- executionContext.leaveNode(transition);
}
public List getDecisionConditions() {
return decisionConditions;
}
+ public Delegation getDecisionDelegation() {
+ return decisionDelegation;
+ }
+
public void setDecisionDelegation(Delegation decisionDelegation) {
this.decisionDelegation = decisionDelegation;
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java 2010-03-04 07:33:35 UTC (rev 6208)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java 2010-03-04 13:17:09 UTC (rev 6209)
@@ -12,26 +12,35 @@
private static ExpressionEvaluator expressionEvaluator;
- static ExpressionEvaluator getExpressionEvaluator() {
+ private static ExpressionEvaluator getExpressionEvaluator() {
return expressionEvaluator != null ? expressionEvaluator
- : (ExpressionEvaluator) JbpmConfiguration.Configs.getObject("jbpm.expression.evaluator");
+ : (ExpressionEvaluator) JbpmConfiguration.Configs.getObject("jbpm.expression.evaluator");
}
- /** @deprecated Use the configuration entry <code>jbpm.expression.evaluator</code> instead */
+ /**
+ * @deprecated set configuration entry <code>jbpm.expression.evaluator</code>
+ * instead
+ */
public static void setExpressionEvaluator(ExpressionEvaluator expressionEvaluator) {
JbpmExpressionEvaluator.expressionEvaluator = expressionEvaluator;
}
- static VariableResolver variableResolver;
+ private static VariableResolver variableResolver;
- /** @deprecated Use the configuration entry <code>jbpm.variable.resolver</code> instead */
+ /**
+ * @deprecated set configuration entry <code>jbpm.variable.resolver</code>
+ * instead
+ */
public static void setVariableResolver(VariableResolver variableResolver) {
JbpmExpressionEvaluator.variableResolver = variableResolver;
}
- static FunctionMapper functionMapper;
+ private static FunctionMapper functionMapper;
- /** @deprecated Use the configuration entry <code>jbpm.function.mapper</code> instead */
+ /**
+ * @deprecated set configuration entry <code>jbpm.function.mapper</code>
+ * instead
+ */
public static void setFunctionMapper(FunctionMapper functionMapper) {
JbpmExpressionEvaluator.functionMapper = functionMapper;
}
@@ -41,26 +50,26 @@
}
public static Object evaluate(String expression, ExecutionContext executionContext,
- VariableResolver variableResolver, FunctionMapper functionMapper) {
+ VariableResolver variableResolver, FunctionMapper functionMapper) {
ExecutionContext.pushCurrentContext(executionContext);
try {
String dollarExpression = translateExpressionToDollars(expression);
return getExpressionEvaluator().evaluate(dollarExpression, Object.class,
- variableResolver, functionMapper);
+ variableResolver, functionMapper);
}
catch (ELException e) {
- throw new JbpmException("couldn't evaluate expression '" + expression + "'",
- e.getRootCause() != null ? e.getRootCause() : e);
+ Throwable rootCause = e.getRootCause();
+ throw new JbpmException("failed to evaluate " + expression, rootCause != null ? rootCause : e);
}
finally {
ExecutionContext.popCurrentContext(executionContext);
}
}
- static String translateExpressionToDollars(String expression) {
+ private static String translateExpressionToDollars(String expression) {
int hashIndex = expression.indexOf("#{");
if (hashIndex == -1) return expression;
-
+
char[] expressionChars = expression.toCharArray();
do {
expressionChars[hashIndex] = '$';
@@ -76,7 +85,7 @@
public static VariableResolver getVariableResolver() {
return variableResolver != null ? variableResolver
- : (VariableResolver) JbpmConfiguration.Configs.getObject("jbpm.variable.resolver");
+ : (VariableResolver) JbpmConfiguration.Configs.getObject("jbpm.variable.resolver");
}
/** @deprecated Use {@link #getFunctionMapper()} instead */
@@ -85,9 +94,8 @@
}
public static FunctionMapper getFunctionMapper() {
- return functionMapper != null ? functionMapper
- : JbpmConfiguration.Configs.hasObject("jbpm.function.mapper") ?
- (FunctionMapper) JbpmConfiguration.Configs.getObject("jbpm.function.mapper")
- : null;
+ return functionMapper != null ? functionMapper : JbpmConfiguration.Configs
+ .hasObject("jbpm.function.mapper") ? (FunctionMapper) JbpmConfiguration.Configs
+ .getObject("jbpm.function.mapper") : null;
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java 2010-03-04 07:33:35 UTC (rev 6208)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java 2010-03-04 13:17:09 UTC (rev 6209)
@@ -83,14 +83,15 @@
// event types //////////////////////////////////////////////////////////////
- static final String[] supportedEventTypes = {
+ private static final String[] EVENT_TYPES = {
Event.EVENTTYPE_TASK_CREATE,
Event.EVENTTYPE_TASK_ASSIGN,
Event.EVENTTYPE_TASK_START,
Event.EVENTTYPE_TASK_END
};
+
public String[] getSupportedEventTypes() {
- return supportedEventTypes;
+ return (String[]) EVENT_TYPES.clone();
}
// task instance factory methods ////////////////////////////////////////////
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd 2010-03-04 07:33:35 UTC (rev 6208)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd 2010-03-04 13:17:09 UTC (rev 6209)
@@ -213,6 +213,7 @@
</xs:choice>
<xs:attribute name="to" type="xs:string" use="required" />
<xs:attribute name="name" type="xs:string" />
+ <xs:attribute name="condition" type="xs:string" />
</xs:complexType>
</xs:element>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/graph/node/JpdlDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/graph/node/JpdlDbTest.java 2010-03-04 07:33:35 UTC (rev 6208)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/graph/node/JpdlDbTest.java 2010-03-04 13:17:09 UTC (rev 6209)
@@ -34,8 +34,8 @@
import org.jbpm.taskmgmt.def.Task;
public class JpdlDbTest extends AbstractDbTestCase {
-
- public void testDecision(){
+
+ public void testDecision() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
" <decision name='d'>" +
@@ -50,34 +50,29 @@
" </transition>" +
" </decision>" +
"</process-definition>");
-
+
processDefinition = saveAndReload(processDefinition);
- try
- {
+ try {
Decision decision = (Decision) processDefinition.getNode("d");
assertEquals("a == 1", decision.getLeavingTransition("one").getCondition());
assertEquals("a == 2", decision.getLeavingTransition("two").getCondition());
assertEquals("a == 3", decision.getLeavingTransition("three").getCondition());
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
-
}
-
- public static class MyDecisionHandler implements DecisionHandler
- {
+
+ public static class MyDecisionHandler implements DecisionHandler {
private static final long serialVersionUID = 1L;
String decisionHandlerConfigText = null;
- public String decide(ExecutionContext executionContext) throws Exception
- {
+ public String decide(ExecutionContext executionContext) throws Exception {
return "two";
}
}
- public void testDecisionDelegation(){
+ public void testDecisionDelegation() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
" <decision name='d' >" +
@@ -89,22 +84,20 @@
" <transition name='three' to='d'/>" +
" </decision>" +
"</process-definition>");
-
+
processDefinition = saveAndReload(processDefinition);
- try
- {
+ try {
Decision decision = (Decision) processDefinition.getNode("d");
- Delegation decisionDelegation = decision.decisionDelegation;
+ Delegation decisionDelegation = decision.getDecisionDelegation();
assertNotNull(decisionDelegation);
- assertEquals("org.jbpm.graph.node.JpdlDbTest$MyDecisionHandler", decisionDelegation.getClassName());
+ assertEquals("org.jbpm.graph.node.JpdlDbTest$MyDecisionHandler", decisionDelegation
+ .getClassName());
MyDecisionHandler decisionHandler = (MyDecisionHandler) decisionDelegation.instantiate();
assertEquals("testing... one, two... testing", decisionHandler.decisionHandlerConfigText);
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
-
}
public void testFork() {
@@ -112,39 +105,33 @@
"<process-definition>" +
" <fork name='f' />" +
"</process-definition>");
-
+
processDefinition = saveAndReload(processDefinition);
- try
- {
+ try {
Fork fork = (Fork) processDefinition.getNode("f");
assertNotNull(fork);
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
-
}
-
+
public void testJoin() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
" <join name='j' />" +
"</process-definition>");
-
+
processDefinition = saveAndReload(processDefinition);
- try
- {
+ try {
Join join = (Join) processDefinition.getNode("j");
assertNotNull(join);
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
-
}
-
+
public void testScript() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
@@ -156,41 +143,35 @@
" <expression>e = m * Math.pow(c,2);</expression>" +
" </script>" +
"</process-definition>");
-
+
processDefinition = saveAndReload(processDefinition);
- try
- {
+ try {
Script script = (Script) processDefinition.getAction("s");
assertNotNull(script);
- assertEquals(4, script.getVariableAccesses().size() );
- assertEquals("e = m * Math.pow(c,2);", script.getExpression() );
+ assertEquals(4, script.getVariableAccesses().size());
+ assertEquals("e = m * Math.pow(c,2);", script.getExpression());
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
-
}
-
+
public void testState() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
" <state name='s' />" +
"</process-definition>");
-
+
processDefinition = saveAndReload(processDefinition);
- try
- {
+ try {
State state = (State) processDefinition.getNode("s");
assertNotNull(state);
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
-
}
-
+
public void testTaskNode() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
@@ -203,17 +184,16 @@
" </task-node>" +
"</process-definition>"
);
-
+
processDefinition = saveAndReload(processDefinition);
- try
- {
+ try {
TaskNode taskNode = (TaskNode) processDefinition.getNode("t");
assertNotNull(taskNode);
assertEquals("t", taskNode.getName());
assertEquals(TaskNode.SIGNAL_FIRST_WAIT, taskNode.getSignal());
assertFalse(taskNode.getCreateTasks());
assertEquals(3, taskNode.getTasks().size());
-
+
Map tasks = new HashMap();
Iterator iter = taskNode.getTasks().iterator();
while (iter.hasNext()) {
@@ -225,22 +205,20 @@
assertSame(taskNode, task.getTaskNode());
assertTrue(task.isBlocking());
assertEquals("anyonebutme", task.getAssignmentDelegation().getClassName());
-
+
task = (Task) tasks.get("change the world twice");
assertNotNull(task);
assertSame(taskNode, task.getTaskNode());
assertFalse(task.isBlocking());
- assertTrue(tasks.containsKey("change the world three times") );
+ assertTrue(tasks.containsKey("change the world three times"));
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
-
}
-
- public void testNoAccessToObsoleteDecisionConditionTable(){
+
+ public void testNoAccessToObsoleteDecisionConditionTable() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
" <start-state>" +
@@ -261,15 +239,14 @@
" <state name='b' />" +
" <state name='c' />" +
"</process-definition>");
-
+
processDefinition = saveAndReload(processDefinition);
- try
- {
+ try {
Decision decision = (Decision) processDefinition.getNode("d");
assertEquals("#{a == 1}", decision.getLeavingTransition("one").getCondition());
assertEquals("#{a == 2}", decision.getLeavingTransition("two").getCondition());
assertEquals("#{a == 3}", decision.getLeavingTransition("three").getCondition());
-
+
// Assure org.jbpm.graph.node.Decision#execute gets the conditions from
// table JBPM_TRANSITIONS rather than the obsolete JBPM_DECISIONCONDITION:
ProcessInstance processInstance = new ProcessInstance(processDefinition);
@@ -277,10 +254,8 @@
processInstance.signal();
assertEquals(processDefinition.getNode("b"), processInstance.getRootToken().getNode());
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
-
- }
+ }
}
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2784/JBPM2784Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2784/JBPM2784Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2784/JBPM2784Test.java 2010-03-04 13:17:09 UTC (rev 6209)
@@ -0,0 +1,66 @@
+/*
+ * 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.jbpm2784;
+
+import java.util.Random;
+
+import org.jbpm.AbstractJbpmTestCase;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * JBPM-2784: XML schema does not accept condition attribute in transition.
+ *
+ * @author Alejandro Guizar
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2784">JBPM-2784</a>
+ */
+public class JBPM2784Test extends AbstractJbpmTestCase {
+
+ public void testTransitionConditionAttribute() {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<?xml version='1.0'?>"
+ + "<process-definition name='jbpm2784' xmlns='urn:jbpm.org:jpdl-3.2'>"
+ + " <start-state name='start'>"
+ + " <transition to='blackjack'/>"
+ + " </start-state>"
+ + " <decision name='blackjack'>"
+ + " <transition name='hit' to='hit' condition='${count < 17}'/>"
+ + " <transition name='stand' to='stand'/>"
+ + " </decision>"
+ + " <end-state name='hit'/>"
+ + " <end-state name='stand'/>"
+ + "</process-definition>");
+
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+
+ int count = new Random().nextInt(21) + 1;
+ ContextInstance contextInstance = processInstance.getContextInstance();
+ contextInstance.setVariable("count", new Integer(count));
+
+ processInstance.signal();
+ assertTrue("expected " + processInstance + " to have ended", processInstance.hasEnded());
+
+ assertEquals(count < 17 ? "hit" : "stand", processInstance.getRootToken()
+ .getNode()
+ .getName());
+ }
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2784/JBPM2784Test.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/el/DecisionExpressionTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/el/DecisionExpressionTest.java 2010-03-04 07:33:35 UTC (rev 6208)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/el/DecisionExpressionTest.java 2010-03-04 13:17:09 UTC (rev 6209)
@@ -69,7 +69,7 @@
fail("expected exception");
}
catch (JbpmException e) {
- assertTrue(e.getMessage().indexOf("non existing transition") != -1);
+ assert e.getMessage().indexOf("UNDEFINED") != -1 : e;
}
}
@@ -82,7 +82,7 @@
fail("expected exception");
}
catch (JbpmException e) {
- // OK
+ assert e.getMessage().indexOf("null") != -1 : e;
}
}
14 years, 2 months
JBoss JBPM SVN: r6208 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src: main/java/org/jbpm/persistence and 2 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-03-04 02:33:35 -0500 (Thu, 04 Mar 2010)
New Revision: 6208
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2637/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2637/JBPM2637Test.java
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/TaskMgmtSession.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/JbpmPersistenceException.java
Log:
JBPM-2637: check for empty taskInstanceIds list in TaskMgmtSession.findTaskInstancesByIds
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2010-03-03 19:06:53 UTC (rev 6207)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2010-03-04 07:33:35 UTC (rev 6208)
@@ -27,10 +27,9 @@
import java.util.Iterator;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
+import org.hibernate.ObjectNotFoundException;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
@@ -42,7 +41,7 @@
import org.jbpm.persistence.JbpmPersistenceException;
/**
- * are the graph related database operations.
+ * graph-related database operations.
*/
public class GraphSession {
@@ -63,32 +62,34 @@
// process definitions //////////////////////////////////////////////////////
+ /**
+ * assigns a version number to the given process definition and then makes it
+ * persistent.
+ */
public void deployProcessDefinition(ProcessDefinition processDefinition) {
- String processDefinitionName = processDefinition.getName();
// versioning applies to named process definitions only
- if (processDefinitionName != null) {
- // find the current latest process definition
- ProcessDefinition previousLatestVersion = findLatestProcessDefinition(processDefinitionName);
- // if there is a current latest process definition
- if (previousLatestVersion != null) {
- // take the next version number
- processDefinition.setVersion(previousLatestVersion.getVersion() + 1);
- }
- else {
- // start from 1
- processDefinition.setVersion(1);
- }
- session.save(processDefinition);
+ String processName = processDefinition.getName();
+ if (processName == null) {
+ throw new JbpmException("process definition has no name");
}
+ // find the current latest process definition
+ ProcessDefinition previousLatestVersion = findLatestProcessDefinition(processName);
+ // if there is a current latest process definition
+ if (previousLatestVersion != null) {
+ // take the next version number
+ processDefinition.setVersion(previousLatestVersion.getVersion() + 1);
+ }
else {
- throw new JbpmException("process definition does not have a name");
+ // start from 1
+ processDefinition.setVersion(1);
}
+ saveProcessDefinition(processDefinition);
}
/**
- * saves the process definitions. this method does not assign a version number. that is the
- * responsibility of the {@link #deployProcessDefinition(ProcessDefinition)
- * deployProcessDefinition} method.
+ * saves the process definition. this method does not assign a version
+ * number.
+ * @see {@link #deployProcessDefinition(ProcessDefinition)}
*/
public void saveProcessDefinition(ProcessDefinition processDefinition) {
try {
@@ -101,80 +102,85 @@
}
/**
- * loads a process definition from the database by the identifier.
- *
- * @throws JbpmPersistenceException in case the referenced process definition doesn't exist.
+ * returns the persistent process definition with the given identifier,
+ * assuming the definition exists. if the requested process definition does
+ * not exist in the database, {@link ObjectNotFoundException} is thrown when
+ * the definition state is first accessed.
*/
public ProcessDefinition loadProcessDefinition(long processDefinitionId) {
try {
- return (ProcessDefinition) session.load(ProcessDefinition.class, new Long(
- processDefinitionId));
+ return (ProcessDefinition) session.load(ProcessDefinition.class,
+ new Long(processDefinitionId));
}
catch (HibernateException e) {
handle(e);
throw new JbpmPersistenceException("could not load process definition "
- + processDefinitionId, e);
+ + processDefinitionId, e);
}
}
/**
- * gets a process definition from the database by the identifier.
+ * returns the persistent process definition with the given identifier.
*
- * @return the referenced process definition or null in case it doesn't exist.
+ * @return the referenced process definition, or <code>null</code> if there is
+ * no such definition.
*/
public ProcessDefinition getProcessDefinition(long processDefinitionId) {
try {
- return (ProcessDefinition) session.get(ProcessDefinition.class, new Long(
- processDefinitionId));
+ return (ProcessDefinition) session.get(ProcessDefinition.class,
+ new Long(processDefinitionId));
}
catch (HibernateException e) {
handle(e);
throw new JbpmPersistenceException("could not get process definition "
- + processDefinitionId, e);
+ + processDefinitionId, e);
}
}
/**
- * queries the database for a process definition with the given name and version.
+ * finds the process definition with the given name and version.
*/
public ProcessDefinition findProcessDefinition(String name, int version) {
try {
return (ProcessDefinition) session.getNamedQuery("GraphSession.findProcessDefinitionByNameAndVersion")
- .setString("name", name)
- .setInteger("version", version)
- .uniqueResult();
+ .setString("name", name)
+ .setInteger("version", version)
+ .uniqueResult();
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("could not find process definition '" + name
- + "' at version " + version, e);
+ throw new JbpmPersistenceException("could not find process definition by name '" + name
+ + "' and version " + version, e);
}
}
/**
- * queries the database for the latest version of a process definition with the given name.
+ * queries the database for the latest version of a process definition with
+ * the given name.
*/
public ProcessDefinition findLatestProcessDefinition(String name) {
try {
return (ProcessDefinition) session.getNamedQuery("GraphSession.findLatestProcessDefinitionQuery")
- .setString("name", name)
- .setMaxResults(1)
- .uniqueResult();
+ .setString("name", name)
+ .setMaxResults(1)
+ .uniqueResult();
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("could not find process definition '" + name + "'", e);
+ throw new JbpmPersistenceException("could not find process definition by name " + name, e);
}
}
/**
- * queries the database for the latest version of each process definition. Process definitions
- * are distinct by name.
+ * queries the database for the latest version of each process definition.
+ * process definitions are distinct by name.
*/
public List findLatestProcessDefinitions() {
try {
List tuples = session.getNamedQuery("GraphSession.findLatestProcessDefinitions").list();
- List result = new ArrayList();
+ if (tuples.isEmpty()) return Collections.EMPTY_LIST;
+
+ List result = new ArrayList(tuples.size());
for (Iterator i = tuples.iterator(); i.hasNext();) {
Object[] tuple = (Object[]) i.next();
String name = (String) tuple[0];
@@ -185,20 +191,26 @@
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException(
- "could not find latest versions of process definitions", e);
+ throw new JbpmPersistenceException("could not find latest process definitions", e);
}
}
public List findProcessDefinitions(Collection processDefinitionIds) {
- return session.createCriteria(ProcessDefinition.class)
+ try {
+ return session.createCriteria(ProcessDefinition.class)
.add(Restrictions.in("id", processDefinitionIds))
.list();
+ }
+ catch (HibernateException e) {
+ handle(e);
+ throw new JbpmPersistenceException("could not find process definitions by identifiers "
+ + processDefinitionIds, e);
+ }
}
/**
- * queries the database for all process definitions, ordered by name (ascending), then by
- * version (descending).
+ * queries the database for all process definitions, ordered by name
+ * (ascending), then by version (descending).
*/
public List findAllProcessDefinitions() {
try {
@@ -211,19 +223,19 @@
}
/**
- * queries the database for all versions of process definitions with the given name, ordered
- * by version (descending).
+ * queries the database for all versions of process definitions with the given
+ * name, ordered by version (descending).
*/
public List findAllProcessDefinitionVersions(String name) {
try {
return session.getNamedQuery("GraphSession.findAllProcessDefinitionVersions")
- .setString("name", name)
- .list();
+ .setString("name", name)
+ .list();
}
catch (HibernateException e) {
- log.error(e);
- throw new JbpmPersistenceException("could not find all versions of process definition '"
- + name + "'", e);
+ handle(e);
+ throw new JbpmPersistenceException("could not find all process definitions by name "
+ + name, e);
}
}
@@ -235,17 +247,14 @@
try {
// delete all the process instances of this definition
List processInstanceIds = session.getNamedQuery("GraphSession.findAllProcessInstanceIdsForDefinition")
- .setLong("processDefinitionId", processDefinition.getId())
- .list();
+ .setLong("processDefinitionId", processDefinition.getId())
+ .list();
for (Iterator i = processInstanceIds.iterator(); i.hasNext();) {
Long processInstanceId = (Long) i.next();
ProcessInstance processInstance = getProcessInstance(processInstanceId.longValue());
if (processInstance != null) {
deleteProcessInstance(processInstance);
}
- else {
- log.debug("process instance " + processInstanceId + " has been deleted already");
- }
}
List referencingProcessStates = findReferencingProcessStates(processDefinition);
@@ -265,8 +274,8 @@
List findReferencingProcessStates(ProcessDefinition subProcessDefinition) {
return session.getNamedQuery("GraphSession.findReferencingProcessStates")
- .setEntity("subProcessDefinition", subProcessDefinition)
- .list();
+ .setEntity("subProcessDefinition", subProcessDefinition)
+ .list();
}
// process instances ////////////////////////////////////////////////////////
@@ -280,11 +289,10 @@
}
/**
- * loads a process instance from the database by the identifier. This throws an exception in
- * case the process instance does not exist.
- *
- * @see #getProcessInstance(long)
- * @throws JbpmPersistenceException in case the process instance doesn't exist.
+ * returns the persistent process instance with the given identifier, assuming
+ * the instance exists. if the requested process instance does not exist in
+ * the database, {@link ObjectNotFoundException} is thrown when the instance
+ * state is first accessed.
*/
public ProcessInstance loadProcessInstance(long processInstanceId) {
try {
@@ -292,14 +300,16 @@
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException(
- "could not load process instance " + processInstanceId, e);
+ throw new JbpmPersistenceException("could not load process instance "
+ + processInstanceId, e);
}
}
/**
- * gets a process instance from the database by the identifier. This method returns null in
- * case the given process instance does not exist.
+ * returns the persistent process instance with the given identifier.
+ *
+ * @return the referenced process instance, or <code>null</code> if there is
+ * no such instance
*/
public ProcessInstance getProcessInstance(long processInstanceId) {
try {
@@ -307,16 +317,16 @@
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("could not get process instance " + processInstanceId,
- e);
+ throw new JbpmPersistenceException("could not get process instance "
+ + processInstanceId, e);
}
}
/**
- * loads a token from the database by the identifier.
- *
- * @return the token.
- * @throws JbpmPersistenceException in case the referenced token doesn't exist.
+ * returns the persistent token with the given identifier, assuming the token
+ * exists. if the requested token does not exist in the database,
+ * {@link ObjectNotFoundException} is thrown when the token state is first
+ * accessed.
*/
public Token loadToken(long tokenId) {
try {
@@ -329,9 +339,10 @@
}
/**
- * gets a token from the database by the identifier.
+ * returns the persistent token with the given identifier.
*
- * @return the token or null in case the token doesn't exist.
+ * @return the referenced token, or <code>null</code> if there is no such
+ * token.
*/
public Token getToken(long tokenId) {
try {
@@ -344,7 +355,7 @@
}
/**
- * locks a process instance in the database.
+ * obtains a pessimistic lock on the process instance with the given identifier.
*/
public void lockProcessInstance(long processInstanceId) {
try {
@@ -352,13 +363,13 @@
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException(
- "could not lock process instance " + processInstanceId, e);
+ throw new JbpmPersistenceException("could not lock process instance "
+ + processInstanceId, e);
}
}
/**
- * locks a process instance in the database.
+ * obtains a pessimistic lock on the given process instance.
*/
public void lockProcessInstance(ProcessInstance processInstance) {
try {
@@ -371,19 +382,19 @@
}
/**
- * fetches all processInstances for the given process definition from the database. The
- * returned list of process instances is sorted start date, youngest first.
+ * finds all instances of the given process definition.
+ * @return a list of process instances ordered by start date, earliest first
*/
public List findProcessInstances(long processDefinitionId) {
try {
return session.getNamedQuery("GraphSession.findAllProcessInstancesForDefinition")
- .setLong("processDefinitionId", processDefinitionId)
- .list();
+ .setLong("processDefinitionId", processDefinitionId)
+ .list();
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException(
- "could not find process instances for process definition " + processDefinitionId, e);
+ throw new JbpmPersistenceException("could not find instances for process definition "
+ + processDefinitionId, e);
}
}
@@ -396,7 +407,7 @@
}
public void deleteProcessInstance(ProcessInstance processInstance, boolean includeTasks,
- boolean includeJobs) {
+ boolean includeJobs) {
if (processInstance == null) {
throw new IllegalArgumentException("processInstance cannot be null");
}
@@ -420,7 +431,6 @@
if (includeTasks) deleteTasks(processInstance);
// delete the process instance
- log.debug("deleting " + processInstance);
session.delete(processInstance);
}
catch (HibernateException e) {
@@ -430,52 +440,40 @@
}
void deleteJobs(ProcessInstance processInstance) {
- log.debug("deleting jobs for " + processInstance);
- int entityCount = session.getNamedQuery("GraphSession.deleteJobsForProcessInstance")
- .setEntity("processInstance", processInstance)
- .executeUpdate();
- log.debug("deleted " + entityCount + " jobs for " + processInstance);
+ session.getNamedQuery("GraphSession.deleteJobsForProcessInstance")
+ .setEntity("processInstance", processInstance)
+ .executeUpdate();
}
void deleteLogs(ProcessInstance processInstance) {
- log.debug("deleting logs for " + processInstance);
List logs = session.getNamedQuery("GraphSession.findLogsForProcessInstance")
- .setEntity("processInstance", processInstance)
- .list();
+ .setEntity("processInstance", processInstance)
+ .list();
for (Iterator i = logs.iterator(); i.hasNext();) {
session.delete(i.next());
}
}
void detachFromSuperProcess(ProcessInstance processInstance, Token superProcessToken) {
- log.debug("detaching " + processInstance + " from " + superProcessToken);
processInstance.setSuperProcessToken(null);
superProcessToken.setSubProcessInstance(null);
}
void deleteSubProcesses(ProcessInstance processInstance) {
- log.debug("deleting subprocesses for " + processInstance);
List subProcessInstances = session.getNamedQuery("GraphSession.findSubProcessInstances")
- .setEntity("processInstance", processInstance)
- .list();
+ .setEntity("processInstance", processInstance)
+ .list();
- if (subProcessInstances.isEmpty()) {
- log.debug("no subprocesses to delete for " + processInstance);
- return;
- }
-
for (Iterator i = subProcessInstances.iterator(); i.hasNext();) {
ProcessInstance subProcessInstance = (ProcessInstance) i.next();
- log.debug("preparing to delete Sub" + subProcessInstance);
deleteProcessInstance(subProcessInstance);
}
}
void deleteTasks(ProcessInstance processInstance) {
- log.debug("deleting tasks for " + processInstance);
List tasks = session.getNamedQuery("GraphSession.findTaskInstancesForProcessInstance")
- .setEntity("processInstance", processInstance)
- .list();
+ .setEntity("processInstance", processInstance)
+ .list();
for (Iterator i = tasks.iterator(); i.hasNext();) {
session.delete(i.next());
}
@@ -542,79 +540,84 @@
public List calculateAverageTimeByNode(long processDefinitionId, long minumumDurationMillis) {
try {
List tuples = session.getNamedQuery("GraphSession.calculateAverageTimeByNode")
- .setLong("processDefinitionId", processDefinitionId)
- .setDouble("minimumDuration", minumumDurationMillis)
- .list();
+ .setLong("processDefinitionId", processDefinitionId)
+ .setDouble("minimumDuration", minumumDurationMillis)
+ .list();
+ if (tuples.isEmpty()) return Collections.EMPTY_LIST;
- List results;
- if (!tuples.isEmpty()) {
- results = new ArrayList();
+ List results = new ArrayList();
+ for (Iterator i = tuples.iterator(); i.hasNext();) {
+ Object[] values = (Object[]) i.next();
- for (Iterator i = tuples.iterator(); i.hasNext();) {
- Object[] values = (Object[]) i.next();
- AverageNodeTimeEntry averageNodeTimeEntry = new AverageNodeTimeEntry();
- averageNodeTimeEntry.setNodeId(((Number) values[0]).longValue());
- averageNodeTimeEntry.setNodeName((String) values[1]);
- averageNodeTimeEntry.setCount(((Number) values[2]).intValue());
- averageNodeTimeEntry.setAverageDuration(((Number) values[3]).longValue());
- averageNodeTimeEntry.setMinDuration(((Number) values[4]).longValue());
- averageNodeTimeEntry.setMaxDuration(((Number) values[5]).longValue());
+ AverageNodeTimeEntry entry = new AverageNodeTimeEntry();
+ entry.setNodeId(((Number) values[0]).longValue());
+ entry.setNodeName((String) values[1]);
+ entry.setCount(((Number) values[2]).intValue());
+ entry.setAverageDuration(((Number) values[3]).longValue());
+ entry.setMinDuration(((Number) values[4]).longValue());
+ entry.setMaxDuration(((Number) values[5]).longValue());
- results.add(averageNodeTimeEntry);
- }
+ results.add(entry);
}
- else {
- results = Collections.EMPTY_LIST;
- }
return results;
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("could not calculate average time by node for "
- + processDefinitionId, e);
+ throw new JbpmPersistenceException("could not calculate average time by node "
+ + "for process definition " + processDefinitionId, e);
}
}
public List findActiveNodesByProcessInstance(ProcessInstance processInstance) {
try {
return session.getNamedQuery("GraphSession.findActiveNodesByProcessInstance")
- .setEntity("processInstance", processInstance)
- .list();
+ .setEntity("processInstance", processInstance)
+ .list();
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("could not find active nodes for " + processInstance,
- e);
+ throw new JbpmPersistenceException("could not find active nodes for "
+ + processInstance, e);
}
}
+ /**
+ * returns the instance of the given process definition with the specified
+ * business key.
+ *
+ * @return the referenced instance, or <code>null</code> if there is no such
+ * instance
+ */
public ProcessInstance getProcessInstance(ProcessDefinition processDefinition, String key) {
try {
return (ProcessInstance) session.getNamedQuery("GraphSession.findProcessInstanceByKey")
- .setEntity("processDefinition", processDefinition)
- .setString("key", key)
- .uniqueResult();
+ .setEntity("processDefinition", processDefinition)
+ .setString("key", key)
+ .uniqueResult();
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("could not get process instance with key '" + key
- + "'", e);
+ throw new JbpmPersistenceException("could not get process instance by key " + key, e);
}
}
+ /**
+ * returns the instance of the given process definition with the specified
+ * business key, assuming the instance exists.
+ *
+ * @throws JbpmPersistenceException if the referenced process instance does
+ * not exist
+ */
public ProcessInstance loadProcessInstance(ProcessDefinition processDefinition, String key) {
ProcessInstance processInstance = getProcessInstance(processDefinition, key);
if (processInstance == null) {
- throw new JbpmException("no process instance was found with key '" + key + "'");
+ throw new JbpmPersistenceException("could not load process instance by key " + key);
}
return processInstance;
}
private void handle(HibernateException exception) {
- // exception will be rethrown, no need to log here at a verbose level
- log.debug(exception);
+ // exception will be rethrown, no need to log here
if (jbpmSession != null) jbpmSession.handleException();
}
-
- private static final Log log = LogFactory.getLog(GraphSession.class);
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/TaskMgmtSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/TaskMgmtSession.java 2010-03-03 19:06:53 UTC (rev 6207)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/TaskMgmtSession.java 2010-03-04 07:33:35 UTC (rev 6208)
@@ -22,10 +22,9 @@
package org.jbpm.db;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.Session;
@@ -51,39 +50,37 @@
}
/**
- * get the tasklist for a given actor.
+ * get the task list for a given actor.
*/
public List findTaskInstances(String actorId) {
try {
return session.getNamedQuery("TaskMgmtSession.findTaskInstancesByActorId")
- .setString("actorId", actorId)
- .list();
+ .setString("actorId", actorId)
+ .list();
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("couldn't get task instances list for actor '"
- + actorId
- + "'", e);
+ throw new JbpmPersistenceException("could not find task instances by actor " + actorId, e);
}
}
/**
- * get all the task instances for all the given actorIds.
+ * get all the task instances for all the given actor identifiers.
*
- * @return a list of task instances. An empty list is returned in case no task instances are
- * found.
+ * @return a list of task instances. An empty list is returned in case no task
+ * instances are found.
*/
public List findTaskInstances(List actorIds) {
+ if (actorIds.isEmpty()) return Collections.EMPTY_LIST;
try {
return session.getNamedQuery("TaskMgmtSession.findTaskInstancesByActorIds")
- .setParameterList("actorIds", actorIds)
- .list();
+ .setParameterList("actorIds", actorIds)
+ .list();
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("couldn't get task instances list for actors '"
- + actorIds
- + "'", e);
+ throw new JbpmPersistenceException("could not find task instances by actors " + actorIds,
+ e);
}
}
@@ -100,15 +97,14 @@
public List findPooledTaskInstances(String actorId) {
try {
List taskInstanceIds = session.getNamedQuery("TaskMgmtSession.findPooledTaskInstancesByActorId")
- .setString("actorId", actorId)
- .list();
+ .setString("actorId", actorId)
+ .list();
return findTaskInstancesByIds(taskInstanceIds);
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("couldn't get pooled task instances list for actor '"
- + actorId
- + "'", e);
+ throw new JbpmPersistenceException("could not find pooled task instances by actor "
+ + actorId, e);
}
}
@@ -116,17 +112,17 @@
* get the task instances for which the given actor is in the pool.
*/
public List findPooledTaskInstances(List actorIds) {
+ if (actorIds.isEmpty()) return Collections.EMPTY_LIST;
try {
List taskInstanceIds = session.getNamedQuery("TaskMgmtSession.findPooledTaskInstancesByActorIds")
- .setParameterList("actorIds", actorIds)
- .list();
+ .setParameterList("actorIds", actorIds)
+ .list();
return findTaskInstancesByIds(taskInstanceIds);
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("couldn't get pooled task instances list for actors '"
- + actorIds
- + "'", e);
+ throw new JbpmPersistenceException("could not find pooled task instances by actors "
+ + actorIds, e);
}
}
@@ -136,13 +132,12 @@
public List findTaskInstancesByToken(long tokenId) {
try {
return session.getNamedQuery("TaskMgmtSession.findTaskInstancesByTokenId")
- .setLong("tokenId", tokenId)
- .list();
+ .setLong("tokenId", tokenId)
+ .list();
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("couldn't get task instances by token '" + tokenId + "'",
- e);
+ throw new JbpmPersistenceException("could not find task instances by token " + tokenId, e);
}
}
@@ -152,14 +147,13 @@
public List findTaskInstancesByProcessInstance(ProcessInstance processInstance) {
try {
return session.getNamedQuery("TaskMgmtSession.findTaskInstancesByProcessInstance")
- .setEntity("processInstance", processInstance)
- .list();
+ .setEntity("processInstance", processInstance)
+ .list();
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("couldn't get task instances by process instance '"
- + processInstance
- + "'", e);
+ throw new JbpmPersistenceException("could not find task instances by " + processInstance,
+ e);
}
}
@@ -173,7 +167,7 @@
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("couldn't get task instance '" + taskInstanceId + "'", e);
+ throw new JbpmPersistenceException("could not load task instance " + taskInstanceId, e);
}
return taskInstance;
}
@@ -188,30 +182,27 @@
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("couldn't get task instance '" + taskInstanceId + "'", e);
+ throw new JbpmPersistenceException("could not get task instance " + taskInstanceId, e);
}
return taskInstance;
}
public List findTaskInstancesByIds(List taskInstanceIds) {
+ if (taskInstanceIds.isEmpty()) return Collections.EMPTY_LIST;
try {
return session.getNamedQuery("TaskMgmtSession.findTaskInstancesByIds")
- .setParameterList("taskInstanceIds", taskInstanceIds)
- .list();
+ .setParameterList("taskInstanceIds", taskInstanceIds)
+ .list();
}
catch (HibernateException e) {
handle(e);
- throw new JbpmPersistenceException("couldn't get task instances by ids '"
- + taskInstanceIds
- + "'", e);
+ throw new JbpmPersistenceException("could not find task instances by identifiers "
+ + taskInstanceIds, e);
}
}
private void handle(HibernateException exception) {
- // exception will be rethrown, no need to log here at a verbose level
- log.debug(exception);
+ // exception will be rethrown, no need to log here
if (jbpmSession != null) jbpmSession.handleException();
}
-
- private static final Log log = LogFactory.getLog(TaskMgmtSession.class);
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/JbpmPersistenceException.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/JbpmPersistenceException.java 2010-03-03 19:06:53 UTC (rev 6207)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/JbpmPersistenceException.java 2010-03-04 07:33:35 UTC (rev 6208)
@@ -27,6 +27,10 @@
private static final long serialVersionUID = 1L;
+ public JbpmPersistenceException(String message) {
+ super(message);
+ }
+
public JbpmPersistenceException(String message, Throwable cause) {
super(message, cause);
}
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2637/JBPM2637Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2637/JBPM2637Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2637/JBPM2637Test.java 2010-03-04 07:33:35 UTC (rev 6208)
@@ -0,0 +1,77 @@
+/*
+ * 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.jbpm2637;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.db.TaskMgmtSession;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * {@link TaskMgmtSession#findTaskInstancesByIds(List)} fails if taskInstanceIds
+ * is an empty list.
+ *
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2637">JBPM-2637</a>
+ * @author Alejandro Guizar
+ */
+public class JBPM2637Test extends AbstractDbTestCase {
+
+ private long processDefinitionId;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ ProcessDefinition processDefinition = ProcessDefinition.createNewProcessDefinition();
+ processDefinition.setName("jbpm2637");
+ jbpmContext.deployProcessDefinition(processDefinition);
+ processDefinitionId = processDefinition.getId();
+ newTransaction();
+
+ ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("jbpm2637");
+ processInstance.getTaskMgmtInstance().createTaskInstance(processInstance.getRootToken());
+ newTransaction();
+ }
+
+ protected void tearDown() throws Exception {
+ graphSession.deleteProcessDefinition(processDefinitionId);
+ super.tearDown();
+ }
+
+ public void testFindTaskInstancesEmptyActorList() {
+ assertEquals(0, taskMgmtSession.findTaskInstances(Collections.EMPTY_LIST).size());
+ }
+
+ public void testFindTaskInstancesEmptyActorArray() {
+ assertEquals(0, taskMgmtSession.findTaskInstances(new String[0]).size());
+ }
+
+ public void testFindPooledTaskInstancesEmptyActorList() {
+ assertEquals(0, taskMgmtSession.findPooledTaskInstances(Collections.EMPTY_LIST).size());
+ }
+
+ public void testFindTaskInstancesEmptyIdList() {
+ assertEquals(0, taskMgmtSession.findTaskInstancesByIds(Collections.EMPTY_LIST).size());
+ }
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2637/JBPM2637Test.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
14 years, 2 months
JBoss JBPM SVN: r6207 - projects/migration_tool/trunk.
by do-not-reply@jboss.org
Author: eschabell
Date: 2010-03-03 14:06:53 -0500 (Wed, 03 Mar 2010)
New Revision: 6207
Modified:
projects/migration_tool/trunk/notes.txt
Log:
Added some notes about upcoming meetings with developer organizations to sort present my ideas.
Modified: projects/migration_tool/trunk/notes.txt
===================================================================
--- projects/migration_tool/trunk/notes.txt 2010-03-01 10:35:38 UTC (rev 6206)
+++ projects/migration_tool/trunk/notes.txt 2010-03-03 19:06:53 UTC (rev 6207)
@@ -2,3 +2,7 @@
Some conversion tooling that exists for v3 jPDL -> v4 jPDL:
- http://docs.jboss.org/jbpm/v4/devguide/html_single/#processconversiontool
+
+
+03.03.2010 - waiting a bit on this project to get orientated with reactions to my ideas (migration strategy) that I will be
+presenting to some developer orgnizations. I want to see how they respond.
14 years, 2 months
JBoss JBPM SVN: r6206 - jbpm3/branches/jbpm-3.2-soa/docs.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2010-03-01 05:35:38 -0500 (Mon, 01 Mar 2010)
New Revision: 6206
Added:
jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.sequence.signal.png
jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.sequence.start.process.instance.png
jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.sequence.task.list.png
Removed:
jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.collaboration.png
Log:
extra transition docs
Deleted: jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.collaboration.png
===================================================================
(Binary files differ)
Added: jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.sequence.signal.png
===================================================================
(Binary files differ)
Property changes on: jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.sequence.signal.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.sequence.start.process.instance.png (from rev 6188, jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.collaboration.png)
===================================================================
(Binary files differ)
Property changes on: jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.sequence.start.process.instance.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.sequence.task.list.png
===================================================================
(Binary files differ)
Property changes on: jbpm3/branches/jbpm-3.2-soa/docs/jbpm3.api.sequence.task.list.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 2 months