<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Fork activities with assignment handlers
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/janashanmug">Janarthanan K S</a> in <i>jBPM Development</i> - <a href="http://community.jboss.org/message/547291#547291">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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".</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Is the way I handle the fork is correct? </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><p>-------------------------------------------------------------------------------</p><p>hello_world.assignee.jpdl.xml</p><p>-------------------------------------------------------------------------------</p><div> </div></p><div id="_mcePaste"><div id="_mcePaste"><?xml version="1.0" encoding="UTF-8"?></div><div id="_mcePaste"> </div><div id="_mcePaste"><span><process name="helloWorld" xmlns="</span><a class="jive-link-external-small" href="http://jbpm.org/4.3/jpdl" target="_blank">http://jbpm.org/4.3/jpdl</a><span>"></span></div><div id="_mcePaste"><span> </span><start g="27,248,80,40"></div><div id="_mcePaste"><span> </span><transition to="fork1"/></div><div id="_mcePaste"><span> </span></start></div><div id="_mcePaste">   <fork g="158,247,91,65" name="fork1"></div><div id="_mcePaste">      <on continue="exclusive" event="printHelloEnd"/></div><div id="_mcePaste">      <transition g="182,486:" to="Parallel Queue"/></div><div id="_mcePaste">      <transition g="182,61:121,-15" name="world" to="printHelloWorld"/></div><div id="_mcePaste">   </fork></div><div id="_mcePaste">   <join g="513,267,61,49" name="join1" continue="exclusive"></div><div id="_mcePaste">      <transition to="printHelloEnd"/></div><div id="_mcePaste">   </join></div><div id="_mcePaste">   <task g="224,457,211,57" name="Parallel Queue"></div><div id="_mcePaste">   <assignment-handler class="cos.workflow.helloworld.HelloWorldAssignmentHandler"/></div><div id="_mcePaste">      <transition g="537,487:" to="join1"/></div><div id="_mcePaste">   </task></div><div id="_mcePaste"><span> </span><java class="cos.workflow.helloworld.Printer" g="468,42,138,40" method="printHelloWorld" name="printHelloWorld"></div><div id="_mcePaste">      <transition g="13,-27" name="join" to="join1"/></div><div id="_mcePaste"><span> </span></java></div><div id="_mcePaste">   <java class="cos.workflow.helloworld.Printer" g="664,268,116,48" method="printHelloEnd" name="printHelloEnd"></div><div id="_mcePaste"><span> </span><transition to="theEnd"/></div><div id="_mcePaste">   </java></div><div id="_mcePaste"><span> </span><end g="893,269,80,40" name="theEnd"/></div><div id="_mcePaste"></process></div></div><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>-------------------------------------------------------------------------------</p><p>cos.workflow.helloworld.Main</p><p>-------------------------------------------------------------------------------</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><p>public class Main {</p><p><span> </span>public static void main(String[] args) {</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span> </span>// Build jBPM services</p><p><span> </span>ProcessEngine processEngine = new Configuration().setResource("workflow.jbpm.cfg.xml").buildProcessEngine();</p><p><span> </span>RepositoryService repositoryService = processEngine.getRepositoryService();</p><p><span> </span>ExecutionService executionService = processEngine.getExecutionService();</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span> </span>// Deploy helloWorld process definition and start a process instance</p><p><span> </span>repositoryService.createDeployment().addResourceFromClasspath("hello_world.assignee.jpdl.xml").deploy();</p><p><span> </span>ProcessInstance processInstance = executionService.startProcessInstanceByKey("helloWorld");</p><p><span> </span>TaskService taskService = processEngine.getTaskService();</p><p><span> </span>String pid = processInstance.getId();</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span> </span> </p><p><span> </span>List < Task > taskList = taskService.findPersonalTasks("admin");</p><p>        Task task = taskList.get(0);</p><p>        taskService.completeTask(task.getId());</p><p>        processInstance = executionService.findProcessInstanceById(pid);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span> </span>}</p><p>}</p></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><p>-------------------------------------------------------------------------------</p><p>cos.workflow.helloworld.HelloWorldAssignmentHandler </p><p>-------------------------------------------------------------------------------</p><div> </div></p><p><p>public class HelloWorldAssignmentHandler implements COSAssignmentHandler {</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span> </span>/**</p><p><span> </span> * </p><p><span> </span> */</p><p><span> </span>private static final long serialVersionUID = 1L;</p><p><span> </span>String userId;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span> </span>/* (non-Javadoc)</p><p><span> </span> * @see org.jbpm.api.task.AssignmentHandler#assign(org.jbpm.api.task.Assignable, org.jbpm.api.model.OpenExecution)</p><p><span> </span> */</p><p><span> </span>public void assign(Assignable assignable, OpenExecution execution)</p><p><span> </span>throws Exception {</p><p><span> </span>userId = "admin";</p><p><span> </span>System.out.println("cos.workflow.helloworld.HelloWorldAssignmentHandler");</p><p><span> </span>assignable.setAssignee(userId);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span> </span>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>}</p></p><p><p>-------------------------------------------------------------------------------</p><p>cos.workflow.helloworld.Printer </p><p>-------------------------------------------------------------------------------</p><div> </div></p><p><p>public class Printer {</p><p><span> </span>public void printHelloWorld() {</p><p><span> </span>System.out.println("<---------------->");</p><p><span> </span>System.out.println("   HELLO WORLD!");</p><p><span> </span>System.out.println("<---------------->");</p><p><span> </span>}</p><p><span> </span>public void printHelloEnd() {</p><p><span> </span>System.out.println("<---------------->");</p><p><span> </span>System.out.println("   HELLO END!");</p><p><span> </span>System.out.println("<---------------->");</p><p><span> </span>}</p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks</p><p>Jana.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><div> </div></p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/547291#547291">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2035">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>