Search in sources :

Example 1 with TaskQueryDto

use of org.camunda.bpm.engine.rest.dto.task.TaskQueryDto 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 2 with TaskQueryDto

use of org.camunda.bpm.engine.rest.dto.task.TaskQueryDto in project camunda-bpm-platform by camunda.

the class TaskRestServiceQueryTest method testOrQuery.

@Test
public void testOrQuery() {
    TaskQueryDto queryDto = TaskQueryDto.fromQuery(new TaskQueryImpl().or().taskName(MockProvider.EXAMPLE_TASK_NAME).taskDescription(MockProvider.EXAMPLE_TASK_DESCRIPTION).endOr());
    given().contentType(POST_JSON_CONTENT_TYPE).header(ACCEPT_JSON_HEADER).body(queryDto).then().expect().statusCode(Status.OK.getStatusCode()).when().post(TASK_QUERY_URL);
    ArgumentCaptor<TaskQueryImpl> argument = ArgumentCaptor.forClass(TaskQueryImpl.class);
    verify(((TaskQueryImpl) mockQuery)).addOrQuery(argument.capture());
    assertEquals(MockProvider.EXAMPLE_TASK_NAME, argument.getValue().getName());
    assertEquals(MockProvider.EXAMPLE_TASK_DESCRIPTION, argument.getValue().getDescription());
}
Also used : TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) TaskQueryDto(org.camunda.bpm.engine.rest.dto.task.TaskQueryDto) Test(org.junit.Test)

Aggregations

TaskQueryDto (org.camunda.bpm.engine.rest.dto.task.TaskQueryDto)2 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 TaskQueryImpl (org.camunda.bpm.engine.impl.TaskQueryImpl)1 Task (org.camunda.bpm.engine.task.Task)1 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)1 Test (org.junit.Test)1