Hi Elmo, thank you for your quick reply:
My code is more or less:
<task-node name="order" create-tasks="true" signal="last">
| <task swimlane="admin" name="Control">
| <controller>
| <variable name="var1" access="read"/>
| <variable name="var2" access="read"/>
| </controller>
| <event type="task-end">
| <action class="org.jbpm.example.endTasks"/>
| </event>
| </task>
| <task swimlane="buyer" name="Buyer-control">
| <controller>
| <variable name="var1" access="read"/>
| <variable name="var2" access="read"/>
| </controller>
| <event type="task-end">
| <action class="org.jbpm.example.endTasks"/>
| </event>
| </task>
|
| <transition name="Confirm" to="confirmed"/>
| <transition name="Cancel" to="cancel" />
|
| </task-node>
|
and the action something like:
package org.jbpm.example;
|
| import org.apache.commons.logging.Log;
| import org.apache.commons.logging.LogFactory;
| import org.jbpm.graph.def.ActionHandler;
| import org.jbpm.graph.exe.ExecutionContext;
| import org.jbpm.graph.exe.Token;
| import org.jbpm.taskmgmt.exe.TaskInstance;
| import java.util.Collection;
| import java.util.*;
|
| public class endTasks implements ActionHandler {
|
| private static final long serialVersionUID = 1L;
|
| String swimlaneName;
|
| public void execute(ExecutionContext executionContext) throws Exception {
|
| Token token = executionContext.getToken();
| log.info("###############################################");
| log.info("### TASKS-TERMINATOR ");
| log.info("###############################################");
| log.info("
!"+executionContext.getTaskMgmtInstance().hasUnfinishedTasks(token)+" ");
|
| TaskInstance ti= executionContext.getTaskInstance();
|
| Collection tasks =
executionContext.getTaskMgmtInstance().getUnfinishedTasks(token);
| Iterator taskItr = tasks.iterator();
| while(taskItr.hasNext()) {
| TaskInstance ti2 = (TaskInstance)taskItr.next();
| if (ti2!=ti) {
| if(!ti2.hasEnded() && !ti2.isCancelled()) {
| ti2.getContextInstance().createVariable("Ended by",
"Class");
| ti2.setSignalling(false);
| ti2.cancel();
| }
| }
| else {
| ti.getContextInstance().createVariable("Ended by", "Class");
| }
| }
|
|
| ti.end();
|
|
| private static final Log log = LogFactory.getLog(terminarTareas.class);
| }
|
I have also a timer in the process (in that task-node) but i don't have
problems with it. The main point is that tasks always take their default
transition (confirm in my case) and i don't want to execute twice the same
action in that node. Now i'm trying to define a new default transition to a nop
but it always appear as a button and i don't want the user to have this
possibility. How do yo make to see how the task ended? do you distinguish
between user and system ended tasks?
Thank you for your help. I didn't put my code in the first posts as i don't
want to solve MY particular problem (although of course i want) but solve it as
a general rule not only for me but for many other users of this forum who also
have this problem.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3925574#3925574
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3925574
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user