use of org.camunda.bpm.engine.impl.util.json.JSONObject 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.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class JsonQueryFilteringPropertyConverter method toObject.
public QueryEntityRelationCondition toObject(JSONObject jsonObject) {
// this is limited in that it allows only String values;
// that is sufficient for current use case with task filters
// but could be extended by a data type in the future
Object scalarValue = null;
if (jsonObject.has(SCALAR_VALUE)) {
scalarValue = jsonObject.getString(SCALAR_VALUE);
}
QueryProperty baseProperty = null;
if (jsonObject.has(BASE_PROPERTY)) {
baseProperty = new QueryPropertyImpl(jsonObject.getString(BASE_PROPERTY));
}
QueryProperty comparisonProperty = null;
if (jsonObject.has(COMPARISON_PROPERTY)) {
comparisonProperty = new QueryPropertyImpl(jsonObject.getString(COMPARISON_PROPERTY));
}
return new QueryEntityRelationCondition(baseProperty, comparisonProperty, scalarValue);
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class MigrationBatchConfigurationJsonConverter method toJsonObject.
public JSONObject toJsonObject(MigrationBatchConfiguration configuration) {
JSONObject json = new JSONObject();
JsonUtil.addField(json, MIGRATION_PLAN, MigrationPlanJsonConverter.INSTANCE, configuration.getMigrationPlan());
JsonUtil.addListField(json, PROCESS_INSTANCE_IDS, configuration.getIds());
JsonUtil.addField(json, SKIP_LISTENERS, configuration.isSkipCustomListeners());
JsonUtil.addField(json, SKIP_IO_MAPPINGS, configuration.isSkipIoMappings());
return json;
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class MigrationBatchConfigurationJsonConverter method readProcessInstanceIds.
protected List<String> readProcessInstanceIds(JSONObject jsonObject) {
List<Object> objects = JsonUtil.jsonArrayAsList(jsonObject.getJSONArray(PROCESS_INSTANCE_IDS));
List<String> processInstanceIds = new ArrayList<String>();
for (Object object : objects) {
processInstanceIds.add((String) object);
}
return processInstanceIds;
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class MigrationPlanJsonConverter method toJsonObject.
public JSONObject toJsonObject(MigrationPlan migrationPlan) {
JSONObject json = new JSONObject();
JsonUtil.addField(json, SOURCE_PROCESS_DEFINITION_ID, migrationPlan.getSourceProcessDefinitionId());
JsonUtil.addField(json, TARGET_PROCESS_DEFINITION_ID, migrationPlan.getTargetProcessDefinitionId());
JsonUtil.addListField(json, INSTRUCTIONS, MigrationInstructionJsonConverter.INSTANCE, migrationPlan.getInstructions());
return json;
}
Aggregations