Help with issue RESTWS-925: Displaying User Name with Name Template

Hi everyone,

I’m working on the issue RESTWS-925: [RESTWS-925] - OpenMRS Issues.

I’ve identified the default name template and traced the code to the getDisplayString method in the PersonNameResource class, which seems responsible for generating the display data according to the template. Additionally, I noticed the USER_CUSTOM_REP string in the session controller that utilizes the CustomRepresentation(USER_CUSTOM_REP) class. This could potentially be affecting the data formatting.

My current understanding is that the code responsible for populating user.person.display in the response might be bypassing the getDisplayString method. There could be other code within the REST module that sets a specific value for user.person.display before the session endpoint retrieves it.

I’m having trouble pinpointing the exact code that populates user.person.display in the REST module. Any pointers on where to look further would be greatly appreciated.

The desired format for user.person.display is to have the user’s name displayed on separate lines, following the template structure:

<string>givenName</string> <string>middleName</string> <string>familyName</string> (Some clarity on this as well) However, currently, the data appears all on one line:

<person> <uuid>fefcf4f4-7db7-48e1-88b3-10de31b6b9cf</uuid> <display>Suubi Joshua Ssebaana</display> </person>

cc @ibacher @dkayiwa @mherman22

Where are you getting that from? It’s desirable that the user’s name renders on a single line. What matters is that I can change the name template and see the display name updated to reflect that. (The template calls the section “lineByLineFormat”, but that’s just because it shares an implementation with the address template we actually remove the lines from the string).

It will end up being the property getter for the PersonResource here that defines the display property.

You might note, in that function this comment, which implies that the PatientResource does something different, but checking the code there reveals that it doesn’t. (Oddly, the code seems to be exactly the same as it was when that comment was added).

Ultimately, the PersonResource calls Person#getName()#getFullName(). In 2017, getFullName() was changed to use the name template, so I don’t think there’s any work to be done here except to remove that comment mentioned above that may imply that there is.

2 Likes

Thank you @ibacher now I think now am in understanding of the issue. Thank you a bunch.

Was really confused because the name displayed was displayed in one string according to template but on one line. Thats why i was thinking maybe what was required was maybe line by line.