Search in sources :

Example 26 with JSONObject

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;
}
Also used : JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject)

Example 27 with JSONObject

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;
}
Also used : ArrayList(java.util.ArrayList) JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject)

Example 28 with JSONObject

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));
}
Also used : JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject) JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject)

Example 29 with JSONObject

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());
}
Also used : JsonTaskQueryConverter(org.camunda.bpm.engine.impl.json.JsonTaskQueryConverter) JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject) TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) QueryOrderingProperty(org.camunda.bpm.engine.impl.QueryOrderingProperty)

Example 30 with JSONObject

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;
}
Also used : ArrayList(java.util.ArrayList) JSONObject(org.camunda.bpm.engine.impl.util.json.JSONObject)

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