Package org.drools.workflow.instance.impl

Examples of org.drools.workflow.instance.impl.NodeInstanceImpl


                .getConfiguration().getProcessNodeInstanceFactoryRegistry();
        NodeInstanceFactory conf = nodeRegistry.getProcessNodeInstanceFactory(node);
        if (conf == null) {
            throw new IllegalArgumentException("Illegal node type: " + node.getClass());
        }
        NodeInstanceImpl nodeInstance = (NodeInstanceImpl) conf.getNodeInstance(node, getProcessInstance(), this);
        if (nodeInstance == null) {
            throw new IllegalArgumentException("Illegal node type: " + node.getClass());
        }
        return nodeInstance;
    }
View Full Code Here


      WorkflowProcessInstance processInstance) throws IOException {
    ObjectInputStream stream = context.stream;
    long id = stream.readLong();
    long nodeId = stream.readLong();
    int nodeType = stream.readShort();
    NodeInstanceImpl nodeInstance = readNodeInstanceContent(nodeType,
        stream, context, processInstance);

    nodeInstance.setNodeId(nodeId);
    nodeInstance.setNodeInstanceContainer(nodeInstanceContainer);
    nodeInstance.setProcessInstance(processInstance);
    nodeInstance.setId(id);

    return nodeInstance;
  }
View Full Code Here

  }

  protected NodeInstanceImpl readNodeInstanceContent(int nodeType,
      ObjectInputStream stream, MarshallerReaderContext context,
      WorkflowProcessInstance processInstance) throws IOException {
    NodeInstanceImpl nodeInstance = null;
    switch ( nodeType ) {
        case PersisterEnums.RULE_SET_NODE_INSTANCE :
            nodeInstance = new RuleSetNodeInstance();
            break;
        case PersisterEnums.HUMAN_TASK_NODE_INSTANCE :
View Full Code Here

    public static NodeInstance readNodeInstance(MarshallerReaderContext context,
                                                NodeInstanceContainer nodeInstanceContainer,
                                                RuleFlowProcessInstance processInstance) throws IOException {
        ObjectInputStream stream = context.stream;
        NodeInstanceImpl nodeInstance = null;
        long id = stream.readLong();
        long nodeId = stream.readLong();
        int nodeType = stream.readShort();
        switch ( nodeType ) {
            case PersisterEnums.RULE_SET_NODE_INSTANCE :
                nodeInstance = new RuleSetNodeInstance();
                break;
            case PersisterEnums.HUMAN_TASK_NODE_INSTANCE :
                nodeInstance = new HumanTaskNodeInstance();
                ((HumanTaskNodeInstance) nodeInstance).internalSetWorkItemId( stream.readLong() );
                break;
            case PersisterEnums.WORK_ITEM_NODE_INSTANCE :
                nodeInstance = new WorkItemNodeInstance();
                ((WorkItemNodeInstance) nodeInstance).internalSetWorkItemId( stream.readLong() );
                break;
            case PersisterEnums.SUB_PROCESS_NODE_INSTANCE :
                nodeInstance = new SubProcessNodeInstance();
                ((SubProcessNodeInstance) nodeInstance).internalSetProcessInstanceId( stream.readLong() );
                break;
            case PersisterEnums.MILESTONE_NODE_INSTANCE :
                nodeInstance = new MilestoneNodeInstance();
                int nbTimerInstances = stream.readInt();
                if (nbTimerInstances > 0) {
                  List<Long> timerInstances = new ArrayList<Long>();
                  for (int i = 0; i < nbTimerInstances; i++) {
                    timerInstances.add(stream.readLong());
                  }
                  ((MilestoneNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
                }
                break;
            case PersisterEnums.TIMER_NODE_INSTANCE :
                nodeInstance = new TimerNodeInstance();
                ((TimerNodeInstance) nodeInstance).internalSetTimerId( stream.readLong() );
                break;
            case PersisterEnums.JOIN_NODE_INSTANCE :
                nodeInstance = new JoinInstance();
                int number = stream.readInt();
                if ( number > 0 ) {
                    Map<Long, Integer> triggers = new HashMap<Long, Integer>();
                    for ( int i = 0; i < number; i++ ) {
                        long l = stream.readLong();
                        int count = stream.readInt();
                        triggers.put( l,
                                      count );
                    }
                    ((JoinInstance) nodeInstance).internalSetTriggers( triggers );
                }
                break;
            case PersisterEnums.COMPOSITE_NODE_INSTANCE :
                nodeInstance = new CompositeContextNodeInstance();
                break;
            case PersisterEnums.FOR_EACH_NODE_INSTANCE :
                nodeInstance = new ForEachNodeInstance();
                break;
            default :
                throw new IllegalArgumentException( "Unknown node type: " + nodeType );
        }
        nodeInstance.setNodeId( nodeId );
        nodeInstance.setNodeInstanceContainer( nodeInstanceContainer );
        nodeInstance.setProcessInstance( processInstance );
        nodeInstance.setId( id );
        switch ( nodeType ) {
            case PersisterEnums.COMPOSITE_NODE_INSTANCE :
                int nbVariables = stream.readInt();
                if ( nbVariables > 0 ) {
                    VariableScopeInstance variableScopeInstance = (VariableScopeInstance) ((CompositeContextNodeInstance) nodeInstance).getContextInstance( VariableScope.VARIABLE_SCOPE );
View Full Code Here

        nodeInstanceContainer).getFirstNodeInstance( node.getId() );
        if (result != null) {
            return result;
        }
        try {
            NodeInstanceImpl nodeInstance = (NodeInstanceImpl) cls.newInstance();
            nodeInstance.setNodeId(node.getId());
            nodeInstance.setNodeInstanceContainer(nodeInstanceContainer);
            nodeInstance.setProcessInstance(processInstance);
            return nodeInstance;
        } catch (Exception e) {
            throw new RuntimeException("Unable to instantiate node '"
                + this.cls.getName() + "': " + e.getMessage());
        }
View Full Code Here

        this.cls = cls;
    }
   
    public NodeInstance getNodeInstance(Node node, WorkflowProcessInstance processInstance, NodeInstanceContainer nodeInstanceContainer) {    
        try {
            NodeInstanceImpl nodeInstance = (NodeInstanceImpl) this.cls.newInstance();
            nodeInstance.setNodeId(node.getId());
            nodeInstance.setNodeInstanceContainer(nodeInstanceContainer);
            nodeInstance.setProcessInstance(processInstance);
            return nodeInstance;
        } catch (Exception e) {
          e.printStackTrace();
            throw new RuntimeException("Unable to instantiate node: '"
                + this.cls.getName() + "':" + e.getMessage());
View Full Code Here

    public static NodeInstance readNodeInstance(MarshallerReaderContext context,
                                                NodeInstanceContainer nodeInstanceContainer,
                                                RuleFlowProcessInstance processInstance) throws IOException {
        ObjectInputStream stream = context.stream;
        NodeInstanceImpl nodeInstance = null;
        long id = stream.readLong();
        long nodeId = stream.readLong();
        int nodeType = stream.readShort();
        switch ( nodeType ) {
            case PersisterEnums.RULE_SET_NODE_INSTANCE :
                nodeInstance = new RuleSetNodeInstance();
                break;
            case PersisterEnums.HUMAN_TASK_NODE_INSTANCE :
                nodeInstance = new HumanTaskNodeInstance();
                ((HumanTaskNodeInstance) nodeInstance).internalSetWorkItemId( stream.readLong() );
                break;
            case PersisterEnums.WORK_ITEM_NODE_INSTANCE :
                nodeInstance = new WorkItemNodeInstance();
                ((WorkItemNodeInstance) nodeInstance).internalSetWorkItemId( stream.readLong() );
                break;
            case PersisterEnums.SUB_PROCESS_NODE_INSTANCE :
                nodeInstance = new SubProcessNodeInstance();
                ((SubProcessNodeInstance) nodeInstance).internalSetProcessInstanceId( stream.readLong() );
                break;
            case PersisterEnums.MILESTONE_NODE_INSTANCE :
                nodeInstance = new MilestoneNodeInstance();
                int nbTimerInstances = stream.readInt();
                if (nbTimerInstances > 0) {
                  List<Long> timerInstances = new ArrayList<Long>();
                  for (int i = 0; i < nbTimerInstances; i++) {
                    timerInstances.add(stream.readLong());
                  }
                  ((MilestoneNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
                }
                break;
            case PersisterEnums.TIMER_NODE_INSTANCE :
                nodeInstance = new TimerNodeInstance();
                ((TimerNodeInstance) nodeInstance).internalSetTimerId( stream.readLong() );
                break;
            case PersisterEnums.JOIN_NODE_INSTANCE :
                nodeInstance = new JoinInstance();
                int number = stream.readInt();
                if ( number > 0 ) {
                    Map<Long, Integer> triggers = new HashMap<Long, Integer>();
                    for ( int i = 0; i < number; i++ ) {
                        long l = stream.readLong();
                        int count = stream.readInt();
                        triggers.put( l,
                                      count );
                    }
                    ((JoinInstance) nodeInstance).internalSetTriggers( triggers );
                }
                break;
            case PersisterEnums.COMPOSITE_NODE_INSTANCE :
                nodeInstance = new CompositeContextNodeInstance();
                break;
            case PersisterEnums.FOR_EACH_NODE_INSTANCE :
                nodeInstance = new ForEachNodeInstance();
                break;
            default :
                throw new IllegalArgumentException( "Unknown node type: " + nodeType );
        }
        nodeInstance.setNodeId( nodeId );
        nodeInstance.setNodeInstanceContainer( nodeInstanceContainer );
        nodeInstance.setProcessInstance( processInstance );
        nodeInstance.setId( id );
        switch ( nodeType ) {
            case PersisterEnums.COMPOSITE_NODE_INSTANCE :
                int nbVariables = stream.readInt();
                if ( nbVariables > 0 ) {
                    VariableScopeInstance variableScopeInstance = (VariableScopeInstance) ((CompositeContextNodeInstance) nodeInstance).getContextInstance( VariableScope.VARIABLE_SCOPE );
View Full Code Here

                .getConfiguration().getProcessNodeInstanceFactoryRegistry();
        NodeInstanceFactory conf = nodeRegistry.getProcessNodeInstanceFactory(node);
        if (conf == null) {
            throw new IllegalArgumentException("Illegal node type: " + node.getClass());
        }
        NodeInstanceImpl nodeInstance = (NodeInstanceImpl) conf.getNodeInstance(node, getProcessInstance(), this);
        if (nodeInstance == null) {
            throw new IllegalArgumentException("Illegal node type: " + node.getClass());
        }
        return nodeInstance;
    }
View Full Code Here

            WorkflowProcessInstance processInstance) throws IOException {
        ObjectInputStream stream = context.stream;
        long id = stream.readLong();
        long nodeId = stream.readLong();
        int nodeType = stream.readShort();
        NodeInstanceImpl nodeInstance = readNodeInstanceContent(nodeType,
                stream, context, processInstance);

        nodeInstance.setNodeId(nodeId);
        nodeInstance.setNodeInstanceContainer(nodeInstanceContainer);
        nodeInstance.setProcessInstance(processInstance);
        nodeInstance.setId(id);

        switch (nodeType) {
            case PersisterEnums.COMPOSITE_NODE_INSTANCE:
            case PersisterEnums.DYNAMIC_NODE_INSTANCE:
                int nbVariables = stream.readInt();
View Full Code Here

    }

    protected NodeInstanceImpl readNodeInstanceContent(int nodeType,
            ObjectInputStream stream, MarshallerReaderContext context,
            WorkflowProcessInstance processInstance) throws IOException {
        NodeInstanceImpl nodeInstance = null;
        switch (nodeType) {
            case PersisterEnums.RULE_SET_NODE_INSTANCE:
                nodeInstance = new RuleSetNodeInstance();
                break;
            case PersisterEnums.HUMAN_TASK_NODE_INSTANCE:
View Full Code Here

TOP

Related Classes of org.drools.workflow.instance.impl.NodeInstanceImpl

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.