-
1. Re: Migrate app to jBPM - multiple starts
ningjinlin Nov 15, 2010 9:13 AM (in response to vcr)This my way to start up in the middle:
step 1:
save the Variable in the map when I star the processInstance :
map.put("startInMiddle", true);
this.executionService.startProcessInstanceByKey("chooseSite",map);
step 2:
add the assign-handdler or event-listener to all the activity you don't want to handle
like this:
@Override
public void assign(Assignable assignable,
OpenExecution execution) throws Exception {ExecutionImpl e = (ExecutionImpl) execution;
e.getVariable("starInMiddle").toString().equals(true){
e.execution).end();
}
} -
2. Re: Migrate app to jBPM - multiple starts
vcr Nov 15, 2010 11:00 AM (in response to ningjinlin)Thanks for sharing the info.
My test process is like this:
-------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<process name="Custom" xmlns="http://jbpm.org/4.3/jpdl">
<start g="20,20,48,48">
<transition to="node1"/>
</start>
<java class="org.jbpm.examples.custom.Node1" g="96,16,100,52" method="hello" name="node1">
<transition to="node2"/>
</java>
<java class="org.jbpm.examples.custom.Node2" g="243,17,100,52" method="hello" name="node2">
<transition to="end"/>
</java>
<end g="422,20,80,40" name="end"/></process>
-------------------------------------------------------------------------------------------------------------------
I have no experience with assign-handler, can you guide me a little, maybe with an example? Thank you.
-
3. Re: Migrate app to jBPM - multiple starts
vcr Nov 15, 2010 11:02 AM (in response to vcr)I want some executions to skip Node 1 and do just Node 2 for example.
-
4. Re: Migrate app to jBPM - multiple starts
ningjinlin Nov 15, 2010 11:51 AM (in response to vcr)I was wondering why do you choose to use java node ? the java node don't have the property of assign-handler
Try to use the state replace your java node , and add a start event listener
<on event="start">
<event-listener class="org.jbpm.examples.eventlistener.LogListener">
<field name="msg"><string value="start on activity wait"/></field>
</event-listener>
</on>
public void notify(EventListenerExecution execution) {ExecutionImpl e = (ExecutionImpl) execution;
e.getVariable("starInMiddle").toString().equals(true){
e.execution).end();
} -
5. Re: Migrate app to jBPM - multiple starts
ningjinlin Nov 15, 2010 11:52 AM (in response to ningjinlin)my msn eminemning@live.cn
-
6. Re: Migrate app to jBPM - multiple starts
vcr Nov 15, 2010 11:56 AM (in response to ningjinlin)I am using the java node because I need to execute some java in each node.
-
7. Re: Migrate app to jBPM - multiple starts
vcr Nov 16, 2010 3:43 AM (in response to vcr)Hi Ning,
Thanks for info. With an event listener I can execute something on start of every node.
But if in the listener I do: ((ExecutionImpl) execution).getExecution().end();
the execution is ended.
How can I do in the listener to end just the current activity?
Regards.
-
8. Re: Migrate app to jBPM - multiple starts
vcr Nov 16, 2010 10:38 AM (in response to vcr)I've tried:
ActivityExecution activityExecution = (ActivityExecution) event;
activityExecution.takeDefaultTransition();but I get:
org.jbpm.api.JbpmException: implementation bug: couldn't find parent activity(node1) around destination activity(node2)
-
9. Re: Migrate app to jBPM - multiple starts
vcr Nov 16, 2010 10:53 AM (in response to vcr)The jBPM dev guide is saying:
6.3. Event listener API
... the execution flow cannot be changed by the event listeners
so I think the execution can not be changed from listener.