use of org.camunda.bpm.engine.impl.json.JsonTaskQueryConverter in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testDeprecatedOrderingFormatDeserializationSecondaryOrdering.
/**
* Tests compatibility with serialization format that was used in 7.2
*/
@SuppressWarnings("deprecation")
public void testDeprecatedOrderingFormatDeserializationSecondaryOrdering() {
String sortByNameAsc = "RES." + TaskQueryProperty.NAME.getName() + " " + Direction.ASCENDING.getName();
String secondaryOrdering = sortByNameAsc + ", RES." + TaskQueryProperty.ASSIGNEE.getName() + " " + Direction.DESCENDING.getName();
JsonTaskQueryConverter converter = (JsonTaskQueryConverter) FilterEntity.queryConverter.get(EntityTypes.TASK);
JSONObject queryJson = converter.toJsonObject(filter.<TaskQuery>getQuery());
// when I apply a secondary ordering
queryJson.put(JsonTaskQueryConverter.ORDER_BY, secondaryOrdering);
TaskQueryImpl deserializedTaskQuery = (TaskQueryImpl) converter.toObject(queryJson);
// then the ordering is applied accordingly
assertEquals(2, deserializedTaskQuery.getOrderingProperties().size());
QueryOrderingProperty orderingProperty1 = deserializedTaskQuery.getOrderingProperties().get(0);
assertNull(orderingProperty1.getRelation());
assertEquals("asc", orderingProperty1.getDirection().getName());
assertNull(orderingProperty1.getRelationConditions());
assertTrue(orderingProperty1.isContainedProperty());
assertEquals(TaskQueryProperty.NAME.getName(), orderingProperty1.getQueryProperty().getName());
assertNull(orderingProperty1.getQueryProperty().getFunction());
QueryOrderingProperty orderingProperty2 = deserializedTaskQuery.getOrderingProperties().get(1);
assertNull(orderingProperty2.getRelation());
assertEquals("desc", orderingProperty2.getDirection().getName());
assertNull(orderingProperty2.getRelationConditions());
assertTrue(orderingProperty2.isContainedProperty());
assertEquals(TaskQueryProperty.ASSIGNEE.getName(), orderingProperty2.getQueryProperty().getName());
assertNull(orderingProperty2.getQueryProperty().getFunction());
}
use of org.camunda.bpm.engine.impl.json.JsonTaskQueryConverter in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testDeprecatedOrderingFormatDeserializationSingleOrdering.
/**
* Tests compatibility with serialization format that was used in 7.2
*/
@SuppressWarnings("deprecation")
public void testDeprecatedOrderingFormatDeserializationSingleOrdering() {
String sortByNameAsc = "RES." + TaskQueryProperty.NAME.getName() + " " + Direction.ASCENDING.getName();
JsonTaskQueryConverter converter = (JsonTaskQueryConverter) FilterEntity.queryConverter.get(EntityTypes.TASK);
JSONObject queryJson = converter.toJsonObject(filter.<TaskQuery>getQuery());
// when I apply a specific ordering by one dimension
queryJson.put(JsonTaskQueryConverter.ORDER_BY, sortByNameAsc);
TaskQueryImpl deserializedTaskQuery = (TaskQueryImpl) converter.toObject(queryJson);
// then the ordering is applied accordingly
assertEquals(1, deserializedTaskQuery.getOrderingProperties().size());
QueryOrderingProperty orderingProperty = deserializedTaskQuery.getOrderingProperties().get(0);
assertNull(orderingProperty.getRelation());
assertEquals("asc", orderingProperty.getDirection().getName());
assertNull(orderingProperty.getRelationConditions());
assertTrue(orderingProperty.isContainedProperty());
assertEquals(TaskQueryProperty.NAME.getName(), orderingProperty.getQueryProperty().getName());
assertNull(orderingProperty.getQueryProperty().getFunction());
}
use of org.camunda.bpm.engine.impl.json.JsonTaskQueryConverter in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method setUp.
@Override
public void setUp() {
filter = filterService.newTaskFilter("name").setOwner("owner").setQuery(taskService.createTaskQuery()).setProperties(new HashMap<String, Object>());
testUser = identityService.newUser("user");
testGroup = identityService.newGroup("group");
identityService.saveUser(testUser);
identityService.saveGroup(testGroup);
identityService.createMembership(testUser.getId(), testGroup.getId());
Group anotherGroup = identityService.newGroup("anotherGroup");
identityService.saveGroup(anotherGroup);
testCandidateGroups.add(testGroup.getId());
testCandidateGroups.add(anotherGroup.getId());
createTasks();
queryConverter = new JsonTaskQueryConverter();
}
use of org.camunda.bpm.engine.impl.json.JsonTaskQueryConverter in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testDeprecatedOrderingFormatDeserializationFunctionOrdering.
/**
* Tests compatibility with serialization format that was used in 7.2
*/
@SuppressWarnings("deprecation")
public void testDeprecatedOrderingFormatDeserializationFunctionOrdering() {
String orderingWithFunction = "LOWER(RES." + TaskQueryProperty.NAME.getName() + ") asc";
JsonTaskQueryConverter converter = (JsonTaskQueryConverter) FilterEntity.queryConverter.get(EntityTypes.TASK);
JSONObject queryJson = converter.toJsonObject(filter.<TaskQuery>getQuery());
// when I apply an ordering with a function
queryJson.put(JsonTaskQueryConverter.ORDER_BY, orderingWithFunction);
TaskQueryImpl deserializedTaskQuery = (TaskQueryImpl) converter.toObject(queryJson);
assertEquals(1, deserializedTaskQuery.getOrderingProperties().size());
// then the ordering is applied accordingly
QueryOrderingProperty orderingProperty = deserializedTaskQuery.getOrderingProperties().get(0);
assertNull(orderingProperty.getRelation());
assertEquals("asc", orderingProperty.getDirection().getName());
assertNull(orderingProperty.getRelationConditions());
assertFalse(orderingProperty.isContainedProperty());
assertEquals(TaskQueryProperty.NAME_CASE_INSENSITIVE.getName(), orderingProperty.getQueryProperty().getName());
assertEquals(TaskQueryProperty.NAME_CASE_INSENSITIVE.getFunction(), orderingProperty.getQueryProperty().getFunction());
}
Aggregations