@Test public void testGetSelectorDataWhenNoNodeSelected() { setSelectedNode(null); SelectorData result = provider.getSelectorData(renderingContext); assertResult(new ArrayList<>(), result); }
@Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(FormRenderingContext context) { final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram(); final String rootUUID = diagram.getMetadata().getCanvasRootUUID(); final Node<?, ? extends Edge> selectedNode = getSelectedNode(diagram, sessionManager.getCurrentSession()); final Map<Object, String> values = new TreeMap<>(SafeComparator.TO_STRING_COMPARATOR); if (selectedNode != null) { Node<?, ? extends Edge> currentNode = selectedNode; final List<Node> compensableNodes = new ArrayList<>(); Node<?, ? extends Edge> parentNode; int levels = 0; do { parentNode = GraphUtils.getParent(currentNode).asNode(); compensableNodes.addAll(getCompensableNodes(parentNode)); if (rootUUID.equals(parentNode.getUUID())) { levels = 2; } else if (isSubProcess(parentNode)) { currentNode = parentNode; levels++; } else if (isLane(parentNode)) { currentNode = parentNode; } } while (levels < 2); compensableNodes.stream() .map(node -> buildPair(node.getUUID(), (BPMNDefinition) (((View) node.getContent()).getDefinition()))) .forEach(pair -> values.put(pair.getK1(), pair.getK2())); ActivityRef currentActivityRef = null; if (isEndCompensationEvent(selectedNode)) { currentActivityRef = ((EndCompensationEvent) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } else if (isIntermediateCompensationEventThrowing(selectedNode)) { currentActivityRef = ((IntermediateCompensationEventThrowing) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } if (currentActivityRef != null && !isEmpty(currentActivityRef.getValue()) && !values.containsKey(currentActivityRef.getValue())) { Node configured = diagram.getGraph().getNode(currentActivityRef.getValue()); if (configured != null) { Pair<Object, String> pair = buildPair(configured.getUUID(), (BPMNDefinition) ((View) configured.getContent()).getDefinition()); values.put(pair.getK1(), pair.getK2()); } } } return new SelectorData(values, null); }
ProcessCompensationRefProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(FormRenderingContext context) { final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram(); final String rootUUID = diagram.getMetadata().getCanvasRootUUID(); final Node<?, ? extends Edge> selectedNode = getSelectedNode(diagram, sessionManager.getCurrentSession()); final Map<Object, String> values = new TreeMap<>(SafeComparator.TO_STRING_COMPARATOR); if (selectedNode != null) { Node<?, ? extends Edge> currentNode = selectedNode; final List<Node> compensableNodes = new ArrayList<>(); Node<?, ? extends Edge> parentNode; int levels = 0; do { parentNode = GraphUtils.getParent(currentNode).asNode(); compensableNodes.addAll(getCompensableNodes(parentNode)); if (rootUUID.equals(parentNode.getUUID())) { levels = 2; } else if (isSubProcess(parentNode)) { currentNode = parentNode; levels++; } else if (isLane(parentNode)) { currentNode = parentNode; } } while (levels < 2); compensableNodes.stream() .map(node -> buildPair(node.getUUID(), (BPMNDefinition) (((View) node.getContent()).getDefinition()))) .forEach(pair -> values.put(pair.getK1(), pair.getK2())); ActivityRef currentActivityRef = null; if (isEndCompensationEvent(selectedNode)) { currentActivityRef = ((EndCompensationEvent) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } else if (isIntermediateCompensationEventThrowing(selectedNode)) { currentActivityRef = ((IntermediateCompensationEventThrowing) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } if (currentActivityRef != null && !isEmpty(currentActivityRef.getValue()) && !values.containsKey(currentActivityRef.getValue())) { Node configured = diagram.getGraph().getNode(currentActivityRef.getValue()); if (configured != null) { Pair<Object, String> pair = buildPair(configured.getUUID(), (BPMNDefinition) ((View) configured.getContent()).getDefinition()); values.put(pair.getK1(), pair.getK2()); } } } return new SelectorData(values, null); } }
ProcessCompensationRefProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(FormRenderingContext context) { final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram(); final String rootUUID = diagram.getMetadata().getCanvasRootUUID(); final Node<?, ? extends Edge> selectedNode = getSelectedNode(diagram, sessionManager.getCurrentSession()); final Map<Object, String> values = new TreeMap<>(SafeComparator.TO_STRING_COMPARATOR); if (selectedNode != null) { Node<?, ? extends Edge> currentNode = selectedNode; final List<Node> compensableNodes = new ArrayList<>(); Node<?, ? extends Edge> parentNode; int levels = 0; do { parentNode = GraphUtils.getParent(currentNode).asNode(); compensableNodes.addAll(getCompensableNodes(parentNode)); if (rootUUID.equals(parentNode.getUUID())) { levels = 2; } else if (isSubProcess(parentNode)) { currentNode = parentNode; levels++; } else if (isLane(parentNode)) { currentNode = parentNode; } } while (levels < 2); compensableNodes.stream() .map(node -> buildPair(node.getUUID(), (BPMNDefinition) (((View) node.getContent()).getDefinition()))) .forEach(pair -> values.put(pair.getK1(), pair.getK2())); ActivityRef currentActivityRef = null; if (isEndCompensationEvent(selectedNode)) { currentActivityRef = ((EndCompensationEvent) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } else if (isIntermediateCompensationEventThrowing(selectedNode)) { currentActivityRef = ((IntermediateCompensationEventThrowing) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } if (currentActivityRef != null && !isEmpty(currentActivityRef.getValue()) && !values.containsKey(currentActivityRef.getValue())) { Node configured = diagram.getGraph().getNode(currentActivityRef.getValue()); if (configured != null) { Pair<Object, String> pair = buildPair(configured.getUUID(), (BPMNDefinition) ((View) configured.getContent()).getDefinition()); values.put(pair.getK1(), pair.getK2()); } } } return new SelectorData(values, null); } @Inject  ProcessCompensationRefProvider(final SessionManager sessionManager); }
ProcessCompensationRefProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(FormRenderingContext context) { final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram(); final String rootUUID = diagram.getMetadata().getCanvasRootUUID(); final Node<?, ? extends Edge> selectedNode = getSelectedNode(diagram, sessionManager.getCurrentSession()); final Map<Object, String> values = new TreeMap<>(SafeComparator.TO_STRING_COMPARATOR); if (selectedNode != null) { Node<?, ? extends Edge> currentNode = selectedNode; final List<Node> compensableNodes = new ArrayList<>(); Node<?, ? extends Edge> parentNode; int levels = 0; do { parentNode = GraphUtils.getParent(currentNode).asNode(); compensableNodes.addAll(getCompensableNodes(parentNode)); if (rootUUID.equals(parentNode.getUUID())) { levels = 2; } else if (isSubProcess(parentNode)) { currentNode = parentNode; levels++; } else if (isLane(parentNode)) { currentNode = parentNode; } } while (levels < 2); compensableNodes.stream() .map(node -> buildPair(node.getUUID(), (BPMNDefinition) (((View) node.getContent()).getDefinition()))) .forEach(pair -> values.put(pair.getK1(), pair.getK2())); ActivityRef currentActivityRef = null; if (isEndCompensationEvent(selectedNode)) { currentActivityRef = ((EndCompensationEvent) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } else if (isIntermediateCompensationEventThrowing(selectedNode)) { currentActivityRef = ((IntermediateCompensationEventThrowing) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } if (currentActivityRef != null && !isEmpty(currentActivityRef.getValue()) && !values.containsKey(currentActivityRef.getValue())) { Node configured = diagram.getGraph().getNode(currentActivityRef.getValue()); if (configured != null) { Pair<Object, String> pair = buildPair(configured.getUUID(), (BPMNDefinition) ((View) configured.getContent()).getDefinition()); values.put(pair.getK1(), pair.getK2()); } } } return new SelectorData(values, null); } @Inject  ProcessCompensationRefProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(FormRenderingContext context); }
ProcessCompensationRefProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(FormRenderingContext context) { final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram(); final String rootUUID = diagram.getMetadata().getCanvasRootUUID(); final Node<?, ? extends Edge> selectedNode = getSelectedNode(diagram, sessionManager.getCurrentSession()); final Map<Object, String> values = new TreeMap<>(SafeComparator.TO_STRING_COMPARATOR); if (selectedNode != null) { Node<?, ? extends Edge> currentNode = selectedNode; final List<Node> compensableNodes = new ArrayList<>(); Node<?, ? extends Edge> parentNode; int levels = 0; do { parentNode = GraphUtils.getParent(currentNode).asNode(); compensableNodes.addAll(getCompensableNodes(parentNode)); if (rootUUID.equals(parentNode.getUUID())) { levels = 2; } else if (isSubProcess(parentNode)) { currentNode = parentNode; levels++; } else if (isLane(parentNode)) { currentNode = parentNode; } } while (levels < 2); compensableNodes.stream() .map(node -> buildPair(node.getUUID(), (BPMNDefinition) (((View) node.getContent()).getDefinition()))) .forEach(pair -> values.put(pair.getK1(), pair.getK2())); ActivityRef currentActivityRef = null; if (isEndCompensationEvent(selectedNode)) { currentActivityRef = ((EndCompensationEvent) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } else if (isIntermediateCompensationEventThrowing(selectedNode)) { currentActivityRef = ((IntermediateCompensationEventThrowing) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } if (currentActivityRef != null && !isEmpty(currentActivityRef.getValue()) && !values.containsKey(currentActivityRef.getValue())) { Node configured = diagram.getGraph().getNode(currentActivityRef.getValue()); if (configured != null) { Pair<Object, String> pair = buildPair(configured.getUUID(), (BPMNDefinition) ((View) configured.getContent()).getDefinition()); values.put(pair.getK1(), pair.getK2()); } } } return new SelectorData(values, null); } @Inject  ProcessCompensationRefProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(FormRenderingContext context);  }