Beispiel #1
0
        public override TaskQuery toObject(JsonObject json)
        {
            TaskQueryImpl query = new TaskQueryImpl();

            if (json.has(OR_QUERIES))
            {
                foreach (JsonElement jsonElement in JsonUtil.getArray(json, OR_QUERIES))
                {
                    query.addOrQuery((TaskQueryImpl)toObject(JsonUtil.getObject(jsonElement)));
                }
            }
            if (json.has(TASK_ID))
            {
                query.taskId(JsonUtil.getString(json, TASK_ID));
            }
            if (json.has(NAME))
            {
                query.taskName(JsonUtil.getString(json, NAME));
            }
            if (json.has(NAME_NOT_EQUAL))
            {
                query.taskNameNotEqual(JsonUtil.getString(json, NAME_NOT_EQUAL));
            }
            if (json.has(NAME_LIKE))
            {
                query.taskNameLike(JsonUtil.getString(json, NAME_LIKE));
            }
            if (json.has(NAME_NOT_LIKE))
            {
                query.taskNameNotLike(JsonUtil.getString(json, NAME_NOT_LIKE));
            }
            if (json.has(DESCRIPTION))
            {
                query.taskDescription(JsonUtil.getString(json, DESCRIPTION));
            }
            if (json.has(DESCRIPTION_LIKE))
            {
                query.taskDescriptionLike(JsonUtil.getString(json, DESCRIPTION_LIKE));
            }
            if (json.has(PRIORITY))
            {
                query.taskPriority(JsonUtil.getInt(json, PRIORITY));
            }
            if (json.has(MIN_PRIORITY))
            {
                query.taskMinPriority(JsonUtil.getInt(json, MIN_PRIORITY));
            }
            if (json.has(MAX_PRIORITY))
            {
                query.taskMaxPriority(JsonUtil.getInt(json, MAX_PRIORITY));
            }
            if (json.has(ASSIGNEE))
            {
                query.taskAssignee(JsonUtil.getString(json, ASSIGNEE));
            }
            if (json.has(ASSIGNEE_LIKE))
            {
                query.taskAssigneeLike(JsonUtil.getString(json, ASSIGNEE_LIKE));
            }
            if (json.has(INVOLVED_USER))
            {
                query.taskInvolvedUser(JsonUtil.getString(json, INVOLVED_USER));
            }
            if (json.has(OWNER))
            {
                query.taskOwner(JsonUtil.getString(json, OWNER));
            }
            if (json.has(ASSIGNED) && JsonUtil.getBoolean(json, ASSIGNED))
            {
                query.taskAssigned();
            }
            if (json.has(UNASSIGNED) && JsonUtil.getBoolean(json, UNASSIGNED))
            {
                query.taskUnassigned();
            }
            if (json.has(DELEGATION_STATE))
            {
                query.taskDelegationState(Enum.Parse(typeof(DelegationState), JsonUtil.getString(json, DELEGATION_STATE)));
            }
            if (json.has(CANDIDATE_USER))
            {
                query.taskCandidateUser(JsonUtil.getString(json, CANDIDATE_USER));
            }
            if (json.has(CANDIDATE_GROUP))
            {
                query.taskCandidateGroup(JsonUtil.getString(json, CANDIDATE_GROUP));
            }
            if (json.has(CANDIDATE_GROUPS) && !json.has(CANDIDATE_USER) && !json.has(CANDIDATE_GROUP))
            {
                query.taskCandidateGroupIn(getList(JsonUtil.getArray(json, CANDIDATE_GROUPS)));
            }
            if (json.has(WITH_CANDIDATE_GROUPS) && JsonUtil.getBoolean(json, WITH_CANDIDATE_GROUPS))
            {
                query.withCandidateGroups();
            }
            if (json.has(WITHOUT_CANDIDATE_GROUPS) && JsonUtil.getBoolean(json, WITHOUT_CANDIDATE_GROUPS))
            {
                query.withoutCandidateGroups();
            }
            if (json.has(WITH_CANDIDATE_USERS) && JsonUtil.getBoolean(json, WITH_CANDIDATE_USERS))
            {
                query.withCandidateUsers();
            }
            if (json.has(WITHOUT_CANDIDATE_USERS) && JsonUtil.getBoolean(json, WITHOUT_CANDIDATE_USERS))
            {
                query.withoutCandidateUsers();
            }
            if (json.has(INCLUDE_ASSIGNED_TASKS) && JsonUtil.getBoolean(json, INCLUDE_ASSIGNED_TASKS))
            {
                query.includeAssignedTasksInternal();
            }
            if (json.has(PROCESS_INSTANCE_ID))
            {
                query.processInstanceId(JsonUtil.getString(json, PROCESS_INSTANCE_ID));
            }
            if (json.has(EXECUTION_ID))
            {
                query.executionId(JsonUtil.getString(json, EXECUTION_ID));
            }
            if (json.has(ACTIVITY_INSTANCE_ID_IN))
            {
                query.activityInstanceIdIn(getArray(JsonUtil.getArray(json, ACTIVITY_INSTANCE_ID_IN)));
            }
            if (json.has(CREATED))
            {
                query.taskCreatedOn(new DateTime(JsonUtil.getLong(json, CREATED)));
            }
            if (json.has(CREATED_BEFORE))
            {
                query.taskCreatedBefore(new DateTime(JsonUtil.getLong(json, CREATED_BEFORE)));
            }
            if (json.has(CREATED_AFTER))
            {
                query.taskCreatedAfter(new DateTime(JsonUtil.getLong(json, CREATED_AFTER)));
            }
            if (json.has(KEY))
            {
                query.taskDefinitionKey(JsonUtil.getString(json, KEY));
            }
            if (json.has(KEYS))
            {
                query.taskDefinitionKeyIn(getArray(JsonUtil.getArray(json, KEYS)));
            }
            if (json.has(KEY_LIKE))
            {
                query.taskDefinitionKeyLike(JsonUtil.getString(json, KEY_LIKE));
            }
            if (json.has(PARENT_TASK_ID))
            {
                query.taskParentTaskId(JsonUtil.getString(json, PARENT_TASK_ID));
            }
            if (json.has(PROCESS_DEFINITION_KEY))
            {
                query.processDefinitionKey(JsonUtil.getString(json, PROCESS_DEFINITION_KEY));
            }
            if (json.has(PROCESS_DEFINITION_KEYS))
            {
                query.processDefinitionKeyIn(getArray(JsonUtil.getArray(json, PROCESS_DEFINITION_KEYS)));
            }
            if (json.has(PROCESS_DEFINITION_ID))
            {
                query.processDefinitionId(JsonUtil.getString(json, PROCESS_DEFINITION_ID));
            }
            if (json.has(PROCESS_DEFINITION_NAME))
            {
                query.processDefinitionName(JsonUtil.getString(json, PROCESS_DEFINITION_NAME));
            }
            if (json.has(PROCESS_DEFINITION_NAME_LIKE))
            {
                query.processDefinitionNameLike(JsonUtil.getString(json, PROCESS_DEFINITION_NAME_LIKE));
            }
            if (json.has(PROCESS_INSTANCE_BUSINESS_KEY))
            {
                query.processInstanceBusinessKey(JsonUtil.getString(json, PROCESS_INSTANCE_BUSINESS_KEY));
            }
            if (json.has(PROCESS_INSTANCE_BUSINESS_KEYS))
            {
                query.processInstanceBusinessKeyIn(getArray(JsonUtil.getArray(json, PROCESS_INSTANCE_BUSINESS_KEYS)));
            }
            if (json.has(PROCESS_INSTANCE_BUSINESS_KEY_LIKE))
            {
                query.processInstanceBusinessKeyLike(JsonUtil.getString(json, PROCESS_INSTANCE_BUSINESS_KEY_LIKE));
            }
            if (json.has(TASK_VARIABLES))
            {
                addVariables(query, JsonUtil.getArray(json, TASK_VARIABLES), true, false);
            }
            if (json.has(PROCESS_VARIABLES))
            {
                addVariables(query, JsonUtil.getArray(json, PROCESS_VARIABLES), false, true);
            }
            if (json.has(CASE_INSTANCE_VARIABLES))
            {
                addVariables(query, JsonUtil.getArray(json, CASE_INSTANCE_VARIABLES), false, false);
            }
            if (json.has(DUE))
            {
                query.dueDate(new DateTime(JsonUtil.getLong(json, DUE)));
            }
            if (json.has(DUE_BEFORE))
            {
                query.dueBefore(new DateTime(JsonUtil.getLong(json, DUE_BEFORE)));
            }
            if (json.has(DUE_AFTER))
            {
                query.dueAfter(new DateTime(JsonUtil.getLong(json, DUE_AFTER)));
            }
            if (json.has(FOLLOW_UP))
            {
                query.followUpDate(new DateTime(JsonUtil.getLong(json, FOLLOW_UP)));
            }
            if (json.has(FOLLOW_UP_BEFORE))
            {
                query.followUpBefore(new DateTime(JsonUtil.getLong(json, FOLLOW_UP_BEFORE)));
            }
            if (json.has(FOLLOW_UP_AFTER))
            {
                query.followUpAfter(new DateTime(JsonUtil.getLong(json, FOLLOW_UP_AFTER)));
            }
            if (json.has(FOLLOW_UP_NULL_ACCEPTED))
            {
                query.FollowUpNullAccepted = JsonUtil.getBoolean(json, FOLLOW_UP_NULL_ACCEPTED);
            }
            if (json.has(EXCLUDE_SUBTASKS) && JsonUtil.getBoolean(json, EXCLUDE_SUBTASKS))
            {
                query.excludeSubtasks();
            }
            if (json.has(SUSPENDED) && JsonUtil.getBoolean(json, SUSPENDED))
            {
                query.suspended();
            }
            if (json.has(ACTIVE) && JsonUtil.getBoolean(json, ACTIVE))
            {
                query.active();
            }
            if (json.has(CASE_DEFINITION_KEY))
            {
                query.caseDefinitionKey(JsonUtil.getString(json, CASE_DEFINITION_KEY));
            }
            if (json.has(CASE_DEFINITION_ID))
            {
                query.caseDefinitionId(JsonUtil.getString(json, CASE_DEFINITION_ID));
            }
            if (json.has(CASE_DEFINITION_NAME))
            {
                query.caseDefinitionName(JsonUtil.getString(json, CASE_DEFINITION_NAME));
            }
            if (json.has(CASE_DEFINITION_NAME_LIKE))
            {
                query.caseDefinitionNameLike(JsonUtil.getString(json, CASE_DEFINITION_NAME_LIKE));
            }
            if (json.has(CASE_INSTANCE_ID))
            {
                query.caseInstanceId(JsonUtil.getString(json, CASE_INSTANCE_ID));
            }
            if (json.has(CASE_INSTANCE_BUSINESS_KEY))
            {
                query.caseInstanceBusinessKey(JsonUtil.getString(json, CASE_INSTANCE_BUSINESS_KEY));
            }
            if (json.has(CASE_INSTANCE_BUSINESS_KEY_LIKE))
            {
                query.caseInstanceBusinessKeyLike(JsonUtil.getString(json, CASE_INSTANCE_BUSINESS_KEY_LIKE));
            }
            if (json.has(CASE_EXECUTION_ID))
            {
                query.caseExecutionId(JsonUtil.getString(json, CASE_EXECUTION_ID));
            }
            if (json.has(TENANT_IDS))
            {
                query.tenantIdIn(getArray(JsonUtil.getArray(json, TENANT_IDS)));
            }
            if (json.has(WITHOUT_TENANT_ID))
            {
                query.withoutTenantId();
            }
            if (json.has(ORDER_BY))
            {
                IList <QueryOrderingProperty> orderingProperties = JsonLegacyQueryOrderingPropertyConverter.INSTANCE.fromOrderByString(JsonUtil.getString(json, ORDER_BY));

                query.OrderingProperties = orderingProperties;
            }
            if (json.has(ORDERING_PROPERTIES))
            {
                JsonArray jsonArray = JsonUtil.getArray(json, ORDERING_PROPERTIES);
                query.OrderingProperties = JsonQueryOrderingPropertyConverter.ARRAY_CONVERTER.toObject(jsonArray);
            }

            // expressions
            foreach (KeyValuePair <string, JsonElement> entry in json.entrySet())
            {
                string key = entry.Key;
                if (key.EndsWith("Expression", StringComparison.Ordinal))
                {
                    string expression = JsonUtil.getString(json, key);
                    query.addExpression(key.Substring(0, key.Length - "Expression".Length), expression);
                }
            }

            return(query);
        }