Search in sources :

Example 1 with ListTypeVersionPageQuery

use of net.geoprism.registry.query.ListTypeVersionPageQuery in project geoprism-registry by terraframe.

the class ListTypeVersion method values.

public JsonArray values(String value, String attributeName, JsonObject criteria) {
    ValueQuery vQuery = new ValueQuery(new QueryFactory());
    BusinessQuery query = new ListTypeVersionPageQuery(this, criteria, true, false).getQuery(vQuery);
    DateFormat filterFormat = new SimpleDateFormat(GeoObjectImportConfiguration.DATE_FORMAT);
    filterFormat.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
    JsonArray results = new JsonArray();
    vQuery.SELECT_DISTINCT(query.get(attributeName, "label"));
    vQuery.FROM(query);
    if (value != null && value.length() > 0) {
        vQuery.WHERE(F.UPPER(query.aCharacter(attributeName)).LIKEi("%" + value.toUpperCase() + "%"));
    }
    try (OIterator<ValueObject> it = vQuery.getIterator(100, 1)) {
        while (it.hasNext()) {
            ValueObject vObject = it.next();
            results.add(vObject.getValue("label"));
        // JsonObject result = new JsonObject();
        // result.addProperty("label", vObject.getValue("label"));
        // result.addProperty("value", vObject.getValue("value"));
        // 
        // results.add(result);
        }
    }
    return results;
}
Also used : ValueQuery(com.runwaysdk.query.ValueQuery) BusinessQuery(com.runwaysdk.business.BusinessQuery) JsonArray(com.google.gson.JsonArray) QueryFactory(com.runwaysdk.query.QueryFactory) ListTypeVersionPageQuery(net.geoprism.registry.query.ListTypeVersionPageQuery) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) ValueObject(com.runwaysdk.dataaccess.ValueObject) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

JsonArray (com.google.gson.JsonArray)1 BusinessQuery (com.runwaysdk.business.BusinessQuery)1 ValueObject (com.runwaysdk.dataaccess.ValueObject)1 QueryFactory (com.runwaysdk.query.QueryFactory)1 ValueQuery (com.runwaysdk.query.ValueQuery)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ListTypeVersionPageQuery (net.geoprism.registry.query.ListTypeVersionPageQuery)1