@Override public String toString() { return "EndEvent (" + getId() + ") {" + "errorRef='" + errorRef + '\'' + ", causeExpression='" + causeExpression + '\'' + '}'; } }
private static List<AbstractElement> addEntryPoint(IdGenerator idGenerator, List<AbstractElement> elements) throws ParserException { if (elements.size() < 1) { throw new ParserException("Can't add an entry point to a empty block"); } List<AbstractElement> l = new ArrayList<>(elements); AbstractElement first = l.get(0); AbstractElement last = l.get(l.size() - 1); String startId = idGenerator.nextId(); String endId = idGenerator.nextId(); l.add(0, new StartEvent(startId)); l.add(1, new SequenceFlow(idGenerator.nextId(), startId, first.getId())); l.add(new SequenceFlow(idGenerator.nextId(), last.getId(), endId)); l.add(new EndEvent(endId)); return l; }
@Override public List<Action> handle(ProcessInstance state, ProcessElementCommand cmd, List<Action> actions) throws ExecutionException { actions.add(new PopCommandAction()); IndexedProcessDefinition pd = state.getDefinition(cmd.getDefinitionId()); EndEvent ev = (EndEvent) ProcessDefinitionUtils.findElement(pd, cmd.getElementId()); String errorRef = ev.getErrorRef(); String causeExpression = ev.getCauseExpression(); if (errorRef != null) { actions.add(BpmnErrorHelper.raiseErrorDeferred(cmd.getDefinitionId(), cmd.getElementId(), errorRef, causeExpression)); } return actions; } }
private static Container toElements(IdGenerator idGenerator, Map<String, Object> m) throws ParserException { if (m.containsKey(SUBPROCESS_KEY)) { return toSubProcess(idGenerator, m); } if (m.containsKey(EXPR_KEY)) { ServiceTask t = new ServiceTask(idGenerator.nextId(), ExpressionType.SIMPLE, m.get("expr").toString()); return new Container(t, t); } if (m.containsKey(END_KEY)) { String errorRef = (String) m.get(END_KEY); EndEvent e = new EndEvent(idGenerator.nextId(), errorRef); return new Container(e, e); } if (m.containsKey(CALL_KEY)) { return toCallActivity(idGenerator, m); } if (m.containsKey(SWITCH_KEY)) { return toSwitch(idGenerator, m); } throw new ParserException("Unsupported element type: " + m); }
protected void addEnd(String errorRef, String causeExpression, Significance sig, int line, int col, String desc) { add(new EndEvent(nextEndId(), errorRef, causeExpression)); if (sig != null) { sourceMap(sig, line, col, desc); } validate(); }
public List<AbstractElement> wrapAsProcess(Chunk c) { List<AbstractElement> l = new ArrayList<>(); String startId = nextId(); l.add(new StartEvent(startId)); if (c.isEmpty()) { String endId = nextId(); l.add(new SequenceFlow(nextId(), startId, endId)); l.add(new EndEvent(endId)); return l; } l.add(new SequenceFlow(nextId(), startId, c.firstElement().getId())); l.addAll(c.getElements()); if (!c.getOutputs().isEmpty()) { String endId = nextId(); for (String src : c.getOutputs()) { l.add(new SequenceFlow(nextId(), src, endId)); } l.add(new EndEvent(endId)); } return l; }
EndEvent ee = new EndEvent(id, errorRef); children.add(ee);
result.add(new EndEvent(endId, ref != null ? ref : "generalError"));
@Override public Chunk convert(ConverterContext ctx, YamlReturn s) throws YamlConverterException { Chunk c = new Chunk(); String id = ctx.nextId(); c.addElement(new EndEvent(id, s.getErrorCode())); c.addSourceMap(id, toSourceMap(s, "Return from a flow (code: " + s.getErrorCode() + ")")); // skip adding an output, it should be the last element of a branch return c; } }
c.addElement(new EndEvent(endId)); c.addElement(new SequenceFlow(ctx.nextId(),throwTaskId, endId));