Search in sources :

Example 11 with Trigger

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

the class ProcessRuntimeImpl method initProcessEventListener.

private void initProcessEventListener(Process process) {
    if (process instanceof ExecutableProcess) {
        for (Node node : ((ExecutableProcess) process).getNodes()) {
            if (node instanceof StartNode) {
                StartNode startNode = (StartNode) node;
                if (startNode != null) {
                    List<Trigger> triggers = startNode.getTriggers();
                    if (triggers != null) {
                        for (Trigger trigger : triggers) {
                            if (trigger instanceof EventTrigger) {
                                final List<EventFilter> filters = ((EventTrigger) trigger).getEventFilters();
                                String type = null;
                                for (EventFilter filter : filters) {
                                    if (filter instanceof EventTypeFilter) {
                                        type = ((EventTypeFilter) filter).getType();
                                    }
                                }
                                StartProcessEventListener listener = new StartProcessEventListener(process.getId(), filters, trigger.getInMappings(), startNode.getEventTransformer());
                                signalManager.addEventListener(type, listener);
                                ((ExecutableProcess) process).getRuntimeMetaData().put("StartProcessEventType", type);
                                ((ExecutableProcess) process).getRuntimeMetaData().put("StartProcessEventListener", listener);
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) EventTypeFilter(io.automatiko.engine.workflow.base.core.event.EventTypeFilter) Trigger(io.automatiko.engine.workflow.process.core.node.Trigger) EventTrigger(io.automatiko.engine.workflow.process.core.node.EventTrigger) Node(io.automatiko.engine.api.definition.process.Node) StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) ExecutableProcess(io.automatiko.engine.workflow.process.executable.core.ExecutableProcess) EventFilter(io.automatiko.engine.workflow.base.core.event.EventFilter) EventTrigger(io.automatiko.engine.workflow.process.core.node.EventTrigger)

Aggregations

EventTrigger (io.automatiko.engine.workflow.process.core.node.EventTrigger)11 Trigger (io.automatiko.engine.workflow.process.core.node.Trigger)11 EventFilter (io.automatiko.engine.workflow.base.core.event.EventFilter)8 EventTypeFilter (io.automatiko.engine.workflow.base.core.event.EventTypeFilter)8 StartNode (io.automatiko.engine.workflow.process.core.node.StartNode)8 ConstraintTrigger (io.automatiko.engine.workflow.process.core.node.ConstraintTrigger)7 Node (io.automatiko.engine.api.definition.process.Node)5 ExecutableProcess (io.automatiko.engine.workflow.process.executable.core.ExecutableProcess)4 ArrayList (java.util.ArrayList)4 NodeContainer (io.automatiko.engine.api.definition.process.NodeContainer)3 ConsequenceAction (io.automatiko.engine.workflow.process.core.impl.ConsequenceAction)3 ActionNode (io.automatiko.engine.workflow.process.core.node.ActionNode)3 EndNode (io.automatiko.engine.workflow.process.core.node.EndNode)3 EventSubProcessNode (io.automatiko.engine.workflow.process.core.node.EventSubProcessNode)3 WorkItemNode (io.automatiko.engine.workflow.process.core.node.WorkItemNode)3 List (java.util.List)3 ContextContainer (io.automatiko.engine.workflow.base.core.ContextContainer)2 ActionExceptionHandler (io.automatiko.engine.workflow.base.core.context.exception.ActionExceptionHandler)2 ExceptionScope (io.automatiko.engine.workflow.base.core.context.exception.ExceptionScope)2 Timer (io.automatiko.engine.workflow.base.core.timer.Timer)2