use of org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException in project records-management by Alfresco.
the class CustomPropertyDefinitionPost method executeImpl.
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
JSONObject json = null;
Map<String, Object> ftlModel = null;
try {
json = new JSONObject(new JSONTokener(req.getContent().getContent()));
try {
ftlModel = createPropertyDefinition(req, json);
} catch (CustomMetadataException e) {
status.setCode(Status.STATUS_BAD_REQUEST);
ftlModel = new HashMap<String, Object>();
ftlModel.put(MESSAGE, e.getMessage());
}
} catch (IOException iox) {
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not read content from req.", iox);
} catch (JSONException je) {
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not parse JSON from req.", je);
}
return ftlModel;
}
use of org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException in project records-management by Alfresco.
the class CustomPropertyDefinitionPut method executeImpl.
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
JSONObject json = null;
Map<String, Object> ftlModel = null;
try {
json = new JSONObject(new JSONTokener(req.getContent().getContent()));
try {
ftlModel = handlePropertyDefinitionUpdate(req, json);
} catch (CustomMetadataException e) {
status.setCode(Status.STATUS_BAD_REQUEST);
ftlModel = new HashMap<String, Object>();
ftlModel.put(MESSAGE, e.getMessage());
}
} catch (IOException iox) {
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not read content from req.", iox);
} catch (JSONException je) {
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not parse JSON from req.", je);
}
return ftlModel;
}
Aggregations