Tasks with assignment handlers in Fork doest not work
janashanmug Jun 10, 2010 4:45 AMHi
Tasks with assignment-handlers inside a fork does not end in join, It seems the control does not goes beyond the task.
Following is my jpdl. The control stops at "parallel Queue"
Is this the correct method to handle tasks inside a fork? Can anyone help me?
-------------------------------------------------------------------------------
hello_world.assignee.jpdl.xml
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
cos.workflow.helloworld.Main
-------------------------------------------------------------------------------
public class Main {
public static void main(String[] args) {
// Build jBPM services
ProcessEngine processEngine = new Configuration().setResource("workflow.jbpm.cfg.xml").buildProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
ExecutionService executionService = processEngine.getExecutionService();
// Deploy helloWorld process definition and start a process instance
repositoryService.createDeployment().addResourceFromClasspath("hello_world.assignee.jpdl.xml").deploy();
ProcessInstance processInstance = executionService.startProcessInstanceByKey("helloWorld");
TaskService taskService = processEngine.getTaskService();
String pid = processInstance.getId();
List < Task > taskList = taskService.findPersonalTasks("admin");
Task task = taskList.get(0);
taskService.completeTask(task.getId());
processInstance = executionService.findProcessInstanceById(pid);
}
}
-------------------------------------------------------------------------------
cos.workflow.helloworld.HelloWorldAssignmentHandler
-------------------------------------------------------------------------------
public class HelloWorldAssignmentHandler implements COSAssignmentHandler {
/**
*
*/
private static final long serialVersionUID = 1L;
String userId;
/* (non-Javadoc)
* @see org.jbpm.api.task.AssignmentHandler#assign(org.jbpm.api.task.Assignable, org.jbpm.api.model.OpenExecution)
*/
public void assign(Assignable assignable, OpenExecution execution)
throws Exception {
userId = "admin";
System.out.println("cos.workflow.helloworld.HelloWorldAssignmentHandler");
assignable.setAssignee(userId);
}
}
-------------------------------------------------------------------------------
cos.workflow.helloworld.Printer
-------------------------------------------------------------------------------
public class Printer {
public void printHelloWorld() {
System.out.println("<---------------->");
System.out.println(" HELLO WORLD!");
System.out.println("<---------------->");
}
public void printHelloEnd() {
System.out.println("<---------------->");
System.out.println(" HELLO END!");
System.out.println("<---------------->");
}
}
Thanks
Jana.