Package org.openengsb.core.workflow.api.model

Examples of org.openengsb.core.workflow.api.model.ProcessBag


        if (processIdFromEvent != null) {
            processIds.add(processIdFromEvent);
            processIds.addAll(getSubFlows(session.getProcessInstance(processIdFromEvent)));
        }
        if (event instanceof InternalWorkflowEvent) {
            ProcessBag bag = ((InternalWorkflowEvent) event).getProcessBag();
            Long processIdFromBag = Long.parseLong(bag.getProcessId());
            processIds.add(processIdFromBag);
            processIds.addAll(getSubFlows(session.getProcessInstance(processIdFromBag)));
        }

        return processIds;
View Full Code Here


    private void updateInRunningWorkflow(Task oldTask, Task task) {
        if (oldTask.getProcessId() == null) {
            return;
        }
        long id = Long.parseLong(oldTask.getProcessId());
        ProcessBag bag = null;
        try {
            bag = workflowService.getProcessBagForInstance(id);
        } catch (IllegalArgumentException e) {
            return;
        }
        if (Objects.equal(oldTask, bag)) {
            bag.setProperties(task.getProperties());
        }
    }
View Full Code Here

    public static long startFlow(KnowledgeRuntime session, String processId) {
        return startFlow(session, processId, new HashMap<String, Object>());
    }

    public static long startFlow(KnowledgeRuntime session, String processId, Map<String, Object> params) {
        ProcessBag processBag = getProcessBag(params);
        ProcessInstance processInstance = session.createProcessInstance(processId, params);
        session.insert(processInstance);
        processBag.setProcessId(String.valueOf(processInstance.getId()));
        session.startProcessInstance(processInstance.getId());
        return processInstance.getId();
    }
View Full Code Here

        session.startProcessInstance(processInstance.getId());
        return processInstance.getId();
    }

    private static ProcessBag getProcessBag(Map<String, Object> params) {
        ProcessBag processBag;
        if (!params.containsKey("processBag")) {
            processBag = new ProcessBag();
            params.put("processBag", processBag);
        } else {
            processBag = (ProcessBag) params.get("processBag");
        }
        return processBag;
View Full Code Here

        service.init();
    }

    @Test
    public void testCreateNewTask_shouldReturnNewTask() throws Exception {
        internalService.createNewTask(new ProcessBag());
        verify(persistenceService).create(any(Task.class));
    }
View Full Code Here

        task.setProcessId("1");
        List<Task> result = new ArrayList<Task>();
        result.add(task);
        when(persistenceService.query(any(Task.class))).thenReturn(result);

        ProcessBag bag = new ProcessBag(task);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("processBag", bag);
        workflowService.startFlowWithParameters("TaskDemoWorkflow", map);
        service.finishTask(task);
View Full Code Here

        verify(logService, times(2)).doSomething("Hello World");
    }

    @Test
    public void testStartProcessWithProperyBagAndChangePropertyByScriptNode_shouldChangeProperty() throws Exception {
        ProcessBag processBag = new ProcessBag();
        Map<String, Object> parameterMap = new HashMap<String, Object>();
        parameterMap.put("processBag", processBag);
        long id = service.startFlowWithParameters("propertybagtest", parameterMap);
        service.waitForFlowToFinishIndefinitely(id);
        assertThat((String) processBag.getProperty("test"), is(String.valueOf(id)));
    }
View Full Code Here

        return task;
    }

    @Test
    public void testExecuteWorkflow_shouldRunWorkFlow() throws Exception {
        ProcessBag result = service.executeWorkflow("simpleFlow", new ProcessBag());
        assertThat((Integer) result.getProperty("test"), is(42));
        assertThat((String) result.getProperty("alternativeName"),
            is("The answer to life the universe and everything"));
    }
View Full Code Here

    }

    @Test
    public void testCancelWorkflowWithOpenTasks_shouldAbortWorkflow() throws Exception {
        long pid = service.startFlow("ci");
        ProcessBag bag = new ProcessBag();
        bag.setProcessId(Long.toString(pid));
        taskboxInternal.createNewTask(bag);
        service.cancelFlow(pid);
        service.waitForFlowToFinish(pid, 5000);
        assertThat("Tasks were not cancelled properly", taskbox.getOpenTasks().isEmpty(), is(true));
    }
View Full Code Here

        addWorkflow("TaskDemoWorkflow");
       
        assertThat(taskboxService.getOpenTasks().size(), is(0));
        authenticateAsAdmin();

        ProcessBag processBag = new ProcessBag();
        processBag.addProperty("test", "test");
        Map<String, Object> parameterMap = new HashMap<String, Object>();
        parameterMap.put("processBag", processBag);

        assertThat(taskboxService.getOpenTasks().size(), is(0));

        workflowService.startFlowWithParameters("TaskDemoWorkflow", parameterMap);
        assertNotNull(processBag.getProcessId());
        assertThat(taskboxService.getOpenTasks().size(), is(1));

        Task task = taskboxService.getOpenTasks().get(0);
        assertEquals(task.getProcessId(), processBag.getProcessId());
        assertEquals(task.getProperty("test"), "test");
        assertEquals(task.getTaskType(), "demo");
        assertNotNull(task.getTaskId());
        taskboxService.finishTask(task);
        assertTrue(taskboxService.getOpenTasks().size() == 0);
View Full Code Here

TOP

Related Classes of org.openengsb.core.workflow.api.model.ProcessBag

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.