1 Reply Latest reply on Dec 1, 2008 9:34 AM by Ronald van Kuijk

    how to dynamically override a swimlane at the time of execut

    Sumit Shrivastava Newbie

      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"?>
       xmlns="urn:jbpm.org:jpdl-3.1" name="ActorSwimlaneProcess">
       <swimlane name="AD">
       <assignment actor-id="user1"></assignment>
       <start-state name="start">
       <transition name="toNode" to="TaskNode"></transition>
       <task-node name="TaskNode">
       <task name="task1" swimlane="AD">
       <event type="task-create">
       <action class="com.framework.workflow.handlers.ActorSwimlaneHandler" />
       <transition name="toEnd" to="end">
       <end-state name="end"></end-state>

      code snippet contained in ActorSwimlaneHandler.java -->
       long taskId = executionContext.getTaskInstance().getId();
       TaskInstance ti = executionContext.getJbpmContext().getTaskInstance(taskId);
       SwimlaneInstance si = executionContext.getTaskInstance().getSwimlaneInstance();

      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();
       // Initiate the flow
       Token token = processInstance.getRootToken();

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