CatchEvent ce = (CatchEvent) fe; EventDefinition ed = null; if (ce.getEventDefinitions() != null && ce.getEventDefinitions().size() > 0) { ed = ce.getEventDefinitions().get(0); be.setCancelActivity(true); } else { Iterator<FeatureMap.Entry> iter = ce.getAnyAttribute().iterator(); while (iter.hasNext()) { FeatureMap.Entry entry2 = iter.next(); if (ce.getDataOutputs() != null) { be.getDataOutputs().addAll(ce.getDataOutputs()); if (ce.getDataOutputAssociation() != null) { be.getDataOutputAssociation().addAll(ce.getDataOutputAssociation()); if (ce.getOutputSet() != null) { be.setOutputSet(ce.getOutputSet()); if (ce.getEventDefinitions() != null) { be.getEventDefinitions().addAll(ce.getEventDefinitions()); if (ce.getEventDefinitionRefs() != null) { be.getEventDefinitionRefs().addAll(ce.getEventDefinitionRefs()); if (ce.getProperties() != null) { be.getProperties().addAll(ce.getProperties());
public List<EventDefinition> getEventDefinitions() { List<EventDefinition> eventDefinitions = catchEvent.getEventDefinitions(); List<EventDefinition> eventDefinitionRefs = catchEvent.getEventDefinitionRefs(); ArrayList<EventDefinition> result = new ArrayList<>(); result.addAll(eventDefinitions); result.addAll(eventDefinitionRefs); return result; } }
@Override public AssignmentsInfo getAssignmentsInfo() { return AssignmentsInfos.of( Collections.emptyList(), Collections.emptyList(), catchEvent.getDataOutputs(), catchEvent.getDataOutputAssociation(), false); }
String[] doutputParts = dataOutput.split(":\\s*"); if (doutputParts.length == 2) { nextOutput.setId(event.getId() + "_" + doutputParts[0]); nextOutput.setName(doutputParts[0]); ExtendedMetaData metadata = ExtendedMetaData.INSTANCE; nextOutput.getAnyAttribute().add(extensionEntry); } else { nextOutput.setId(event.getId() + "_" + dataOutput); nextOutput.setName(dataOutput); ExtendedMetaData metadata = ExtendedMetaData.INSTANCE; event.getDataOutputs().add(nextOutput); outSet.getDataOutputRefs().add(nextOutput); event.setOutputSet(outSet); SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("boundarycancelactivity")); event.getAnyAttribute().add(extensionEntry); List<DataOutput> dataOutputs = event.getDataOutputs(); if (dataOutputs != null) { for (DataOutput ddo : dataOutputs) { if (ddo.getId().equals(event.getId() + "_" + fromPart)) { doa.getSourceRef().add(ddo); e.setId(associationParts[1]); doa.setTargetRef(e);
@Override public void addEventDefinition(EventDefinition eventDefinition) { this.event.getEventDefinitions().add(eventDefinition); }
} else if (fe instanceof CatchEvent) { CatchEvent act = (CatchEvent) fe; if(act.getIncoming() == null || act.getIncoming().isEmpty() && !isParentEventSubprocess(fe)) { String ref = processEventDefinitions(((CatchEvent) fe).getEventDefinitions()); simPath.setSignalName(ref);
List<DataOutput> dataOutputs = ce.getDataOutputs(); for (DataOutput dout : dataOutputs) { if (dout.getId().equals(ce.getId() + "_" + da.getId() + "OutputX")) { foundDataOutput = true; dataout.setId(ce.getId() + "_" + da.getId() + "OutputX"); dataout.setName(da.getId() + "OutputX"); ce.getDataOutputs().add(dataout); if (ce.getOutputSet() == null) { OutputSet outset = Bpmn2Factory.eINSTANCE.createOutputSet(); ce.setOutputSet(outset); ce.getOutputSet().getDataOutputRefs().add(dataout); DataOutputAssociation dia = Bpmn2Factory.eINSTANCE.createDataOutputAssociation(); dia.setTargetRef(da); dia.getSourceRef().add(dataout); ce.getDataOutputAssociation().add(dia);
@Before public void setup() { when(definitionResolver.getResolutionFactor()).thenReturn(RESOLUTION_FACTOR); when(catchEvent.getId()).thenReturn(CATCH_EVENT_ID); when(boundaryEvent.getId()).thenReturn(BOUNDARY_EVENT_ID); when(throwEvent.getId()).thenReturn(THROW_EVENT_ID); when(gateway.getId()).thenReturn(GATEWAY_EVENT_ID); when(definitionResolver.getShape(eq(CATCH_EVENT_ID))).thenReturn(catchEventShape); when(definitionResolver.getShape(eq(BOUNDARY_EVENT_ID))).thenReturn(boundaryEventShape); when(definitionResolver.getShape(eq(THROW_EVENT_ID))).thenReturn(throwEventShape); when(definitionResolver.getShape(eq(GATEWAY_EVENT_ID))).thenReturn(gatewayEventShape); this.catchEventPropertyReader = new CatchEventPropertyReader(catchEvent, diagram, definitionResolver); this.boundaryEventPropertyReader = spy(new BoundaryEventPropertyReader(boundaryEvent, diagram, definitionResolver)); this.throwEventPropertyReader = new ThrowEventPropertyReader(throwEvent, diagram, definitionResolver); this.gatewayPropertyReader = new GatewayPropertyReader(gateway, diagram, gatewayEventShape, RESOLUTION_FACTOR); }
private void setCatchEventProperties(CatchEvent event, Map<String, Object> properties, Definitions def) { if (event.getOutputSet() != null) { List<DataOutput> dataOutputs = event.getOutputSet().getDataOutputRefs(); StringBuffer doutbuff = new StringBuffer(); for (DataOutput dout : dataOutputs) { properties.put(DATAOUTPUT, dataoutput); List<DataOutputAssociation> outputAssociations = event.getDataOutputAssociation(); StringBuffer doutassociationbuff = new StringBuffer(); for (DataOutputAssociation doa : outputAssociations) { List<EventDefinition> eventdefs = event.getEventDefinitions(); for (EventDefinition ed : eventdefs) { if (ed instanceof TimerEventDefinition) {
protected boolean hasPathToCatchEvent(FlowElement catchEvent) { List<SequenceFlow> incoming = ((CatchEvent)catchEvent).getIncoming(); boolean hasSplitActivity = findSplitActivity(incoming); // if there is split activity before catch event consider it's not reachable // as simulation cannot determine if it can be reached or not so pessimistically // assume it cannot if (hasSplitActivity) { return false; } return true; }
public CatchEventPropertyReader(CatchEvent catchEvent, BPMNDiagram diagram, DefinitionResolver definitionResolver) { super(catchEvent, diagram, definitionResolver, EventPropertyReader.getSignalRefId(catchEvent.getEventDefinitions())); this.catchEvent = catchEvent; }
} else if (fe instanceof CatchEvent) { CatchEvent act = (CatchEvent) fe; if(act.getIncoming() == null || act.getIncoming().isEmpty() && !isParentEventSubprocess(fe)) { String ref = processEventDefinitions(((CatchEvent) fe).getEventDefinitions()); simPath.setSignalName(ref);
private BpmnNode compensationEvent(CatchEvent event, CompensateEventDefinition e) { String nodeId = event.getId(); Node<View<IntermediateCompensationEvent>, Edge> node = factoryManager.newNode(nodeId, IntermediateCompensationEvent.class); IntermediateCompensationEvent definition = node.getContent().getDefinition(); CatchEventPropertyReader p = propertyReaderFactory.of(event); definition.setGeneral(new BPMNGeneralSet( new Name(p.getName()), new Documentation(p.getDocumentation()) )); node.getContent().setBounds(p.getBounds()); definition.setDimensionsSet(p.getCircleDimensionSet()); definition.setFontSet(p.getFontSet()); definition.setBackgroundSet(p.getBackgroundSet()); return BpmnNode.of(node); }
public void setAssignmentsInfo(AssignmentsInfo info) { ParsedAssignmentsInfo assignmentsInfo = ParsedAssignmentsInfo.of(info); List<InitializedOutputVariable> outputs = assignmentsInfo.createInitializedOutputVariables( getId(), variableScope); if (outputs.isEmpty()) { return; } if (outputs.size() > 1) { throw new IllegalArgumentException("Output Associations should be at most 1 in Catch Events"); } InitializedOutputVariable output = outputs.get(0); DataOutput dataOutput = output.getDataOutput(); event.getDataOutputs().add(dataOutput); getOutputSet().getDataOutputRefs().add(dataOutput); this.addItemDefinition(dataOutput.getItemSubjectRef()); DataOutputAssociation dataOutputAssociation = output.getDataOutputAssociation(); if (dataOutputAssociation != null) { event.getDataOutputAssociation().add(dataOutputAssociation); } }
protected boolean hasPathToCatchEvent(FlowElement catchEvent) { List<SequenceFlow> incoming = ((CatchEvent)catchEvent).getIncoming(); boolean hasSplitActivity = findSplitActivity(incoming); // if there is split activity before catch event consider it's not reachable // as simulation cannot determine if it can be reached or not so pessimistically // assume it cannot if (hasSplitActivity) { return false; } return true; }
@Override public CatchEvent createBpmn2Event(CompensateEventDefinition compensateEvent) { CatchEvent catchEvent = mock(CatchEvent.class); List<EventDefinition> eventDefinitions = Collections.singletonList(compensateEvent); when(catchEvent.getEventDefinitions()).thenReturn(eventDefinitions); return catchEvent; }
private BpmnNode conditionalEvent(CatchEvent event, ConditionalEventDefinition e) { String nodeId = event.getId(); Node<View<IntermediateConditionalEvent>, Edge> node = factoryManager.newNode(nodeId, IntermediateConditionalEvent.class); IntermediateConditionalEvent definition = node.getContent().getDefinition(); CatchEventPropertyReader p = propertyReaderFactory.of(event); definition.setGeneral(new BPMNGeneralSet( new Name(p.getName()), new Documentation(p.getDocumentation()) )); definition.setExecutionSet(new CancellingConditionalEventExecutionSet( new CancelActivity(p.isCancelActivity()), p.getConditionExpression(e) )); node.getContent().setBounds(p.getBounds()); definition.setDimensionsSet(p.getCircleDimensionSet()); definition.setFontSet(p.getFontSet()); definition.setBackgroundSet(p.getBackgroundSet()); return BpmnNode.of(node); }
public static BaseElement createElement(String stencilId, String taskType, boolean customElement) { if (customElement) { stencilId = "Task"; taskType = "Custom"; } Bpmn20Stencil stencil = Bpmn20Stencil.valueOf(taskType == null ? stencilId : stencilId + "_" + taskType.replaceAll(" ", "_")); if (stencil == null) { throw new IllegalArgumentException("unregistered stencil id: " + stencilId); } BaseElement elt = (BaseElement) Bpmn2Factory.eINSTANCE.create(stencil.className); if (stencil.eventType != null) { if (elt instanceof CatchEvent) { ((CatchEvent) elt).getEventDefinitions().add((EventDefinition) Bpmn2Factory.eINSTANCE.create(stencil.eventType)); } else if (elt instanceof ThrowEvent) { ((ThrowEvent) elt).getEventDefinitions().add((EventDefinition) Bpmn2Factory.eINSTANCE.create(stencil.eventType)); } else { throw new IllegalArgumentException("Cannot set eventType on " + elt); } } if (stencil.associationDirection != null) { ((Association) elt).setAssociationDirection(stencil.associationDirection); } return elt; } }
private BpmnNode timerEvent(CatchEvent event, TimerEventDefinition e) { String nodeId = event.getId(); Node<View<IntermediateTimerEvent>, Edge> node = factoryManager.newNode(nodeId, IntermediateTimerEvent.class); IntermediateTimerEvent definition = node.getContent().getDefinition(); CatchEventPropertyReader p = propertyReaderFactory.of(event); definition.setGeneral(new BPMNGeneralSet( new Name(p.getName()), new Documentation(p.getDocumentation()) )); definition.setExecutionSet(new CancellingTimerEventExecutionSet( new CancelActivity(p.isCancelActivity()), new TimerSettings(p.getTimerSettings(e)) )); node.getContent().setBounds(p.getBounds()); definition.setDimensionsSet(p.getCircleDimensionSet()); definition.setFontSet(p.getFontSet()); definition.setBackgroundSet(p.getBackgroundSet()); return BpmnNode.of(node); }
public void setSignalRefForCatchEvents(FlowElementsContainer container, Definitions def) { List<FlowElement> flowElements = container.getFlowElements(); for (FlowElement fe : flowElements) { if (fe instanceof CatchEvent) { if (((CatchEvent) fe).getEventDefinitions().size() > 0) { EventDefinition ed = ((CatchEvent) fe).getEventDefinitions().get(0); if (ed instanceof SignalEventDefinition) { SignalEventDefinition sed = (SignalEventDefinition) ed; if (sed.getSignalRef() != null) { Signal signal = findSignalWithName(sed.getSignalRef(), def); if (signal != null) { sed.setSignalRef(signal.getId()); } } } } } else if (fe instanceof FlowElementsContainer) { setSignalRefForCatchEvents((FlowElementsContainer) fe, def); } } }