REST WS: PatientIdentifierResource preferring name over UUID when setting identifier type

Hi all,

I’m referring to this in setIdentifierType(PatientIdentifier, PatientIdentifierType):

public void setIdentifierType(PatientIdentifier instance, PatientIdentifierType identifierType) {
  String uuid = identifierType.getUuid();
  String name = identifierType.getName();
  if (name != null && !name.isEmpty()) {
  } else if (uuid != null && !uuid.isEmpty()) {

(Q.) Why is this setter prioritizing the name over the UUID when fetching the identifier type before setting it to the identifier?

Here is the ticket that led to this:

Thanks @dkayiwa!

The thread doesn’t make a strong case for the change altogether, it seems to have originated from a design flaw in Bahmni Apps more than anything else.

@raff, do you remember why you chose to prioritize the name over the UUID?

I’d make an exception and allow referencing by name although it’s possible to first search for PatientIdentifierType by name and then use its uuid.

I felt exactly the same as you. That is why i could not defend the change but simply point you to the discussion. :smile:

I reopened the issue, commented on it, and here is the PR #283.