Search in sources :

Example 46 with ConsequenceAction

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);
}
Also used : ConsequenceAction(io.automatiko.engine.workflow.process.core.impl.ConsequenceAction) ActionExceptionHandler(io.automatiko.engine.workflow.base.core.context.exception.ActionExceptionHandler)

Example 47 with ConsequenceAction

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);
    }
}
Also used : StateBasedNode(io.automatiko.engine.workflow.process.core.node.StateBasedNode) ProcessAction(io.automatiko.engine.workflow.process.core.ProcessAction) EventNode(io.automatiko.engine.workflow.process.core.node.EventNode) CancelNodeInstanceAction(io.automatiko.engine.workflow.base.instance.impl.actions.CancelNodeInstanceAction) Timer(io.automatiko.engine.workflow.base.core.timer.Timer) ConsequenceAction(io.automatiko.engine.workflow.process.core.impl.ConsequenceAction)

Example 48 with ConsequenceAction

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;
}
Also used : ProcessAction(io.automatiko.engine.workflow.process.core.ProcessAction) ConsequenceAction(io.automatiko.engine.workflow.process.core.impl.ConsequenceAction)

Example 49 with ConsequenceAction

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;
}
Also used : Timer(io.automatiko.engine.workflow.base.core.timer.Timer) ConsequenceAction(io.automatiko.engine.workflow.process.core.impl.ConsequenceAction)

Aggregations

ConsequenceAction (io.automatiko.engine.workflow.process.core.impl.ConsequenceAction)49 ProcessAction (io.automatiko.engine.workflow.process.core.ProcessAction)30 ActionNode (io.automatiko.engine.workflow.process.core.node.ActionNode)25 EndNode (io.automatiko.engine.workflow.process.core.node.EndNode)18 ArrayList (java.util.ArrayList)17 EventTypeFilter (io.automatiko.engine.workflow.base.core.event.EventTypeFilter)16 EventNode (io.automatiko.engine.workflow.process.core.node.EventNode)16 StartNode (io.automatiko.engine.workflow.process.core.node.StartNode)15 ExecutableProcess (io.automatiko.engine.workflow.process.executable.core.ExecutableProcess)14 BoundaryEventNode (io.automatiko.engine.workflow.process.core.node.BoundaryEventNode)11 Action (io.automatiko.engine.workflow.base.instance.impl.Action)10 CancelNodeInstanceAction (io.automatiko.engine.workflow.base.instance.impl.actions.CancelNodeInstanceAction)10 ConnectionImpl (io.automatiko.engine.workflow.process.core.impl.ConnectionImpl)10 WorkItemNode (io.automatiko.engine.workflow.process.core.node.WorkItemNode)10 Timer (io.automatiko.engine.workflow.base.core.timer.Timer)9 EventTrigger (io.automatiko.engine.workflow.process.core.node.EventTrigger)9 Map (java.util.Map)9 Node (io.automatiko.engine.api.definition.process.Node)8 ProcessContext (io.automatiko.engine.api.runtime.process.ProcessContext)8 ActionExceptionHandler (io.automatiko.engine.workflow.base.core.context.exception.ActionExceptionHandler)8