Package org.drools.common

Examples of org.drools.common.InternalKnowledgeRuntime


                    }
                    boolean hidden = false;
                    if (getNode().getMetaData().get("hidden") != null) {
                      hidden = true;
                    }
                    InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime();
                    if (!hidden) {
                      ((InternalProcessRuntime) kruntime.getProcessRuntime())
                        .getProcessEventSupport().fireBeforeNodeLeft(this, kruntime);
                    }
                      ((org.jbpm.workflow.instance.NodeInstance) entry.getKey())
                      .trigger(this, entry.getValue());
                      if (!hidden) {
                        ((InternalProcessRuntime) kruntime.getProcessRuntime())
                          .getProcessEventSupport().fireAfterNodeLeft(this, kruntime);
                      }
                  }
                }
                break;
View Full Code Here


    public final void trigger(NodeInstance from, String type) {
      boolean hidden = false;
      if (getNode().getMetaData().get("hidden") != null) {
        hidden = true;
      }
      InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime();
      if (!hidden) {
        ((InternalProcessRuntime) kruntime.getProcessRuntime())
          .getProcessEventSupport().fireBeforeNodeTriggered(this, kruntime);
      }
        internalTrigger(from, type);
        if (!hidden) {
          ((InternalProcessRuntime) kruntime.getProcessRuntime())
            .getProcessEventSupport().fireAfterNodeTriggered(this, kruntime);
        }
    }
View Full Code Here

    protected void triggerConnection(Connection connection) {
      boolean hidden = false;
      if (getNode().getMetaData().get("hidden") != null) {
        hidden = true;
      }
      InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime();
      if (!hidden) {
        ((InternalProcessRuntime) kruntime.getProcessRuntime())
          .getProcessEventSupport().fireBeforeNodeLeft(this, kruntime);
      }
      // check for exclusive group first
      NodeInstanceContainer parent = getNodeInstanceContainer();
      if (parent instanceof ContextInstanceContainer) {
        List<ContextInstance> contextInstances = ((ContextInstanceContainer) parent).getContextInstances(ExclusiveGroup.EXCLUSIVE_GROUP);
        if (contextInstances != null) {
          for (ContextInstance contextInstance: new ArrayList<ContextInstance>(contextInstances)) {
            ExclusiveGroupInstance groupInstance = (ExclusiveGroupInstance) contextInstance;
            if (groupInstance.containsNodeInstance(this)) {
              for (NodeInstance nodeInstance: groupInstance.getNodeInstances()) {
                if (nodeInstance != this) {
                  ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).cancel();
                }
              }
              ((ContextInstanceContainer) parent).removeContextInstance(ExclusiveGroup.EXCLUSIVE_GROUP, contextInstance);
            }
           
          }
        }
      }
      // trigger next node
        ((org.jbpm.workflow.instance.NodeInstance) ((org.jbpm.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer())
          .getNodeInstance(connection.getTo())).trigger(this, connection.getToType());
        if (!hidden) {
          ((InternalProcessRuntime) kruntime.getProcessRuntime())
            .getProcessEventSupport().fireAfterNodeLeft(this, kruntime);
        }
    }
View Full Code Here

        public void execute(JobContext c) {
            ProcessJobContext ctx = (ProcessJobContext) c;

            Long processInstanceId = ctx.getProcessInstanceId();
            InternalKnowledgeRuntime kruntime = ctx.getKnowledgeRuntime();

            if ( processInstanceId == null ) {
                throw new IllegalArgumentException( "Could not find process instance for timer " );
            }

            ctx.getTimer().setLastTriggered( new Date() );

            ((InternalProcessRuntime) kruntime.getProcessRuntime())
              .getSignalManager().signalEvent( processInstanceId,
                                                 "timerTriggered",
                                                  ctx.getTimer() );

            if ( ctx.getTimer().getPeriod() == 0 ) {
View Full Code Here

  public void setState(final int state) {
    super.setState(state);
    // TODO move most of this to ProcessInstanceImpl
    if (state == ProcessInstance.STATE_COMPLETED
        || state == ProcessInstance.STATE_ABORTED) {
      InternalKnowledgeRuntime kruntime = getKnowledgeRuntime();
      InternalProcessRuntime processRuntime = (InternalProcessRuntime) kruntime.getProcessRuntime();
      processRuntime.getProcessEventSupport().fireBeforeProcessCompleted(this, kruntime);
      // deactivate all node instances of this process instance
      while (!nodeInstances.isEmpty()) {
        NodeInstance nodeInstance = nodeInstances.get(0);
        ((org.jbpm.workflow.instance.NodeInstance) nodeInstance)
View Full Code Here

        if (getEndNode().isTerminate()) {
          boolean hidden = false;
          if (getNode().getMetaData().get("hidden") != null) {
            hidden = true;
          }
          InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime();
          if (!hidden) {
            ((InternalProcessRuntime) kruntime.getProcessRuntime())
              .getProcessEventSupport().fireBeforeNodeLeft(this, kruntime);
          }
          ((ProcessInstance) getProcessInstance()).setState( ProcessInstance.STATE_COMPLETED );
            if (!hidden) {
              ((InternalProcessRuntime) kruntime.getProcessRuntime())
                .getProcessEventSupport().fireAfterNodeLeft(this, kruntime);
            }
        } else {
            ((NodeInstanceContainer) getNodeInstanceContainer())
                .nodeInstanceCompleted(this, null);
View Full Code Here

        Collection<StatefulKnowledgeSession> c = new ArrayList<StatefulKnowledgeSession>();
        StatefulSession[] sss = this.ruleBase.getStatefulSessions();
        if (sss != null) {
            for (StatefulSession ss : sss) {
                if (ss instanceof ReteooStatefulSession) {
                    InternalKnowledgeRuntime kruntime = ((InternalWorkingMemory) ss).getKnowledgeRuntime();
                    if( kruntime instanceof StatefulKnowledgeSession ) {
                        c.add((StatefulKnowledgeSessionImpl) kruntime);
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.drools.common.InternalKnowledgeRuntime

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.