use of org.activiti.bpmn.model.ParallelGateway in project Activiti by Activiti.
the class FlowNodeMultipleOutgoingFlowsConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("parallel1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof ParallelGateway);
ParallelGateway gateway = (ParallelGateway) flowElement;
List<SequenceFlow> sequenceFlows = gateway.getOutgoingFlows();
assertTrue(sequenceFlows.size() == 3);
assertTrue(sequenceFlows.get(0).getId().equals("sid-B9EE4ECE-BF72-4C25-B768-8295906E5CF8") || sequenceFlows.get(0).getId().equals("sid-D2491B73-0382-4EC2-AAAC-C8FD129E4CBE") || sequenceFlows.get(0).getId().equals("sid-7036D56C-E8EF-493B-ADEC-57EED4C6CE1F"));
assertTrue(sequenceFlows.get(1).getId().equals("sid-B9EE4ECE-BF72-4C25-B768-8295906E5CF8") || sequenceFlows.get(1).getId().equals("sid-D2491B73-0382-4EC2-AAAC-C8FD129E4CBE") || sequenceFlows.get(1).getId().equals("sid-7036D56C-E8EF-493B-ADEC-57EED4C6CE1F"));
assertTrue(sequenceFlows.get(2).getId().equals("sid-B9EE4ECE-BF72-4C25-B768-8295906E5CF8") || sequenceFlows.get(2).getId().equals("sid-D2491B73-0382-4EC2-AAAC-C8FD129E4CBE") || sequenceFlows.get(2).getId().equals("sid-7036D56C-E8EF-493B-ADEC-57EED4C6CE1F"));
assertTrue(sequenceFlows.get(0).getSourceRef().equals("parallel1"));
assertTrue(sequenceFlows.get(1).getSourceRef().equals("parallel1"));
assertTrue(sequenceFlows.get(2).getSourceRef().equals("parallel1"));
flowElement = model.getMainProcess().getFlowElement("parallel2");
assertNotNull(flowElement);
assertTrue(flowElement instanceof ParallelGateway);
gateway = (ParallelGateway) flowElement;
sequenceFlows = gateway.getIncomingFlows();
assertTrue(sequenceFlows.size() == 3);
assertTrue(sequenceFlows.get(0).getId().equals("sid-4C19E041-42FA-485D-9D09-D47CCD9DB270") || sequenceFlows.get(0).getId().equals("sid-05A991A6-0296-4867-ACBA-EF9EEC68FB8A") || sequenceFlows.get(0).getId().equals("sid-C546AC84-379D-4094-9DC3-548593F2EA0D"));
assertTrue(sequenceFlows.get(1).getId().equals("sid-4C19E041-42FA-485D-9D09-D47CCD9DB270") || sequenceFlows.get(1).getId().equals("sid-05A991A6-0296-4867-ACBA-EF9EEC68FB8A") || sequenceFlows.get(1).getId().equals("sid-C546AC84-379D-4094-9DC3-548593F2EA0D"));
assertTrue(sequenceFlows.get(2).getId().equals("sid-4C19E041-42FA-485D-9D09-D47CCD9DB270") || sequenceFlows.get(2).getId().equals("sid-05A991A6-0296-4867-ACBA-EF9EEC68FB8A") || sequenceFlows.get(2).getId().equals("sid-C546AC84-379D-4094-9DC3-548593F2EA0D"));
assertTrue(sequenceFlows.get(0).getTargetRef().equals("parallel2"));
assertTrue(sequenceFlows.get(1).getTargetRef().equals("parallel2"));
assertTrue(sequenceFlows.get(2).getTargetRef().equals("parallel2"));
}
use of org.activiti.bpmn.model.ParallelGateway in project Activiti by Activiti.
the class ParallelGatewayXMLConverter method convertXMLToElement.
@Override
protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
ParallelGateway gateway = new ParallelGateway();
BpmnXMLUtil.addXMLLocation(gateway, xtr);
parseChildElements(getXMLElementName(), gateway, model, xtr);
return gateway;
}
use of org.activiti.bpmn.model.ParallelGateway in project Activiti by Activiti.
the class ParallelStepsDefinitionConverter method createProcessArtifact.
protected ParallelGateway createProcessArtifact(ParallelStepsDefinition parallelStepsDefinition, WorkflowDefinitionConversion conversion) {
// First parallel gateway
ParallelGateway forkGateway = createParallelGateway(conversion);
// Sequence flow from last activity to first gateway
addSequenceFlow(conversion, conversion.getLastActivityId(), forkGateway.getId());
conversion.setLastActivityId(forkGateway.getId());
// Convert all other steps, disabling activity id updates which makes all
// generated steps have a sequence flow to the first gateway
WorkflowDefinitionConversionFactory conversionFactory = conversion.getConversionFactory();
List<FlowElement> endElements = new ArrayList<FlowElement>();
for (ListStepDefinition<ParallelStepsDefinition> stepListDefinition : parallelStepsDefinition.getStepList()) {
for (int i = 0; i < stepListDefinition.getSteps().size(); i++) {
if (i == 0) {
conversion.setSequenceflowGenerationEnabled(false);
} else {
conversion.setSequenceflowGenerationEnabled(true);
}
StepDefinition step = stepListDefinition.getSteps().get(i);
FlowElement flowElement = (FlowElement) conversionFactory.getStepConverterFor(step).convertStepDefinition(step, conversion);
if (i == 0) {
addSequenceFlow(conversion, forkGateway.getId(), flowElement.getId());
}
if ((i + 1) == stepListDefinition.getSteps().size()) {
endElements.add(flowElement);
}
}
}
conversion.setSequenceflowGenerationEnabled(false);
// Second parallel gateway
ParallelGateway joinGateway = createParallelGateway(conversion);
conversion.setLastActivityId(joinGateway.getId());
conversion.setSequenceflowGenerationEnabled(true);
// Create sequence flow from all generated steps to the second gateway
for (FlowElement endElement : endElements) {
addSequenceFlow(conversion, endElement.getId(), joinGateway.getId());
}
return forkGateway;
}
use of org.activiti.bpmn.model.ParallelGateway in project Activiti by Activiti.
the class FeedbackStepDefinitionConverter method createForkParallelGateway.
protected ParallelGateway createForkParallelGateway(WorkflowDefinitionConversion conversion, Map<String, BaseElement> processElements) {
ParallelGateway fork = new ParallelGateway();
fork.setId(conversion.getUniqueNumberedId(ConversionConstants.GATEWAY_ID_PREFIX));
addFlowElement(conversion, fork);
processElements.put(FEEDBACK_FORK, fork);
return fork;
}
Aggregations