Search in sources :

Example 16 with TaskQueryImpl

use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.

the class FilterTaskQueryTest method testTaskQueryByBusinessKeyLikeExpressionInAdhocQuery.

public void testTaskQueryByBusinessKeyLikeExpressionInAdhocQuery() {
    // given
    processEngineConfiguration.setEnableExpressionsInAdhocQueries(true);
    String aBusinessKey = "business key";
    Mocks.register("aBusinessKeyLike", "%" + aBusinessKey.substring(5));
    createDeploymentWithBusinessKey(aBusinessKey);
    // when
    Filter filter = filterService.newTaskFilter("aFilterName");
    filter.setQuery(taskService.createTaskQuery());
    filterService.saveFilter(filter);
    TaskQueryImpl extendingQuery = (TaskQueryImpl) taskService.createTaskQuery().processInstanceBusinessKeyLikeExpression("${ " + Mocks.getMocks().keySet().toArray()[0] + " }");
    // then
    assertEquals(extendingQuery.getExpressions().get("processInstanceBusinessKeyLike"), "${ " + Mocks.getMocks().keySet().toArray()[0] + " }");
    assertEquals(1, filterService.list(filter.getId(), extendingQuery).size());
}
Also used : Filter(org.camunda.bpm.engine.filter.Filter) TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl)

Example 17 with TaskQueryImpl

use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.

the class FilterTaskQueryTest method testTaskQueryCandidateUserExpressionIncludeAssignedTasks.

public void testTaskQueryCandidateUserExpressionIncludeAssignedTasks() {
    TaskQueryImpl query = new TaskQueryImpl();
    query.taskCandidateUserExpression(testString);
    query.includeAssignedTasks();
    saveQuery(query);
    query = filterService.getFilter(filter.getId()).getQuery();
    assertEquals(testString, query.getExpressions().get("taskCandidateUser"));
    assertTrue(query.isIncludeAssignedTasks());
}
Also used : TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl)

Example 18 with TaskQueryImpl

use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.

the class FilterTaskQueryTest method testTaskQueryCandidateGroupIncludeAssignedTasks.

public void testTaskQueryCandidateGroupIncludeAssignedTasks() {
    TaskQueryImpl query = new TaskQueryImpl();
    query.taskCandidateGroup(testGroup.getId());
    query.includeAssignedTasks();
    saveQuery(query);
    query = filterService.getFilter(filter.getId()).getQuery();
    assertEquals(testGroup.getId(), query.getCandidateGroup());
    assertTrue(query.isIncludeAssignedTasks());
}
Also used : TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl)

Example 19 with TaskQueryImpl

use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.

the class FilterTaskQueryTest method testTaskQueryCandidateGroupsIncludeAssignedTasks.

public void testTaskQueryCandidateGroupsIncludeAssignedTasks() {
    TaskQueryImpl query = new TaskQueryImpl();
    query.taskCandidateGroupIn(testCandidateGroups);
    query.includeAssignedTasks();
    saveQuery(query);
    query = filterService.getFilter(filter.getId()).getQuery();
    assertEquals(testCandidateGroups, query.getCandidateGroupsInternal());
    assertTrue(query.isIncludeAssignedTasks());
}
Also used : TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl)

Example 20 with TaskQueryImpl

use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.

the class FilterTaskQueryTest method testTaskQueryByFollowUpBeforeOrNotExistentExtendingQuery.

public void testTaskQueryByFollowUpBeforeOrNotExistentExtendingQuery() {
    // create query
    TaskQueryImpl query = new TaskQueryImpl();
    query.followUpBeforeOrNotExistent(testDate);
    // save filter without query
    filterService.saveFilter(filter);
    // fetch from db
    filter = filterService.createTaskFilterQuery().singleResult();
    // use query as extending query
    List<Task> tasks = filterService.list(filter.getId(), query);
    assertEquals(3, tasks.size());
    // set as filter query and save filter
    filter.setQuery(query);
    filterService.saveFilter(filter);
    // fetch from db
    filter = filterService.createTaskFilterQuery().singleResult();
    tasks = filterService.list(filter.getId());
    assertEquals(3, tasks.size());
    TaskQuery extendingQuery = taskService.createTaskQuery();
    extendingQuery.orderByTaskCreateTime().asc();
    tasks = filterService.list(filter.getId(), extendingQuery);
    assertEquals(3, tasks.size());
}
Also used : Task(org.camunda.bpm.engine.task.Task) TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) TaskQuery(org.camunda.bpm.engine.task.TaskQuery)

Aggregations

TaskQueryImpl (org.camunda.bpm.engine.impl.TaskQueryImpl)60 Filter (org.camunda.bpm.engine.filter.Filter)26 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)25 Test (org.junit.Test)17 FilterEntity (org.camunda.bpm.engine.impl.persistence.entity.FilterEntity)12 MockProvider.mockFilter (org.camunda.bpm.engine.rest.helper.MockProvider.mockFilter)12 QueryOrderingProperty (org.camunda.bpm.engine.impl.QueryOrderingProperty)8 Map (java.util.Map)7 Response (com.jayway.restassured.response.Response)6 HashMap (java.util.HashMap)6 Matchers.isEmptyOrNullString (org.hamcrest.Matchers.isEmptyOrNullString)6 Matchers.anyString (org.mockito.Matchers.anyString)6 JSONObject (org.camunda.bpm.engine.impl.util.json.JSONObject)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 Date (java.util.Date)3 TaskQueryVariableValue (org.camunda.bpm.engine.impl.TaskQueryVariableValue)3 JsonTaskQueryConverter (org.camunda.bpm.engine.impl.json.JsonTaskQueryConverter)3 ArrayList (java.util.ArrayList)2 JSONArray (org.camunda.bpm.engine.impl.util.json.JSONArray)2 VariableQueryParameterDto (org.camunda.bpm.engine.rest.dto.VariableQueryParameterDto)2