Question:
How do I implement DELETE /patient/{patient_uuid}/allergy/ to delete all allergies for a patient.
I can implement DELETE /patient/{patient_uuid}/allergy/{allergy_uuid} to delete a single allergy no problem.
It seems webservices.rest does not support the delete all requirement.
This was discussed on the talk topic that Lluis mentioned and he proposed to override public void delete(String parentUniqueId, String uuid, String reason, RequestContext context) and if uuid is null delete all allergies
I don’t see the word “purge” anywhere in that thread.
Anyway, to be clear:
doing DELETE .../patient/{uuid}/allergy should void all of the patient’s allergies (and set them back to the unknown status.
DELETE .../patient/{uuid}/allergy?purge=true should fail with a 4xx status (or, alternately, it should just not be recognized as anything different from DELETE without the parameter.
And, per my comment on the commit, I’m not sure what purging has to do with any of this. (Because the test method wyclif commented on is about voiding, not purging.)
@darius, and @Wyclif, I have a pull request for review.
It solves the DELETE all subresource problem
It is a bit untidy (WIP) with some comments remaining however I want the approach evaluated as I may have to do the same to support the PUT requirement.
pull request: https://github.com/openmrs/openmrs-module-webservices.rest/pull/183
MainSubResourceController.java is a major change, having difficulty with git, but changes are at the end of the file, from line 168 onwards.
some changes are some problem to do with the git pull: ConversionUtil,java, ConversionUtilTest.java & SwaggerSpecificationController.java. I did not change these files.
some changes are going into openmrs-core to support this pull request including adding UUID support to allergy.