public ForkImpl<T> boundaryEvent(String errorRef, String timeDuration) { return new ForkImpl<T>(this, new BoundaryEvent(nextStepId(), lastId, errorRef, timeDuration)); }
public static BoundaryEvent findBoundaryErrorEvent(IndexedProcessDefinition pd, String attachedToRef, String errorRef) throws ExecutionException { List<BoundaryEvent> l = findOptionalBoundaryEvents(pd, attachedToRef); for (BoundaryEvent ev : l) { if (attachedToRef.equals(ev.getAttachedToRef())) { if (errorRef != null) { if (errorRef.equals(ev.getErrorRef())) { return ev; } } else if (ev.getErrorRef() == null && ev.getTimeDuration() == null) { return ev; } } } return null; }
public static Map<String, Command> findErrors(IndexedProcessDefinition pd, ProcessElementCommand cmd) throws ExecutionException { Map<String, Command> m = new HashMap<>(); List<BoundaryEvent> events = ProcessDefinitionUtils.findOptionalBoundaryEvents(pd, cmd.getElementId()); for (BoundaryEvent ev : events) { if (ev.getErrorRef() != null && ev.getTimeDuration() == null) { m.put(ev.getErrorRef(), new ProcessElementCommand(pd.getId(), ev.getId())); } } return m; }
b.append(" ").append(ev.getErrorRef()).append(" @ ").append(ev.getAttachedToRef());
public static List<Timeout<Command>> findTimers(IndexedProcessDefinition pd, ProcessElementCommand cmd) throws ExecutionException { List<BoundaryEvent> events = ProcessDefinitionUtils.findOptionalBoundaryEvents(pd, cmd.getElementId()); List<Timeout<Command>> l = new ArrayList<>(events.size()); for (BoundaryEvent ev : events) { if (ev.getTimeDuration() != null) { Duration d = Duration.parse(ev.getTimeDuration()); Command c = new ProcessElementCommand(pd.getId(), ev.getId()); l.add(new Timeout<>(d.getMillis(), c)); } } l.sort((o1, o2) -> (int) (o1.getDuration() - o2.getDuration())); return l; }
@Override public String toString() { return "BoundaryEvent (" + getId() + ") {" + "attachedToRef='" + attachedToRef + '\'' + ", errorRef='" + errorRef + '\'' + ", timeDuration='" + timeDuration + '\'' + '}'; } }
private static void indexBoundaryEvents0(ProcessDefinition pd, Map<String, List<BoundaryEvent>> accumulator) { for (AbstractElement e : pd.getChildren()) { if (e instanceof ProcessDefinition) { indexBoundaryEvents0((ProcessDefinition) e, accumulator); } if (!(e instanceof BoundaryEvent)) { continue; } BoundaryEvent ev = (BoundaryEvent) e; if (ev.getAttachedToRef() == null) { continue; } List<BoundaryEvent> l = accumulator.computeIfAbsent(ev.getAttachedToRef(), k -> new ArrayList<>()); l.add(ev); } } }
private static void fillQueue(Queue<FlowSignal> q, IndexedProcessDefinition pd, String elemId, int count) throws ExecutionException { findOptionalOutgoingFlows(pd, elemId).stream() .map(s -> new FlowSignal(s, count)) .forEach(q::add); for (BoundaryEvent be : findOptionalBoundaryEvents(pd, elemId)) { findOptionalOutgoingFlows(pd, be.getId()).stream() .map(s -> new FlowSignal(s, 0)) // assuming no errors at first .forEach(q::add); } }
BoundaryEvent be = new BoundaryEvent(id, attachedToRef, errorRef, timeDuration); children.add(be);
public static Command findDefaultError(IndexedProcessDefinition pd, ProcessElementCommand cmd) throws ExecutionException { List<BoundaryEvent> events = ProcessDefinitionUtils.findOptionalBoundaryEvents(pd, cmd.getElementId()); for (BoundaryEvent ev : events) { if (ev.getErrorRef() == null && ev.getTimeDuration() == null) { return new ProcessElementCommand(pd.getId(), ev.getId()); } } return null; }
result.add(new BoundaryEvent(evId, attachedTo, ref));
@SuppressWarnings("unchecked") default void applyErrorBlock(ConverterContext ctx, Chunk c, String attachedRef, Map<String, Object> opts) throws YamlConverterException { if (opts == null) { return; } Seq<YamlStep> errorSteps = (Seq<YamlStep>) opts.get("error"); if (errorSteps == null) { return; } String evId = ctx.nextId(); c.addElement(new BoundaryEvent(evId, attachedRef, null)); Chunk err = ctx.convert(errorSteps); // connect the boundary event to the error block's steps String dst = err.firstElement().getId(); c.addElement(new SequenceFlow(ctx.nextId(), evId, dst)); c.addElements(err.getElements()); c.addOutputs(err.getOutputs()); // keep the source map of the error block's steps c.addSourceMaps(err.getSourceMap()); }
c.addElement(new BoundaryEvent(originalTaskEvId, attachedRef, null)); c.addElement(new BoundaryEvent(retryTaskEventId, retryTaskId, null)); c.addElement(new SequenceFlow(ctx.nextId(), retryTaskEventId, incCounterId));