Search in sources :

Example 41 with ProcessAction

use of io.automatiko.engine.workflow.process.core.ProcessAction in project automatiko-engine by automatiko-io.

the class EndNodeFactory method action.

public EndNodeFactory action(Action action) {
    ProcessAction processAction = new ProcessAction();
    processAction.setMetaData(ACTION, action);
    List<ProcessAction> enterActions = getEndNode().getActions(ExtendedNodeImpl.EVENT_NODE_ENTER);
    if (enterActions == null) {
        enterActions = new ArrayList<>();
        getEndNode().setActions(ExtendedNodeImpl.EVENT_NODE_ENTER, enterActions);
    }
    enterActions.add(processAction);
    return this;
}
Also used : ProcessAction(io.automatiko.engine.workflow.process.core.ProcessAction)

Example 42 with ProcessAction

use of io.automatiko.engine.workflow.process.core.ProcessAction in project automatiko-engine by automatiko-io.

the class ExtendedNodeFactory method onEntryAction.

public ExtendedNodeFactory onEntryAction(String dialect, String action) {
    if (getExtendedNode().getActions(dialect) != null) {
        getExtendedNode().getActions(dialect).add(new ConsequenceAction(dialect, action));
    } else {
        List<ProcessAction> actions = new ArrayList<>();
        actions.add(new ConsequenceAction(dialect, action));
        getExtendedNode().setActions(ExtendedNodeImpl.EVENT_NODE_ENTER, actions);
    }
    return this;
}
Also used : ProcessAction(io.automatiko.engine.workflow.process.core.ProcessAction) ConsequenceAction(io.automatiko.engine.workflow.process.core.impl.ConsequenceAction) ArrayList(java.util.ArrayList)

Example 43 with ProcessAction

use of io.automatiko.engine.workflow.process.core.ProcessAction in project automatiko-engine by automatiko-io.

the class ExtendedNodeFactory method onExitAction.

public ExtendedNodeFactory onExitAction(String dialect, String action) {
    if (getExtendedNode().getActions(dialect) != null) {
        getExtendedNode().getActions(dialect).add(new ConsequenceAction(dialect, action));
    } else {
        List<ProcessAction> actions = new ArrayList<>();
        actions.add(new ConsequenceAction(dialect, action));
        getExtendedNode().setActions(ExtendedNodeImpl.EVENT_NODE_EXIT, actions);
    }
    return this;
}
Also used : ProcessAction(io.automatiko.engine.workflow.process.core.ProcessAction) ConsequenceAction(io.automatiko.engine.workflow.process.core.impl.ConsequenceAction) ArrayList(java.util.ArrayList)

Example 44 with ProcessAction

use of io.automatiko.engine.workflow.process.core.ProcessAction 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 45 with ProcessAction

use of io.automatiko.engine.workflow.process.core.ProcessAction 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)

Aggregations

ProcessAction (io.automatiko.engine.workflow.process.core.ProcessAction)47 ConsequenceAction (io.automatiko.engine.workflow.process.core.impl.ConsequenceAction)30 ActionNode (io.automatiko.engine.workflow.process.core.node.ActionNode)20 EndNode (io.automatiko.engine.workflow.process.core.node.EndNode)18 ArrayList (java.util.ArrayList)18 EventNode (io.automatiko.engine.workflow.process.core.node.EventNode)16 StartNode (io.automatiko.engine.workflow.process.core.node.StartNode)15 EventTypeFilter (io.automatiko.engine.workflow.base.core.event.EventTypeFilter)14 Action (io.automatiko.engine.workflow.base.instance.impl.Action)13 ExecutableProcess (io.automatiko.engine.workflow.process.executable.core.ExecutableProcess)13 Timer (io.automatiko.engine.workflow.base.core.timer.Timer)12 ProcessContext (io.automatiko.engine.api.runtime.process.ProcessContext)11 BoundaryEventNode (io.automatiko.engine.workflow.process.core.node.BoundaryEventNode)11 CancelNodeInstanceAction (io.automatiko.engine.workflow.base.instance.impl.actions.CancelNodeInstanceAction)10 ConnectionImpl (io.automatiko.engine.workflow.process.core.impl.ConnectionImpl)9 Node (io.automatiko.engine.api.definition.process.Node)8 ContextContainer (io.automatiko.engine.workflow.base.core.ContextContainer)7 VariableScope (io.automatiko.engine.workflow.base.core.context.variable.VariableScope)7 EventTrigger (io.automatiko.engine.workflow.process.core.node.EventTrigger)7 WorkItemNode (io.automatiko.engine.workflow.process.core.node.WorkItemNode)7