[jboss-user] [JBoss jBPM] - how to dynamically override a swimlane at the time of execut

sumit.jbpm do-not-reply at jboss.com
Mon Dec 1 09:04:44 EST 2008


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>

code snippet contained in ActorSwimlaneHandler.java -->
.....
  | 		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);
  | 	.....

code snippet being used to createProcessInstance -->
.......	
  | 		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();
  | 	.......
  | 

Please reply soon. If you have any approximate idea then also share that with me.

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

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



More information about the jboss-user mailing list