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

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


        this.bundleContext = bundleContext;
    }

    @Override
    public void createNewTask(ProcessBag bag) throws PersistenceException {
        Task task = new Task(bag);
        persistence.create(task);
        LOGGER.info("New human task with id {} created", task.getTaskId());
    }
View Full Code Here


        return persistence.query(example);
    }

    @Override
    public Task getTaskForId(String id) throws TaskboxException {
        Task example = Task.createTaskWithAllValuesSetToNull();
        example.setTaskId(id);
        List<Task> list = getTasksForExample(example);
        if (list.size() != 1) {
            throw new TaskboxException((list.size() == 0 ? "No" : "More than one") + " task with ID " + id + " found!");
        }
        return list.get(0);
View Full Code Here

        return list.get(0);
    }

    @Override
    public List<Task> getTasksForProcessId(String id) {
        Task example = Task.createTaskWithAllValuesSetToNull();
        example.setProcessId(id);
        return getTasksForExample(example);
    }
View Full Code Here

    }

    @Override
    public synchronized void finishTask(Task task) throws WorkflowException {
        InternalWorkflowEvent finishedEvent = new InternalWorkflowEvent(task);
        Task t = Task.createTaskWithAllValuesSetToNull();
        t.setTaskId(task.getTaskId());
        List<Task> old = getTasksForExample(t);
        if (old.size() > 0) {
            try {
                updateInRunningWorkflow(old.get(0), task);
                persistence.delete(t);
View Full Code Here

        }
    }

    @Override
    public void updateTask(Task task) throws WorkflowException {
        Task oldTask = getTaskForId(task.getTaskId());
        try {
            persistence.update(oldTask, task);
            updateInRunningWorkflow(oldTask, task);
            LOGGER.info("updated task {}", task.getTaskId());
        } catch (PersistenceException e) {
View Full Code Here

        service.init();
    }

    @Test
    public void testGetTaskPanel_shouldReturnDefaultPanel() throws Exception {
        Task t = new Task();
        t.setTaskType("Type1");
        Panel p = service.getTaskPanel(t, "panel");
        assertEquals(p.getClass(), TaskPanel.class);
    }
View Full Code Here

        List<PanelRegistryEntry> list = new ArrayList<PanelRegistryEntry>();
        list.add(new PanelRegistryEntry("Type1", CustomTaskPanel.class));

        when(persistenceService.query(any(PanelRegistryEntry.class))).thenReturn(list);

        Task t = new Task();
        t.setTaskType("Type1");
        Panel p = service.getTaskPanel(t, "panel");
        assertEquals(p.getClass(), CustomTaskPanel.class);
    }
View Full Code Here

    }

    @Test
    public void testGetOpenTasks_shouldReturnOpenTasks() throws Exception {
        List<Task> result = new ArrayList<Task>();
        result.add(new Task());
        when(persistenceService.query(any(Task.class))).thenReturn(result);

        List<Task> ret = service.getOpenTasks();
        assertEquals(1, ret.size());
    }
View Full Code Here

        assertEquals(1, ret.size());
    }

    @Test
    public void testGetTaskForId_shouldRunQuery() throws Exception {
        Task task = Task.createTaskWithAllValuesSetToNull();
        task.setTaskId("1");

        try {
            service.getTaskForId("1");
        } catch (TaskboxException e) {
        }
View Full Code Here

        verify(persistenceService).query(any(Task.class));
    }

    @Test
    public void testGetTaskForProcessId_shouldRunQuery() throws Exception {
        Task task = Task.createTaskWithAllValuesSetToNull();
        task.setProcessId("1");

        service.getTasksForProcessId("1");
        verify(persistenceService).query(any(Task.class));
    }
View Full Code Here

TOP

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

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.