use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class ModificationBatchConfigurationJsonConverter 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 ModificationBatchConfigurationJsonConverter method toJsonObject.
@Override
public JSONObject toJsonObject(ModificationBatchConfiguration configuration) {
JSONObject json = new JSONObject();
JsonUtil.addListField(json, INSTRUCTIONS, ModificationCmdJsonConverter.INSTANCE, configuration.getInstructions());
JsonUtil.addListField(json, PROCESS_INSTANCE_IDS, configuration.getIds());
JsonUtil.addField(json, PROCESS_DEFINITION_ID, configuration.getProcessDefinitionId());
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 JsonArrayOfObjectsConverter method toJsonArray.
public JSONArray toJsonArray(List<T> objects) {
JSONArray jsonArray = new JSONArray();
for (T object : objects) {
JSONObject jsonObject = objectConverter.toJsonObject(object);
jsonArray.put(jsonObject);
}
return jsonArray;
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class JsonTaskQueryVariableValueConverter method toJsonObject.
public JSONObject toJsonObject(TaskQueryVariableValue variable) {
JSONObject json = new JSONObject();
json.put("name", variable.getName());
json.put("value", variable.getValue());
json.put("operator", variable.getOperator());
return json;
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class JsonUtil method jsonObjectAsMap.
/**
* Converts a {@link JSONObject} to a {@link Map}. It supports nested {@link JSONObject}
* and {@link JSONArray}.
*
* @param jsonObject the json object to convert
* @return the resulting map
*/
public static Map<String, Object> jsonObjectAsMap(JSONObject jsonObject) {
if (jsonObject == null) {
return null;
} else {
Map<String, Object> map = new HashMap<String, Object>();
Iterator keys = jsonObject.keys();
while (keys.hasNext()) {
String key = (String) keys.next();
Object value = optJavaNull(jsonObject.get(key));
if (JSONObject.class.isInstance(value)) {
value = jsonObjectAsMap(JSONObject.class.cast(value));
} else if (JSONArray.class.isInstance(value)) {
value = jsonArrayAsList(JSONArray.class.cast(value));
}
map.put(key, value);
}
return map;
}
}
Aggregations