Example #1
0
 /** Sets an attribute on a person. */
 public static void setPersonAttributeValue(
     Patient patient, PersonAttributeType attrType, String value) {
   PersonService personService = Context.getPersonService();
   PersonAttribute attribute = patient.getAttribute(attrType);
   if (attribute == null) {
     attribute = new PersonAttribute();
     attribute.setAttributeType(attrType);
     attribute.setValue(value);
     patient.addAttribute(attribute);
   } else {
     attribute.setValue(value);
   }
   personService.savePerson(patient);
 }
Example #2
0
 /** Gets the value of an attribute on a person. */
 public static String getPersonAttributeValue(Person person, PersonAttributeType attrType) {
   PersonAttribute attribute = person.getAttribute(attrType);
   return attribute != null ? attribute.getValue() : null;
 }