Package org.jbpm.process.instance

Examples of org.jbpm.process.instance.ProcessInstance


        builder.addRuleFlow(source);
        Package pkg = builder.getPackage();
        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
        ruleBase.addPackage( pkg );
        WorkingMemory workingMemory = ruleBase.newStatefulSession();
        ProcessInstance processInstance = ( ProcessInstance )
            workingMemory.startProcess("org.drools.exception");
        assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
    }
View Full Code Here


        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
        ruleBase.addPackage( pkg );
        WorkingMemory workingMemory = ruleBase.newStatefulSession();
        List<String> list = new ArrayList<String>();
        workingMemory.setGlobal("list", list);
        ProcessInstance processInstance = ( ProcessInstance )
            workingMemory.startProcess("org.drools.exception");
        assertEquals(1, list.size());
        assertEquals("SomeValue", list.get(0));
        assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
    }
View Full Code Here

        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
        ruleBase.addPackage( pkg );
        WorkingMemory workingMemory = ruleBase.newStatefulSession();
        List<String> list = new ArrayList<String>();
        workingMemory.setGlobal("list", list);
        ProcessInstance processInstance = ( ProcessInstance )
            workingMemory.startProcess("org.drools.exception");
        assertEquals(1, list.size());
        assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
    }
View Full Code Here

  public void handleException(ExceptionHandler handler, String exception, Object params) {
   
    if (handler instanceof ActionExceptionHandler) {
      Action action = (Action) ((ActionExceptionHandler) handler).getAction().getMetaData("Action");
      try {
          ProcessInstance processInstance = getProcessInstance();
          ProcessContext processContext = new ProcessContext(processInstance.getKnowledgeRuntime());
          ContextInstanceContainer contextInstanceContainer = getContextInstanceContainer();
          if (contextInstanceContainer instanceof NodeInstance) {
            processContext.setNodeInstance((NodeInstance) contextInstanceContainer);
          } else {
            processContext.setProcessInstance(processInstance);
View Full Code Here

          processInstance.setState(ProcessInstance.STATE_ABORTED);
        } else {
          ProcessEventSupport eventSupport = ((InternalProcessRuntime)
          ((InternalKnowledgeRuntime) ksession).getProcessRuntime()).getProcessEventSupport();
        eventSupport.fireBeforeNodeTriggered(subProcessNodeInstance, ksession);
        ProcessInstance subProcessInstance = (ProcessInstance)
          ksession.startProcess(processId, parameters);
        eventSupport.fireAfterNodeTriggered(subProcessNodeInstance, ksession);
        if (subProcessInstance.getState() == ProcessInstance.STATE_COMPLETED) {
          subProcessNodeInstance.triggerCompleted();
        } else {
          subProcessNodeInstance.internalSetProcessInstanceId(subProcessInstance.getId());
            subProcessNodeInstance.addEventListeners();
        }
        }
  }
View Full Code Here

          System.err.println("Could not find process " + processId);
          System.err.println("Aborting process");
          ((ProcessInstance) getProcessInstance()).setState(ProcessInstance.STATE_ABORTED);
          throw new RuntimeDroolsException("Could not find process " + processId);
        } else {
        ProcessInstance processInstance = ( ProcessInstance )
          ((ProcessInstance) getProcessInstance()).getKnowledgeRuntime()
            .startProcess(processId, parameters);
        this.processInstanceId = processInstance.getId();
        ((ProcessInstanceImpl) processInstance).setMetaData("ParentProcessInstanceId", processInstance.getId());
        if (!getSubProcessNode().isWaitForCompletion()) {
          triggerCompleted();
        } else if (processInstance.getState() == ProcessInstance.STATE_COMPLETED) {
          handleOutMappings(processInstance);
          triggerCompleted();
        } else {
          addProcessListener();
        }
View Full Code Here

    }
   
    public void cancel() {
        super.cancel();
        if (getSubProcessNode() == null || !getSubProcessNode().isIndependent()) {
            ProcessInstance processInstance = (ProcessInstance)
                ((ProcessInstance) getProcessInstance()).getKnowledgeRuntime()
                    .getProcessInstance(processInstanceId);
            if (processInstance != null) {
              processInstance.setState(ProcessInstance.STATE_ABORTED);
            }
        }
    }
View Full Code Here

   
    @Override
    public Void execute(Context context) {
      Collection<?> processInstances = ksession.getProcessInstances();
      for (Object obj : processInstances) {
        ProcessInstance instance = (ProcessInstance) obj;
        boolean notCompeted = instance.getState() != ProcessInstance.STATE_COMPLETED;
        boolean notAborted = instance.getState() != ProcessInstance.STATE_ABORTED;
        boolean hasId = instance.getId() > 0;
        if (hasId && notCompeted && notAborted) {
          ProcessInstanceInfo info = new ProcessInstanceInfo(instance, ksession.getEnvironment());
          info.setId(instance.getId());
          info.transform();
          persistenceContext.persist(info);
        }
      }
      return null;
View Full Code Here

TOP

Related Classes of org.jbpm.process.instance.ProcessInstance

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.