use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testExtendTaskQueryWithCandidateGroupInAndCandidateGroup.
public void testExtendTaskQueryWithCandidateGroupInAndCandidateGroup() {
// create an query with candidate group in and save it as a filter
TaskQueryImpl candidateGroupInQuery = (TaskQueryImpl) taskService.createTaskQuery().taskCandidateGroupIn(Arrays.asList("testGroup", "testGroup2"));
assertEquals(2, candidateGroupInQuery.getCandidateGroups().size());
assertEquals("testGroup", candidateGroupInQuery.getCandidateGroups().get(0));
assertEquals("testGroup2", candidateGroupInQuery.getCandidateGroups().get(1));
Filter candidateGroupInFilter = filterService.newTaskFilter("Groups filter");
candidateGroupInFilter.setQuery(candidateGroupInQuery);
// create a query with candidate group
// and save it as filter
TaskQuery candidateGroupQuery = taskService.createTaskQuery().taskCandidateGroup("testGroup2");
// extend candidate group in filter by query with candidate group
Filter extendedFilter = candidateGroupInFilter.extend(candidateGroupQuery);
TaskQueryImpl extendedQuery = extendedFilter.getQuery();
assertEquals(1, extendedQuery.getCandidateGroups().size());
assertEquals("testGroup2", extendedQuery.getCandidateGroups().get(0));
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterServiceTest method testExtendFilter.
public void testExtendFilter() {
TaskQuery extendingQuery = taskService.createTaskQuery().taskName("newName").taskOwner("newOwner");
Filter newFilter = filter.extend(extendingQuery);
assertNull(newFilter.getId());
TaskQueryImpl filterQuery = newFilter.getQuery();
assertEquals("newName", filterQuery.getName());
assertEquals("newOwner", filterQuery.getOwner());
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testTaskQuery.
public void testTaskQuery() {
// create query
TaskQueryImpl query = new TaskQueryImpl();
query.taskId(testString);
query.taskName(testString);
query.taskNameNotEqual(testString);
query.taskNameLike(testString);
query.taskNameNotLike(testString);
query.taskDescription(testString);
query.taskDescriptionLike(testString);
query.taskPriority(testInteger);
query.taskMinPriority(testInteger);
query.taskMaxPriority(testInteger);
query.taskAssignee(testString);
query.taskAssigneeExpression(testString);
query.taskAssigneeLike(testString);
query.taskAssigneeLikeExpression(testString);
query.taskInvolvedUser(testString);
query.taskInvolvedUserExpression(testString);
query.taskOwner(testString);
query.taskOwnerExpression(testString);
query.taskUnassigned();
query.taskAssigned();
query.taskDelegationState(testDelegationState);
query.taskCandidateGroupIn(testCandidateGroups);
query.taskCandidateGroupInExpression(testString);
query.withCandidateGroups();
query.withoutCandidateGroups();
query.withCandidateUsers();
query.withoutCandidateUsers();
query.processInstanceId(testString);
query.executionId(testString);
query.activityInstanceIdIn(testActivityInstances);
query.taskCreatedOn(testDate);
query.taskCreatedOnExpression(testString);
query.taskCreatedBefore(testDate);
query.taskCreatedBeforeExpression(testString);
query.taskCreatedAfter(testDate);
query.taskCreatedAfterExpression(testString);
query.taskDefinitionKey(testString);
query.taskDefinitionKeyIn(testKeys);
query.taskDefinitionKeyLike(testString);
query.processDefinitionKey(testString);
query.processDefinitionKeyIn(testKeys);
query.processDefinitionId(testString);
query.processDefinitionName(testString);
query.processDefinitionNameLike(testString);
query.processInstanceBusinessKey(testString);
query.processInstanceBusinessKeyExpression(testString);
query.processInstanceBusinessKeyIn(testKeys);
query.processInstanceBusinessKeyLike(testString);
query.processInstanceBusinessKeyLikeExpression(testString);
// variables
query.taskVariableValueEquals(variableNames[0], variableValues[0]);
query.taskVariableValueGreaterThanOrEquals(variableNames[1], variableValues[1]);
query.processVariableValueLessThan(variableNames[2], variableValues[2]);
query.processVariableValueLike(variableNames[3], (String) variableValues[3]);
query.caseInstanceVariableValueNotEquals(variableNames[4], variableValues[4]);
query.caseInstanceVariableValueLessThanOrEquals(variableNames[5], variableValues[5]);
query.dueDate(testDate);
query.dueDateExpression(testString);
query.dueBefore(testDate);
query.dueBeforeExpression(testString);
query.dueAfter(testDate);
query.dueAfterExpression(testString);
query.followUpDate(testDate);
query.followUpDateExpression(testString);
query.followUpBefore(testDate);
query.followUpBeforeExpression(testString);
query.followUpAfter(testDate);
query.followUpAfterExpression(testString);
query.excludeSubtasks();
query.suspended();
query.caseDefinitionKey(testString);
query.caseDefinitionId(testString);
query.caseDefinitionName(testString);
query.caseDefinitionNameLike(testString);
query.caseInstanceId(testString);
query.caseInstanceBusinessKey(testString);
query.caseInstanceBusinessKeyLike(testString);
query.caseExecutionId(testString);
// ordering
query.orderByExecutionId().desc();
query.orderByDueDate().asc();
query.orderByProcessVariable("var", ValueType.STRING).desc();
List<QueryOrderingProperty> expectedOrderingProperties = query.getOrderingProperties();
// save filter
filter.setQuery(query);
filterService.saveFilter(filter);
// fetch from db
filter = filterService.createTaskFilterQuery().singleResult();
// test query
query = filter.getQuery();
assertEquals(testString, query.getTaskId());
assertEquals(testString, query.getName());
assertEquals(testString, query.getNameNotEqual());
assertEquals(testString, query.getNameNotLike());
assertEquals(testString, query.getNameLike());
assertEquals(testString, query.getDescription());
assertEquals(testString, query.getDescriptionLike());
assertEquals(testInteger, query.getPriority());
assertEquals(testInteger, query.getMinPriority());
assertEquals(testInteger, query.getMaxPriority());
assertEquals(testString, query.getAssignee());
assertEquals(testString, query.getExpressions().get("taskAssignee"));
assertEquals(testString, query.getAssigneeLike());
assertEquals(testString, query.getExpressions().get("taskAssigneeLike"));
assertEquals(testString, query.getInvolvedUser());
assertEquals(testString, query.getExpressions().get("taskInvolvedUser"));
assertEquals(testString, query.getOwner());
assertEquals(testString, query.getExpressions().get("taskOwner"));
assertTrue(query.isUnassigned());
assertTrue(query.isAssigned());
assertEquals(testDelegationState, query.getDelegationState());
assertEquals(testCandidateGroups, query.getCandidateGroups());
assertTrue(query.isWithCandidateGroups());
assertTrue(query.isWithoutCandidateGroups());
assertTrue(query.isWithCandidateUsers());
assertTrue(query.isWithoutCandidateUsers());
assertEquals(testString, query.getExpressions().get("taskCandidateGroupIn"));
assertEquals(testString, query.getProcessInstanceId());
assertEquals(testString, query.getExecutionId());
assertEquals(testActivityInstances.length, query.getActivityInstanceIdIn().length);
for (int i = 0; i < query.getActivityInstanceIdIn().length; i++) {
assertEquals(testActivityInstances[i], query.getActivityInstanceIdIn()[i]);
}
assertEquals(testDate, query.getCreateTime());
assertEquals(testString, query.getExpressions().get("taskCreatedOn"));
assertEquals(testDate, query.getCreateTimeBefore());
assertEquals(testString, query.getExpressions().get("taskCreatedBefore"));
assertEquals(testDate, query.getCreateTimeAfter());
assertEquals(testString, query.getExpressions().get("taskCreatedAfter"));
assertEquals(testString, query.getKey());
assertEquals(testKeys.length, query.getKeys().length);
for (int i = 0; i < query.getKeys().length; i++) {
assertEquals(testKeys[i], query.getKeys()[i]);
}
assertEquals(testString, query.getKeyLike());
assertEquals(testString, query.getProcessDefinitionKey());
for (int i = 0; i < query.getProcessDefinitionKeys().length; i++) {
assertEquals(testKeys[i], query.getProcessDefinitionKeys()[i]);
}
assertEquals(testString, query.getProcessDefinitionId());
assertEquals(testString, query.getProcessDefinitionName());
assertEquals(testString, query.getProcessDefinitionNameLike());
assertEquals(testString, query.getProcessInstanceBusinessKey());
assertEquals(testString, query.getExpressions().get("processInstanceBusinessKey"));
for (int i = 0; i < query.getProcessInstanceBusinessKeys().length; i++) {
assertEquals(testKeys[i], query.getProcessInstanceBusinessKeys()[i]);
}
assertEquals(testString, query.getProcessInstanceBusinessKeyLike());
assertEquals(testString, query.getExpressions().get("processInstanceBusinessKeyLike"));
// variables
List<TaskQueryVariableValue> variables = query.getVariables();
for (int i = 0; i < variables.size(); i++) {
TaskQueryVariableValue variable = variables.get(i);
assertEquals(variableNames[i], variable.getName());
assertEquals(variableValues[i], variable.getValue());
assertEquals(variableOperators[i], variable.getOperator());
assertEquals(isTaskVariable[i], variable.isLocal());
assertEquals(isProcessVariable[i], variable.isProcessInstanceVariable());
}
assertEquals(testDate, query.getDueDate());
assertEquals(testString, query.getExpressions().get("dueDate"));
assertEquals(testDate, query.getDueBefore());
assertEquals(testString, query.getExpressions().get("dueBefore"));
assertEquals(testDate, query.getDueAfter());
assertEquals(testString, query.getExpressions().get("dueAfter"));
assertEquals(testDate, query.getFollowUpDate());
assertEquals(testString, query.getExpressions().get("followUpDate"));
assertEquals(testDate, query.getFollowUpBefore());
assertEquals(testString, query.getExpressions().get("followUpBefore"));
assertEquals(testDate, query.getFollowUpAfter());
assertEquals(testString, query.getExpressions().get("followUpAfter"));
assertTrue(query.isExcludeSubtasks());
assertEquals(SuspensionState.SUSPENDED, query.getSuspensionState());
assertEquals(testString, query.getCaseDefinitionKey());
assertEquals(testString, query.getCaseDefinitionId());
assertEquals(testString, query.getCaseDefinitionName());
assertEquals(testString, query.getCaseDefinitionNameLike());
assertEquals(testString, query.getCaseInstanceId());
assertEquals(testString, query.getCaseInstanceBusinessKey());
assertEquals(testString, query.getCaseInstanceBusinessKeyLike());
assertEquals(testString, query.getCaseExecutionId());
// ordering
verifyOrderingProperties(expectedOrderingProperties, query.getOrderingProperties());
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testTaskQueryCandidateGroup.
public void testTaskQueryCandidateGroup() {
TaskQueryImpl query = new TaskQueryImpl();
query.taskCandidateGroup(testGroup.getId());
query.taskCandidateGroupExpression(testGroup.getId());
filter.setQuery(query);
query = filter.getQuery();
assertEquals(testGroup.getId(), query.getCandidateGroup());
assertEquals(testGroup.getId(), query.getExpressions().get("taskCandidateGroup"));
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testTaskQueryWithCandidateGroupInExpressionAndCandidateGroup.
public void testTaskQueryWithCandidateGroupInExpressionAndCandidateGroup() {
// create an query with candidate group in expression and candidate group at once
TaskQueryImpl candidateGroupInQuery = (TaskQueryImpl) taskService.createTaskQuery().taskCandidateGroupInExpression("${'test'}").taskCandidateGroup("testGroup");
assertEquals("${'test'}", candidateGroupInQuery.getExpressions().get("taskCandidateGroupIn"));
assertEquals("testGroup", candidateGroupInQuery.getCandidateGroup());
}
Aggregations