use of io.automatiko.engine.workflow.process.core.impl.ConsequenceAction in project automatiko-engine by automatiko-io.
the class ExecutableProcessFactory method exceptionHandler.
public ExecutableProcessFactory exceptionHandler(String exception, String dialect, String action) {
ActionExceptionHandler exceptionHandler = new ActionExceptionHandler();
exceptionHandler.setAction(new ConsequenceAction(dialect, action));
return exceptionHandler(exception, exceptionHandler);
}
use of io.automatiko.engine.workflow.process.core.impl.ConsequenceAction in project automatiko-engine by automatiko-io.
the class ExecutableProcessFactory method linkBoundaryTimerEvent.
protected void linkBoundaryTimerEvent(Node node, String attachedTo, Node attachedNode) {
boolean cancelActivity = (Boolean) node.getMetaData().get(CANCEL_ACTIVITY);
StateBasedNode compositeNode = (StateBasedNode) attachedNode;
String timeDuration = (String) node.getMetaData().get(TIME_DURATION);
String timeCycle = (String) node.getMetaData().get(TIME_CYCLE);
String timeDate = (String) node.getMetaData().get(TIME_DATE);
Timer timer = new Timer();
if (timeDuration != null) {
timer.setDelay(timeDuration);
timer.setTimeType(Timer.TIME_DURATION);
compositeNode.addTimer(timer, timerAction("Timer-" + attachedTo + "-" + timeDuration + "-" + node.getId()));
} else if (timeCycle != null) {
int index = timeCycle.indexOf("###");
if (index != -1) {
String period = timeCycle.substring(index + 3);
timeCycle = timeCycle.substring(0, index);
timer.setPeriod(period);
}
timer.setDelay(timeCycle);
timer.setTimeType(Timer.TIME_CYCLE);
compositeNode.addTimer(timer, timerAction("Timer-" + attachedTo + "-" + timeCycle + (timer.getPeriod() == null ? "" : "###" + timer.getPeriod()) + "-" + node.getId()));
} else if (timeDate != null) {
timer.setDate(timeDate);
timer.setTimeType(Timer.TIME_DATE);
compositeNode.addTimer(timer, timerAction("Timer-" + attachedTo + "-" + timeDate + "-" + node.getId()));
}
if (cancelActivity) {
List<ProcessAction> actions = ((EventNode) node).getActions(EVENT_NODE_EXIT);
if (actions == null) {
actions = new ArrayList<>();
}
ConsequenceAction cancelAction = new ConsequenceAction("java", null);
cancelAction.setMetaData(ACTION, new CancelNodeInstanceAction(attachedTo));
actions.add(cancelAction);
((EventNode) node).setActions(EVENT_NODE_EXIT, actions);
}
}
use of io.automatiko.engine.workflow.process.core.impl.ConsequenceAction in project automatiko-engine by automatiko-io.
the class ActionNodeFactory method action.
public ActionNodeFactory action(String dialect, String action, boolean isprocessAction) {
if (isprocessAction) {
ProcessAction processAction = new ProcessAction();
processAction.setMetaData(ACTION, action);
getActionNode().setAction(processAction);
} else {
getActionNode().setAction(new ConsequenceAction(dialect, action));
}
return this;
}
use of io.automatiko.engine.workflow.process.core.impl.ConsequenceAction in project automatiko-engine by automatiko-io.
the class StateBasedNodeFactory method timer.
public StateBasedNodeFactory timer(String delay, String period, String dialect, String action) {
Timer timer = new Timer();
timer.setDelay(delay);
timer.setPeriod(period);
getStateBasedNode().addTimer(timer, new ConsequenceAction(dialect, action));
return this;
}
Aggregations