use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class DeleteProcessInstanceBatchConfigurationJsonConverter method toJsonObject.
public JSONObject toJsonObject(DeleteProcessInstanceBatchConfiguration configuration) {
JSONObject json = new JSONObject();
JsonUtil.addField(json, DELETE_REASON, configuration.getDeleteReason());
JsonUtil.addListField(json, PROCESS_INSTANCE_IDS, configuration.getIds());
JsonUtil.addField(json, SKIP_CUSTOM_LISTENERS, configuration.isSkipCustomListeners());
JsonUtil.addField(json, SKIP_SUBPROCESSES, configuration.isSkipSubprocesses());
return json;
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class UpdateProcessInstancesSuspendStateBatchConfigurationJsonConverter method toJsonObject.
public JSONObject toJsonObject(UpdateProcessInstancesSuspendStateBatchConfiguration configuration) {
JSONObject json = new JSONObject();
JsonUtil.addListField(json, PROCESS_INSTANCE_IDS, configuration.getIds());
JsonUtil.addField(json, SUSPENDING, configuration.getSuspended());
return json;
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class FilterEntity method setPropertiesInternal.
public void setPropertiesInternal(String properties) {
if (properties != null) {
JSONObject jsonObject = new JSONObject(properties);
this.properties = JsonUtil.jsonObjectAsMap(jsonObject);
} else {
this.properties = null;
}
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class JsonUtil method jsonArrayAsList.
/**
* Converts a {@link JSONArray} to a {@link List}. It supports nested {@link JSONObject}
* and {@link JSONArray}.
*
* @param jsonArray the json array to convert
* @return the resulting map
*/
public static List<Object> jsonArrayAsList(JSONArray jsonArray) {
if (jsonArray == null) {
return null;
} else {
List<Object> list = new ArrayList<Object>();
for (int i = 0; i < jsonArray.length(); i++) {
Object value = optJavaNull(jsonArray.get(i));
if (JSONObject.class.isInstance(value)) {
value = jsonObjectAsMap(JSONObject.class.cast(value));
} else if (JSONArray.class.isInstance(value)) {
value = jsonArrayAsList(JSONArray.class.cast(value));
}
list.add(value);
}
return list;
}
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject 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());
}
Aggregations