Examples of ProcessInstance


Examples of org.drools.runtime.process.ProcessInstance

  }

  public void testSubProcess() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-SubProcess.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("SubProcess");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

Examples of org.drools.runtime.process.ProcessInstance

    Map<String, Object> params = new HashMap<String, Object>();
    List<String> myList = new ArrayList<String>();
    myList.add("First Item");
    myList.add("Second Item");
    params.put("list", myList);
    ProcessInstance processInstance = ksession.startProcess("MultiInstanceLoopCharacteristicsProcess", params);
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

Examples of org.drools.runtime.process.ProcessInstance

  }

    public void testEscalationBoundaryEvent() throws Exception {
        KnowledgeBase kbase = createKnowledgeBase("BPMN2-EscalationBoundaryEvent.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        ProcessInstance processInstance = ksession.startProcess("EscalationBoundaryEvent");
        assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
    }
View Full Code Here

Examples of org.drools.runtime.process.ProcessInstance

    public void testEscalationBoundaryEventInterrupting() throws Exception {
        KnowledgeBase kbase = createKnowledgeBase("BPMN2-EscalationBoundaryEventInterrupting.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        ksession.getWorkItemManager().registerWorkItemHandler("MyTask", new DoNothingWorkItemHandler());
        ProcessInstance processInstance = ksession.startProcess("EscalationBoundaryEvent");
        assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
        // TODO: check for cancellation of task
    }
View Full Code Here

Examples of org.fireflow.engine.impl.ProcessInstance

        if (e.getEventType() == NodeInstanceEvent.NODEINSTANCE_COMPLETED) {
            // 执行ProcessInstance的complete操作

            IToken tk = e.getToken();
           
            ProcessInstance currentProcessInstance = (ProcessInstance) tk.getProcessInstance();
            currentProcessInstance.complete();
        }
    }
View Full Code Here

Examples of org.jbpm.api.ProcessInstance

    try
    {
      ExecutionService execService = this.processEngine.getExecutionService();
      ProcessInstanceQuery query = execService.createProcessInstanceQuery();
      query.processInstanceId(instanceId);
      ProcessInstance processInstance = query.uniqueResult();
      return ModelAdaptor.adoptExecution( (ExecutionImpl)processInstance);
    }
    finally
    {
      env.close();
View Full Code Here

Examples of org.jbpm.graph.exe.ProcessInstance

    ProcessDefinition definition =
      ProcessDefinition.parseXmlResource("simple.par/processdefinition.xml");
    assertNotNull("Definition should not be null", definition);

    // Create an instance of the process definition.
    ProcessInstance instance = new ProcessInstance(definition);
    assertEquals(
        "Instance is in start state",
        instance.getRootToken().getNode().getName(),
        "start");
    assertNull(
        "Message variable should not exist yet",
        instance.getContextInstance().getVariable("message"));

    // Move the process instance from its start state to the first state.
    // The configured action should execute and the appropriate message
    // should appear in the message process variable.
    instance.signal();
    assertEquals(
        "Instance is in first state",
        instance.getRootToken().getNode().getName(),
        "first");
    assertEquals(
        "Message variable contains message",
        instance.getContextInstance().getVariable("message"),
        "Going to the first state!");

    // Move the process instance to the end state. The configured action
    // should execute again. The message variable contains a new value.
    instance.signal();
    assertEquals(
        "Instance is in end state",
        instance.getRootToken().getNode().getName(),
        "end");
    assertTrue("Instance has ended", instance.hasEnded());
    assertEquals(
        "Message variable is changed",
        instance.getContextInstance().getVariable("message"),
        "About to finish!");

  }
View Full Code Here

Examples of org.jbpm.process.instance.ProcessInstance

        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.dynamic");
        assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
        assertEquals(4, list.size());
    }
View Full Code Here

Examples of org.jbpm.process.instance.ProcessInstance

        WorkingMemory workingMemory = ruleBase.newStatefulSession();
        List<String> list = new ArrayList<String>();
        workingMemory.setGlobal("list", list);
        TestWorkItemHandler testHandler = new TestWorkItemHandler();
        workingMemory.getWorkItemManager().registerWorkItemHandler("Work", testHandler);
        ProcessInstance processInstance = ( ProcessInstance )
            workingMemory.startProcess("org.drools.dynamic");
        assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
        assertEquals(1, list.size());
        WorkItem workItem = testHandler.getWorkItem();
        assertNotNull(workItem);
        workingMemory.getWorkItemManager().completeWorkItem(workItem.getId(), null);
        assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
        assertEquals(3, list.size());
    }
View Full Code Here

Examples of org.jbpm.process.instance.ProcessInstance

    StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
    KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
    TestWorkItemHandler handler = new TestWorkItemHandler();
    ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
    // start a new process instance
    ProcessInstance processInstance = (ProcessInstance) ksession.startProcess("org.drools.dynamic");
    DynamicNodeInstance dynamicContext = (DynamicNodeInstance)
      ((WorkflowProcessInstance) processInstance).getNodeInstances().iterator().next();
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("TaskName", "Dynamic Task");
    assertNull(handler.getWorkItem());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.