01-14-2013 05:14 PM
protected void selectInitial(List<ActivityImpl> startEventActivities, ProcessDefinitionEntity processDefinition, Element parentElement) {
ActivityImpl initial = null;
// validate that there is s single none start event / timer start event:
for (ActivityImpl activityImpl : startEventActivities) {
if(!activityImpl.getProperty("type").equals("messageStartEvent")) {
if(initial == null) {
initial = activityImpl;
} else {
addError("multiple none start events or timer start events not supported on process definition", parentElement);
}
}
}
// if there is a single start event, select it as initial, regardless of it's type:
if(initial == null && startEventActivities.size() == 1) {
initial = startEventActivities.get(0);
}
processDefinition.setInitial(initial);
}
01-15-2013 04:17 AM
01-15-2013 04:53 PM
You can use multiple message-start events (http://activiti.org/userguide/index.html#bpmnMessageStartEvent) on your process. Instead of just calling startProcessInstance, you'll have to use startProcessInstanceByMessage(String messageName);.
If you want to use explorer (and you don't control what API-call is done when starting a process), you're only option is to use the activiti:initiator="${initiator}" construct with a single none-start-event and a exclusive-gateway which decides based on the "initiator" variable, which path to take.
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="myProcess333" name="My process 333" isExecutable="true">
<startEvent id="startevent1" name="Start" activiti:initiator="initiator"></startEvent>
<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="exclusivegateway1"></sequenceFlow>
<userTask id="usertask1" name="User Task 1" activiti:assignee="kermit" activiti:candidateUsers="kermit">
<extensionElements>
<activiti:formProperty id="idkermit111" name="kermit tst 1" type="string" readable="false" required="true"></activiti:formProperty>
</extensionElements>
</userTask>
<sequenceFlow id="flow2" sourceRef="exclusivegateway1" targetRef="usertask1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${initiator == 'kermit'}]]></conditionExpression>
</sequenceFlow>
<userTask id="usertask2" name="User Task I" activiti:assignee="fozzie" activiti:candidateUsers="fozzie">
<extensionElements>
<activiti:formProperty id="id111" name="test fozzie I" type="string" required="true"></activiti:formProperty>
</extensionElements>
</userTask>
<sequenceFlow id="flow3" sourceRef="exclusivegateway1" targetRef="usertask2">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${initiator == 'fozzie'}]]></conditionExpression>
</sequenceFlow>
<userTask id="usertask3" name="User Task 2" activiti:assignee="kermit" activiti:candidateUsers="kermit"></userTask>
<sequenceFlow id="flow4" sourceRef="usertask1" targetRef="usertask3"></sequenceFlow>
<userTask id="usertask4" name="User Task II" activiti:assignee="fozzie" activiti:candidateUsers="fozzie">
<extensionElements>
<activiti:formProperty id="id222" name="fozzie test II" type="long" required="true"></activiti:formProperty>
</extensionElements>
</userTask>
<sequenceFlow id="flow5" sourceRef="usertask2" targetRef="usertask4"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow6" sourceRef="usertask3" targetRef="endevent1"></sequenceFlow>
<sequenceFlow id="flow7" sourceRef="usertask4" targetRef="endevent1"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
<bpmndi:BPMNPlane bpmnElement="myProcess333" id="BPMNPlane_myProcess">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35.0" width="35.0" x="40.0" y="140.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
<omgdc:Bounds height="40.0" width="40.0" x="120.0" y="137.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
<omgdc:Bounds height="55.0" width="105.0" x="210.0" y="50.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
<omgdc:Bounds height="55.0" width="105.0" x="205.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
<omgdc:Bounds height="55.0" width="105.0" x="370.0" y="50.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask4" id="BPMNShape_usertask4">
<omgdc:Bounds height="55.0" width="105.0" x="365.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="530.0" y="60.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="75.0" y="157.0"></omgdi:waypoint>
<omgdi:waypoint x="120.0" y="157.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="140.0" y="137.0"></omgdi:waypoint>
<omgdi:waypoint x="262.0" y="105.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="160.0" y="157.0"></omgdi:waypoint>
<omgdi:waypoint x="205.0" y="157.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="315.0" y="77.0"></omgdi:waypoint>
<omgdi:waypoint x="370.0" y="77.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="310.0" y="157.0"></omgdi:waypoint>
<omgdi:waypoint x="365.0" y="157.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="475.0" y="77.0"></omgdi:waypoint>
<omgdi:waypoint x="530.0" y="77.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
<omgdi:waypoint x="470.0" y="157.0"></omgdi:waypoint>
<omgdi:waypoint x="547.0" y="157.0"></omgdi:waypoint>
<omgdi:waypoint x="547.0" y="95.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="myProcess333wg" name="My process 333wgwy">
<startEvent id="startevent1" name="Start" activiti:initiator="initiator"></startEvent>
<userTask id="usertask1" name="User Task 1" activiti:assignee="kermit" activiti:candidateUsers="kermit">
<extensionElements>
<activiti:formProperty id="idkermit111" name="kermit tst 1" type="string" required="true" readable="false"></activiti:formProperty>
</extensionElements>
</userTask>
<userTask id="usertask2" name="User Task I" activiti:assignee="fozzie" activiti:candidateUsers="fozzie">
<extensionElements>
<activiti:formProperty id="id111" name="test fozzie I" type="string" required="true"></activiti:formProperty>
</extensionElements>
</userTask>
<userTask id="usertask3" name="User Task 2" activiti:assignee="kermit" activiti:candidateUsers="kermit"></userTask>
<userTask id="usertask4" name="User Task II" activiti:assignee="fozzie" activiti:candidateUsers="fozzie">
<extensionElements>
<activiti:formProperty id="id222" name="fozzie test II" type="long" required="true"></activiti:formProperty>
</extensionElements>
</userTask>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow4" name="" sourceRef="usertask1" targetRef="usertask3"></sequenceFlow>
<sequenceFlow id="flow5" name="" sourceRef="usertask2" targetRef="usertask4"></sequenceFlow>
<sequenceFlow id="flow6" name="" sourceRef="usertask3" targetRef="endevent1"></sequenceFlow>
<sequenceFlow id="flow7" name="" sourceRef="usertask4" targetRef="endevent1"></sequenceFlow>
<sequenceFlow id="flow8" name="" sourceRef="startevent1" targetRef="usertask1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${initiator == 'kermit'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow9" name="" sourceRef="startevent1" targetRef="usertask2">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${initiator == 'fozzie'}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_myProcess333wg">
<bpmndi:BPMNPlane bpmnElement="myProcess333wg" id="BPMNPlane_myProcess333wg">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35" width="35" x="40" y="140"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
<omgdc:Bounds height="55" width="105" x="210" y="50"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
<omgdc:Bounds height="55" width="105" x="205" y="130"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
<omgdc:Bounds height="55" width="105" x="370" y="50"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask4" id="BPMNShape_usertask4">
<omgdc:Bounds height="55" width="105" x="365" y="130"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35" width="35" x="530" y="60"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="315" y="77"></omgdi:waypoint>
<omgdi:waypoint x="370" y="77"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="310" y="157"></omgdi:waypoint>
<omgdi:waypoint x="365" y="157"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="475" y="77"></omgdi:waypoint>
<omgdi:waypoint x="530" y="77"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
<omgdi:waypoint x="470" y="157"></omgdi:waypoint>
<omgdi:waypoint x="547" y="157"></omgdi:waypoint>
<omgdi:waypoint x="547" y="95"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
<omgdi:waypoint x="57" y="140"></omgdi:waypoint>
<omgdi:waypoint x="262" y="105"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
<omgdi:waypoint x="75" y="157"></omgdi:waypoint>
<omgdi:waypoint x="205" y="157"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.