How to assign input CallActivity subprocess

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2010 12:35 PM
Hi,
I'm new to this BPM. May I know how to assign variable 'workOrderApproved' upon callActivity to subprocess 'inventoryRelease' ?
Thanks
I'm new to this BPM. May I know how to assign variable 'workOrderApproved' upon callActivity to subprocess 'inventoryRelease' ?
<sequenceFlow id='flow4' sourceRef="workOrderApprovedDecision" targetRef="createInventoryRelease"> <conditionExpression xsi:type="tFormalExpression">${workOrderApproved}</conditionExpression> </sequenceFlow> <callActivity id="createInventoryRelease" name="Inventory release" calledElement="inventoryRelease">
Thanks
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2010 04:47 AM
Hi,
First solution is to add a service-task in between the sequenceflow and the call-activity:
If this is to intrusive (adding an element to set a simple variable) you can use an event-listener (which is available in activiti.5.0.rc1, released this monday). The example below will set the variable 'workOrderApproved' when the transition 'flow4' is taken.
For more info about the possibilities of expressions and eventllisteners, check out the userguide. This has some good info about this subject.
First solution is to add a service-task in between the sequenceflow and the call-activity:
<serviceTask id="setVarServiceTask">
activiti:expression="#{value}"
activiti:resultVariableName="workOrderApproved" />
If this is to intrusive (adding an element to set a simple variable) you can use an event-listener (which is available in activiti.5.0.rc1, released this monday). The example below will set the variable 'workOrderApproved' when the transition 'flow4' is taken.
<sequenceFlow id='flow4' sourceRef="workOrderApprovedDecision" targetRef="createInventoryRelease">
<conditionExpression xsi:type="tFormalExpression">${workOrderApproved}</conditionExpression>
<extensionElements>
<activiti:listener expression="${execution.setVariable('workOrderApproved', value)}" />
</extensionElements>
</sequenceFlow>
<callActivity id="createInventoryRelease" name="Inventory release" calledElement="inventoryRelease">
For more info about the possibilities of expressions and eventllisteners, check out the userguide. This has some good info about this subject.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2010 11:22 PM
hi, thanks for the reply.
if I change your code in ExecutionImpl.java
by setting the subProcess's parent,
The subprocess will automatically get the variable from it's parent (if it can't find the variable in the process).
And I don't need to change or add something to the BPMN work flow. :mrgreen:
Perhaps, my additional line of code above would solve other issue regarding 'execution.getParent() always return null' (i saw it on other thread).
in addition,
I commented out line 65 of AtomicOperationActivityEnd.java
I don't know if changes I made would break the activiti, but so far it works for me. I'm happy :mrgreen:
if I change your code in ExecutionImpl.java
public PvmProcessInstance createSubProcessInstance(PvmProcessDefinition processDefinition) {
ExecutionImpl subProcessInstance = newExecution();
// manage bidirectional super-subprocess relation
subProcessInstance.setParent(this);//arief add this
subProcessInstance.setSuperExecution(this);
this.setSubProcessInstance(subProcessInstance);
// Initialize the new execution
subProcessInstance.setProcessDefinition((ProcessDefinitionImpl) processDefinition);
subProcessInstance.setProcessInstance(subProcessInstance);
return subProcessInstance;
}
by setting the subProcess's parent,
The subprocess will automatically get the variable from it's parent (if it can't find the variable in the process).
And I don't need to change or add something to the BPMN work flow. :mrgreen:
Perhaps, my additional line of code above would solve other issue regarding 'execution.getParent() always return null' (i saw it on other thread).
in addition,
I commented out line 65 of AtomicOperationActivityEnd.java
//parentScopeExecution.setActivity(parentActivity);
This will solve nullPointer exception when subprocess end.I don't know if changes I made would break the activiti, but so far it works for me. I'm happy :mrgreen:
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2010 12:55 PM
I misunderstood your question. The example above is for a single process, not for passing of variables to subproces, my bad


Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2010 10:15 AM
1) good point, we don't have data mapping capabilities yet in the process definition to specify transfer of data between super process and sub process : http://jira.codehaus.org/browse/ACT-354
2) if the setParent() is all that it takes to enable variable lookup, that would be cool. in theory it could work like that. but i would be surprised if there no side effect to setting the parent for that purpose. (e.g. i believe the isProcessInstance() is implemented as parent!=null)
would be nice if that feature makes it in. might take a couple of months for us to get to that feature. if you want it, file a jira feature request and vote for it.
2) if the setParent() is all that it takes to enable variable lookup, that would be cool. in theory it could work like that. but i would be surprised if there no side effect to setting the parent for that purpose. (e.g. i believe the isProcessInstance() is implemented as parent!=null)
would be nice if that feature makes it in. might take a couple of months for us to get to that feature. if you want it, file a jira feature request and vote for it.
