@ivange94 did you choose to make it a BaseOpenmrsData and not a BaseOpenmrsData? Because I would make it a BaseOpenmrsData so we get the benefit of having creator/dateCreated,… filled out for us. So I suggest you make it BaseOpenmrsData and then it should just be the same as the RadiologyOrderResource
@ivange94 and I just tried Autowiring the RadiologyOrderService in the RadiologyOrderResource which didnt work and threw an exception when deployed. So get your Service via the Context.getService(). See RadiologyOrderResource.
I saw that. But i thought it only works with Services in core? RadiologyOrder is a subclass of Order which has a service OrderService.java registered in core. So i assumed thats why it worked for RadiologyOrder. But MrrtReportTemplate has no superclass in core. Will that also work for it too?
Thanks for this hint @wyclif but this is another topic (which I will open later). This is topic is about MrrtReportTemplate which in my opinion should be BaseOpenmrsData and its REST resource can be implemented as RadiologyOrderResource is currently implemented and it sure will work fine
Whem i was extending BaseOpenmrsObject, i had to add “uuid” inside my hibernate mapping and also in my liquibase changeset. Now i have to extend BaseOpenmrsData and it has seven fields but you only added 4 in RadiologyStudy.hbm.xml . So am i doing the same or is that only for RadiologyStudy?
It’s nice to name things following conventions, this can be helpful to other devs looking through your code, i.e if you have a domain object named MrrtReportTemplate, it’s REST resource should be named MrrtReportTemplateResource and not RadiologyOrderResource, this will save you also from obscure bugs like I saw someone run into with a service method like saveStudy(RadiologyStudy) instead of saveRadiologyStudy(RadiologyStudy) where the save handler couldn’t work.
By the way, right now I’m confused by what issue you’re trying to solve
@wyclif you got it wrong. MrrtReportTemplate and RadiologyOrder are different objects which each have their resource named MrrtReportTemplateResource and RadiologyOrderResource respectively.
@ivange94 I just built and ran your changes. I imported some templates from radreport.
I was also able to get the resource via REST GET uuid. The only issue is with the REPRESENTATION “full”. This one doesnt work. Do you have time to talk on IRC?
I actually fixed that last night. But internet connections here have been unstable due to some accident with some fiber optics. So i have not pushed my changes yet. Even replying to talk posts is taking a lot of time. Here is a screenshot of rest working, http://picpaste.com/pics/rest_working-0J9Lv44e.1466758727.png