[jboss-user] [JBoss jBPM] - Re: Ending tasks manually

frinux do-not-reply at jboss.com
Tue Jun 2 04:48:04 EDT 2009


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).

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4234630#4234630

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4234630



More information about the jboss-user mailing list