use of com.haulmont.chile.core.datatypes.ParameterizedDatatype in project cuba by cuba-platform.
the class DatatypesControllerManager method getDatatypesJson.
public String getDatatypesJson() {
JsonArray jsonArray = new JsonArray();
try {
for (String id : datatypes.getIds()) {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("id", id);
// for backward compatibility
jsonObject.addProperty("name", id);
Datatype datatype = datatypes.get(id);
if (datatype instanceof ParameterizedDatatype) {
Map<String, Object> parameters = ((ParameterizedDatatype) datatype).getParameters();
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
jsonObject.addProperty(entry.getKey(), entry.getValue().toString());
}
}
jsonArray.add(jsonObject);
}
} catch (Exception e) {
log.error("Fail to get datatype settings", e);
throw new RestAPIException("Fail to get datatype settings", e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
return jsonArray.toString();
}
Aggregations