In our application, a user may create a 1-N entities we call AccessRequests. In the SFSB
method which is invoked by the user on submit, we create a loop to create each
AccessRequest and create a ProcessInstance with that AccessRequest's id as a process
variable. In this particular use case, we signal up to the 'provisioning' state
previously described. Here is the code that creates the N ProcessInstances (inside the
braces of a for loop):
| // Load the JBPM context
| JbpmConfiguration jbpmConfiguration =
JbpmConfiguration.getInstance();
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| // Create new process, associate with this access request and save
| ProcessInstance process =
jbpmContext.newProcessInstance("NewAccessRequest");
| process.getContextInstance().setVariable("accessRequestId",
accessRequest.getId());
| Contexts.getEventContext().set(
| "accessRequest",
| accessRequest
| );
| Token token = process.getRootToken();
| token.signal(); // move to <task-node name="User Manager
Approve-Reject Request">
| and flushed).");
|
|
| Collection<TaskInstance> tasks =
(Collection<TaskInstance>) process.getTaskMgmtInstance().getTaskInstances();
|
| // Thd jBPM API sucks (3.1.4) - this is the only way I can find of
ending the current task
| // along the 'approve'
transition
| for (TaskInstance task : tasks) {
| if ("Approve/Reject".equals(task.getName())) {
| task.end("approve");
| break;
| }
| }
|
| jbpmContext.close();
|
|
thanks
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030046#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...