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

frinux do-not-reply at jboss.com
Wed May 27 05:00:42 EDT 2009


Hum I'm encountering the same problem, but I can't make it work. Like you, I want to choose one transition among 2 existing. WHen I try this:

Transition tr=taskInstance.getTask().getTaskNode().getLeavingTransition("refusee");

I get the good transition. But when I do task.end(tr), it always takes the first transition (without any error).

Here is the complete code:


  | JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
  | try {
  | 
  | 	processInstance = jbpmContext.loadProcessInstance(processInstanceId);
  | 	
  | 	TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
  | 	@SuppressWarnings(value={"unchecked"}) //taskMgmtSession returns a raw List... We ignore the warning thrown by Java
  | 	List<TaskInstance> userTaskList = taskMgmtSession.findTaskInstances(demande.getValideur().getUsername());
  | 	
  | 	for(int i = 0 ; i < userTaskList.size() ; i++)
  | 	{
  | 		TaskInstance taskInstance = userTaskList.get(i);
  | 		if(taskInstance.getProcessInstance().getId() == processInstanceId)
  | 		{
  | 			if(taskInstance.getName().equals("valider_demande"))
  | 			{
  | 				processInstance.getContextInstance().setVariable("demande", demande);
  | 				Transition tr=taskInstance.getTask().getTaskNode().getLeavingTransition("refusee");
  | 				taskInstance.end(tr);
  | 				break;
  | 			}
  | 		}
  | 	}
  | 	
  | 	}
  | 

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

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



More information about the jboss-user mailing list