use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class DeleteHistoricDecisionInstanceBatchConfigurationJsonConverter method toJsonObject.
public JSONObject toJsonObject(BatchConfiguration configuration) {
JSONObject json = new JSONObject();
JsonUtil.addListField(json, HISTORIC_DECISION_INSTANCE_IDS, configuration.getIds());
return json;
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class DeleteHistoricDecisionInstanceBatchConfigurationJsonConverter method readDecisionInstanceIds.
protected List<String> readDecisionInstanceIds(JSONObject jsonObject) {
List<Object> objects = JsonUtil.jsonArrayAsList(jsonObject.getJSONArray(HISTORIC_DECISION_INSTANCE_IDS));
List<String> decisionInstanceIds = new ArrayList<String>();
for (Object object : objects) {
decisionInstanceIds.add((String) object);
}
return decisionInstanceIds;
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class FilterEntity method setQueryInternal.
public void setQueryInternal(String query) {
ensureNotNull(NotValidException.class, "query", query);
JsonObjectConverter<Object> converter = getConverter();
this.query = (AbstractQuery<?, ?>) converter.toObject(new JSONObject(query));
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject 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());
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class SetExternalTaskRetriesBatchConfigurationJsonConverter method readExternalTaskIds.
protected List<String> readExternalTaskIds(JSONObject json) {
List<Object> objects = JsonUtil.jsonArrayAsList(json.getJSONArray(EXTERNAL_TASK_IDS));
List<String> externalTaskIds = new ArrayList<String>();
for (Object object : objects) {
externalTaskIds.add(object.toString());
}
return externalTaskIds;
}
Aggregations