use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class SetExternalTaskRetriesBatchConfigurationJsonConverter method toJsonObject.
@Override
public JSONObject toJsonObject(SetRetriesBatchConfiguration configuration) {
JSONObject json = new JSONObject();
JsonUtil.addListField(json, EXTERNAL_TASK_IDS, configuration.getIds());
JsonUtil.addField(json, RETRIES, configuration.getRetries());
return json;
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class UpdateProcessInstancesSuspendStateBatchConfigurationJsonConverter 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 JsonQueryFilteringPropertyConverter method toJsonObject.
public JSONObject toJsonObject(QueryEntityRelationCondition filteringProperty) {
JSONObject jsonObject = new JSONObject();
JsonUtil.addField(jsonObject, BASE_PROPERTY, filteringProperty.getProperty().getName());
QueryProperty comparisonProperty = filteringProperty.getComparisonProperty();
if (comparisonProperty != null) {
JsonUtil.addField(jsonObject, COMPARISON_PROPERTY, comparisonProperty.getName());
}
Object scalarValue = filteringProperty.getScalarValue();
if (scalarValue != null) {
JsonUtil.addField(jsonObject, SCALAR_VALUE, scalarValue);
}
return jsonObject;
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class JsonTaskQueryConverter method addVariables.
private void addVariables(TaskQueryImpl query, JSONArray variables, boolean isTaskVariable, boolean isProcessVariable) {
for (int i = 0; i < variables.length(); i++) {
JSONObject variable = variables.getJSONObject(i);
String name = variable.getString(NAME);
Object value = variable.get("value");
QueryOperator operator = QueryOperator.valueOf(variable.getString("operator"));
query.addVariable(name, value, operator, isTaskVariable, isProcessVariable);
}
}
use of org.camunda.bpm.engine.impl.util.json.JSONObject in project camunda-bpm-platform by camunda.
the class JsonTaskQueryConverter method toJsonObject.
public JSONObject toJsonObject(TaskQuery taskQuery, boolean isOrQueryActive) {
JSONObject json = new JSONObject();
TaskQueryImpl query = (TaskQueryImpl) taskQuery;
addField(json, TASK_ID, query.getTaskId());
addField(json, NAME, query.getName());
addField(json, NAME_NOT_EQUAL, query.getNameNotEqual());
addField(json, NAME_LIKE, query.getNameLike());
addField(json, NAME_NOT_LIKE, query.getNameNotLike());
addField(json, DESCRIPTION, query.getDescription());
addField(json, DESCRIPTION_LIKE, query.getDescriptionLike());
addField(json, PRIORITY, query.getPriority());
addField(json, MIN_PRIORITY, query.getMinPriority());
addField(json, MAX_PRIORITY, query.getMaxPriority());
addField(json, ASSIGNEE, query.getAssignee());
addField(json, ASSIGNEE_LIKE, query.getAssigneeLike());
addField(json, INVOLVED_USER, query.getInvolvedUser());
addField(json, OWNER, query.getOwner());
addDefaultField(json, UNASSIGNED, false, query.isUnassigned());
addDefaultField(json, ASSIGNED, false, query.isAssigned());
addField(json, DELEGATION_STATE, query.getDelegationStateString());
addField(json, CANDIDATE_USER, query.getCandidateUser());
addField(json, CANDIDATE_GROUP, query.getCandidateGroup());
addListField(json, CANDIDATE_GROUPS, query.getCandidateGroupsInternal());
addDefaultField(json, WITH_CANDIDATE_GROUPS, false, query.isWithCandidateGroups());
addDefaultField(json, WITHOUT_CANDIDATE_GROUPS, false, query.isWithoutCandidateGroups());
addDefaultField(json, WITH_CANDIDATE_USERS, false, query.isWithCandidateUsers());
addDefaultField(json, WITHOUT_CANDIDATE_USERS, false, query.isWithoutCandidateUsers());
addField(json, INCLUDE_ASSIGNED_TASKS, query.isIncludeAssignedTasksInternal());
addField(json, PROCESS_INSTANCE_ID, query.getProcessInstanceId());
addField(json, EXECUTION_ID, query.getExecutionId());
addArrayField(json, ACTIVITY_INSTANCE_ID_IN, query.getActivityInstanceIdIn());
addDateField(json, CREATED, query.getCreateTime());
addDateField(json, CREATED_BEFORE, query.getCreateTimeBefore());
addDateField(json, CREATED_AFTER, query.getCreateTimeAfter());
addField(json, KEY, query.getKey());
addArrayField(json, KEYS, query.getKeys());
addField(json, KEY_LIKE, query.getKeyLike());
addField(json, PARENT_TASK_ID, query.getParentTaskId());
addField(json, PROCESS_DEFINITION_KEY, query.getProcessDefinitionKey());
addArrayField(json, PROCESS_DEFINITION_KEYS, query.getProcessDefinitionKeys());
addField(json, PROCESS_DEFINITION_ID, query.getProcessDefinitionId());
addField(json, PROCESS_DEFINITION_NAME, query.getProcessDefinitionName());
addField(json, PROCESS_DEFINITION_NAME_LIKE, query.getProcessDefinitionNameLike());
addField(json, PROCESS_INSTANCE_BUSINESS_KEY, query.getProcessInstanceBusinessKey());
addArrayField(json, PROCESS_INSTANCE_BUSINESS_KEYS, query.getProcessInstanceBusinessKeys());
addField(json, PROCESS_INSTANCE_BUSINESS_KEY_LIKE, query.getProcessInstanceBusinessKeyLike());
addVariablesFields(json, query.getVariables());
addDateField(json, DUE, query.getDueDate());
addDateField(json, DUE_BEFORE, query.getDueBefore());
addDateField(json, DUE_AFTER, query.getDueAfter());
addDateField(json, FOLLOW_UP, query.getFollowUpDate());
addDateField(json, FOLLOW_UP_BEFORE, query.getFollowUpBefore());
addDefaultField(json, FOLLOW_UP_NULL_ACCEPTED, false, query.isFollowUpNullAccepted());
addDateField(json, FOLLOW_UP_AFTER, query.getFollowUpAfter());
addDefaultField(json, EXCLUDE_SUBTASKS, false, query.isExcludeSubtasks());
addSuspensionStateField(json, query.getSuspensionState());
addField(json, CASE_DEFINITION_KEY, query.getCaseDefinitionKey());
addField(json, CASE_DEFINITION_ID, query.getCaseDefinitionId());
addField(json, CASE_DEFINITION_NAME, query.getCaseDefinitionName());
addField(json, CASE_DEFINITION_NAME_LIKE, query.getCaseDefinitionNameLike());
addField(json, CASE_INSTANCE_ID, query.getCaseInstanceId());
addField(json, CASE_INSTANCE_BUSINESS_KEY, query.getCaseInstanceBusinessKey());
addField(json, CASE_INSTANCE_BUSINESS_KEY_LIKE, query.getCaseInstanceBusinessKeyLike());
addField(json, CASE_EXECUTION_ID, query.getCaseExecutionId());
addTenantIdFields(json, query);
if (query.getQueries().size() > 1 && !isOrQueryActive) {
JSONArray orQueries = new JSONArray();
for (TaskQueryImpl orQuery : query.getQueries()) {
if (orQuery != null && orQuery.isOrQueryActive()) {
orQueries.put(toJsonObject(orQuery, true));
}
}
addField(json, OR_QUERIES, orQueries);
}
if (query.getOrderingProperties() != null && !query.getOrderingProperties().isEmpty()) {
addField(json, ORDERING_PROPERTIES, JsonQueryOrderingPropertyConverter.ARRAY_CONVERTER.toJsonArray(query.getOrderingProperties()));
}
// expressions
for (Map.Entry<String, String> expressionEntry : query.getExpressions().entrySet()) {
json.put(expressionEntry.getKey() + "Expression", expressionEntry.getValue());
}
return json;
}
Aggregations