-
1. Re: Get all nodes in process definition when a SuperState is
mjm_uk Mar 23, 2006 2:29 PM (in response to hiata)I'm having the same issue...
Process Definition =
<?xml version="1.0" encoding="UTF-8"?>
<process-definition name="test">
<start-state name="start">
</start-state>
<end-state name="end1"></end-state>
<super-state name="super1">
</super-state>
<super-state name="super2">
</super-state>
<super-state name="super3">
</super-state>
</process-definition>
Code to get the nodes =
ProcessDefinition def1 = jbpmContext.getGraphSession().findLatestProcessDefinition("test");
System.err.println("*********** GET THE NODES ********** " + def1.getNodes().size());
for (Iterator i = def1.getNodes().iterator(); i.hasNext();) {
Node val = (Node)i.next();
System.err.println("Got node : " + val.getFullyQualifiedName());
}
System.err.println("*********** ALL OF THE NODES ********");
Result of Code =
19:21:18,777 INFO [STDOUT] *********** GET THE NODES ********** 6
19:21:18,777 INFO [STDOUT] Got node : super3/state5
19:21:18,777 INFO [STDOUT] Got node : super3/state6
19:21:18,777 INFO [STDOUT] Got node : super1
19:21:18,777 INFO [STDOUT] Got node : super2
19:21:18,777 INFO [STDOUT] Got node : super3
19:21:18,777 INFO [STDOUT] Got node : state7
19:21:18,777 INFO [STDOUT] *********** ALL OF THE NODES ********
If I change my code to: -
ProcessDefinition def1 = jbpmContext.getGraphSession().findLatestProcessDefinition("test");
System.err.println("*********** GET THE NODES ********** " + def1.getNodes().size());
for (Iterator i = def1.getNodes().iterator(); i.hasNext();) {
Node val = (Node)i.next();
if (val instanceof SuperState) {
for (Iterator j = ((SuperState)val).getNodes().iterator(); j.hasNext();) {
Node val1 = (Node)j.next();
System.err.println("Got node : " + val1.getFullyQualifiedName());
}
}
System.err.println("Got node : " + val.getFullyQualifiedName());
}
System.err.println("*********** ALL OF THE NODES ********");
I get: -
19:25:51,720 INFO [STDOUT] *********** GET THE NODES ********** 6
19:25:51,720 INFO [STDOUT] Got node : super3/state5
19:25:51,720 INFO [STDOUT] Got node : super3/state6
19:25:51,720 INFO [STDOUT] Got node : super1/state1
19:25:51,720 INFO [STDOUT] Got node : super1/state2
19:25:51,720 INFO [STDOUT] Got node : super1
19:25:51,720 INFO [STDOUT] Got node : super2/state3
19:25:51,720 INFO [STDOUT] Got node : super2/state4
19:25:51,720 INFO [STDOUT] Got node : super2
19:25:51,720 INFO [STDOUT] Got node : super3/state5
19:25:51,720 INFO [STDOUT] Got node : super3/state6
19:25:51,720 INFO [STDOUT] Got node : super3
19:25:51,720 INFO [STDOUT] Got node : state7
19:25:51,720 INFO [STDOUT] *********** ALL OF THE NODES ********
Which is still not totally correct because super3 is displayed twice. -
2. Re: Get all nodes in process definition when a SuperState is
mjm_uk Mar 27, 2006 5:30 AM (in response to hiata)Their is also a BUG here!!!
If there are more than 24 states e.g.
start
super1
state1
state2
super2
state3
state4
super3
state5
state6
state7
state8
state9
state10
state11
state12
state13
state14
state15
state16
state17
state19
state20
state21
state22
state23
super4
state24
state25
state26
state27
state28
end1
The output is (for the non nested version): -
10:04:55,488 INFO [STDOUT] *********** GET THE NODES ********** 24
10:04:55,488 INFO [STDOUT] Got node : super4/state24
10:04:55,488 INFO [STDOUT] Got node : super4/state25
10:04:55,488 INFO [STDOUT] Got node : super4/state26
10:04:55,488 INFO [STDOUT] Got node : super4/state27
10:04:55,488 INFO [STDOUT] Got node : state7
10:04:55,488 INFO [STDOUT] Got node : state8
10:04:55,488 INFO [STDOUT] Got node : state9
10:04:55,488 INFO [STDOUT] Got node : state10
10:04:55,488 INFO [STDOUT] Got node : state11
10:04:55,488 INFO [STDOUT] Got node : state12
10:04:55,488 INFO [STDOUT] Got node : state13
10:04:55,488 INFO [STDOUT] Got node : state14
10:04:55,488 INFO [STDOUT] Got node : state15
10:04:55,488 INFO [STDOUT] Got node : state16
10:04:55,488 INFO [STDOUT] Got node : state17
10:04:55,488 INFO [STDOUT] Got node : state18
10:04:55,488 INFO [STDOUT] Got node : state19
10:04:55,488 INFO [STDOUT] Got node : state20
10:04:55,488 INFO [STDOUT] Got node : state21
10:04:55,488 INFO [STDOUT] Got node : state22
10:04:55,488 INFO [STDOUT] Got node : state23
10:04:55,488 INFO [STDOUT] Got node : super4
10:04:55,488 INFO [STDOUT] Got node : state28
10:04:55,488 INFO [STDOUT] Got node : end1
10:04:55,488 INFO [STDOUT] *********** ALL OF THE NODES ********
As can be seen super states 1, 2 and 3, are not found (and their child nodes), and the start state ?start?, when a ?findNode? is called on the process definition for ?super1/state1? it is not found where as ?super4/state25? is found.
It seems that the super state is ?overwriting? the other nodes.
This is VERY urgent for me. Any ideas? Is this caused by hibernate? As the addNode on the process definition seems to be working correctly. I traced it though when deploying the definition above and the nodeList looked correct (iw all the start, end, super, and states not contained in the super state), but the version of the ProcessDefinition retrieved from hibernate has the issues described above.
Any help would be appreciated; and this needs to raised as a bug! -
3. Re: Get all nodes in process definition when a SuperState is
mjm_uk Mar 27, 2006 8:03 AM (in response to hiata)Well I've got a fix for this, can this be added as an issue?
The issue is that the ProcessDefinition.hbm.xml has: -
<list-index column="NODECOLLECTIONINDEX_" />
<one-to-many class="org.jbpm.graph.def.Node" />
This means that super states nodes and normal nodes that both have an nodecollectionindex_ of 0, 1 .... will get overriden by the last one loaded.
To resolve this issue I have added
where="SUPERSTATE_ is null" to the list criteria.
This is probably not the best way to go (I don't really know hibernate, but a filter looked like it might be more preferable). -
4. Re: Get all nodes in process definition when a SuperState is
hiata Mar 27, 2006 9:13 AM (in response to hiata)"mjm_uk" wrote:
Well I've got a fix for this, can this be added as an issue?
To resolve this issue I have added
where="SUPERSTATE_ is null" to the list criteria.
This is probably not the best way to go (I don't really know hibernate, but a filter looked like it might be more preferable).
Great!!
Could you show me where you have added the criteria code?
I´ll implement it and make the analysis of this change.
Best regards,
Hiata Anderson -
5. Re: Get all nodes in process definition when a SuperState is
mjm_uk Mar 28, 2006 4:50 AM (in response to hiata)Sorry I should have said, it's in the
\build\classes.jbpm\org\jbpm\graph\def\ProcessDefinition.hbm.xml
Change the nodes list: -
<list name="nodes" cascade="all" where="SUPERSTATE_ is null">.
Mark -
6. Re: Get all nodes in process definition when a SuperState is
koen.aers Mar 29, 2006 5:20 AM (in response to hiata)Can you please provide a JUnit test demonstrating the error in JIRA?
Regards,
Koen