Elaboration:- Say suppose I am defining a processdefinition.xml which contains only one task-node (containg only one task). I have defined a swimlane (using actor-id tag like: actor-id="user1").
Now at the time of execution (once the processinstance is getting created) if I want to override the swimlane with "user2", will JBPM allow that? If yes, how? And if not, why?
What I tried:-
ProcessDefinition.xml -->
<?xml version="1.0" encoding="UTF-8"?> <process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="ActorSwimlaneProcess"> <swimlane name="AD"> <assignment actor-id="user1"></assignment> </swimlane> <start-state name="start"> <transition name="toNode" to="TaskNode"></transition> </start-state> <task-node name="TaskNode"> <task name="task1" swimlane="AD"> <event type="task-create"> <action class="com.framework.workflow.handlers.ActorSwimlaneHandler" /> </event> </task> <transition name="toEnd" to="end"> </transition> </task-node> <end-state name="end"></end-state> </process-definition>
..... long taskId = executionContext.getTaskInstance().getId(); TaskInstance ti = executionContext.getJbpmContext().getTaskInstance(taskId); SwimlaneInstance si = executionContext.getTaskInstance().getSwimlaneInstance(); si.setActorId("user2"); ti.setSwimlaneInstance(si); executionContext.getJbpmContext().save(ti); .....
....... JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); GraphSession graphSession = jbpmContext.getGraphSession(); ProcessDefinition processDefinition = graphSession.findLatestProcessDefinition(processDefinitionName); ProcessInstance processInstance = new ProcessInstance(processDefinition); processInstanceID = processInstance.getId(); jbpmContext.save(processInstance); // Initiate the flow Token token = processInstance.getRootToken(); jbpmContext.save(token); token.signal(); jbpmContext.close(); .......
will JBPM allow that? If yes, how? And if not, why?