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;
}
Aggregations