我有一个子进程的进程,如下所示:
UserTask1 - > SubProcess(ServiceTask1 - > ServiceTask2) - > UserTask5 - >端
SubProcess配置为带有集合和元素变量的多实例,我可以通过DelegateExecution.id上的executionId使用ServiceTask2上的局部变量获取元素变量值,但是在ServiceTask2上使用相同的代码,只有在我使用DelegateExecution.parentId时才会得到任何内容。调试代码我意识到ServiceTask1上的DelegateExecution带有SubProcess ExecutionId,而ServiceTask2上的DelegateExecution带有自己的ExecutionId,而SubProcess是它的parentId,似乎只是ServiceTask2是正确的。我不能为ServiceTask1和ServiceTask2使用相同的代码。这是一个错误还是我做错了什么?
完整进程xml:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://activiti.org/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_6RXjgBy9EeSVeKdg6gA1kA" exporter="camunda modeler" exporterVersion="2.6.0" targetNamespace="http://activiti.org/bpmn">
<bpmn2:process id="com.Campaign" name="Campanha" isExecutable="true">
<bpmn2:subProcess id="subProcess" name="subProcess">
<bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
<bpmn2:multiInstanceLoopCharacteristics camunda:collection="${conceptIdList}" camunda:elementVariable="conceptId"/>
<bpmn2:startEvent id="StartEvent_2">
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="StartEvent_2" targetRef="ServiceTask1"/>
<bpmn2:serviceTask id="ServiceTask1" camunda:delegateExpression="${customLogHandler}" name="ServiceTask1">
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="ServiceTask1" targetRef="ServiceTask2"/>
<bpmn2:serviceTask id="ServiceTask2" camunda:delegateExpression="${customLogHandler}" name="ServiceTask2">
<bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_65</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_65" name="" sourceRef="ServiceTask2" targetRef="EndEvent_13"/>
<bpmn2:endEvent id="EndEvent_13">
<bpmn2:incoming>SequenceFlow_65</bpmn2:incoming>
</bpmn2:endEvent>
</bpmn2:subProcess>
<bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="subProcess" targetRef="UserTask2"/>
<bpmn2:userTask id="UserTask1" camunda:assignee="bruno" name="UserTask1">
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
</bpmn2:userTask>
<bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="UserTask1" targetRef="subProcess"/>
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_2" sourceRef="StartEvent_1" targetRef="UserTask1"/>
<bpmn2:userTask id="UserTask2" camunda:assignee="bruno" name="UserTask2">
<bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing>
</bpmn2:userTask>
<bpmn2:sequenceFlow id="SequenceFlow_17" name="" sourceRef="UserTask2" targetRef="EndEvent_5"/>
<bpmn2:endEvent id="EndEvent_5">
<bpmn2:incoming>SequenceFlow_17</bpmn2:incoming>
</bpmn2:endEvent>
</bpmn2:process>
<bpmn2:message id="Message_1" name="msgAjustarConceito"/>
<bpmn2:message id="Message_2" name="msgCotacaoGerada"/>
<bpmn2:message id="Message_3" name="msgCatalogoGerado"/>
<bpmn2:message id="Message_4" name="msgSolicitarRFQ"/>
<bpmn2:signal id="Signal_1" name="msgAjusteConceito"/>
<bpmn2:message id="Message_5" name="msgNewMaterial"/>
<bpmn2:message id="Message_6" name="msgCampanhaFinalizada"/>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="com.Campaign">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_21" bpmnElement="StartEvent_1">
<dc:Bounds height="36.0" width="36.0" x="18.0" y="86.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="36.0" y="127.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_UserTask_29" bpmnElement="UserTask1">
<dc:Bounds height="80.0" width="100.0" x="108.0" y="64.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_StartEvent_21" targetElement="_BPMNShape_UserTask_29">
<di:waypoint xsi:type="dc:Point" x="54.0" y="104.0"/>
<di:waypoint xsi:type="dc:Point" x="108.0" y="104.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="79.0" y="104.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_3" bpmnElement="subProcess" isExpanded="true">
<dc:Bounds height="178.0" width="528.0" x="265.0" y="15.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_UserTask_29" targetElement="_BPMNShape_SubProcess_3">
<di:waypoint xsi:type="dc:Point" x="208.0" y="104.0"/>
<di:waypoint xsi:type="dc:Point" x="265.0" y="104.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="230.0" y="104.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_22" bpmnElement="StartEvent_2">
<dc:Bounds height="36.0" width="36.0" x="285.0" y="93.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="303.0" y="134.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_SendTask_17" bpmnElement="ServiceTask1">
<dc:Bounds height="80.0" width="100.0" x="371.0" y="71.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_StartEvent_22" targetElement="_BPMNShape_SendTask_17">
<di:waypoint xsi:type="dc:Point" x="321.0" y="111.0"/>
<di:waypoint xsi:type="dc:Point" x="371.0" y="111.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="343.0" y="111.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_SendTask_18" bpmnElement="ServiceTask2">
<dc:Bounds height="80.0" width="100.0" x="564.0" y="71.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_UserTask_33" bpmnElement="UserTask2">
<dc:Bounds height="80.0" width="100.0" x="876.0" y="64.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_SubProcess_3" targetElement="_BPMNShape_UserTask_33">
<di:waypoint xsi:type="dc:Point" x="793.0" y="104.0"/>
<di:waypoint xsi:type="dc:Point" x="876.0" y="104.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="815.0" y="104.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_27" bpmnElement="EndEvent_13">
<dc:Bounds height="36.0" width="36.0" x="720.0" y="93.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="738.0" y="134.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_65" bpmnElement="SequenceFlow_65" sourceElement="_BPMNShape_SendTask_18" targetElement="_BPMNShape_EndEvent_27">
<di:waypoint xsi:type="dc:Point" x="664.0" y="111.0"/>
<di:waypoint xsi:type="dc:Point" x="720.0" y="111.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="692.0" y="111.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_SendTask_17" targetElement="_BPMNShape_SendTask_18">
<di:waypoint xsi:type="dc:Point" x="471.0" y="111.0"/>
<di:waypoint xsi:type="dc:Point" x="564.0" y="111.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="515.0" y="111.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_33" bpmnElement="EndEvent_5">
<dc:Bounds height="36.0" width="36.0" x="1035.0" y="86.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="1053.0" y="127.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_UserTask_33" targetElement="_BPMNShape_EndEvent_33">
<di:waypoint xsi:type="dc:Point" x="976.0" y="104.0"/>
<di:waypoint xsi:type="dc:Point" x="1035.0" y="104.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="998.0" y="104.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>