/** * @see SubResource#purge(java.lang.String, java.lang.String, RequestContext) */ @Override public void purge(String parentUniqueId, String uuid, RequestContext context) throws ResponseException { T delegate = getByUniqueId(uuid); if (delegate == null) { // HTTP DELETE is idempotent, so if we can't find the object, we assume it's already deleted and return success return; } testParent(delegate, parentUniqueId); purge(delegate, context); }
/** * @see org.openmrs.module.webservices.rest.web.resource.api.SubResource#delete(java.lang.String, * java.lang.String, java.lang.String, * org.openmrs.module.webservices.rest.web.RequestContext) */ @Override public void delete(String parentUniqueId, String uuid, String reason, RequestContext context) throws ResponseException { T delegate = getByUniqueId(uuid); if (delegate == null) throw new ObjectNotFoundException(); testParent(delegate, parentUniqueId); delete(delegate, reason, context); }
/** * @see SubResource#retrieve(java.lang.String, java.lang.String, RequestContext) */ @Override public Object retrieve(String parentUniqueId, String uuid, RequestContext context) throws ResponseException { T delegate = getByUniqueId(uuid); if (delegate == null) throw new ObjectNotFoundException(); testParent(delegate, parentUniqueId); return asRepresentation(delegate, context.getRepresentation()); }
/** * @see SubResource#update(java.lang.String, java.lang.String, SimpleObject, RequestContext) */ @Override public Object update(String parentUniqueId, String uuid, SimpleObject propertiesToUpdate, RequestContext context) throws ResponseException { T delegate = getByUniqueId(uuid); if (delegate == null) throw new ObjectNotFoundException(); testParent(delegate, parentUniqueId); setConvertedProperties(delegate, propertiesToUpdate, getUpdatableProperties(), false); delegate = save(delegate); return ConversionUtil.convertToRepresentation(delegate, Representation.DEFAULT); }