Search in sources :

Example 6 with QueryProperty

use of org.camunda.bpm.engine.query.QueryProperty in project camunda-bpm-platform by camunda.

the class MybatisJoinHelper method orderBy.

public static String orderBy(QueryOrderingProperty orderingProperty, int index) {
    QueryProperty queryProperty = orderingProperty.getQueryProperty();
    StringBuilder sb = new StringBuilder();
    sb.append(tableAlias(orderingProperty.getRelation(), index));
    if (orderingProperty.isContainedProperty()) {
        sb.append(".");
    } else {
        sb.append("_");
    }
    sb.append(queryProperty.getName());
    sb.append(" ");
    sb.append(orderingProperty.getDirection().getName());
    return sb.toString();
}
Also used : QueryProperty(org.camunda.bpm.engine.query.QueryProperty)

Example 7 with QueryProperty

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

Example 8 with QueryProperty

use of org.camunda.bpm.engine.query.QueryProperty in project camunda-bpm-platform by camunda.

the class JsonQueryOrderingPropertyConverter method toObject.

public QueryOrderingProperty toObject(JSONObject jsonObject) {
    String relation = null;
    if (jsonObject.has(RELATION)) {
        relation = jsonObject.getString(RELATION);
    }
    QueryOrderingProperty property = null;
    if (QueryOrderingProperty.RELATION_VARIABLE.equals(relation)) {
        property = new VariableOrderProperty();
    } else {
        property = new QueryOrderingProperty();
    }
    property.setRelation(relation);
    if (jsonObject.has(QUERY_PROPERTY)) {
        String propertyName = jsonObject.getString(QUERY_PROPERTY);
        String propertyFunction = null;
        if (jsonObject.has(QUERY_PROPERTY_FUNCTION)) {
            propertyFunction = jsonObject.getString(QUERY_PROPERTY_FUNCTION);
        }
        QueryProperty queryProperty = new QueryPropertyImpl(propertyName, propertyFunction);
        property.setQueryProperty(queryProperty);
    }
    if (jsonObject.has(DIRECTION)) {
        String direction = jsonObject.getString(DIRECTION);
        property.setDirection(Direction.findByName(direction));
    }
    if (jsonObject.has(RELATION_CONDITIONS)) {
        List<QueryEntityRelationCondition> relationConditions = JsonQueryFilteringPropertyConverter.ARRAY_CONVERTER.toObject(jsonObject.getJSONArray(RELATION_CONDITIONS));
        property.setRelationConditions(relationConditions);
    }
    return property;
}
Also used : QueryPropertyImpl(org.camunda.bpm.engine.impl.QueryPropertyImpl) VariableInstanceQueryProperty(org.camunda.bpm.engine.impl.VariableInstanceQueryProperty) QueryProperty(org.camunda.bpm.engine.query.QueryProperty) QueryOrderingProperty(org.camunda.bpm.engine.impl.QueryOrderingProperty) VariableOrderProperty(org.camunda.bpm.engine.impl.VariableOrderProperty) QueryEntityRelationCondition(org.camunda.bpm.engine.impl.QueryEntityRelationCondition)

Aggregations

QueryProperty (org.camunda.bpm.engine.query.QueryProperty)8 QueryPropertyImpl (org.camunda.bpm.engine.impl.QueryPropertyImpl)3 VariableInstanceQueryProperty (org.camunda.bpm.engine.impl.VariableInstanceQueryProperty)3 JSONObject (org.camunda.bpm.engine.impl.util.json.JSONObject)3 Direction (org.camunda.bpm.engine.impl.Direction)2 QueryEntityRelationCondition (org.camunda.bpm.engine.impl.QueryEntityRelationCondition)2 QueryOrderingProperty (org.camunda.bpm.engine.impl.QueryOrderingProperty)2 ArrayList (java.util.ArrayList)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 TaskQueryProperty (org.camunda.bpm.engine.impl.TaskQueryProperty)1 VariableOrderProperty (org.camunda.bpm.engine.impl.VariableOrderProperty)1 JSONArray (org.camunda.bpm.engine.impl.util.json.JSONArray)1 RestException (org.camunda.bpm.engine.rest.exception.RestException)1