JBoss Community

Re: setActorID for Swimlane in JBPM5

created by Aditya Gaurav in jBPM - View the full discussion

Hi Maciej,

 

I am currently trying to work out a POC where I can change the actor on a Swimlane after the process has been started. i.e.

 

===

 




final ProcessInstance pi = ksession.startProcess("com.sample.evaluation1");

 

===

 

And then:

 

GenericCommand<Void> genericCommand = new GenericCommand<Void>(){

public Void execute(Context context){

 

                                                  System.out.println("inside execute");

                                                  StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession();

                                                  ProcessInstance processInstance = ksession.getProcessInstance(pi.getId());

                                                  WorkflowProcessInstance wfpi = (WorkflowProcessInstance)processInstance;

                                                  SwimlaneContextInstance slci = (SwimlaneContextInstance)wfpi.getContextInstance(SwimlaneContext.SWIMLANE_SCOPE);

 

                                                  SwimlaneContext sc = slci.getSwimlaneContext();

 

                                                  Swimlane s1 = sc.getSwimlane("SL1");

                                                  Swimlane s2 = sc.getSwimlane("SL2");

 

                                                  s1.setActorId("krisv");

                                                  s2.setActorId("mary");

 

//                                                  WorkflowProcessInstanceUpgrader.upgradeProcessInstance(ksession, processInstance.getId(), "com.sample.evaluation1", null);

 

                                                  //slci.setActorId("SL1", "krisv");

                                                  //slci.setActorId("SL2", "mary");

 

                                                  return null;

 

                                        }

                              };

 

ksession.execute(genericCommand);

================================

 

 

The intention is that we should be able to dynamically modify/set the actor ID (using setActorID method of Swimlane class).

 

 

Thanks

Reply to this message by going to Community

Start a new discussion in jBPM at Community