Search in sources :

Example 6 with NodeContainer

use of io.automatiko.engine.api.definition.process.NodeContainer in project automatiko-engine by automatiko-io.

the class XmlBPMNProcessDumper method getUniqueNodeId.

public static String getUniqueNodeId(Node node) {
    String result = (String) node.getMetaData().get("UniqueId");
    if (result != null) {
        return result;
    }
    result = node.getId() + "";
    NodeContainer nodeContainer = node.getParentContainer();
    while (nodeContainer instanceof CompositeNode) {
        CompositeNode composite = (CompositeNode) nodeContainer;
        result = composite.getId() + "-" + result;
        nodeContainer = composite.getParentContainer();
    }
    return "_" + result;
}
Also used : CompositeNode(io.automatiko.engine.workflow.process.core.node.CompositeNode) NodeContainer(io.automatiko.engine.api.definition.process.NodeContainer)

Example 7 with NodeContainer

use of io.automatiko.engine.api.definition.process.NodeContainer in project automatiko-engine by automatiko-io.

the class BPMNPlaneHandler method processConnectionInfo.

private boolean processConnectionInfo(ConnectionInfo connectionInfo, Node[] nodes) {
    for (Node node : nodes) {
        for (List<Connection> connections : node.getOutgoingConnections().values()) {
            for (Connection connection : connections) {
                String id = (String) connection.getMetaData().get("UniqueId");
                if (id != null && id.equals(connectionInfo.getElementRef())) {
                    ((ConnectionImpl) connection).setMetaData("bendpoints", connectionInfo.getBendpoints());
                    ((ConnectionImpl) connection).setMetaData("x", connectionInfo.getXs());
                    ((ConnectionImpl) connection).setMetaData("y", connectionInfo.getYs());
                    return true;
                }
            }
        }
        if (node instanceof NodeContainer) {
            boolean found = processConnectionInfo(connectionInfo, ((NodeContainer) node).getNodes());
            if (found) {
                return true;
            }
        }
    }
    return false;
}
Also used : ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode) Node(io.automatiko.engine.api.definition.process.Node) Connection(io.automatiko.engine.api.definition.process.Connection) ConnectionImpl(io.automatiko.engine.workflow.process.core.impl.ConnectionImpl) NodeContainer(io.automatiko.engine.api.definition.process.NodeContainer)

Example 8 with NodeContainer

use of io.automatiko.engine.api.definition.process.NodeContainer in project automatiko-engine by automatiko-io.

the class NodeImpl method getUniqueId.

public String getUniqueId() {
    String result = id + "";
    NodeContainer nodeContainer = getParentContainer();
    while (nodeContainer instanceof CompositeNode) {
        CompositeNode composite = (CompositeNode) nodeContainer;
        result = composite.getId() + ":" + result;
        nodeContainer = composite.getParentContainer();
    }
    return result;
}
Also used : CompositeNode(io.automatiko.engine.workflow.process.core.node.CompositeNode) NodeContainer(io.automatiko.engine.api.definition.process.NodeContainer)

Example 9 with NodeContainer

use of io.automatiko.engine.api.definition.process.NodeContainer in project automatiko-engine by automatiko-io.

the class CompensationTest method findNode.

private Node findNode(ExecutableProcess process, String nodeName) {
    Node found = null;
    Queue<io.automatiko.engine.api.definition.process.Node> nodes = new LinkedList<io.automatiko.engine.api.definition.process.Node>();
    nodes.addAll(Arrays.asList(process.getNodes()));
    while (!nodes.isEmpty()) {
        io.automatiko.engine.api.definition.process.Node node = nodes.poll();
        if (node.getName().equals(nodeName)) {
            found = (Node) node;
        }
        if (node instanceof NodeContainer) {
            nodes.addAll(Arrays.asList(((NodeContainer) node).getNodes()));
        }
    }
    assertNotNull(found, "Could not find node (" + nodeName + ").");
    return found;
}
Also used : CompositeNode(io.automatiko.engine.workflow.process.core.node.CompositeNode) CompositeContextNode(io.automatiko.engine.workflow.process.core.node.CompositeContextNode) BoundaryEventNode(io.automatiko.engine.workflow.process.core.node.BoundaryEventNode) Node(io.automatiko.engine.workflow.process.core.Node) ActionNode(io.automatiko.engine.workflow.process.core.node.ActionNode) EventSubProcessNode(io.automatiko.engine.workflow.process.core.node.EventSubProcessNode) WorkItemNode(io.automatiko.engine.workflow.process.core.node.WorkItemNode) StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) EndNode(io.automatiko.engine.workflow.process.core.node.EndNode) NodeContainer(io.automatiko.engine.api.definition.process.NodeContainer) LinkedList(java.util.LinkedList)

Example 10 with NodeContainer

use of io.automatiko.engine.api.definition.process.NodeContainer in project automatiko-engine by automatiko-io.

the class ProcessHandler method linkBoundaryTimerEvent.

protected void linkBoundaryTimerEvent(NodeContainer nodeContainer, Node node, String attachedTo, Node attachedNode) {
    boolean cancelActivity = (Boolean) node.getMetaData().get("CancelActivity");
    StateBasedNode compositeNode = (StateBasedNode) attachedNode;
    String timeDuration = (String) node.getMetaData().get("TimeDuration");
    String timeCycle = (String) node.getMetaData().get("TimeCycle");
    String timeDate = (String) node.getMetaData().get("TimeDate");
    Timer timer = new Timer();
    if (timeDuration != null) {
        timer.setDelay(timeDuration);
        timer.setTimeType(Timer.TIME_DURATION);
        ConsequenceAction consequenceAction = createJavaAction(new SignalProcessInstanceAction("Timer-" + attachedTo + "-" + timeDuration + "-" + node.getId(), kcontext -> kcontext.getNodeInstance().getId(), SignalProcessInstanceAction.PROCESS_INSTANCE_SCOPE));
        compositeNode.addTimer(timer, consequenceAction);
    } 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);
        String finalTimeCycle = timeCycle;
        ConsequenceAction action = createJavaAction(new SignalProcessInstanceAction("Timer-" + attachedTo + "-" + finalTimeCycle + (timer.getPeriod() == null ? "" : "###" + timer.getPeriod()) + "-" + node.getId(), kcontext -> kcontext.getNodeInstance().getId(), SignalProcessInstanceAction.PROCESS_INSTANCE_SCOPE));
        compositeNode.addTimer(timer, action);
    } else if (timeDate != null) {
        timer.setDate(timeDate);
        timer.setTimeType(Timer.TIME_DATE);
        ConsequenceAction action = createJavaAction(new SignalProcessInstanceAction("Timer-" + attachedTo + "-" + timeDate + "-" + node.getId(), kcontext -> kcontext.getNodeInstance().getId(), SignalProcessInstanceAction.PROCESS_INSTANCE_SCOPE));
        compositeNode.addTimer(timer, action);
    }
    if (cancelActivity) {
        List<ProcessAction> actions = ((EventNode) node).getActions(EndNode.EVENT_NODE_EXIT);
        if (actions == null) {
            actions = new ArrayList<ProcessAction>();
        }
        ConsequenceAction action = createJavaAction(new CancelNodeInstanceAction(attachedTo));
        actions.add(action);
        ((EventNode) node).setActions(EndNode.EVENT_NODE_EXIT, actions);
    }
}
Also used : Handler(io.automatiko.engine.workflow.compiler.xml.Handler) CompensationHandler(io.automatiko.engine.workflow.base.core.context.exception.CompensationHandler) StateBasedNode(io.automatiko.engine.workflow.process.core.node.StateBasedNode) ItemDefinition(io.automatiko.engine.workflow.bpmn2.core.ItemDefinition) Constraint(io.automatiko.engine.workflow.process.core.Constraint) ExecutableProcessValidator(io.automatiko.engine.workflow.process.executable.core.validation.ExecutableProcessValidator) LoggerFactory(org.slf4j.LoggerFactory) Definitions(io.automatiko.engine.workflow.bpmn2.core.Definitions) ProcessBuildData(io.automatiko.engine.workflow.compiler.xml.ProcessBuildData) FunctionTagDefinition(io.automatiko.engine.workflow.base.core.FunctionTagDefinition) Error(io.automatiko.engine.workflow.bpmn2.core.Error) Action(io.automatiko.engine.workflow.base.instance.impl.Action) NodeImpl(io.automatiko.engine.workflow.process.core.impl.NodeImpl) Matcher(java.util.regex.Matcher) ConstraintImpl(io.automatiko.engine.workflow.process.core.impl.ConstraintImpl) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ContextContainer(io.automatiko.engine.workflow.base.core.ContextContainer) DataStore(io.automatiko.engine.workflow.bpmn2.core.DataStore) CompositeContextNode(io.automatiko.engine.workflow.process.core.node.CompositeContextNode) Map(java.util.Map) TagDefinition(io.automatiko.engine.workflow.base.core.TagDefinition) Swimlane(io.automatiko.engine.workflow.base.core.context.swimlane.Swimlane) ProcessAction(io.automatiko.engine.workflow.process.core.ProcessAction) ActionNode(io.automatiko.engine.workflow.process.core.node.ActionNode) FaultNode(io.automatiko.engine.workflow.process.core.node.FaultNode) VariableScope(io.automatiko.engine.workflow.base.core.context.variable.VariableScope) ExceptionScope(io.automatiko.engine.workflow.base.core.context.exception.ExceptionScope) EventSubProcessNode(io.automatiko.engine.workflow.process.core.node.EventSubProcessNode) NodeContainer(io.automatiko.engine.api.definition.process.NodeContainer) List(java.util.List) StateNode(io.automatiko.engine.workflow.process.core.node.StateNode) EventTypeFilter(io.automatiko.engine.workflow.base.core.event.EventTypeFilter) ProcessInstanceCompensationAction(io.automatiko.engine.workflow.base.instance.impl.actions.ProcessInstanceCompensationAction) PatternConstants(io.automatiko.engine.workflow.util.PatternConstants) ExtensibleXmlParser(io.automatiko.engine.workflow.compiler.xml.ExtensibleXmlParser) SAXException(org.xml.sax.SAXException) SignalProcessInstanceAction(io.automatiko.engine.workflow.base.instance.impl.actions.SignalProcessInstanceAction) WorkItemNode(io.automatiko.engine.workflow.process.core.node.WorkItemNode) Variable(io.automatiko.engine.workflow.base.core.context.variable.Variable) BaseAbstractHandler(io.automatiko.engine.workflow.compiler.xml.BaseAbstractHandler) StaticTagDefinition(io.automatiko.engine.workflow.base.core.StaticTagDefinition) ConsequenceAction(io.automatiko.engine.workflow.process.core.impl.ConsequenceAction) Interface(io.automatiko.engine.workflow.bpmn2.core.Interface) Lane(io.automatiko.engine.workflow.bpmn2.core.Lane) SubProcessNode(io.automatiko.engine.workflow.process.core.node.SubProcessNode) Trigger(io.automatiko.engine.workflow.process.core.node.Trigger) Timer(io.automatiko.engine.workflow.base.core.timer.Timer) IntermediateLink(io.automatiko.engine.workflow.bpmn2.core.IntermediateLink) Resource(io.automatiko.engine.workflow.bpmn2.core.Resource) RuleSetNode(io.automatiko.engine.workflow.process.core.node.RuleSetNode) CompositeNode(io.automatiko.engine.workflow.process.core.node.CompositeNode) Split(io.automatiko.engine.workflow.process.core.node.Split) HashMap(java.util.HashMap) ConstraintTrigger(io.automatiko.engine.workflow.process.core.node.ConstraintTrigger) Node(io.automatiko.engine.api.definition.process.Node) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) HumanTaskNode(io.automatiko.engine.workflow.process.core.node.HumanTaskNode) DataAssociation(io.automatiko.engine.workflow.process.core.node.DataAssociation) CancelNodeInstanceAction(io.automatiko.engine.workflow.base.instance.impl.actions.CancelNodeInstanceAction) ActionExceptionHandler(io.automatiko.engine.workflow.base.core.context.exception.ActionExceptionHandler) Escalation(io.automatiko.engine.workflow.bpmn2.core.Escalation) BoundaryEventNode(io.automatiko.engine.workflow.process.core.node.BoundaryEventNode) Attributes(org.xml.sax.Attributes) EventFilter(io.automatiko.engine.workflow.base.core.event.EventFilter) Association(io.automatiko.engine.workflow.bpmn2.core.Association) Logger(org.slf4j.Logger) Signal(io.automatiko.engine.workflow.bpmn2.core.Signal) ConnectionImpl(io.automatiko.engine.workflow.process.core.impl.ConnectionImpl) Connection(io.automatiko.engine.workflow.process.core.Connection) ExtendedNodeImpl(io.automatiko.engine.workflow.process.core.impl.ExtendedNodeImpl) WorkflowProcess(io.automatiko.engine.api.definition.process.WorkflowProcess) ExecutableProcess(io.automatiko.engine.workflow.process.executable.core.ExecutableProcess) SequenceFlow(io.automatiko.engine.workflow.bpmn2.core.SequenceFlow) ConnectionRef(io.automatiko.engine.workflow.process.core.impl.ConnectionRef) StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) Process(io.automatiko.engine.workflow.base.core.Process) CompensationScope(io.automatiko.engine.workflow.base.core.context.exception.CompensationScope) EventTrigger(io.automatiko.engine.workflow.process.core.node.EventTrigger) MVEL(org.mvel2.MVEL) Message(io.automatiko.engine.workflow.bpmn2.core.Message) EndNode(io.automatiko.engine.workflow.process.core.node.EndNode) EventNode(io.automatiko.engine.workflow.process.core.node.EventNode) ProcessAction(io.automatiko.engine.workflow.process.core.ProcessAction) SignalProcessInstanceAction(io.automatiko.engine.workflow.base.instance.impl.actions.SignalProcessInstanceAction) CancelNodeInstanceAction(io.automatiko.engine.workflow.base.instance.impl.actions.CancelNodeInstanceAction) ConsequenceAction(io.automatiko.engine.workflow.process.core.impl.ConsequenceAction) StateBasedNode(io.automatiko.engine.workflow.process.core.node.StateBasedNode) BoundaryEventNode(io.automatiko.engine.workflow.process.core.node.BoundaryEventNode) EventNode(io.automatiko.engine.workflow.process.core.node.EventNode) Timer(io.automatiko.engine.workflow.base.core.timer.Timer)

Aggregations

NodeContainer (io.automatiko.engine.api.definition.process.NodeContainer)17 Node (io.automatiko.engine.api.definition.process.Node)12 CompositeNode (io.automatiko.engine.workflow.process.core.node.CompositeNode)10 EndNode (io.automatiko.engine.workflow.process.core.node.EndNode)9 EventSubProcessNode (io.automatiko.engine.workflow.process.core.node.EventSubProcessNode)9 StartNode (io.automatiko.engine.workflow.process.core.node.StartNode)9 ActionNode (io.automatiko.engine.workflow.process.core.node.ActionNode)8 WorkItemNode (io.automatiko.engine.workflow.process.core.node.WorkItemNode)8 BoundaryEventNode (io.automatiko.engine.workflow.process.core.node.BoundaryEventNode)7 EventNode (io.automatiko.engine.workflow.process.core.node.EventNode)7 FaultNode (io.automatiko.engine.workflow.process.core.node.FaultNode)7 ForEachNode (io.automatiko.engine.workflow.process.core.node.ForEachNode)5 RuleSetNode (io.automatiko.engine.workflow.process.core.node.RuleSetNode)5 StateBasedNode (io.automatiko.engine.workflow.process.core.node.StateBasedNode)5 StateNode (io.automatiko.engine.workflow.process.core.node.StateNode)5 SubProcessNode (io.automatiko.engine.workflow.process.core.node.SubProcessNode)5 EventFilter (io.automatiko.engine.workflow.base.core.event.EventFilter)4 EventTypeFilter (io.automatiko.engine.workflow.base.core.event.EventTypeFilter)4 ConnectionImpl (io.automatiko.engine.workflow.process.core.impl.ConnectionImpl)4 ExtendedNodeImpl (io.automatiko.engine.workflow.process.core.impl.ExtendedNodeImpl)4