-
15. Re: Ending tasks manually
frinux May 27, 2009 8:13 AM (in response to wurzelbutz)tr is not null, and contains the right transition. That's whay that's strange, like the end(tr) was not working...
tr Transition (id=140) condition null description null events PersistentMap (id=147) exceptionHandlers PersistentList (id=150) from TaskNode_$$_javassist_219 (id=155) id 4 isConditionEnforced true name "refusee" (id=161) processDefinition ProcessDefinition_$$_javassist_185 (id=162) to Node_$$_javassist_254 (id=164)
And like kukeltje said, what is the aim of:taskInstance =jbpmContext.getTaskInstance(taskInstance.getID());
-
16. Re: Ending tasks manually
frinux May 27, 2009 8:18 AM (in response to wurzelbutz)I tried your code though, but not working.
Here is my code to check if I'm on the right node :Token currentToken = processInstance.getRootToken(); Node currentNode = currentToken.getNode(); if(currentNode.getName().equals("notifier_demande_refusee")) { ...
-
17. Re: Ending tasks manually
kukeltje May 27, 2009 8:26 AM (in response to wurzelbutz)can you try
taskInstance.end(tr.getName())
and see if it makes a difference?
Secondly, make a *full* unittest with *everything* embedded (the processdefinition as a string) so I can test it? -
18. Re: Ending tasks manually
kukeltje May 27, 2009 8:37 AM (in response to wurzelbutz)can you try
taskInstance.end(tr.getName())
and see if it makes a difference? (I doubt it but nevertheless)
And set the debug level for the TaskInstance class.
If that does not result in anything, make a *full* unittest with *everything* embedded (the processdefinition as a string) so I can test it? -
19. Re: Ending tasks manually
frinux May 27, 2009 9:56 AM (in response to wurzelbutz)It doesn't make any difference (I already tried before).
When debugging, I get the followinf messages (allthough not debug but WARN messages...°:WARN ProxyWarnLog:638 - Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks == WARN ProxyWarnLog:638 - Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks ==
I have no idea what it means... -
20. Re: Ending tasks manually
frinux May 27, 2009 10:58 AM (in response to wurzelbutz)All I see in the debug is that jBPM is taking the wrong transition. No error.
Here is the interesting part of the log :GraphElement:180 - event 'node-leave" on 'TaskNode(valider_demande)' for 'Token(/)' GraphElement:180 - event 'transition' on 'Transition(validee) for 'Token(/)' GraphElement:180 - event 'node-enter' on 'MailNode(notifier_acceptation) for 'Token(/)'
And here is my process definition:<?xml version="1.0" encoding="UTF-8"?> <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="demande"> <start-state name="saisir_demande"> <transition to="notifier_valideur" name="to notifier_valideur"></transition> </start-state> <mail-node name="notifier_valideur" to="#{demande.valideur.email}" template="task-assign"> <subject>#{mailSubject}</subject> <text>#{mailText}</text> <exception-handler exception-class="java.lang.Exception"> <action name="InvalidEmailAddressExceptionHandler" class="logica.actions.InvalidEmailAddressExceptionHandler"></action> </exception-handler> <transition to="valider_demande" name="to valider_demande"></transition> </mail-node> <task-node name="valider_demande"> <description> Le valideur doit valider ouy refuser manuellement la demande émise </description> <task name="valider_demande"> <description> Le valideur doit valider ou refuser la demande de congé effectuée par le collaborateur </description> <assignment class="logica.actions.ValideurAssignmentHandler"></assignment> <controller class="logica.actions.EndTaskControllerHandler"></controller> </task> <transition to="notifier_acceptation" name="validee"></transition> <transition to="notifier_refus" name="refusee"></transition> </task-node> <mail-node name="notifier_acceptation" to="#{demande.demandeur.email}"> <subject>#{mailSubject}</subject> <text>#{mailText}</text> <transition to="notifier_demande_validee" name="to notifier_demande_validee"></transition> </mail-node> <decision name="informer_chef_projet"> <handler class="logica.actions.CheckChefProjetDecisionHandler"></handler> <transition to="notifier_chef_projet" name="oui"></transition> <transition to="cloturer" name="non"></transition> </decision> <mail-node name="notifier_chef_projet" to="#{demande.chefProjet.email}" async="true"> <subject> #{mailSubject} </subject> <text> #{mailText} </text> <transition to="cloturer" name="chefprojet notifie"></transition> </mail-node> <task-node name="cloturer"> <task name="cloturer"> <description> La demande est considérée comme traitée. Cette finalisation est une tâche manuelle </description> <assignment actor-id="system"></assignment> <controller class="logica.actions.EndTaskControllerHandler"></controller> </task> <transition to="fin" name="to fin"></transition> </task-node> <task-node name="notifier_demande_refusee"> <task name="notifier_demande_refusee"> <assignment class="logica.actions.DemandeurAssignmentHandler"></assignment> </task> <transition to="fin_refus" name="to fin_refus"></transition> </task-node> <mail-node name="notifier_refus" to="#{demande.demandeur.email}"> <subject></subject> <text></text> <transition to="notifier_demande_refusee" name="to notifier_demande_refusee"></transition> </mail-node> <task-node name="notifier_demande_validee"> <task name="notifier_demande_validee"> <assignment class="logica.actions.DemandeurAssignmentHandler"></assignment> <controller class="logica.actions.EndTaskControllerHandler"></controller> </task> <transition to="informer_chef_projet" name="to informer_chef_projet"></transition> </task-node> <node name="relance_auto_1"> <transition to="notifier_valideur" name="relance_auto_1 effectuee"></transition> </node> <node name="relance_auto_2"> <transition to="notifier_valideur" name="relance_auto_2 effectuee"></transition> </node> <end-state name="fin"></end-state> <end-state name="fin_refus"></end-state> </process-definition>
-
21. Re: Ending tasks manually
frinux May 27, 2009 11:08 AM (in response to wurzelbutz)One strange thing I noticed: when I try to know the active node, I'm doing:
Token currentToken = processInstance.getRootToken();
Node currentNode = currentToken.getNode();
The strange thing is that the token is not null, but every value of its properties is null:currentToken Token_$$_javassist_187 (id=160) children null comments null end null handler JavassistLazyInitializer (id=183) id 0 isAbleToReactivateParent true isSuspended false isTerminationImplicit false lock null name null nextLogIndex 0 node null nodeEnter null parent null processInstance null start null subProcessInstance null version 0
-
22. Re: Ending tasks manually
kukeltje May 27, 2009 12:30 PM (in response to wurzelbutz)"frinux" wrote:
It doesn't make any difference (I already tried before).
When debugging, I get the followinf messages (allthough not debug but WARN messages...°:WARN ProxyWarnLog:638 - Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks == WARN ProxyWarnLog:638 - Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks ==
I have no idea what it means...
Search the forum, internet etc.... asked lots of times before -
23. Re: Ending tasks manually
kukeltje May 27, 2009 12:33 PM (in response to wurzelbutz)"frinux" wrote:
All I see in the debug is that jBPM is taking the wrong transition. No error.
Here is the interesting part of the log :GraphElement:180 - event 'node-leave" on 'TaskNode(valider_demande)' for 'Token(/)' GraphElement:180 - event 'transition' on 'Transition(validee) for 'Token(/)' GraphElement:180 - event 'node-enter' on 'MailNode(notifier_acceptation) for 'Token(/)'
As mentioned in my previous post, oh sorry, the one before that, please make a (minimal) unittest that demonstrates the problem. unitests are great for that, but make sure to embed *everything* in on full class without requiring external files. -
24. Re: Ending tasks manually
frinux Jun 2, 2009 4:47 AM (in response to wurzelbutz)Hum sorry but I don't have lot of time to build an sample of the error. I found a (dirty) way to do the job :
I noticed that although taskInstance.end(transition) doesn't work, token.signal(transition) does. So here is what I've done :Transition tr=taskInstance.getTask().getTaskNode().getLeavingTransition("refusee"); Token currentToken = processInstance.getRootToken(); currentToken.signal(tr); @SuppressWarnings(value={"unchecked"}) //taskMgmtSession returns a raw List... We ignore the warning thrown by Java List<TaskInstance> userTaskList2 = taskMgmtSession.findTaskInstances(demande.getDemandeur().getUsername()); for(int j = 0 ; j < userTaskList2.size() ; j++) { TaskInstance taskInstance2 = userTaskList2.get(j); if(taskInstance2.getProcessInstance().getId() == processInstanceId) { if(taskInstance2.getName().equals("valider_demande")); { taskInstance2.end(); break; } } }
It is a temporary solution, and it's not optimized but it works. I keep it like that until I don't find a clean way... (I still suspect that taskInstance.end(transition) doesn't work properly).