What's the core usecase for IdentifierResource

restws
idgen
Tags: #<Tag:0x00007f88c948a090> #<Tag:0x00007f88c9489e88>

(Samuel Male) #1

Hey,

We have an IdentifierResource already added in the idgen module as a subresource for IdentifierSourceResource however, this resource isn’t working.

curl -u admin:Admin123 -i "http://localhost:8080/openmrs/ws/rest/v1/idgen/identifiersource/05a29f94-c0ed-11e2-94be-8c13b969e334/identifier"

The above call causes an UnknownResourceException full log : https://pastebin.com/R1EgJxQt

Well I believe this resource ain’t available because this method #getPropertiesToExposeAsSubResources() wasn’t overriden in IdentifierSourceResource.

My Qeury

But I wonder what’s the use of this Subresource? I find it sort of trivial! Is it there for someone who wants an identifier string to be generated for them depending on a given IdentifierSource? If so, which property of the IdenifierSource is this Subresource delegating? Is it the reservedIdentifiers?

cc: @burke, @mogoodrich, @dkayiwa


(Daniel Kayiwa) #2

Did you take a look at the unit tests for that resource?


(Samuel Male) #3

Well looking at the test units gives me a better insight. I understand its used to generate new Identifiers according to the sourceType.

Which property of IdentifierSource is this sub-resource delegating to?


(Samuel Male) #4

Well seems we have a bug in the webservices.rest. Created ticket at : https://issues.openmrs.org/browse/RESTWS-747


(Samuel Male) #5

With further investigation, I realized that we just had to override BaseRestController#getNamespace() and update it with the module namespace.

Lets close RESTWS-747 as Wont fix/Fixed.

The issue was this wasn’t documented anywhere.

cc: @dkayiwa


(Daniel Kayiwa) #6

Did you respond to Burke’s comment on the ticket?