Search in sources :

Example 1 with ValueObjectDTO

use of com.runwaysdk.business.ValueObjectDTO in project geoprism-registry by terraframe.

the class TermController method getClassifierSuggestions.

@Endpoint(error = ErrorSerialization.JSON)
public ResponseIF getClassifierSuggestions(ClientRequestIF request, @RequestParamter(name = "mdAttributeId", required = true) String mdAttributeId, @RequestParamter(name = "text") String text, @RequestParamter(name = "limit") Integer limit) throws JSONException {
    JSONArray response = new JSONArray();
    ValueQueryDTO query = ClassifierDTO.getClassifierSuggestions(request, mdAttributeId, text, limit);
    List<ValueObjectDTO> results = query.getResultSet();
    for (ValueObjectDTO result : results) {
        JSONObject object = new JSONObject();
        object.put("label", result.getValue(ClassifierDTO.DISPLAYLABEL));
        object.put("value", result.getValue(ClassifierDTO.OID));
        response.put(object);
    }
    return new RestBodyResponse(response);
}
Also used : JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) ValueQueryDTO(com.runwaysdk.business.ValueQueryDTO) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) ValueObjectDTO(com.runwaysdk.business.ValueObjectDTO) Endpoint(com.runwaysdk.mvc.Endpoint)

Aggregations

ValueObjectDTO (com.runwaysdk.business.ValueObjectDTO)1 ValueQueryDTO (com.runwaysdk.business.ValueQueryDTO)1 Endpoint (com.runwaysdk.mvc.Endpoint)1 RestBodyResponse (com.runwaysdk.mvc.RestBodyResponse)1 JSONArray (org.json.JSONArray)1 JSONObject (org.json.JSONObject)1