use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testExtendingSorting.
public void testExtendingSorting() {
// create empty query
TaskQueryImpl query = (TaskQueryImpl) taskService.createTaskQuery();
saveQuery(query);
// assert default sorting
query = filter.getQuery();
assertTrue(query.getOrderingProperties().isEmpty());
// extend query by new task query with sorting
TaskQueryImpl sortQuery = (TaskQueryImpl) taskService.createTaskQuery().orderByTaskName().asc();
Filter extendedFilter = filter.extend(sortQuery);
query = extendedFilter.getQuery();
List<QueryOrderingProperty> expectedOrderingProperties = new ArrayList<QueryOrderingProperty>(sortQuery.getOrderingProperties());
verifyOrderingProperties(expectedOrderingProperties, query.getOrderingProperties());
// extend query by new task query with additional sorting
TaskQueryImpl extendingQuery = (TaskQueryImpl) taskService.createTaskQuery().orderByTaskAssignee().desc();
extendedFilter = extendedFilter.extend(extendingQuery);
query = extendedFilter.getQuery();
expectedOrderingProperties.addAll(extendingQuery.getOrderingProperties());
verifyOrderingProperties(expectedOrderingProperties, query.getOrderingProperties());
// extend query by incomplete sorting query (should add sorting anyway)
sortQuery = (TaskQueryImpl) taskService.createTaskQuery().orderByCaseExecutionId();
extendedFilter = extendedFilter.extend(sortQuery);
query = extendedFilter.getQuery();
expectedOrderingProperties.addAll(sortQuery.getOrderingProperties());
verifyOrderingProperties(expectedOrderingProperties, query.getOrderingProperties());
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testTaskQueryWithCandidateGroupInAndCandidateGroupExpression.
public void testTaskQueryWithCandidateGroupInAndCandidateGroupExpression() {
// create an query with candidate group in and candidate group expression
TaskQueryImpl candidateGroupInQuery = (TaskQueryImpl) taskService.createTaskQuery().taskCandidateGroupIn(Arrays.asList("testGroup", "testGroup2")).taskCandidateGroupExpression("${'test'}");
assertEquals("${'test'}", candidateGroupInQuery.getExpressions().get("taskCandidateGroup"));
assertEquals(2, candidateGroupInQuery.getCandidateGroups().size());
assertEquals("testGroup", candidateGroupInQuery.getCandidateGroups().get(0));
assertEquals("testGroup2", candidateGroupInQuery.getCandidateGroups().get(1));
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testExtendTaskQueryWithCandidateGroupInExpressionAndIncludeAssignedTasks.
public void testExtendTaskQueryWithCandidateGroupInExpressionAndIncludeAssignedTasks() {
// create an empty query and save it as a filter
TaskQuery emptyQuery = taskService.createTaskQuery();
Filter emptyFilter = filterService.newTaskFilter("empty");
emptyFilter.setQuery(emptyQuery);
// create a query with candidate group in expression and include assigned tasks
// and save it as filter
TaskQuery query = taskService.createTaskQuery();
query.taskCandidateGroupInExpression("${'test'}").includeAssignedTasks();
Filter filter = filterService.newTaskFilter("filter");
filter.setQuery(query);
// extend empty query by query with candidate group in expression and include assigned tasks
Filter extendedFilter = emptyFilter.extend(query);
TaskQueryImpl extendedQuery = extendedFilter.getQuery();
assertEquals("${'test'}", extendedQuery.getExpressions().get("taskCandidateGroupIn"));
assertTrue(extendedQuery.isIncludeAssignedTasks());
// extend query with candidate group in expression and include assigned tasks with empty query
extendedFilter = filter.extend(emptyQuery);
extendedQuery = extendedFilter.getQuery();
assertEquals("${'test'}", extendedQuery.getExpressions().get("taskCandidateGroupIn"));
assertTrue(extendedQuery.isIncludeAssignedTasks());
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testTaskQueryCandidateUserIncludeAssignedTasks.
public void testTaskQueryCandidateUserIncludeAssignedTasks() {
TaskQueryImpl query = new TaskQueryImpl();
query.taskCandidateUser(testUser.getId());
query.includeAssignedTasks();
saveQuery(query);
query = filterService.getFilter(filter.getId()).getQuery();
assertEquals(testUser.getId(), query.getCandidateUser());
assertTrue(query.isIncludeAssignedTasks());
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testTaskQueryCandidateGroupExpressionIncludeAssignedTasks.
public void testTaskQueryCandidateGroupExpressionIncludeAssignedTasks() {
TaskQueryImpl query = new TaskQueryImpl();
query.taskCandidateGroupExpression(testString);
query.includeAssignedTasks();
saveQuery(query);
query = filterService.getFilter(filter.getId()).getQuery();
assertEquals(testString, query.getExpressions().get("taskCandidateGroup"));
assertTrue(query.isIncludeAssignedTasks());
}
Aggregations