Search in sources :

Example 91 with TaskQuery

use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.

the class MultiInstanceTest method testSequentialSubProcessEndEvent.

@Deployment
public void testSequentialSubProcessEndEvent() {
    // ACT-1185: end-event in subprocess causes inactivated execution
    String procId = runtimeService.startProcessInstanceByKey("miSequentialSubprocess").getId();
    TaskQuery query = taskService.createTaskQuery().orderByTaskName().asc();
    for (int i = 0; i < 4; i++) {
        List<Task> tasks = query.list();
        assertEquals(1, tasks.size());
        assertEquals("task one", tasks.get(0).getName());
        taskService.complete(tasks.get(0).getId());
        // Last run, the execution no longer exists
        if (i != 3) {
            List<String> activities = runtimeService.getActiveActivityIds(procId);
            assertNotNull(activities);
            assertEquals(1, activities.size());
        }
    }
    assertProcessEnded(procId);
}
Also used : Task(org.activiti.engine.task.Task) DelegateTask(org.activiti.engine.delegate.DelegateTask) TaskQuery(org.activiti.engine.task.TaskQuery) Deployment(org.activiti.engine.test.Deployment)

Example 92 with TaskQuery

use of org.activiti.engine.task.TaskQuery in project midpoint by Evolveum.

the class WorkItemProvider method searchWorkItems.

public SearchResultList<WorkItemType> searchWorkItems(ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult result) throws SchemaException {
    TaskQuery taskQuery = createTaskQuery(query, true, options, result);
    if (taskQuery == null) {
        return new SearchResultList<>(Collections.emptyList());
    }
    Integer offset = query != null ? query.getOffset() : null;
    Integer maxSize = query != null ? query.getMaxSize() : null;
    List<Task> tasks;
    if (offset == null && maxSize == null) {
        tasks = taskQuery.list();
    } else {
        tasks = taskQuery.listPage(defaultIfNull(offset, 0), defaultIfNull(maxSize, Integer.MAX_VALUE));
    }
    // TODO implement based on options
    boolean getAllVariables = true;
    // there's no need to fill-in assignee details ; but candidates are necessary to fill-in; TODO implement based on options (resolve)
    return tasksToWorkItems(tasks, null, false, false, true, getAllVariables, result);
}
Also used : SearchResultList(com.evolveum.midpoint.schema.SearchResultList) Task(org.activiti.engine.task.Task) TaskQuery(org.activiti.engine.task.TaskQuery)

Aggregations

TaskQuery (org.activiti.engine.task.TaskQuery)92 Task (org.activiti.engine.task.Task)32 Deployment (org.activiti.engine.test.Deployment)29 ActivitiException (org.activiti.engine.ActivitiException)19 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)19 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)12 ArrayList (java.util.ArrayList)10 SimpleDateFormat (java.text.SimpleDateFormat)8 Date (java.util.Date)7 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)6 DelegateTask (org.activiti.engine.delegate.DelegateTask)3 HistoricVariableInstance (org.activiti.engine.history.HistoricVariableInstance)3 HistoricVariableInstanceEntity (org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity)3 Job (org.activiti.engine.runtime.Job)3 HashMap (java.util.HashMap)2 TaskService (org.activiti.engine.TaskService)2 Test (org.testng.annotations.Test)2 PrismPropertyValue (com.evolveum.midpoint.prism.PrismPropertyValue)1 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)1 PrismValue (com.evolveum.midpoint.prism.PrismValue)1