Search in sources :

Example 1 with TaskQuery

use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.

the class ProcessEngineRestServiceTest method createTaskMock.

private void createTaskMock() {
    Task mockTask = MockProvider.createMockTask();
    TaskQuery mockTaskQuery = mock(TaskQuery.class);
    when(mockTaskQuery.taskId(eq(MockProvider.EXAMPLE_TASK_ID))).thenReturn(mockTaskQuery);
    when(mockTaskQuery.initializeFormKeys()).thenReturn(mockTaskQuery);
    when(mockTaskQuery.singleResult()).thenReturn(mockTask);
    when(mockTaskService.createTaskQuery()).thenReturn(mockTaskQuery);
}
Also used : ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask) Task(org.camunda.bpm.engine.task.Task) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery)

Example 2 with TaskQuery

use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.

the class TaskRestServiceImpl method queryTasksCount.

@Override
public CountResultDto queryTasksCount(TaskQueryDto queryDto) {
    ProcessEngine engine = getProcessEngine();
    queryDto.setObjectMapper(getObjectMapper());
    TaskQuery query = queryDto.toQuery(engine);
    long count = query.count();
    CountResultDto result = new CountResultDto();
    result.setCount(count);
    return result;
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery) CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 3 with TaskQuery

use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.

the class TaskRestServiceImpl method getHalTasks.

public HalTaskList getHalTasks(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
    TaskQueryDto queryDto = new TaskQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    ProcessEngine engine = getProcessEngine();
    TaskQuery query = queryDto.toQuery(engine);
    // get list of tasks
    List<Task> matchingTasks = executeTaskQuery(firstResult, maxResults, query);
    // get total count
    long count = query.count();
    return HalTaskList.generate(matchingTasks, count, engine);
}
Also used : Task(org.camunda.bpm.engine.task.Task) TaskQueryDto(org.camunda.bpm.engine.rest.dto.task.TaskQueryDto) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 4 with TaskQuery

use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.

the class TaskRestServiceQueryTest method setUpMockTaskQuery.

private TaskQuery setUpMockTaskQuery(List<Task> mockedTasks) {
    TaskQuery sampleTaskQuery = mock(TaskQueryImpl.class);
    when(sampleTaskQuery.list()).thenReturn(mockedTasks);
    when(sampleTaskQuery.count()).thenReturn((long) mockedTasks.size());
    when(sampleTaskQuery.taskCandidateGroup(anyString())).thenReturn(sampleTaskQuery);
    when(processEngine.getTaskService().createTaskQuery()).thenReturn(sampleTaskQuery);
    return sampleTaskQuery;
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery)

Example 5 with TaskQuery

use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.

the class AbstractExecuteFilterCmd method getFilterQuery.

protected Query<?, ?> getFilterQuery(CommandContext commandContext) {
    Filter filter = getFilter(commandContext);
    Query<?, ?> query = filter.getQuery();
    if (query instanceof TaskQuery) {
        ((TaskQuery) query).initializeFormKeys();
    }
    return query;
}
Also used : Filter(org.camunda.bpm.engine.filter.Filter) TaskQuery(org.camunda.bpm.engine.task.TaskQuery)

Aggregations

TaskQuery (org.camunda.bpm.engine.task.TaskQuery)517 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)230 Task (org.camunda.bpm.engine.task.Task)227 Test (org.junit.Test)224 Deployment (org.camunda.bpm.engine.test.Deployment)195 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)124 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)86 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)55 Filter (org.camunda.bpm.engine.filter.Filter)26 TaskQueryImpl (org.camunda.bpm.engine.impl.TaskQueryImpl)24 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)23 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)22 Execution (org.camunda.bpm.engine.runtime.Execution)22 Job (org.camunda.bpm.engine.runtime.Job)20 ExecutionQuery (org.camunda.bpm.engine.runtime.ExecutionQuery)17 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)15 Date (java.util.Date)12 HashMap (java.util.HashMap)12 SequenceFlow (org.camunda.bpm.model.bpmn.instance.SequenceFlow)12 CamundaExecutionListener (org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener)12