forked from Raxa/raxacore
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BAH-987|Praveena| - Internationalisation of patient attributes in reg…
…istration page (#94) * BAH-929 | Updated Concept names property-getter to include names in user & global locale * Praveena | BAH-989 Response to patient attributes should include answers in user default locale and global locale * Praveena | Removed unused JAVA import
- Loading branch information
1 parent
c8b8c84
commit b7c974f
Showing
2 changed files
with
86 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ain/java/org/openmrs/module/bahmnicore/web/v1_0/resource/PersonAttributeTypeResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.openmrs.module.bahmnicore.web.v1_0.resource; | ||
|
||
import org.openmrs.Concept; | ||
import org.openmrs.PersonAttributeType; | ||
import org.openmrs.api.context.Context; | ||
import org.openmrs.module.webservices.rest.web.ConversionUtil; | ||
import org.openmrs.module.webservices.rest.web.RequestContext; | ||
import org.openmrs.module.webservices.rest.web.RestConstants; | ||
import org.openmrs.module.webservices.rest.web.annotation.PropertyGetter; | ||
import org.openmrs.module.webservices.rest.web.annotation.Resource; | ||
import org.openmrs.module.webservices.rest.web.representation.NamedRepresentation; | ||
import org.openmrs.module.webservices.rest.web.representation.Representation; | ||
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription; | ||
import org.openmrs.module.webservices.rest.web.response.ResponseException; | ||
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.PersonAttributeTypeResource1_8; | ||
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.BaseAttributeTypeCrudResource1_9; | ||
import org.openmrs.util.OpenmrsUtil; | ||
|
||
@Resource(name = RestConstants.VERSION_1 + "/personattributetype", supportedClass = PersonAttributeType.class, supportedOpenmrsVersions = {"1.12.*","2.0.*", "2.1.*"}, order = 0) | ||
public class PersonAttributeTypeResource extends PersonAttributeTypeResource1_8 { | ||
@PropertyGetter("concept") | ||
public Object getConcept(PersonAttributeType delegate) { | ||
if (OpenmrsUtil.nullSafeEquals(delegate.getFormat(), Concept.class.getCanonicalName())) { | ||
Concept concept = Context.getConceptService().getConcept(delegate.getForeignKey()); | ||
return ConversionUtil.convertToRepresentation(concept, new NamedRepresentation("bahmniFullAnswers")); | ||
} | ||
return null; | ||
} | ||
} |