use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class TaskQueryDto method fromQuery.
public static TaskQueryDto fromQuery(Query<?, ?> query, boolean isOrQueryActive) {
TaskQueryImpl taskQuery = (TaskQueryImpl) query;
TaskQueryDto dto = new TaskQueryDto();
if (!isOrQueryActive) {
dto.orQueries = new ArrayList<TaskQueryDto>();
for (TaskQueryImpl orQuery : taskQuery.getQueries()) {
if (orQuery.isOrQueryActive()) {
dto.orQueries.add(fromQuery(orQuery, true));
}
}
}
dto.activityInstanceIdIn = taskQuery.getActivityInstanceIdIn();
dto.caseDefinitionId = taskQuery.getCaseDefinitionId();
dto.caseDefinitionKey = taskQuery.getCaseDefinitionKey();
dto.caseDefinitionName = taskQuery.getCaseDefinitionName();
dto.caseDefinitionNameLike = taskQuery.getCaseDefinitionNameLike();
dto.caseExecutionId = taskQuery.getCaseExecutionId();
dto.caseInstanceBusinessKey = taskQuery.getCaseInstanceBusinessKey();
dto.caseInstanceBusinessKeyLike = taskQuery.getCaseInstanceBusinessKeyLike();
dto.caseInstanceId = taskQuery.getCaseInstanceId();
dto.candidateUser = taskQuery.getCandidateUser();
dto.candidateGroup = taskQuery.getCandidateGroup();
dto.candidateGroups = taskQuery.getCandidateGroupsInternal();
dto.includeAssignedTasks = taskQuery.isIncludeAssignedTasksInternal();
dto.withCandidateGroups = taskQuery.isWithCandidateGroups();
dto.withoutCandidateGroups = taskQuery.isWithoutCandidateGroups();
dto.withCandidateUsers = taskQuery.isWithCandidateUsers();
dto.withoutCandidateUsers = taskQuery.isWithoutCandidateUsers();
dto.processInstanceBusinessKey = taskQuery.getProcessInstanceBusinessKey();
dto.processInstanceBusinessKeyLike = taskQuery.getProcessInstanceBusinessKeyLike();
dto.processDefinitionKey = taskQuery.getProcessDefinitionKey();
dto.processDefinitionKeyIn = taskQuery.getProcessDefinitionKeys();
dto.processDefinitionId = taskQuery.getProcessDefinitionId();
dto.executionId = taskQuery.getExecutionId();
dto.processDefinitionName = taskQuery.getProcessDefinitionName();
dto.processDefinitionNameLike = taskQuery.getProcessDefinitionNameLike();
dto.processInstanceId = taskQuery.getProcessInstanceId();
dto.assignee = taskQuery.getAssignee();
dto.assigneeLike = taskQuery.getAssigneeLike();
dto.taskDefinitionKey = taskQuery.getKey();
dto.taskDefinitionKeyIn = taskQuery.getKeys();
dto.taskDefinitionKeyLike = taskQuery.getKeyLike();
dto.description = taskQuery.getDescription();
dto.descriptionLike = taskQuery.getDescriptionLike();
dto.involvedUser = taskQuery.getInvolvedUser();
dto.maxPriority = taskQuery.getMaxPriority();
dto.minPriority = taskQuery.getMinPriority();
dto.name = taskQuery.getName();
dto.nameNotEqual = taskQuery.getNameNotEqual();
dto.nameLike = taskQuery.getNameLike();
dto.nameNotLike = taskQuery.getNameNotLike();
dto.owner = taskQuery.getOwner();
dto.priority = taskQuery.getPriority();
dto.assigned = taskQuery.isAssignedInternal();
dto.unassigned = taskQuery.isUnassignedInternal();
dto.parentTaskId = taskQuery.getParentTaskId();
dto.dueAfter = taskQuery.getDueAfter();
dto.dueBefore = taskQuery.getDueBefore();
dto.dueDate = taskQuery.getDueDate();
dto.followUpAfter = taskQuery.getFollowUpAfter();
if (taskQuery.isFollowUpNullAccepted()) {
dto.followUpBeforeOrNotExistent = taskQuery.getFollowUpBefore();
} else {
dto.followUpBefore = taskQuery.getFollowUpBefore();
}
dto.followUpDate = taskQuery.getFollowUpDate();
dto.createdAfter = taskQuery.getCreateTimeAfter();
dto.createdBefore = taskQuery.getCreateTimeBefore();
dto.createdOn = taskQuery.getCreateTime();
if (taskQuery.getDelegationState() != null) {
dto.delegationState = taskQuery.getDelegationState().toString();
}
if (taskQuery.isTenantIdSet()) {
if (taskQuery.getTenantIds() != null) {
dto.tenantIdIn = taskQuery.getTenantIds();
} else {
dto.withoutTenantId = true;
}
}
dto.processVariables = new ArrayList<VariableQueryParameterDto>();
dto.taskVariables = new ArrayList<VariableQueryParameterDto>();
dto.caseInstanceVariables = new ArrayList<VariableQueryParameterDto>();
for (TaskQueryVariableValue variableValue : taskQuery.getVariables()) {
VariableQueryParameterDto variableValueDto = new VariableQueryParameterDto(variableValue);
if (variableValue.isProcessInstanceVariable()) {
dto.processVariables.add(variableValueDto);
} else if (variableValue.isLocal()) {
dto.taskVariables.add(variableValueDto);
} else {
dto.caseInstanceVariables.add(variableValueDto);
}
}
if (taskQuery.getSuspensionState() == SuspensionState.ACTIVE) {
dto.active = true;
}
if (taskQuery.getSuspensionState() == SuspensionState.SUSPENDED) {
dto.suspended = true;
}
// sorting
List<QueryOrderingProperty> orderingProperties = taskQuery.getOrderingProperties();
if (!orderingProperties.isEmpty()) {
dto.setSorting(convertQueryOrderingPropertiesToSortingDtos(orderingProperties));
}
// expressions
Map<String, String> expressions = taskQuery.getExpressions();
if (expressions.containsKey("taskAssignee")) {
dto.setAssigneeExpression(expressions.get("taskAssignee"));
}
if (expressions.containsKey("taskAssigneeLike")) {
dto.setAssigneeLikeExpression(expressions.get("taskAssigneeLike"));
}
if (expressions.containsKey("taskOwner")) {
dto.setOwnerExpression(expressions.get("taskOwner"));
}
if (expressions.containsKey("taskCandidateUser")) {
dto.setCandidateUserExpression(expressions.get("taskCandidateUser"));
}
if (expressions.containsKey("taskInvolvedUser")) {
dto.setInvolvedUserExpression(expressions.get("taskInvolvedUser"));
}
if (expressions.containsKey("taskCandidateGroup")) {
dto.setCandidateGroupExpression(expressions.get("taskCandidateGroup"));
}
if (expressions.containsKey("taskCandidateGroupIn")) {
dto.setCandidateGroupsExpression(expressions.get("taskCandidateGroupIn"));
}
if (expressions.containsKey("taskCreatedOne")) {
dto.setCreatedOnExpression(expressions.get("taskCreatedOne"));
}
if (expressions.containsKey("taskCreatedBefore")) {
dto.setCreatedBeforeExpression(expressions.get("taskCreatedBefore"));
}
if (expressions.containsKey("taskCreatedAfter")) {
dto.setCreatedAfterExpression(expressions.get("taskCreatedAfter"));
}
if (expressions.containsKey("dueDate")) {
dto.setDueDateExpression(expressions.get("dueDate"));
}
if (expressions.containsKey("dueBefore")) {
dto.setDueBeforeExpression(expressions.get("dueBefore"));
}
if (expressions.containsKey("dueAfter")) {
dto.setDueAfterExpression(expressions.get("dueAfter"));
}
if (expressions.containsKey("followUpDate")) {
dto.setFollowUpDateExpression(expressions.get("followUpDate"));
}
if (expressions.containsKey("followUpBefore")) {
dto.setFollowUpBeforeExpression(expressions.get("followUpBefore"));
}
if (expressions.containsKey("followUpBeforeOrNotExistent")) {
dto.setFollowUpBeforeOrNotExistentExpression(expressions.get("followUpBeforeOrNotExistent"));
}
if (expressions.containsKey("followUpAfter")) {
dto.setFollowUpAfterExpression(expressions.get("followUpAfter"));
}
if (expressions.containsKey("processInstanceBusinessKey")) {
dto.setProcessInstanceBusinessKeyExpression(expressions.get("processInstanceBusinessKey"));
}
if (expressions.containsKey("processInstanceBusinessKeyLike")) {
dto.setProcessInstanceBusinessKeyLikeExpression(expressions.get("processInstanceBusinessKeyLike"));
}
return dto;
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class TaskQueryDto method applyFilters.
@Override
protected void applyFilters(TaskQuery query) {
if (orQueries != null) {
for (TaskQueryDto orQueryDto : orQueries) {
TaskQueryImpl orQuery = new TaskQueryImpl();
orQuery.setOrQueryActive();
orQueryDto.applyFilters(orQuery);
((TaskQueryImpl) query).addOrQuery(orQuery);
}
}
if (processInstanceBusinessKey != null) {
query.processInstanceBusinessKey(processInstanceBusinessKey);
}
if (processInstanceBusinessKeyExpression != null) {
query.processInstanceBusinessKeyExpression(processInstanceBusinessKeyExpression);
}
if (processInstanceBusinessKeyIn != null && processInstanceBusinessKeyIn.length > 0) {
query.processInstanceBusinessKeyIn(processInstanceBusinessKeyIn);
}
if (processInstanceBusinessKeyLike != null) {
query.processInstanceBusinessKeyLike(processInstanceBusinessKeyLike);
}
if (processInstanceBusinessKeyLikeExpression != null) {
query.processInstanceBusinessKeyLikeExpression(processInstanceBusinessKeyLikeExpression);
}
if (processDefinitionKey != null) {
query.processDefinitionKey(processDefinitionKey);
}
if (processDefinitionKeyIn != null && processDefinitionKeyIn.length > 0) {
query.processDefinitionKeyIn(processDefinitionKeyIn);
}
if (processDefinitionId != null) {
query.processDefinitionId(processDefinitionId);
}
if (executionId != null) {
query.executionId(executionId);
}
if (activityInstanceIdIn != null && activityInstanceIdIn.length > 0) {
query.activityInstanceIdIn(activityInstanceIdIn);
}
if (tenantIdIn != null && tenantIdIn.length > 0) {
query.tenantIdIn(tenantIdIn);
}
if (TRUE.equals(withoutTenantId)) {
query.withoutTenantId();
}
if (processDefinitionName != null) {
query.processDefinitionName(processDefinitionName);
}
if (processDefinitionNameLike != null) {
query.processDefinitionNameLike(processDefinitionNameLike);
}
if (processInstanceId != null) {
query.processInstanceId(processInstanceId);
}
if (assignee != null) {
query.taskAssignee(assignee);
}
if (assigneeExpression != null) {
query.taskAssigneeExpression(assigneeExpression);
}
if (assigneeLike != null) {
query.taskAssigneeLike(assigneeLike);
}
if (assigneeLikeExpression != null) {
query.taskAssigneeLikeExpression(assigneeLikeExpression);
}
if (candidateGroup != null) {
query.taskCandidateGroup(candidateGroup);
}
if (candidateGroupExpression != null) {
query.taskCandidateGroupExpression(candidateGroupExpression);
}
if (withCandidateGroups != null && withCandidateGroups) {
query.withCandidateGroups();
}
if (withoutCandidateGroups != null && withoutCandidateGroups) {
query.withoutCandidateGroups();
}
if (withCandidateUsers != null && withCandidateUsers) {
query.withCandidateUsers();
}
if (withoutCandidateUsers != null && withoutCandidateUsers) {
query.withoutCandidateUsers();
}
if (candidateUser != null) {
query.taskCandidateUser(candidateUser);
}
if (candidateUserExpression != null) {
query.taskCandidateUserExpression(candidateUserExpression);
}
if (taskDefinitionKeyIn != null && taskDefinitionKeyIn.length > 0) {
query.taskDefinitionKeyIn(taskDefinitionKeyIn);
}
if (taskDefinitionKey != null) {
query.taskDefinitionKey(taskDefinitionKey);
}
if (taskDefinitionKeyLike != null) {
query.taskDefinitionKeyLike(taskDefinitionKeyLike);
}
if (description != null) {
query.taskDescription(description);
}
if (descriptionLike != null) {
query.taskDescriptionLike(descriptionLike);
}
if (involvedUser != null) {
query.taskInvolvedUser(involvedUser);
}
if (involvedUserExpression != null) {
query.taskInvolvedUserExpression(involvedUserExpression);
}
if (maxPriority != null) {
query.taskMaxPriority(maxPriority);
}
if (minPriority != null) {
query.taskMinPriority(minPriority);
}
if (name != null) {
query.taskName(name);
}
if (nameNotEqual != null) {
query.taskNameNotEqual(nameNotEqual);
}
if (nameLike != null) {
query.taskNameLike(nameLike);
}
if (nameNotLike != null) {
query.taskNameNotLike(nameNotLike);
}
if (owner != null) {
query.taskOwner(owner);
}
if (ownerExpression != null) {
query.taskOwnerExpression(ownerExpression);
}
if (priority != null) {
query.taskPriority(priority);
}
if (parentTaskId != null) {
query.taskParentTaskId(parentTaskId);
}
if (assigned != null && assigned) {
query.taskAssigned();
}
if (unassigned != null && unassigned) {
query.taskUnassigned();
}
if (dueAfter != null) {
query.dueAfter(dueAfter);
}
if (dueAfterExpression != null) {
query.dueAfterExpression(dueAfterExpression);
}
if (dueBefore != null) {
query.dueBefore(dueBefore);
}
if (dueBeforeExpression != null) {
query.dueBeforeExpression(dueBeforeExpression);
}
if (dueDate != null) {
query.dueDate(dueDate);
}
if (dueDateExpression != null) {
query.dueDateExpression(dueDateExpression);
}
if (followUpAfter != null) {
query.followUpAfter(followUpAfter);
}
if (followUpAfterExpression != null) {
query.followUpAfterExpression(followUpAfterExpression);
}
if (followUpBefore != null) {
query.followUpBefore(followUpBefore);
}
if (followUpBeforeExpression != null) {
query.followUpBeforeExpression(followUpBeforeExpression);
}
if (followUpBeforeOrNotExistent != null) {
query.followUpBeforeOrNotExistent(followUpBeforeOrNotExistent);
}
if (followUpBeforeOrNotExistentExpression != null) {
query.followUpBeforeOrNotExistentExpression(followUpBeforeOrNotExistentExpression);
}
if (followUpDate != null) {
query.followUpDate(followUpDate);
}
if (followUpDateExpression != null) {
query.followUpDateExpression(followUpDateExpression);
}
if (createdAfter != null) {
query.taskCreatedAfter(createdAfter);
}
if (createdAfterExpression != null) {
query.taskCreatedAfterExpression(createdAfterExpression);
}
if (createdBefore != null) {
query.taskCreatedBefore(createdBefore);
}
if (createdBeforeExpression != null) {
query.taskCreatedBeforeExpression(createdBeforeExpression);
}
if (createdOn != null) {
query.taskCreatedOn(createdOn);
}
if (createdOnExpression != null) {
query.taskCreatedOnExpression(createdOnExpression);
}
if (delegationState != null) {
DelegationStateConverter converter = new DelegationStateConverter();
DelegationState state = converter.convertQueryParameterToType(delegationState);
query.taskDelegationState(state);
}
if (candidateGroups != null) {
query.taskCandidateGroupIn(candidateGroups);
}
if (candidateGroupsExpression != null) {
query.taskCandidateGroupInExpression(candidateGroupsExpression);
}
if (includeAssignedTasks != null && includeAssignedTasks) {
query.includeAssignedTasks();
}
if (active != null && active) {
query.active();
}
if (suspended != null && suspended) {
query.suspended();
}
if (caseDefinitionId != null) {
query.caseDefinitionId(caseDefinitionId);
}
if (caseDefinitionKey != null) {
query.caseDefinitionKey(caseDefinitionKey);
}
if (caseDefinitionName != null) {
query.caseDefinitionName(caseDefinitionName);
}
if (caseDefinitionNameLike != null) {
query.caseDefinitionNameLike(caseDefinitionNameLike);
}
if (caseExecutionId != null) {
query.caseExecutionId(caseExecutionId);
}
if (caseInstanceBusinessKey != null) {
query.caseInstanceBusinessKey(caseInstanceBusinessKey);
}
if (caseInstanceBusinessKeyLike != null) {
query.caseInstanceBusinessKeyLike(caseInstanceBusinessKeyLike);
}
if (caseInstanceId != null) {
query.caseInstanceId(caseInstanceId);
}
if (taskVariables != null) {
for (VariableQueryParameterDto variableQueryParam : taskVariables) {
String variableName = variableQueryParam.getName();
String op = variableQueryParam.getOperator();
Object variableValue = variableQueryParam.resolveValue(objectMapper);
if (op.equals(VariableQueryParameterDto.EQUALS_OPERATOR_NAME)) {
query.taskVariableValueEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.NOT_EQUALS_OPERATOR_NAME)) {
query.taskVariableValueNotEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OPERATOR_NAME)) {
query.taskVariableValueGreaterThan(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OR_EQUALS_OPERATOR_NAME)) {
query.taskVariableValueGreaterThanOrEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LESS_THAN_OPERATOR_NAME)) {
query.taskVariableValueLessThan(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LESS_THAN_OR_EQUALS_OPERATOR_NAME)) {
query.taskVariableValueLessThanOrEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LIKE_OPERATOR_NAME)) {
query.taskVariableValueLike(variableName, String.valueOf(variableValue));
} else {
throw new InvalidRequestException(Status.BAD_REQUEST, "Invalid task variable comparator specified: " + op);
}
}
}
if (processVariables != null) {
for (VariableQueryParameterDto variableQueryParam : processVariables) {
String variableName = variableQueryParam.getName();
String op = variableQueryParam.getOperator();
Object variableValue = variableQueryParam.resolveValue(objectMapper);
if (op.equals(VariableQueryParameterDto.EQUALS_OPERATOR_NAME)) {
query.processVariableValueEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.NOT_EQUALS_OPERATOR_NAME)) {
query.processVariableValueNotEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OPERATOR_NAME)) {
query.processVariableValueGreaterThan(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OR_EQUALS_OPERATOR_NAME)) {
query.processVariableValueGreaterThanOrEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LESS_THAN_OPERATOR_NAME)) {
query.processVariableValueLessThan(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LESS_THAN_OR_EQUALS_OPERATOR_NAME)) {
query.processVariableValueLessThanOrEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LIKE_OPERATOR_NAME)) {
query.processVariableValueLike(variableName, String.valueOf(variableValue));
} else {
throw new InvalidRequestException(Status.BAD_REQUEST, "Invalid process variable comparator specified: " + op);
}
}
}
if (caseInstanceVariables != null) {
for (VariableQueryParameterDto variableQueryParam : caseInstanceVariables) {
String variableName = variableQueryParam.getName();
String op = variableQueryParam.getOperator();
Object variableValue = variableQueryParam.resolveValue(objectMapper);
if (op.equals(VariableQueryParameterDto.EQUALS_OPERATOR_NAME)) {
query.caseInstanceVariableValueEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.NOT_EQUALS_OPERATOR_NAME)) {
query.caseInstanceVariableValueNotEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OPERATOR_NAME)) {
query.caseInstanceVariableValueGreaterThan(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OR_EQUALS_OPERATOR_NAME)) {
query.caseInstanceVariableValueGreaterThanOrEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LESS_THAN_OPERATOR_NAME)) {
query.caseInstanceVariableValueLessThan(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LESS_THAN_OR_EQUALS_OPERATOR_NAME)) {
query.caseInstanceVariableValueLessThanOrEquals(variableName, variableValue);
} else if (op.equals(VariableQueryParameterDto.LIKE_OPERATOR_NAME)) {
query.caseInstanceVariableValueLike(variableName, String.valueOf(variableValue));
} else {
throw new InvalidRequestException(Status.BAD_REQUEST, "Invalid case variable comparator specified: " + op);
}
}
}
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithVariableTypeSorting.
@Test
public void testGetFilterWithVariableTypeSorting() {
TaskQuery query = new TaskQueryImpl().orderByExecutionVariable("foo", ValueType.STRING).asc().orderByProcessVariable("foo", ValueType.STRING).asc().orderByTaskVariable("foo", ValueType.STRING).asc().orderByCaseExecutionVariable("foo", ValueType.STRING).asc().orderByCaseInstanceVariable("foo", ValueType.STRING).asc();
Filter filter = new FilterEntity("Task").setName("test").setQuery(query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filter);
Response response = given().pathParam("id", EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).when().get(SINGLE_FILTER_URL);
// validate sorting content
String content = response.asString();
List<Map<String, Object>> sortings = from(content).getJsonObject("query.sorting");
assertThat(sortings).hasSize(5);
assertSorting(sortings.get(0), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
assertSorting(sortings.get(1), SORT_BY_PROCESS_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
assertSorting(sortings.get(2), SORT_BY_TASK_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
assertSorting(sortings.get(3), SORT_BY_CASE_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
assertSorting(sortings.get(4), SORT_BY_CASE_INSTANCE_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithVariableSortOrderSorting.
@Test
public void testGetFilterWithVariableSortOrderSorting() {
TaskQuery query = new TaskQueryImpl().orderByExecutionVariable("foo", ValueType.STRING).asc().orderByExecutionVariable("foo", ValueType.STRING).desc();
Filter filter = new FilterEntity("Task").setName("test").setQuery(query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filter);
Response response = given().pathParam("id", EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).when().get(SINGLE_FILTER_URL);
// validate sorting content
String content = response.asString();
List<Map<String, Object>> sortings = from(content).getJsonObject("query.sorting");
assertThat(sortings).hasSize(2);
assertSorting(sortings.get(0), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
assertSorting(sortings.get(1), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_DESC_VALUE, "foo", ValueType.STRING);
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithMultipleSorting.
@Test
public void testGetFilterWithMultipleSorting() {
TaskQuery query = new TaskQueryImpl().orderByDueDate().asc().orderByCaseExecutionId().desc();
Filter filter = new FilterEntity("Task").setName("test").setQuery(query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filter);
Response response = given().pathParam("id", EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).when().get(SINGLE_FILTER_URL);
// validate sorting content
String content = response.asString();
List<Map<String, Object>> sortings = from(content).getJsonObject("query.sorting");
assertThat(sortings).hasSize(2);
assertSorting(sortings.get(0), SORT_BY_DUE_DATE_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(1), SORT_BY_CASE_EXECUTION_ID_VALUE, SORT_ORDER_DESC_VALUE);
}
Aggregations