Package org.drools.ruleflow.instance

Examples of org.drools.ruleflow.instance.RuleFlowNodeInstance


        return Collections.unmodifiableCollection( new ArrayList(this.nodeInstances) );
    }

    public RuleFlowNodeInstance getFirstNodeInstance(final long nodeId) {
        for ( final Iterator iterator = this.nodeInstances.iterator(); iterator.hasNext(); ) {
            final RuleFlowNodeInstance nodeInstance = (RuleFlowNodeInstance) iterator.next();
            if ( nodeInstance.getNodeId() == nodeId ) {
                return nodeInstance;
            }
        }
        return null;
    }
View Full Code Here


      return this.workingMemory;
    }

    public RuleFlowNodeInstance getNodeInstance(final Node node) {
        if ( node instanceof RuleSetNode ) {
            final RuleFlowNodeInstance result = (RuleFlowNodeInstance) getAgenda().getRuleFlowGroup( ((RuleSetNode) node).getRuleFlowGroup() );
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        } else if ( node instanceof Split ) {
            RuleFlowNodeInstance result = getFirstNodeInstance( node.getId() );
            if ( result == null ) {
                result = new RuleFlowSplitInstanceImpl();
                result.setNodeId( node.getId() );
                addNodeInstance( result );
            }
            return result;
        } else if ( node instanceof Join ) {
            RuleFlowNodeInstance result = getFirstNodeInstance( node.getId() );
            if ( result == null ) {
                result = new RuleFlowJoinInstanceImpl();
                result.setNodeId( node.getId() );
                addNodeInstance( result );
            }
            return result;
        } else if ( node instanceof StartNode ) {
            final RuleFlowNodeInstance result = new StartNodeInstanceImpl();
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        } else if ( node instanceof EndNode ) {
            final RuleFlowNodeInstance result = new EndNodeInstanceImpl();
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        } else if ( node instanceof MilestoneNode ) {
            final RuleFlowNodeInstance result = new MilestoneNodeInstanceImpl();
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        } else if ( node instanceof SubFlowNode ) {
            final RuleFlowNodeInstance result = new SubFlowNodeInstanceImpl();
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        } else if ( node instanceof ActionNode ) {
            final RuleFlowNodeInstance result = new ActionNodeInstanceImpl();
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        }
        throw new IllegalArgumentException( "Illegal node type: " + node.getClass() );
    }
View Full Code Here

    public void setState(final int state) {
        super.setState(state);
        if (state == ProcessInstanceImpl.STATE_COMPLETED) {
            // deactivate all node instances of this process instance
            while (!nodeInstances.isEmpty()) {
              RuleFlowNodeInstance nodeInstance = (RuleFlowNodeInstance) nodeInstances.get(0);
              nodeInstance.cancel();
            }
            workingMemory.removeEventListener((AgendaEventListener) this);
            workingMemory.removeEventListener((RuleFlowEventListener) this);
          ((EventSupport) this.workingMemory).getRuleFlowEventSupport()
            .fireRuleFlowProcessCompleted(this, this.workingMemory);
View Full Code Here

    if ("DROOLS_SYSTEM".equals(ruleFlowGroup)) {
      // new activations of the rule associate with a milestone node
      // trigger node instances of that milestone node
      String ruleName = event.getActivation().getRule().getName();
      for (Iterator iterator = getNodeInstances().iterator(); iterator.hasNext(); ) {
        RuleFlowNodeInstance nodeInstance = (RuleFlowNodeInstance) iterator.next();
        if (nodeInstance instanceof MilestoneNodeInstanceImpl) {
          String milestoneName = "RuleFlow-Milestone-" + getProcess().getId()
              + "-" + nodeInstance.getNodeId();
          if (milestoneName.equals(ruleName)) {
            ((MilestoneNodeInstanceImpl) nodeInstance).triggerCompleted();
          }
        }
       
View Full Code Here

  }

  public void ruleFlowCompleted(RuleFlowCompletedEvent event, WorkingMemory workingMemory) {
    // TODO group all subflow related code in subflow instance impl?
    for (Iterator iterator = getNodeInstances().iterator(); iterator.hasNext(); ) {
      RuleFlowNodeInstance nodeInstance = (RuleFlowNodeInstance) iterator.next();
      if (nodeInstance instanceof SubFlowNodeInstanceImpl) {
        SubFlowNodeInstanceImpl subFlowInstance = (SubFlowNodeInstanceImpl) nodeInstance;
        if (event.getRuleFlowProcessInstance().getId() == subFlowInstance.getProcessInstanceId()) {
          subFlowInstance.triggerCompleted();
        }
View Full Code Here

        return Collections.unmodifiableCollection( new ArrayList(this.nodeInstances) );
    }

    public RuleFlowNodeInstance getFirstNodeInstance(final long nodeId) {
        for ( final Iterator iterator = this.nodeInstances.iterator(); iterator.hasNext(); ) {
            final RuleFlowNodeInstance nodeInstance = (RuleFlowNodeInstance) iterator.next();
            if ( nodeInstance.getNodeId() == nodeId ) {
                return nodeInstance;
            }
        }
        return null;
    }
View Full Code Here

      return this.workingMemory;
    }

    public RuleFlowNodeInstance getNodeInstance(final Node node) {
        if ( node instanceof RuleSetNode ) {
            final RuleFlowNodeInstance result = (RuleFlowNodeInstance) getAgenda().getRuleFlowGroup( ((RuleSetNode) node).getRuleFlowGroup() );
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        } else if ( node instanceof Split ) {
            RuleFlowNodeInstance result = getFirstNodeInstance( node.getId() );
            if ( result == null ) {
                result = new RuleFlowSplitInstanceImpl();
                result.setNodeId( node.getId() );
                addNodeInstance( result );
            }
            return result;
        } else if ( node instanceof Join ) {
            RuleFlowNodeInstance result = getFirstNodeInstance( node.getId() );
            if ( result == null ) {
                result = new RuleFlowJoinInstanceImpl();
                result.setNodeId( node.getId() );
                addNodeInstance( result );
            }
            return result;
        } else if ( node instanceof StartNode ) {
            final RuleFlowNodeInstance result = new StartNodeInstanceImpl();
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        } else if ( node instanceof EndNode ) {
            final RuleFlowNodeInstance result = new EndNodeInstanceImpl();
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        } else if ( node instanceof MilestoneNode ) {
            final RuleFlowNodeInstance result = new MilestoneNodeInstanceImpl();
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        } else if ( node instanceof SubFlowNode ) {
            final RuleFlowNodeInstance result = new SubFlowNodeInstanceImpl();
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        } else if ( node instanceof ActionNode ) {
            final RuleFlowNodeInstance result = new ActionNodeInstanceImpl();
            result.setNodeId( node.getId() );
            addNodeInstance( result );
            return result;
        }
        throw new IllegalArgumentException( "Illegal node type: " + node.getClass() );
    }
View Full Code Here

    public void setState(final int state) {
        super.setState(state);
        if (state == ProcessInstanceImpl.STATE_COMPLETED) {
            // deactivate all node instances of this process instance
            while (!nodeInstances.isEmpty()) {
              RuleFlowNodeInstance nodeInstance = (RuleFlowNodeInstance) nodeInstances.get(0);
              nodeInstance.cancel();
            }
            workingMemory.removeEventListener((AgendaEventListener) this);
            workingMemory.removeEventListener((RuleFlowEventListener) this);
          ((EventSupport) this.workingMemory).getRuleFlowEventSupport()
            .fireRuleFlowProcessCompleted(this, this.workingMemory);
View Full Code Here

    if ("DROOLS_SYSTEM".equals(ruleFlowGroup)) {
      // new activations of the rule associate with a milestone node
      // trigger node instances of that milestone node
      String ruleName = event.getActivation().getRule().getName();
      for (Iterator iterator = getNodeInstances().iterator(); iterator.hasNext(); ) {
        RuleFlowNodeInstance nodeInstance = (RuleFlowNodeInstance) iterator.next();
        if (nodeInstance instanceof MilestoneNodeInstanceImpl) {
          String milestoneName = "RuleFlow-" + getProcess().getId()
              + "-" + nodeInstance.getNodeId();
          if (milestoneName.equals(ruleName)) {
            ((MilestoneNodeInstanceImpl) nodeInstance).triggerCompleted();
          }
        }
       
View Full Code Here

  }

  public void ruleFlowCompleted(RuleFlowCompletedEvent event, WorkingMemory workingMemory) {
    // TODO group all subflow related code in subflow instance impl?
    for (Iterator iterator = getNodeInstances().iterator(); iterator.hasNext(); ) {
      RuleFlowNodeInstance nodeInstance = (RuleFlowNodeInstance) iterator.next();
      if (nodeInstance instanceof SubFlowNodeInstanceImpl) {
        SubFlowNodeInstanceImpl subFlowInstance = (SubFlowNodeInstanceImpl) nodeInstance;
        if (event.getRuleFlowProcessInstance().getId() == subFlowInstance.getProcessInstanceId()) {
          subFlowInstance.triggerCompleted();
        }
View Full Code Here

TOP

Related Classes of org.drools.ruleflow.instance.RuleFlowNodeInstance

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.