[rules-users] Drools Flow - problem with parameter mapping
Mauricio Salatino
salaboy at gmail.com
Mon Nov 15 05:38:38 EST 2010
You need to use both mappings
IN Mappings (Parameter Mapping in the IDE): this will copy your process
variables to the work item scope
and OUT Mappings (Result Mappings): this will copy the information created
or modified by the work item (in this case a human task) to the process
scope.
Greetings!
2010/11/15 matus <matus.majchrak at gmail.com>
> Hi,
>
> I recently run into some problems when trying to create a simple holiday
> request process.
> I defined process variables but I struggle to understand how to access them
> in Human Task.
> In my User Task ,,holiday approval" I have this as a description:
> #{employee} requested holiday for #{length} days
> I set both variables when I start the process and the result looks as
> expected, for example ,,John requested holiday fo 14 days.
> But lets say I want a manager approving the holiday request to add his
> response as a variable. How do I do that?
> I tried to use the Result mapping with someting like this:
> response=response but I get an error saying ,,There is no ID/IDREF binding
> for IDREF '_2_response'.
> Also if I manage to get this running, how do I set this variable in a
> client app?[using WS_HT]
> I am sorry if I am asking realy basic things, but I realy need some advice.
> Bellow is the process definition.
> Thanks a lot, matus
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions id="Definition"
> targetNamespace="http://www.jboss.org/drools"
> typeLanguage="http://www.java.com/javaTypes"
> expressionLanguage="http://www.mvel.org/2.0"
> xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
> xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
> xs:schemaLocation="
> http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
> xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
> xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
> xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
> xmlns:tns="http://www.jboss.org/drools">
>
> <itemDefinition id="_employeeItem" structureRef="String" />
> <itemDefinition id="_lengthItem" structureRef="String" />
> <itemDefinition id="_managersItem" structureRef="String" />
> <itemDefinition id="_responseItem" structureRef="String" />
>
> <process processType="Private" isExecutable="true" id="com.sample.test"
> name="test process" tns:packageName="defaultPackage" >
>
> <!-- process variables -->
> <property id="employee" itemSubjectRef="_employeeItem"/>
> <property id="length" itemSubjectRef="_lengthItem"/>
> <property id="managers" itemSubjectRef="_managersItem"/>
> <property id="response" itemSubjectRef="_responseItem"/>
>
> <!-- nodes -->
> <startEvent id="_1" name="StartProcess" />
> <userTask id="_2" name="Holiday approval" >
> <ioSpecification>
> <dataInput id="_2_CommentInput" name="Comment" />
> <dataInput id="_2_SkippableInput" name="Skippable" />
> <dataInput id="_2_ContentInput" name="Content" />
> <dataInput id="_2_TaskNameInput" name="TaskName" />
> <dataInput id="_2_PriorityInput" name="Priority" />
> <dataOutput id="_2_responseOutput" name="response" />
> <inputSet>
> <dataInputRefs>_2_CommentInput</dataInputRefs>
> <dataInputRefs>_2_SkippableInput</dataInputRefs>
> <dataInputRefs>_2_ContentInput</dataInputRefs>
> <dataInputRefs>_2_TaskNameInput</dataInputRefs>
> <dataInputRefs>_2_PriorityInput</dataInputRefs>
> </inputSet>
> <outputSet>
> <dataOutputRefs>_2_responseOutput</dataOutputRefs>
> </outputSet>
> </ioSpecification>
> <dataInputAssociation>
> <targetRef>_2_CommentInput</targetRef>
> <assignment>
> <from xs:type="tFormalExpression">#{employee} requested holiday
> for #{length} days </from>
> <to xs:type="tFormalExpression">_2_CommentInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_2_SkippableInput</targetRef>
> <assignment>
> <from xs:type="tFormalExpression">false</from>
> <to xs:type="tFormalExpression">_2_SkippableInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_2_ContentInput</targetRef>
> <assignment>
> <from xs:type="tFormalExpression"></from>
> <to xs:type="tFormalExpression">_2_ContentInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_2_TaskNameInput</targetRef>
> <assignment>
> <from xs:type="tFormalExpression">Holiday Approval</from>
> <to xs:type="tFormalExpression">_2_TaskNameInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_2_PriorityInput</targetRef>
> <assignment>
> <from xs:type="tFormalExpression"></from>
> <to xs:type="tFormalExpression">_2_PriorityInput</to>
> </assignment>
> </dataInputAssociation>
> <dataOutputAssociation>
> <sourceRef>_2_response</sourceRef>
> <targetRef>_2_response</targetRef>
> </dataOutputAssociation>
> <potentialOwner>
> <resourceAssignmentExpression>
> <formalExpression>#{managers}</formalExpression>
> </resourceAssignmentExpression>
> </potentialOwner>
> </userTask>
> <endEvent id="_3" name="End" >
> <terminateEventDefinition/>
> </endEvent>
>
> <!-- connections -->
> <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
> <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
>
> </process>
>
> <bpmndi:BPMNDiagram>
> <bpmndi:BPMNPlane bpmnElement="com.sample.test" >
> <bpmndi:BPMNShape bpmnElement="_1" >
> <dc:Bounds x="16" y="16" width="48" height="48" />
> </bpmndi:BPMNShape>
> <bpmndi:BPMNShape bpmnElement="_2" >
> <dc:Bounds x="96" y="16" width="100" height="48" />
> </bpmndi:BPMNShape>
> <bpmndi:BPMNShape bpmnElement="_3" >
> <dc:Bounds x="340" y="16" width="48" height="48" />
> </bpmndi:BPMNShape>
> <bpmndi:BPMNEdge bpmnElement="_1-_2" >
> <di:waypoint x="40" y="40" />
> <di:waypoint x="146" y="40" />
> </bpmndi:BPMNEdge>
> <bpmndi:BPMNEdge bpmnElement="_2-_3" >
> <di:waypoint x="146" y="40" />
> <di:waypoint x="364" y="40" />
> </bpmndi:BPMNEdge>
> </bpmndi:BPMNPlane>
> </bpmndi:BPMNDiagram>
>
> </definitions>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
- CTO @ http://www.plugtree.com
- MyJourney @ http://salaboy.wordpress.com
- Co-Founder @ http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101115/b5a1c6d0/attachment.html
More information about the rules-users
mailing list