Package org.activiti.engine

Examples of org.activiti.engine.ProcessEngine


        }
        return obj;
    }

    protected Object executeCommand() throws Exception {
        ProcessEngine pe = this.getProcessEngine();
        if (pe == null) {
            out().println("Process Engine NOT Found!");
            return null;
        }
        if (this.instanceID == null || this.instanceID.trim().length() == 0) {
View Full Code Here


        this.getPrintHandler().printActivityData(out, this.isVerbose(), this.isQuiet(), actInst);
        out().println("-------------");
    }

    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) {
View Full Code Here

    private boolean cascade;


    @Override
    protected Object doExecute() throws Exception {
        ProcessEngine engine = this.getProcessEngine();
        if (engine == null) {
            out().println("Process Engine NOT Found!");
            return null;
        }

        RepositoryService repo = engine.getRepositoryService();

        if (this.deploymentIDs != null && this.deploymentIDs.length > 0) {
            for (String deploymentID : this.deploymentIDs) {
                repo.deleteDeployment(deploymentID, this.cascade);
                out().printf("Undeployed %s \n", deploymentID);
View Full Code Here

    private boolean deployments;


    @Override
    protected Object doExecute() throws Exception {
        ProcessEngine pe = this.getProcessEngine();

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

        if (!(this.active || this.definitions || this.history || this.deployments)) {
            // none of them set, display everything
            // set all to true;
            this.active = this.definitions = this.history = this.deployments = true;
        }

        if (this.deployments) {
            RepositoryService repo = pe.getRepositoryService();
            printDeployments(out(), repo);
        }

        if (this.definitions) {
            RepositoryService repo = pe.getRepositoryService();
            printProcessDefinitions(out(), repo);
        }

        if (this.history) {
            HistoryService his = pe.getHistoryService();
            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

        description = "Activiti Process definition ID to start an instance of it.")
    private String definitionID;

    @Override
    protected Object doExecute() throws Exception {
        ProcessEngine pe = this.getProcessEngine();
        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());
        }
View Full Code Here

        description = "Removes history of process instances started from the definitions")
    private String[] definitionIDs;

    @Override
    protected Object doExecute() throws Exception {
        ProcessEngine engine = this.getProcessEngine();
        if (engine == null) {
            out().println("Process Engine NOT Found!");
            return null;
        }
        HistoryService historyService = engine.getHistoryService();

        // order of priority if instnaceIDs or definitionIDs and all on the list
        // process instnaceID and exist or process definitionIDs and exit or process all
        // TODO figure out how to add mutually exclusive options - instanceIDs | definitions | all
View Full Code Here

    @Option(name = "-a", aliases = "--all", description = "Kill all active process instances")
    private boolean killAll;

    @Override
    protected Object doExecute() throws Exception {
        ProcessEngine processEngine = this.getProcessEngine();
        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);
View Full Code Here

    @Test
    public void testDestroyPool() throws Exception {
        Provisionr service = mock(Provisionr.class);
        when(service.getId()).thenReturn(TEST_PROVISIONR_ID);

        ProcessEngine processEngine = mockProcessEngine(PROCESS_INSTANCE_ID, TEST_BUSINESS_KEY, TEST_PROVISIONR_ID);

        DestroyPoolCommand command = new DestroyPoolCommand(ImmutableList.of(service), processEngine);
        command.setBusinessKey(TEST_BUSINESS_KEY);

        CommandSession session = mock(CommandSession.class);
View Full Code Here

        verify(service).destroyPool(TEST_BUSINESS_KEY);
    }

    @Test(expected = NoSuchElementException.class)
    public void testFailsWithAnEmptyServiceList() throws Exception {
        ProcessEngine processEngine = mockProcessEngine(PROCESS_INSTANCE_ID, TEST_BUSINESS_KEY, TEST_PROVISIONR_ID);

        DestroyPoolCommand command = new DestroyPoolCommand(ImmutableList.<Provisionr>of(), processEngine);

        CommandSession session = mock(CommandSession.class);
        command.setBusinessKey(TEST_BUSINESS_KEY);
View Full Code Here

        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);

        return processEngine;
    }
View Full Code Here

TOP

Related Classes of org.activiti.engine.ProcessEngine

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.