public ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver) { super(activity, diagram, definitionResolver.getShape(activity.getId()), definitionResolver.getResolutionFactor()); this.activity = activity; this.definitionResolver = definitionResolver; }
public AssignmentsInfo getAssignmentsInfo() { Optional<InputOutputSpecification> ioSpecification = Optional.ofNullable(activity.getIoSpecification()); return AssignmentsInfos.of( ioSpecification.map(InputOutputSpecification::getDataInputs) .orElse(Collections.emptyList()), activity.getDataInputAssociations(), ioSpecification.map(InputOutputSpecification::getDataOutputs) .orElse(Collections.emptyList()), activity.getDataOutputAssociations(), ioSpecification.isPresent() ); }
} else if((fElement instanceof Activity) && BPMN2Utils.isContainerAdHoc(container)) { Activity act = (Activity) fElement; if(act.getIncoming() == null || act.getIncoming().size() == 0) { triggerElements.add(0, fElement);
private InputOutputSpecification getIoSpecification() { InputOutputSpecification ioSpecification = activity.getIoSpecification(); if (ioSpecification == null) { ioSpecification = bpmn2.createInputOutputSpecification(); activity.setIoSpecification(ioSpecification); } return ioSpecification; }
if (properties.get("dataoutputset") != null && properties.get("dataoutputset").trim().length() > 0) { String[] allDataOutputs = properties.get("dataoutputset").split(",\\s*"); if (activity.getIoSpecification() == null) { InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification(); activity.setIoSpecification(iospec); String[] dataOutputParts = dataOutput.split(":\\s*"); if (dataOutputParts.length == 2) { nextOut.setId(activity.getId() + "_" + dataOutputParts[0] + (dataOutputParts[0].endsWith("OutputX") ? "" : "OutputX")); nextOut.setName(dataOutputParts[0]); ExtendedMetaData metadata = ExtendedMetaData.INSTANCE; nextOut.getAnyAttribute().add(extensionEntry); } else { nextOut.setId(activity.getId() + "_" + dataOutput + (dataOutput.endsWith("OutputX") ? "" : "OutputX")); nextOut.setName(dataOutput); ExtendedMetaData metadata = ExtendedMetaData.INSTANCE; nextOut.getAnyAttribute().add(extensionEntry); activity.getIoSpecification().getDataOutputs().add(nextOut); outset.getDataOutputRefs().add(nextOut); activity.getIoSpecification().getOutputSets().add(outset); } else { if (activity.getIoSpecification() != null) { activity.getIoSpecification().getOutputSets().add(Bpmn2Factory.eINSTANCE.createOutputSet());
Activity targetElement = (Activity) sf.getTargetRef(); DataObject da = (DataObject) as.getSourceRef(); if (targetElement.getIoSpecification() == null) { InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification(); targetElement.setIoSpecification(iospec); if (targetElement.getIoSpecification().getInputSets() == null || targetElement.getIoSpecification().getInputSets().size() < 1) { InputSet inset = Bpmn2Factory.eINSTANCE.createInputSet(); targetElement.getIoSpecification().getInputSets().add(inset); InputSet inSet = targetElement.getIoSpecification().getInputSets().get(0); boolean foundDataInput = false; for (DataInput dataInput : inSet.getDataInputRefs()) { if (dataInput.getId().equals(targetElement.getId() + "_" + da.getId() + "InputX")) { foundDataInput = true; d.setId(targetElement.getId() + "_" + da.getId() + "InputX"); d.setName(da.getId() + "InputX"); targetElement.getIoSpecification().getDataInputs().add(d); targetElement.getIoSpecification().getInputSets().get(0).getDataInputRefs().add(d); DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); dia.setTargetRef(d); dia.getSourceRef().add(da); targetElement.getDataInputAssociations().add(dia); if (sourceElement.getIoSpecification() == null) { InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification(); sourceElement.setIoSpecification(iospec);
@Test @SuppressWarnings("unchecked") public void testProcessWhenOutEdgeExists() { String uuid = "UUID"; Edge edge = mock(Edge.class); Node targetNode = mock(Node.class); when(targetNode.getUUID()).thenReturn(uuid); List outEdges = new ArrayList<>(); outEdges.add(edge); when(node.getOutEdges()).thenReturn(outEdges); Activity activity = mock(Activity.class); when(activity.getId()).thenReturn(uuid); when(edge.getTargetNode()).thenReturn(targetNode); List<FlowElement> flowElements = Collections.singletonList(activity); when(process.getFlowElements()).thenReturn(flowElements); converter.process(processWriter, nodeWriter, (Node) node); verify(activity).setIsForCompensation(true); } }
public boolean handle(FlowElement element, PathContextManager manager) { List<SequenceFlow> outgoing = new ArrayList<SequenceFlow>(getOutgoing(element)); if (outgoing.size() == 0) { return false; } PathContext context = manager.getContextFromStack(); List<BoundaryEvent> bEvents = ((Activity) element).getBoundaryEventRefs(); if (bEvents != null && bEvents.size() > 0) { boolean cancelActivity = false; for (BoundaryEvent bEvent : bEvents) { manager.addToPath(bEvent, context); List<SequenceFlow> bOut = bEvent.getOutgoing(); outgoing.addAll(bOut); cancelActivity = bEvent.isCancelActivity(); handleSeparatePaths(outgoing, manager, bEvent); handleCombinedPaths(outgoing, manager); if (!cancelActivity) { handleAllPaths(outgoing, manager); } } return true; } else { HandlerRegistry.getHandler().handle(element, manager); return false; } }
List<FlowElement> fes = p.getFlowElements(); for (FlowElement f : fes) { if (f instanceof Activity && ((Activity) f).getName().equals(activityNameRef)) { ((CompensateEventDefinition) ed).setActivityRef((Activity) f); ((Activity) f).setIsForCompensation(true);
private String marshallDataOutputSet(Activity activity, Map<String, Object> properties, List<String> disallowedNames) { if (activity.getIoSpecification() != null) { List<OutputSet> outputSetList = activity.getIoSpecification().getOutputSets(); StringBuilder dataOutBuffer = new StringBuilder(); for (OutputSet outset : outputSetList) { List<DataOutput> dataOutputList = outset.getDataOutputRefs(); marshallItemAwareElements(activity, dataOutputList, dataOutBuffer, disallowedNames); } if (dataOutBuffer.length() > 0) { dataOutBuffer.setLength(dataOutBuffer.length() - 1); } String dataoutputset = dataOutBuffer.toString(); properties.put(DATAOUTPUTSET, dataoutputset); return dataoutputset; } else { return null; } }
DataInputAssociation dataInputAssociation = input.getDataInputAssociation(); if (dataInputAssociation != null) { activity.getDataInputAssociations().add(dataInputAssociation); DataOutputAssociation dataOutputAssociation = output.getDataOutputAssociation(); if (dataOutputAssociation != null) { activity.getDataOutputAssociations().add(dataOutputAssociation);
private ItemAwareElement getDataOutputAssociationSourceRef(Activity activity, String idSuffix) { List<DataOutputAssociation> dataOutputAssociations = activity.getDataOutputAssociations(); if (dataOutputAssociations != null) { for (DataOutputAssociation dataOutputAssociation : dataOutputAssociations) { List<ItemAwareElement> sourceRef = dataOutputAssociation.getSourceRef(); if (sourceRef != null && !sourceRef.isEmpty()) { ItemAwareElement result = Arrays.stream(sourceRef.toArray(new ItemAwareElement[sourceRef.size()])) .filter(itemAwareElement -> itemAwareElement.getId().endsWith(idSuffix)) .findFirst() .orElse(null); if (result != null) { return result; } } } } return null; }
private ItemAwareElement getDataInputAssociationSourceRef(Activity activity, String id) { List<DataInputAssociation> dataInputAssociations = activity.getDataInputAssociations(); if (dataInputAssociations != null) { for (DataInputAssociation dataInputAssociation : dataInputAssociations) { List<ItemAwareElement> sourceRef = dataInputAssociation.getSourceRef(); if (sourceRef != null && !sourceRef.isEmpty()) { ItemAwareElement result = Arrays.stream(sourceRef.toArray(new ItemAwareElement[sourceRef.size()])) .filter(itemAwareElement -> id.equals(itemAwareElement.getId())) .findFirst() .orElse(null); if (result != null) { return result; } } } } return null; }
protected List<SequenceFlow> getOutgoing(FlowElement element) { List<SequenceFlow> outgoing = null; if (element instanceof StartEvent) { outgoing = ((StartEvent) element).getOutgoing(); } else if (element instanceof SubProcess) { SubProcess subProcess = ((SubProcess) element); outgoing = subProcess.getOutgoing(); } else if (element instanceof Event) { outgoing = ((Event) element).getOutgoing(); } else if (element instanceof Activity) { outgoing = ((Activity) element).getOutgoing(); } else if (element instanceof EndEvent) { outgoing = ((EndEvent) element).getOutgoing(); } else if (element instanceof Gateway) { Gateway gateway = ((Gateway) element); outgoing = gateway.getOutgoing(); } return outgoing; }
@Override public void process(ProcessPropertyWriter processWriter, BasePropertyWriter nodeWriter, Node<View<? extends BPMNViewDefinition>, ?> node) { if (!node.getOutEdges().isEmpty()) { final Edge<?, ?> edge = node.getOutEdges().iterator().next(); if (edge != null && edge.getTargetNode() != null) { final Activity activity = findActivity(processWriter.getProcess(), edge.getTargetNode().getUUID()); if (activity != null) { activity.setIsForCompensation(true); } } } } }
if (properties.get("datainputset") != null && properties.get("datainputset").trim().length() > 0) { String[] allDataInputs = properties.get("datainputset").split(",\\s*"); if (activity.getIoSpecification() == null) { InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification(); activity.setIoSpecification(iospec); nextInput.setId(activity.getId() + "_" + dataInputParts[0] + (dataInputParts[0].endsWith("InputX") ? "" : "InputX")); nextInput.setName(dataInputParts[0]); ExtendedMetaData metadata = ExtendedMetaData.INSTANCE; nextInput.setId(activity.getId() + "_" + dataInput + (dataInput.endsWith("InputX") ? "" : "InputX")); nextInput.setName(dataInput); ExtendedMetaData metadata = ExtendedMetaData.INSTANCE; nextInput.getAnyAttribute().add(extensionEntry); activity.getIoSpecification().getDataInputs().add(nextInput); inset.getDataInputRefs().add(nextInput); activity.getIoSpecification().getInputSets().add(inset); } else { if (activity.getIoSpecification() != null) { activity.getIoSpecification().getInputSets().add(Bpmn2Factory.eINSTANCE.createInputSet());
List<BoundaryEvent> bEvents = ((Activity) element).getBoundaryEventRefs(); if (bEvents != null && !bEvents.isEmpty()) { boolean cancelActivity = false;
if (f instanceof Activity && ((Activity) f) .getName() .equals(activityNameRef)) { ((CompensateEventDefinition) ed) .setActivityRef((Activity) f); ((Activity) f).setIsForCompensation(true);
private String marshallDataInputSet(Activity activity, Map<String, Object> properties, List<String> disallowedNames) { if (activity.getIoSpecification() != null) { List<InputSet> inputSetList = activity.getIoSpecification().getInputSets(); StringBuilder dataInBuffer = new StringBuilder(); for (InputSet inset : inputSetList) { List<DataInput> dataInputList = inset.getDataInputRefs(); marshallItemAwareElements(activity, dataInputList, dataInBuffer, disallowedNames); } if (dataInBuffer.length() > 0) { dataInBuffer.setLength(dataInBuffer.length() - 1); } String datainputset = dataInBuffer.toString(); properties.put(DATAINPUTSET, datainputset); return datainputset; } else { return null; } }
private ItemAwareElement getDataOutputAssociationSourceRef(Activity activity, String idSuffix) { List<DataOutputAssociation> dataOutputAssociations = activity.getDataOutputAssociations(); if (dataOutputAssociations != null) { for (DataOutputAssociation dataOutputAssociation : dataOutputAssociations) { List<ItemAwareElement> sourceRef = dataOutputAssociation.getSourceRef(); if (sourceRef != null && !sourceRef.isEmpty()) { ItemAwareElement result = Arrays.stream(sourceRef.toArray(new ItemAwareElement[sourceRef.size()])) .filter(itemAwareElement -> itemAwareElement.getId().endsWith(idSuffix)) .findFirst() .orElse(null); if (result != null) { return result; } } } } return null; }