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