/** * Returns the transition with the given ID, or null if not found. */ public Transition findTransition(String transitionId) { if (activities == null || transitionId == null) { return null; } for (Transition transition : transitions) { if (transitionId.equals(transition.getId())) { return transition; } } return null; }
/** * Returns the transition with the given ID, or null if not found. */ public Transition findTransition(String transitionId) { if (activities == null || transitionId == null) { return null; } for (Transition transition : transitions) { if (transitionId.equals(transition.getId())) { return transition; } } return null; }
workflow.getTransitions().stream().map(transition -> transition.getId()).collect(Collectors.toSet()); diagram.edges.stream() .filter(edge -> transitionIds.contains(edge.id))
/** * Returns a list of edges read from sequenceFlow element transitions, and BPMNEdge coordinates. */ private List<Edge> readEdges(List<Node> shapes, List<Transition> transitions, XmlElement planeElement) { Map<String, Edge> edgesBySequenceFlowId = readEdgesBySequenceFlowId(planeElement); // Map shape activity IDs to shape IDs, which are needed for edge from/to IDs. Map<String,String> nodeIdByActivityId = new HashMap<>(); for (Node shape : shapes) { nodeIdByActivityId.put(shape.elementId, shape.id); } // Add node IDs from the previously-parsed workflow transitions and diagram nodes. List<Edge> edges = new ArrayList<>(); for (Transition transition : transitions) { String sequenceFlowId = transition.getId(); Edge edge = edgesBySequenceFlowId.get(sequenceFlowId); if (edge==null) { BadRequestException.checkNotNull(edge, "No edge for sequenceFlow " + sequenceFlowId); } edge.fromId(nodeIdByActivityId.get(transition.getFromId())); edge.toId(nodeIdByActivityId.get(transition.getToId())); edges.add(edge); } return edges; }
public static String getIdText(Object object) { if (object instanceof Activity) { return ((Activity)object).getId(); } else if (object instanceof Transition) { return ((Transition)object).getId(); } else if (object instanceof Variable) { return ((Variable)object).getId(); } else if (object instanceof ExecutableWorkflow) { WorkflowId workflowId = ((ExecutableWorkflow)object).getId(); return workflowId!=null ? workflowId.getInternal() : null; } return null; }
restClient.getIssueClient().transition(issue.getTransitionsUri(), new TransitionInput(startProgressTransition.getId()), pm); final TransitionInput transitionInput = new TransitionInput(resolveIssueTransition.getId(), fieldInputs, Comment.valueOf("My comment")); restClient.getIssueClient().transition(issue.getTransitionsUri(), transitionInput, pm);
public void parse(Transition transition, ScopeImpl parentImpl, Map<String, ActivityImpl> activitiesByDefaultTransitionId, WorkflowParser parser) { this.id = transition.getId(); if (id!=null) { if (parser.transitionIds.contains(id)) {
public void testTransition() { Condition condition = new IsTrue().left(new Binding().expression("testsPassed")); ExecutableWorkflow workflow = new ExecutableWorkflow() .activity("start", new StartEvent()) .activity("smokeTest", new NoneTask()) .activity("checkTestResult", new ExclusiveGateway().defaultTransitionId("to-failed")) .activity("passed", new EndEvent()) .activity("failed", new EndEvent()) .transition("to-smokeTest", new Transition().fromId("start").toId("smokeTest").description("Starting the process")) .transition("to-checkTestResult", new Transition().fromId("smokeTest").toId("checkTestResult")) .transition("to-passed", new Transition().fromId("checkTestResult").toId("passed").condition(condition)) .transition("to-failed", new Transition().fromId("checkTestResult").toId("failed")); workflow = serialize(workflow); assertEquals(4, workflow.getTransitions().size()); assertEquals("to-smokeTest", workflow.getTransitions().get(0).getId()); assertEquals("Starting the process", workflow.getTransitions().get(0).getDescription()); assertEquals("start", workflow.getTransitions().get(0).getFromId()); assertEquals("smokeTest", workflow.getTransitions().get(0).getToId()); assertEquals("to-passed", workflow.getTransitions().get(2).getId()); IsTrue deserialisedCondition = (IsTrue) workflow.getTransitions().get(2).getCondition(); assertEquals("testsPassed", deserialisedCondition.getLeft().getExpression()); }