[jboss-user] [jBPM] - Re: setActorID for Swimlane in JBPM5
Maciej Swiderski
do-not-reply at jboss.com
Thu Feb 28 13:38:39 EST 2013
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion
"Re: setActorID for Swimlane in JBPM5"
To view the discussion, visit: https://community.jboss.org/message/800138#800138
--------------------------------------------------------------
just gave it a try on master, https://github.com/droolsjbpm/jbpm/blob/master/jbpm-test/src/test/java/org/jbpm/ProcessPersistenceHumanTaskOnLaneTest.java here is a test case that uses swimlanes and I added following code to check and change actorId on the swimlane and it worked fine, it was saved. To give that atry on that test case just replace line 56 with this code
ksession.execute(new GenericCommand<Void>(){
public Void execute(Context context){
KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
ProcessInstance pi = ksession.getProcessInstance(processInstance.getId());
WorkflowProcessInstance wfpi = (WorkflowProcessInstance)pi;
SwimlaneContextInstance slci = (SwimlaneContextInstance)wfpi.getContextInstance(SwimlaneContext.SWIMLANE_SCOPE);
SwimlaneContext sc = slci.getSwimlaneContext();
Swimlane sl = sc.getSwimlane("MyLane");
System.out.println("Before: Current actor id is " + sl.getActorId());
return null;
}});
GenericCommand<Void> genericCommand = new GenericCommand<Void>(){
public Void execute(Context context){
KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
ProcessInstance pi = ksession.getProcessInstance(processInstance.getId());
WorkflowProcessInstance wfpi = (WorkflowProcessInstance)pi;
SwimlaneContextInstance slci = (SwimlaneContextInstance)wfpi.getContextInstance(SwimlaneContext.SWIMLANE_SCOPE);
SwimlaneContext sc = slci.getSwimlaneContext();
Swimlane sl = sc.getSwimlane("MyLane");
System.out.println("Command: Current actor id is " + sl.getActorId());
sl.setActorId("mary");
return null;
}
};
ksession.execute(genericCommand);
// simulating a system restart
ksession = restoreSession(ksession, true);
ksession.execute(new GenericCommand<Void>(){
public Void execute(Context context){
KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
ProcessInstance pi = ksession.getProcessInstance(processInstance.getId());
WorkflowProcessInstance wfpi = (WorkflowProcessInstance)pi;
SwimlaneContextInstance slci = (SwimlaneContextInstance)wfpi.getContextInstance(SwimlaneContext.SWIMLANE_SCOPE);
SwimlaneContext sc = slci.getSwimlaneContext();
Swimlane sl = sc.getSwimlane("MyLane");
System.out.println("After: Current actor id is " + sl.getActorId());
return null;
}});
HTH
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/800138#800138]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130228/b5c89f94/attachment.html
More information about the jboss-user
mailing list