private String getPathFlowElementsAsString(Set<FlowElement> flowElements) { String ret = ""; if(flowElements != null && flowElements.size() > 0) { for(FlowElement fe : flowElements) { ret += fe.getId(); ret += "|"; } } return ret.endsWith("|") ? ret.substring(0, ret.length() - 1) : ret; }
private String getPathFlowElementsAsString(Set<FlowElement> flowElements) { String ret = ""; if(flowElements != null && !flowElements.isEmpty()) { for(FlowElement fe : flowElements) { ret += fe.getId(); ret += "|"; } } return ret.endsWith("|") ? ret.substring(0, ret.length() - 1) : ret; }
private String getPathFlowElementsAsString(Set<FlowElement> flowElements) { String ret = ""; if(flowElements != null && !flowElements.isEmpty()) { for(FlowElement fe : flowElements) { ret += fe.getId(); ret += "|"; } } return ret.endsWith("|") ? ret.substring(0, ret.length() - 1) : ret; }
private FlowElementsContainer findContanerForFlowElement(FlowElementsContainer container, FlowElement fl) { for (FlowElement flowElement : container.getFlowElements()) { if (flowElement.getId().equals(fl.getId())) { return container; } if (flowElement instanceof FlowElementsContainer) { return findContanerForFlowElement((FlowElementsContainer) flowElement, fl); } } return null; }
protected void addToCompleted(PathContext context) { //generate path id StringBuffer pathIdElements = new StringBuffer(); List<FlowElement> list = new ArrayList<FlowElement>(context.getPathElements()); Collections.sort(list, new Comparator<FlowElement>() { public int compare(FlowElement o1, FlowElement o2) { return o1.getId().compareTo(o2.getId()); } }); for (FlowElement fe : list) { pathIdElements.append(fe.getId()); } context.setPathId("Path"+pathIdElements.toString().hashCode()); this.completePaths.add(context); } }
protected void addToCompleted(PathContext context) { //generate path id StringBuffer pathIdElements = new StringBuffer(); List<FlowElement> list = new ArrayList<FlowElement>(context.getPathElements()); Collections.sort(list, new Comparator<FlowElement>() { public int compare(FlowElement o1, FlowElement o2) { return o1.getId().compareTo(o2.getId()); } }); for (FlowElement fe : list) { pathIdElements.append(fe.getId()); } int elementsId = pathIdElements.toString().hashCode(); context.setPathId("Path" + elementsId + "-" + this.completePaths.size()); if (!completedPathsIds.contains(elementsId+"")) { this.completePaths.add(context); completedPathsIds.add(elementsId+""); } }
protected void addToCompleted(PathContext context) { //generate path id StringBuffer pathIdElements = new StringBuffer(); List<FlowElement> list = new ArrayList<FlowElement>(context.getPathElements()); Collections.sort(list, new Comparator<FlowElement>() { public int compare(FlowElement o1, FlowElement o2) { return o1.getId().compareTo(o2.getId()); } }); for (FlowElement fe : list) { pathIdElements.append(fe.getId()); } int elementsId = pathIdElements.toString().hashCode(); context.setPathId("Path" + elementsId + "-" + this.completePaths.size()); if (!completedPathsIds.contains(elementsId+"")) { this.completePaths.add(context); completedPathsIds.add(elementsId+""); } }
protected FlowElement findElementInContainer(FlowElementsContainer container, String id) { List<FlowElement> currentContainerElems = container.getFlowElements(); for (FlowElement fElement : currentContainerElems) { if (fElement.getId().equals(id) ) { return fElement; } else if (fElement instanceof FlowElementsContainer) { FlowElement fe = findElementInContainer((FlowElementsContainer) fElement, id); if (fe != null) { return fe; } } } return null; }
protected FlowElement findElementInContainer(FlowElementsContainer container, String id) { List<FlowElement> currentContainerElems = container.getFlowElements(); for (FlowElement fElement : currentContainerElems) { if (fElement.getId().equals(id) ) { return fElement; } else if (fElement instanceof FlowElementsContainer) { FlowElement fe = findElementInContainer((FlowElementsContainer) fElement, id); if (fe != null) { return fe; } } } return null; }
protected FlowElement findElementInContainer(FlowElementsContainer container, String id) { List<FlowElement> currentContainerElems = container.getFlowElements(); for (FlowElement fElement : currentContainerElems) { if (fElement.getId().equals(id) ) { return fElement; } else if (fElement instanceof FlowElementsContainer) { FlowElement fe = findElementInContainer((FlowElementsContainer) fElement, id); if (fe != null) { return fe; } } } return null; }
protected Activity findActivity(FlowElementsContainer container, String uuid) { final List<FlowElementsContainer> subContainers = new ArrayList<>(); for (FlowElement flowElement : container.getFlowElements()) { if (flowElement instanceof Activity) { if (flowElement.getId().equals(uuid)) { return (Activity) flowElement; } else if (flowElement instanceof SubProcess) { subContainers.add((SubProcess) flowElement); } } } Activity result; for (FlowElementsContainer subContainer : subContainers) { result = findActivity(subContainer, uuid); if (result != null) { return result; } } return null; } }
public static List<FlowElement> removeDuplicates(Set<FlowElement> orig) { Set<String> uniqueIds = new HashSet<String>(); List<FlowElement> unique = new ArrayList<FlowElement>(); for (FlowElement fElement : orig) { if (!uniqueIds.contains(fElement.getId())) { uniqueIds.add(fElement.getId()); unique.add(fElement); } } System.out.println("Size of flow elements after removing duplicates " + unique.size()); return unique; }
public static List<FlowElement> removeDuplicates(Set<FlowElement> orig) { Set<String> uniqueIds = new HashSet<String>(); List<FlowElement> unique = new ArrayList<FlowElement>(); for (FlowElement fElement : orig) { if (!uniqueIds.contains(fElement.getId())) { uniqueIds.add(fElement.getId()); unique.add(fElement); } } System.out.println("Size of flow elements after removing duplicates " + unique.size()); return unique; }
public static List<FlowElement> removeDuplicates(Set<FlowElement> orig) { Set<String> uniqueIds = new HashSet<String>(); List<FlowElement> unique = new ArrayList<FlowElement>(); for (FlowElement fElement : orig) { if (!uniqueIds.contains(fElement.getId())) { uniqueIds.add(fElement.getId()); unique.add(fElement); } } System.out.println("Size of flow elements after removing duplicates " + unique.size()); return unique; }
public FlowElementPropertyReader of(FlowElement el) { return new FlowElementPropertyReader(el, diagram, definitionResolver.getShape(el.getId()), definitionResolver.getResolutionFactor()); }
protected FlowElementsContainer findContainerForBoundaryEvent(FlowElementsContainer container, BoundaryEvent be) { for (FlowElement flowElement : container.getFlowElements()) { if (flowElement.getId().equals(be.getAttachedToRef().getId())) { return container; } if (flowElement instanceof FlowElementsContainer) { FlowElementsContainer result = findContainerForBoundaryEvent((FlowElementsContainer) flowElement, be); if (result != null) { return result; } } } return null; }
@Test public void marshallAssociations() throws Exception { Diagram<Graph, Metadata> d = unmarshall(newMarshaller, BPMN_FILE_PATH); Node<View<UserTask>, ?> node = d.getGraph().getNode(TASK_ID); UserTask definition = node.getContent().getDefinition(); DefinitionsConverter definitionsConverter = new DefinitionsConverter(d.getGraph()); Definitions definitions = definitionsConverter.toDefinitions(); Process p = (Process) definitions.getRootElements().get(0); org.eclipse.bpmn2.UserTask flowElement = (org.eclipse.bpmn2.UserTask) p.getFlowElements().stream().filter(e -> e.getId().equals(TASK_ID)).findFirst().get(); List<DataInputAssociation> associations = flowElement.getDataInputAssociations(); assertEquals("myprocvar", findVar(associations, "From")); assertEquals("<![CDATA[HELLO]]>", findAssignment(associations, "Body")); }