Package org.activiti.engine

Examples of org.activiti.engine.RuntimeService


        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(Lists.newArrayList("1", "invalid"));

        ProcessVariablesCollector collector = new ProcessVariablesCollector();
        collector.install(execution);

        RuntimeService runtimeService = mockRuntimeService(ImmutableMap.of(
            "1", mockProcessInstance(/* ended= */ true)), "invalid");

        JavaDelegate delegate = new CheckProcessesEnded(runtimeService, PROCESS_IDS, RESULT);
        delegate.execute(execution);

View Full Code Here


        ProcessEngine engine = this.getProcessEngine();
        if (engine == null) {
            out().println("Process Engine NOT Found!");
            return null;
        }
        RuntimeService runtimeService = engine.getRuntimeService();

        if (this.instanceIDs != null && this.instanceIDs.length > 0) {
            for (String instanceID : this.instanceIDs) {
                signal(runtimeService, instanceID, this.activities);
            }
            return null;
        }

        if (!signalAll) {
            out().println("Process instance IDs required or use the command with -a or --all option");
            return null;
        } else {
            out().println("Signalling all executions in all active process instances...");
            List<ProcessInstance> piList = runtimeService.createProcessInstanceQuery().orderByProcessInstanceId().asc().list();
            for (ProcessInstance pi : piList) {
                signal(runtimeService, pi.getProcessInstanceId(), this.activities);
            }
        }
View Full Code Here

    }

    protected void printDetails(String pid) {
        ProcessEngine pe = this.getProcessEngine();
        RepositoryService repo = pe.getRepositoryService();
        RuntimeService rt = pe.getRuntimeService();
        HistoryService hs = pe.getHistoryService();

        ProcessInstance pi = rt.createProcessInstanceQuery().processInstanceId(pid).singleResult();
        HistoricProcessInstance hpi = hs.createHistoricProcessInstanceQuery().processInstanceId(pid)
            .singleResult();
        if (pi == null && hpi == null) {
            // both null means. no process with that id.
            out().printf("No process details found with process id %s \n", pid);
View Full Code Here

            boolean printActive = !this.active; // if we show active process, dont print then in history
            printHistoricProcessInstances(out(), his, printActive);
        }

        if (this.active) {
            RuntimeService rt = pe.getRuntimeService();
            printActiveProcessInstances(out(), rt);
        }


        return null;
View Full Code Here

        if (pe == null) {
            out().println("Process Engine NOT Found!");
            return null;
        }

        RuntimeService rt = pe.getRuntimeService();
        if (definitionID != null) {
            ProcessInstance pi = rt.startProcessInstanceById(definitionID);
            out().printf("Process instance %s Started\n", pi.getProcessInstanceId());
        }

        return null;
    }
View Full Code Here

        if (processEngine == null) {
            out().println("Process Engine NOT Found!");
            return null;
        }

        RuntimeService runtimeService = processEngine.getRuntimeService();

        if (this.instanceIDs != null && this.instanceIDs.length > 0) {
            for (String instanceID : instanceIDs) {
                runtimeService.deleteProcessInstance(instanceID, "Forcefully terminating the instance");
                out().printf("Process instance %s terminated\n", instanceID);
            }
            return null;
        }

        if (!killAll) {
            out().println("Process instance IDs required or use the command with -a or --all option");
            return null;
        } else {
            out().println("Signalling all executions in all active process instances...");
            List<ProcessInstance> piList = runtimeService.createProcessInstanceQuery().orderByProcessInstanceId().asc().list();
            for (ProcessInstance pi : piList) {
                String instanceID = pi.getProcessInstanceId();
                runtimeService.deleteProcessInstance(instanceID, "Forcefully terminating the instance");
                out().printf("Process instance %s terminated\n", instanceID);
            }
        }

        return null;
View Full Code Here

            convertTimeoutToISO8601TimeDuration(pool.getBootstrapTimeInSeconds()));

        /* Authenticate as kermit to make the process visible in the Explorer UI */
        processEngine.getIdentityService().setAuthenticatedUserId(CoreConstants.ACTIVITI_EXPLORER_DEFAULT_USER);

        RuntimeService runtimeService = processEngine.getRuntimeService();
        ProcessInstance instance = runtimeService.startProcessInstanceByKey(PROCESS_KEY, businessKey, arguments);

        return instance.getProcessInstanceId();
    }
View Full Code Here

        ProcessInstanceQuery query = mock(ProcessInstanceQuery.class);
        when(query.singleResult()).thenReturn(instance);
        when(query.processInstanceBusinessKey(eq(businessKey))).thenReturn(query);

        RuntimeService runtimeService = mock(RuntimeService.class);
        when(runtimeService.createProcessInstanceQuery()).thenReturn(query);
        when(runtimeService.getVariable(eq(processInstanceId), eq(CoreProcessVariables.PROVIDER)))
            .thenReturn(providerId);

        ProcessEngine processEngine = mock(ProcessEngine.class);
        when(processEngine.getRuntimeService()).thenReturn(runtimeService);
View Full Code Here

        return instance;
    }

    private void setVariable(ProcessEngine engine, String instanceId, String key, Object value) {
        RuntimeService runtimeService = engine.getRuntimeService();

        when(runtimeService.getVariable(instanceId, key)).thenReturn(value);
    }
View Full Code Here

    }

    private ProcessEngine newProcessEngineMock(List<ProcessInstance> instances) {
        ProcessEngine processEngine = mock(ProcessEngine.class);

        RuntimeService runtimeService = mock(RuntimeService.class);
        when(processEngine.getRuntimeService()).thenReturn(runtimeService);

        ProcessInstanceQuery allInstancesQuery = mock(ProcessInstanceQuery.class);
        when(allInstancesQuery.list()).thenReturn(instances);
        when(runtimeService.createProcessInstanceQuery()).thenReturn(allInstancesQuery);

        for (ProcessInstance instance : instances) {
            ProcessInstanceQuery singleResultQuery = mock(ProcessInstanceQuery.class);

            when(singleResultQuery.list()).thenReturn(ImmutableList.of(instance));
View Full Code Here

TOP

Related Classes of org.activiti.engine.RuntimeService

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.