[jboss-jira] [JBoss JIRA] Created: (JBPM-854) Condition in transition not retrieved from database JBPM_TRANSITIONS#DECISION_
Arjan van Bentem (JIRA)
jira-events at lists.jboss.org
Wed Feb 28 04:52:38 EST 2007
Condition in transition not retrieved from database JBPM_TRANSITIONS#DECISION_
------------------------------------------------------------------------------
Key: JBPM-854
URL: http://jira.jboss.com/jira/browse/JBPM-854
Project: JBoss jBPM
Issue Type: Bug
Components: Core Engine
Affects Versions: jBPM jPDL 3.2 beta 2
Environment: All
Reporter: Arjan van Bentem
Assigned To: Tom Baeyens
Though table JBPM_DECISIONCONDITION is replaced by column DECISION_ in table JBPM_TRANSITIONS, the Java code will still query that old table to load processes that were deployed using a previous version. For an empty query result Hibernate will return an empty List (at least for the Hypersonic database), while the code only checks for the List to be null. This fails, and results in conditions not being taken from JBPM_TRANSITIONS.
Fix: replace line 105 of Decision.java (version 1.3)
http://fisheye.jboss.com/browse/JBPM/jbpm.3/jpdl/jar/src/main/java/org/jbpm/graph/node/Decision.java?r=1.3#l100
48 List decisionConditions = null;
:
105 } else if (decisionConditions!=null) {
106 // backwards compatible mode based on separate DecisionCondition
with
105 } else if (decisionConditions!=null && !decisionConditions.isEmpty()) {
To test one could replace org.jbpm.graph.node.JpdlDbTest#testDecision() to use correct EL expression, and then signal the process to invoke the troublesome code:
http://fisheye.jboss.com/browse/JBPM/jbpm.3/jpdl/jar/src/test/java/org/jbpm/graph/node/JpdlDbTest.java?r=1.2#l43
public void testDecision(){
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
" <start-state>" +
" <transition to='d' />" +
" </start-state>" +
" <decision name='d'>" +
" <transition name='one' to='a'>" +
" <condition>#{a == 1}</condition>" +
" </transition>" +
" <transition name='two' to='b'>" +
" <condition>#{a == 2}</condition>" +
" </transition>" +
" <transition name='three' to='c'>" +
" <condition>#{a == 3}</condition>" +
" </transition>" +
" </decision>" +
" <state name='a' />" +
" <state name='b' />" +
" <state name='c' />" +
"</process-definition>");
processDefinition = saveAndReload(processDefinition);
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);
processInstance.getContextInstance().setVariable("a", new Integer(2));
processInstance.signal();
assertEquals(processDefinition.getNode("b"), processInstance.getRootToken().getNode());
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list