[jboss-user] [jBPM Development] - Fork activities with assignment handlers

Janarthanan K S do-not-reply at jboss.com
Thu Jun 10 04:25:32 EDT 2010


Janarthanan K S [http://community.jboss.org/people/janashanmug] created the discussion

"Fork activities with assignment handlers"

To view the discussion, visit: http://community.jboss.org/message/547291#547291

--------------------------------------------------------------
Hi

The fork activities does not end in join while using assignment-handlers in the tasks. Following is my jpdl. It seems the control does not goes beyond the task "Parallel Queue".

Is the way I handle the fork is correct? 

-------------------------------------------------------------------------------
hello_world.assignee.jpdl.xml
-------------------------------------------------------------------------------
 
<?xml version="1.0" encoding="UTF-8"?>
 
<process name="helloWorld" xmlns=" http://jbpm.org/4.3/jpdl http://jbpm.org/4.3/jpdl">
 <start g="27,248,80,40">
 <transition to="fork1"/>
 </start>
   <fork g="158,247,91,65" name="fork1">
      <on continue="exclusive" event="printHelloEnd"/>
      <transition g="182,486:" to="Parallel Queue"/>
      <transition g="182,61:121,-15" name="world" to="printHelloWorld"/>
   </fork>
   <join g="513,267,61,49" name="join1" continue="exclusive">
      <transition to="printHelloEnd"/>
   </join>
   <task g="224,457,211,57" name="Parallel Queue">
   <assignment-handler class="cos.workflow.helloworld.HelloWorldAssignmentHandler"/>
      <transition g="537,487:" to="join1"/>
   </task>
 <java class="cos.workflow.helloworld.Printer" g="468,42,138,40" method="printHelloWorld" name="printHelloWorld">
      <transition g="13,-27" name="join" to="join1"/>
 </java>
   <java class="cos.workflow.helloworld.Printer" g="664,268,116,48" method="printHelloEnd" name="printHelloEnd">
 <transition to="theEnd"/>
   </java>
 <end g="893,269,80,40" name="theEnd"/>
</process>

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

 

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/547291#547291]

Start a new discussion in jBPM Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2035]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100610/cf5f5f2b/attachment-0001.html 


More information about the jboss-user mailing list