Package org.jbpm.api

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


    }

    @Test
    public void testWaitStatesSequence() {
        ProcessInstance processInstance = executionService.startProcessInstanceByKey("StateSequence");
        Execution executionInA = processInstance.findActiveExecutionIn("a");
        assertNotNull(executionInA);

        processInstance = executionService.signalExecutionById(executionInA.getId());
        Execution executionInB = processInstance.findActiveExecutionIn("b");
        assertNotNull(executionInB);

        processInstance = executionService.signalExecutionById(executionInB.getId());
        Execution executionInC = processInstance.findActiveExecutionIn("c");
        assertNotNull(executionInC);
    }
View Full Code Here

     *
     * @return the newly-created ProcessInstance
     */
    public Object startProcess(Object processDefinitionKey, Object signalName, Map variables) throws Exception
    {
        ProcessInstance processInstance =
            processEngine.getExecutionService().startProcessInstanceByKey((String) processDefinitionKey, (Map) variables);

        if (processInstance == null)
        {
            throw new IllegalArgumentException("No process definition found for process " + processDefinitionKey);
View Full Code Here

        {
            processEngine.getExecutionService().signalExecutionById((String) executionId, (String) signalName, variables);
        }

        // Refresh process info. from the DB
        ProcessInstance process = processEngine.getExecutionService().findProcessInstanceById(processId);
        if (process == null)
        {
            // The process has already ended, so we return a mock/skeleton ProcessInstance with the expected ID and state = "ended"
            process = new EndedProcess(processId);
        }
View Full Code Here

        {
            processEngine.getExecutionService().setVariables((String) executionId, variables);
        }

        // Refresh process info. from the DB
        ProcessInstance process = processEngine.getExecutionService().findProcessInstanceById(processId);
        if (process == null)
        {
            // The process has already ended, so we return a mock/skeleton ProcessInstance with the expected ID and state = "ended"
            process = new EndedProcess(processId);
        }
View Full Code Here

        BPMS bpms = muleContext.getRegistry().lookupObject(BPMS.class);
        assertNotNull(bpms);

        // Create a new process.
        MuleMessage response = muleContext.getClient().send("vm://fork", "data", null);                     
        ProcessInstance process = (ProcessInstance) response.getPayload();
       
        // The process should be waiting for asynchronous responses from both services
        String state = (String) bpms.getState(process);
        assertTrue(state.contains("waitForResponseA"));
        assertTrue(state.contains("waitForResponseB"));

        Thread.sleep(2000);

        // ServiceA is initially stopped, so we're still waiting for a response from ServiceA
        process = (ProcessInstance) bpms.lookupProcess(process.getId());
        assertEquals("waitForResponseA", bpms.getState(process));

        // Start ServiceA
        muleContext.getRegistry().lookupService("ServiceA").resume();
        Thread.sleep(2000);
                   
        // The process should have ended.
        process = (ProcessInstance) bpms.lookupProcess(process.getId());
        assertTrue("Process should have ended, but is in state " + bpms.getState(process),
                bpms.hasEnded(process));
    }
View Full Code Here

     * @return the newly-created ProcessInstance
     */
    @Override
    public Object startProcess(Object processDefinitionKey, Object signalName, Map variables) throws Exception
    {
        ProcessInstance processInstance =
            processEngine.getExecutionService().startProcessInstanceByKey((String) processDefinitionKey, variables);

        if (processInstance == null)
        {
            throw new IllegalArgumentException("No process definition found for process " + processDefinitionKey);
View Full Code Here

        {
            processEngine.getExecutionService().signalExecutionById((String) executionId, (String) signalName, variables);
        }

        // Refresh process info. from the DB
        ProcessInstance process = processEngine.getExecutionService().findProcessInstanceById(processId);
        if (process == null)
        {
            // The process has already ended, so we return a mock/skeleton ProcessInstance with the expected ID and state = "ended"
            process = new EndedProcess(processId);
        }
View Full Code Here

        {
            processEngine.getExecutionService().setVariables((String) executionId, variables);
        }

        // Refresh process info. from the DB
        ProcessInstance process = processEngine.getExecutionService().findProcessInstanceById(processId);
        if (process == null)
        {
            // The process has already ended, so we return a mock/skeleton ProcessInstance with the expected ID and state = "ended"
            process = new EndedProcess(processId);
        }
View Full Code Here

        BPMS bpms = muleContext.getRegistry().lookupObject(BPMS.class);
        assertNotNull(bpms);

        // Create a new process.
        MuleMessage response = muleContext.getClient().send("vm://fork", "data", null);
        ProcessInstance process = (ProcessInstance) response.getPayload();
       
        // The process should be waiting for asynchronous responses from both services
        String state = (String) bpms.getState(process);
        assertTrue(state.contains("waitForResponseA"));
        assertTrue(state.contains("waitForResponseB"));

        Thread.sleep(2000);

        // ServiceA is initially stopped, so we're still waiting for a response from ServiceA
        process = (ProcessInstance) bpms.lookupProcess(process.getId());
        assertEquals("waitForResponseA", bpms.getState(process));

        // Start ServiceA
        muleContext.getRegistry().lookupService("ServiceA").resume();
        Thread.sleep(2000);
                   
        // The process should have ended.
        process = (ProcessInstance) bpms.lookupProcess(process.getId());
        assertTrue("Process should have ended, but is in state " + bpms.getState(process),
                bpms.hasEnded(process));
    }
View Full Code Here

TOP

Related Classes of org.jbpm.api.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.