Search in sources :

Example 16 with JSONObject

use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.

the class HistoryCleanupJobHandlerConfiguration method toCanonicalString.

@Override
public String toCanonicalString() {
    JSONObject json = new JSONObject();
    json.put(JOB_CONFIG_COUNT_EMPTY_RUNS, countEmptyRuns);
    json.put(JOB_CONFIG_EXECUTE_AT_ONCE, immediatelyDue);
    return json.toString();
}
Also used : JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject)

Example 17 with JSONObject

use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.

the class JsonQueryOrderingPropertyConverter method toJsonObject.

public JSONObject toJsonObject(QueryOrderingProperty property) {
    JSONObject jsonObject = new JSONObject();
    JsonUtil.addField(jsonObject, RELATION, property.getRelation());
    QueryProperty queryProperty = property.getQueryProperty();
    if (queryProperty != null) {
        JsonUtil.addField(jsonObject, QUERY_PROPERTY, queryProperty.getName());
        JsonUtil.addField(jsonObject, QUERY_PROPERTY_FUNCTION, queryProperty.getFunction());
    }
    Direction direction = property.getDirection();
    if (direction != null) {
        JsonUtil.addField(jsonObject, DIRECTION, direction.getName());
    }
    if (property.hasRelationConditions()) {
        JSONArray relationConditionsJson = JsonQueryFilteringPropertyConverter.ARRAY_CONVERTER.toJsonArray(property.getRelationConditions());
        JsonUtil.addField(jsonObject, RELATION_CONDITIONS, relationConditionsJson);
    }
    return jsonObject;
}
Also used : JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject) VariableInstanceQueryProperty(org.camunda.bpm.engine.impl.VariableInstanceQueryProperty) QueryProperty(org.camunda.bpm.engine.query.QueryProperty) JSONArray(org.camunda.bpm.engine.impl.util.json.JSONArray) Direction(org.camunda.bpm.engine.impl.Direction)

Example 18 with JSONObject

use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.

the class JsonTaskQueryVariableValueConverter method toObject.

public TaskQueryVariableValue toObject(JSONObject json) {
    String name = json.getString("name");
    Object value = json.get("value");
    QueryOperator operator = QueryOperator.valueOf(json.getString("operator"));
    boolean isTaskVariable = json.getBoolean("taskVariable");
    boolean isProcessVariable = json.getBoolean("processVariable");
    return new TaskQueryVariableValue(name, value, operator, isTaskVariable, isProcessVariable);
}
Also used : TaskQueryVariableValue(org.camunda.bpm.engine.impl.TaskQueryVariableValue) JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject) QueryOperator(org.camunda.bpm.engine.impl.QueryOperator)

Example 19 with JSONObject

use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.

the class MigrationInstructionJsonConverter method toJsonObject.

public JSONObject toJsonObject(MigrationInstruction instruction) {
    JSONObject json = new JSONObject();
    JsonUtil.addArrayField(json, SOURCE_ACTIVITY_IDS, new String[] { instruction.getSourceActivityId() });
    JsonUtil.addArrayField(json, TARGET_ACTIVITY_IDS, new String[] { instruction.getTargetActivityId() });
    JsonUtil.addField(json, UPDATE_EVENT_TRIGGER, instruction.isUpdateEventTrigger());
    return json;
}
Also used : JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject)

Example 20 with JSONObject

use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.

the class JsonUtilTest method testJsonObjectNullRetained.

@Test
public void testJsonObjectNullRetained() {
    String json = "{\"key\":null}";
    JSONObject object = new JSONObject(json);
    assertTrue(object.has("key"));
    Map<String, Object> map = jsonObjectAsMap(object);
    assertTrue(map.containsKey("key"));
    assertNull(map.get("key"));
}
Also used : JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject) JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject) Test(org.junit.Test)

Aggregations

JSONObject (org.camunda.bpm.engine.impl.util.json.JSONObject)40 ArrayList (java.util.ArrayList)10 JSONArray (org.camunda.bpm.engine.impl.util.json.JSONArray)5 TaskQueryImpl (org.camunda.bpm.engine.impl.TaskQueryImpl)4 QueryOrderingProperty (org.camunda.bpm.engine.impl.QueryOrderingProperty)3 JsonTaskQueryConverter (org.camunda.bpm.engine.impl.json.JsonTaskQueryConverter)3 QueryProperty (org.camunda.bpm.engine.query.QueryProperty)3 Map (java.util.Map)2 QueryOperator (org.camunda.bpm.engine.impl.QueryOperator)2 Test (org.junit.Test)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Writer (java.io.Writer)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)1 HttpPost (org.apache.http.client.methods.HttpPost)1 Direction (org.camunda.bpm.engine.impl.Direction)1 QueryEntityRelationCondition (org.camunda.bpm.engine.impl.QueryEntityRelationCondition)1