How REST module handle resource updates

2 views
Skip to first unread message

Harsha Kumara

unread,
Mar 31, 2015, 3:35:45 PM3/31/15
to d...@openmrs.org, Darius Jazayeri, Wyclif Luyima, Suranga Kasthurirathne
Hi All,

During our FHIR module resource update operations, we encounter some issues with updating the resources through REST. I looked at save methods of person and patient and saw they are doing saveOrUpdate in DAO layer. In DAO layer, it's checking whether id is exist for resource and do creation or update. 

How REST module handle resource update requests? Is it first get resource by uuid and then update the fields then save it? Or is it follow different approach?

Thanks,
Harsha
--
Harsha Kumara
Software Engineer
WSO2 Inc.
Sri Lanka.

Darius Jazayeri

unread,
Mar 31, 2015, 3:41:19 PM3/31/15
to Harsha Kumara, d...@openmrs.org, Wyclif Luyima, Suranga Kasthurirathne
Hi Harsha,

Most of the resources extend some common base classes, so you can see the typical behavior in DelegatingCrudResource.update() here:


Particularly, yes it does:
T delegate = getByUniqueId(uuid);
...
delegate = save(delegate);

-Darius

Harsha Kumara

unread,
Mar 31, 2015, 3:50:14 PM3/31/15
to Darius Jazayeri, d...@openmrs.org, Wyclif Luyima, Suranga Kasthurirathne
Got it thanks Darius for the pointer. :)

Harsha Kumara

unread,
Apr 2, 2015, 9:03:46 AM4/2/15
to Darius Jazayeri, Sashrika Waidyarathna, d...@openmrs.org, Wyclif Luyima, Suranga Kasthurirathne
adding Sashirka as he is working on person update. 
Reply all
Reply to author
Forward
0 new messages