Package org.kie.api.definition.process

Examples of org.kie.api.definition.process.Node


                event.getProcessInstance().getProcessName(),
                event.getProcessInstance().getId()) );
    }
   
    private String createNodeId(NodeInstance nodeInstance) {
        Node node = nodeInstance.getNode();
        if (node == null) {
            return "";
        }
        Object uniqueIdObj = node.getMetaData().get("UniqueId");
        String nodeId;
        if( uniqueIdObj == null ) {
            nodeId = "" + node.getId();
        } else {
            nodeId = (String) uniqueIdObj;
        }
        NodeContainer nodeContainer = node.getNodeContainer();
        while (nodeContainer != null) {
            if (nodeContainer instanceof Node) {
                node = (Node) nodeContainer;
                nodeContainer = node.getNodeContainer();
                // TODO fix this filter out hidden compositeNode inside ForEach node
                if (!(nodeContainer.getClass().getName().endsWith("ForEachNode"))) {
                    nodeId = node.getId() + ":" + nodeId;
                }
            } else {
                break;
            }
        }
View Full Code Here


      // not full properties for BPMN2 process, which is set to autocomplete = true
      return !getRuleFlowProcess().isAutoComplete();
    }
   
    protected void internalAddElement(ElementWrapper element) {
        Node node = ((NodeWrapper) element).getNode();
        long id = 0;
        for (Node n: getRuleFlowProcess().getNodes()) {
            if (n.getId() > id) {
                id = n.getId();
            }
View Full Code Here

                event.getProcessInstance().getProcessName(),
                event.getProcessInstance().getId()) );
    }
   
    private String createNodeId(NodeInstance nodeInstance) {
        Node node = nodeInstance.getNode();
        if (node == null) {
            return "";
        }
        Object uniqueIdObj = node.getMetaData().get("UniqueId");
        String nodeId;
        if( uniqueIdObj == null ) {
            nodeId = "" + node.getId();
        } else {
            nodeId = (String) uniqueIdObj;
        }
        NodeContainer nodeContainer = node.getNodeContainer();
        while (nodeContainer != null) {
            if (nodeContainer instanceof Node) {
                node = (Node) nodeContainer;
                nodeContainer = node.getNodeContainer();
                // TODO fix this filter out hidden compositeNode inside ForEach node
                if (!(nodeContainer.getClass().getName().endsWith("ForEachNode"))) {
                    nodeId = node.getId() + ":" + nodeId;
                }
            } else {
                break;
            }
        }
View Full Code Here

        NodeInstance eventNodeInstance = (NodeInstance) activity;
        long startTime = context.getClock().getCurrentTime();
        Map<String, Object> metadata = eventNodeInstance.getNode().getMetaData();
       
        ProcessInstance pi = eventNodeInstance.getProcessInstance();
        Node node = eventNodeInstance.getNode();
        String bpmn2NodeId = (String) metadata.get("UniqueId");
        SimulationDataProvider provider = context.getDataProvider();
       
        TimeGenerator timeGenerator=TimeGeneratorFactory.newTimeGenerator(provider.getSimulationDataForNode(node));
        long duration = timeGenerator.generateTime();
       
        context.getClock().advanceTime(duration, TimeUnit.MILLISECONDS);
        // set end time for processinstance end time
        context.setMaxEndTime(context.getClock().getCurrentTime());

        String type = (String) provider.getProcessDataForNode(node).get("node.type");

        return new ActivitySimulationEvent(pi.getProcessId(), context.getProcessInstanceId(), node.getName(), bpmn2NodeId, duration,
                startTime, context.getClock().getCurrentTime(), type);
    }
View Full Code Here

        NodeInstance gateway = (NodeInstance) activity;
        long startTime = context.getClock().getCurrentTime();
        Map<String, Object> metadata = gateway.getNode().getMetaData();
       
        ProcessInstance pi = gateway.getProcessInstance();
        Node node = gateway.getNode();
        String bpmn2NodeId = (String) metadata.get("UniqueId");
        // todo
        long duration = 0;
       
        long endTime = startTime + duration;

        context.getClock().advanceTime(duration, TimeUnit.MILLISECONDS);
        // set end time for processinstance end time
        context.setMaxEndTime(context.getClock().getCurrentTime());
        SimulationDataProvider provider = context.getDataProvider();
        String type = (String) provider.getProcessDataForNode(node).get("node.type");

        return new GatewaySimulationEvent(pi.getProcessId(), context.getProcessInstanceId(), startTime, endTime, bpmn2NodeId, node.getName(), type);
    }
View Full Code Here

        NodeInstance nodeInstance = (NodeInstance) activity;
       
        ProcessInstance pi = nodeInstance.getProcessInstance();

        context.setStartTime(context.getClock().getCurrentTime());
        Node node = nodeInstance.getNode();
        String bpmn2NodeId = (String) node.getMetaData().get("UniqueId");

        // set end time for processinstance end time
        context.setMaxEndTime(context.getClock().getCurrentTime());
       
        return new StartSimulationEvent(pi.getProcessId(), context.getProcessInstanceId(), context.getStartTime(), context.getClock().getCurrentTime(), bpmn2NodeId, node.getName());
    }
View Full Code Here

        NodeInstance stateNode = (NodeInstance) activity;
       
        Map<String, Object> metadata = stateNode.getNode().getMetaData();
       
        ProcessInstance pi = stateNode.getProcessInstance();
        Node node = stateNode.getNode();
        String bpmn2NodeId = (String) metadata.get("UniqueId");
        SimulationDataProvider provider = context.getDataProvider();
        Map<String, Object> properties = provider.getSimulationDataForNode(node);
       
        TimeGenerator timeGenerator=TimeGeneratorFactory.newTimeGenerator(properties);
        long duration = timeGenerator.generateTime();
       
        context.getStaffPoolManager().registerPool(pi.getProcessId(), node, 1);
        StaffPool pool = context.getStaffPoolManager().getActivityPool(node.getName());
       
        long waitTime = pool.allocate(context.getClock().getCurrentTime());
       
       
        double resourceUtilization = pool.getResourceUtilization();
        // ensure that duration will include wait time
        duration += waitTime;
       
        TimeUnit timeUnit = SimulationUtils.getTimeUnit(properties);
        long durationInUnit = timeUnit.convert(duration, TimeUnit.MILLISECONDS);
        double resourceCost = pool.getResourceCost() * durationInUnit;
       
        context.getClock().advanceTime((duration), TimeUnit.MILLISECONDS);
       
        // set end time for processinstance end time
        context.setMaxEndTime(context.getClock().getCurrentTime());
       
        return new HumanTaskActivitySimulationEvent(pi.getProcessId(), context.getProcessInstanceId(), node.getName(),
                bpmn2NodeId, duration, waitTime, resourceCost, startTime,
                context.getClock().getCurrentTime(), resourceUtilization);
    }
View Full Code Here

       NodeInstance stateNode = (NodeInstance) activity;
       long startTime = context.getClock().getCurrentTime();
       Map<String, Object> metadata = stateNode.getNode().getMetaData();
      
       ProcessInstance pi = stateNode.getProcessInstance();
       Node node = stateNode.getNode();
       String bpmn2NodeId = (String) metadata.get("UniqueId");
       SimulationDataProvider provider = context.getDataProvider();
      
       TimeGenerator timeGenerator=TimeGeneratorFactory.newTimeGenerator(provider.getSimulationDataForNode(node));
       long duration = timeGenerator.generateTime();
      
       context.getClock().advanceTime(duration, TimeUnit.MILLISECONDS);
       // set end time for processinstance end time
       context.setMaxEndTime(context.getClock().getCurrentTime());

       String type = (String) provider.getProcessDataForNode(node).get("node.type");

       return new ActivitySimulationEvent(pi.getProcessId(), context.getProcessInstanceId(), node.getName(), bpmn2NodeId, duration,
               startTime, context.getClock().getCurrentTime(), type);
    }
View Full Code Here

    public SimulationEvent simulate(Object activity, SimulationContext context) {
        NodeInstance nodeInstance = (NodeInstance) activity;
        long startTime = context.getClock().getCurrentTime();
        ProcessInstance pi = nodeInstance.getProcessInstance();
       
        Node node = nodeInstance.getNode();
        String bpmn2NodeId = (String) node.getMetaData().get("UniqueId");
       
        String processName = pi.getProcessName();
        String processVer = pi.getProcess().getVersion();
        if (processVer == null) {
            processVer = "";
        }
        // set end time for processinstance end time
        context.setMaxEndTime(context.getClock().getCurrentTime());
        return new EndSimulationEvent(pi.getProcessId(), context.getProcessInstanceId(), startTime, context.getClock().getCurrentTime(), context.getStartTime(), bpmn2NodeId, node.getName(), processName, processVer);
    }
View Full Code Here

        }
        long currentNodeId = getNodeId();
        // handle boundary events
        for (String boundaryEvent : context.getCurrentPath().getBoundaryEventIds()) {
           
            Node boundaryEventNode = null;
            for (Node node : getNode().getNodeContainer().getNodes()) {
               
                if (node.getMetaData().get("UniqueId").equals(boundaryEvent) &&
                        node.getMetaData().get("AttachedTo").equals(getNode().getMetaData().get("UniqueId"))) {
                  
                    boundaryEventNode = node;
                    break;
                }
            }
            if (boundaryEventNode != null) {
                NodeInstance next = ((org.jbpm.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer()).getNodeInstance(boundaryEventNode);
                setNodeId(boundaryEventNode.getId());
                this.trigger(next, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
            }
        }
        setNodeId(currentNodeId);
    }
View Full Code Here

TOP

Related Classes of org.kie.api.definition.process.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.