@Test public void getFullNameWithFamilyNameFirst_shouldReturnProperSimpleName() { PersonName name = new PersonName(); name.setGivenName("Mark"); name.setFamilyName("Goodrich"); assertThat(HtmlFormEntryUtil.getFullNameWithFamilyNameFirst(name), is("Goodrich, Mark")); }
public static String getFullNameWithFamilyNameFirst(PersonName personName) { if (personName == null) { return "[" + Context.getMessageSourceService().getMessage("htmlformentry.unknownProviderName") + "]"; } StringBuffer nameString = new StringBuffer(); if (StringUtils.isNotBlank(personName.getFamilyNamePrefix())) { nameString.append(personName.getFamilyNamePrefix() + " "); } if (StringUtils.isNotBlank(personName.getFamilyName())) { nameString.append(personName.getFamilyName() + " "); } if (StringUtils.isNotBlank(personName.getFamilyName2())) { nameString.append(personName.getFamilyName2() + " "); } if (StringUtils.isNotBlank(personName.getFamilyNameSuffix())) { nameString.append(personName.getFamilyNameSuffix() + " "); } if (nameString.length() > 0) { nameString.deleteCharAt(nameString.length() - 1); nameString.append(", "); } if (StringUtils.isNotBlank(personName.getPrefix())) { nameString.append(personName.getPrefix() + " "); } if (StringUtils.isNotBlank(personName.getGivenName())) { nameString.append(personName.getGivenName() + " "); } if (StringUtils.isNotBlank(personName.getMiddleName())) { nameString.append(personName.getMiddleName() + " "); } if (StringUtils.isNotBlank(personName.getDegree())) { nameString.append(personName.getDegree() + " "); } if (nameString.length() > 1) { nameString.deleteCharAt(nameString.length() - 1); } return nameString.toString(); }
HtmlFormEntryUtil { public static String getFullNameWithFamilyNameFirst(PersonName personName) { if (personName == null) { return "[" + Context.getMessageSourceService().getMessage("htmlformentry.unknownProviderName") + "]"; } StringBuffer nameString = new StringBuffer(); if (StringUtils.isNotBlank(personName.getFamilyNamePrefix())) { nameString.append(personName.getFamilyNamePrefix() + " "); } if (StringUtils.isNotBlank(personName.getFamilyName())) { nameString.append(personName.getFamilyName() + " "); } if (StringUtils.isNotBlank(personName.getFamilyName2())) { nameString.append(personName.getFamilyName2() + " "); } if (StringUtils.isNotBlank(personName.getFamilyNameSuffix())) { nameString.append(personName.getFamilyNameSuffix() + " "); } if (nameString.length() > 0) { nameString.deleteCharAt(nameString.length() - 1); nameString.append(", "); } if (StringUtils.isNotBlank(personName.getPrefix())) { nameString.append(personName.getPrefix() + " "); } if (StringUtils.isNotBlank(personName.getGivenName())) { nameString.append(personName.getGivenName() + " "); } if (StringUtils.isNotBlank(personName.getMiddleName())) { nameString.append(personName.getMiddleName() + " "); } if (StringUtils.isNotBlank(personName.getDegree())) { nameString.append(personName.getDegree() + " "); } if (nameString.length() > 1) { nameString.deleteCharAt(nameString.length() - 1); } return nameString.toString(); } }
HtmlFormEntryUtil { public static String getFullNameWithFamilyNameFirst(PersonName personName) { if (personName == null) { return "[" + Context.getMessageSourceService().getMessage("htmlformentry.unknownProviderName") + "]"; } StringBuffer nameString = new StringBuffer(); if (StringUtils.isNotBlank(personName.getFamilyNamePrefix())) { nameString.append(personName.getFamilyNamePrefix() + " "); } if (StringUtils.isNotBlank(personName.getFamilyName())) { nameString.append(personName.getFamilyName() + " "); } if (StringUtils.isNotBlank(personName.getFamilyName2())) { nameString.append(personName.getFamilyName2() + " "); } if (StringUtils.isNotBlank(personName.getFamilyNameSuffix())) { nameString.append(personName.getFamilyNameSuffix() + " "); } if (nameString.length() > 0) { nameString.deleteCharAt(nameString.length() - 1); nameString.append(", "); } if (StringUtils.isNotBlank(personName.getPrefix())) { nameString.append(personName.getPrefix() + " "); } if (StringUtils.isNotBlank(personName.getGivenName())) { nameString.append(personName.getGivenName() + " "); } if (StringUtils.isNotBlank(personName.getMiddleName())) { nameString.append(personName.getMiddleName() + " "); } if (StringUtils.isNotBlank(personName.getDegree())) { nameString.append(personName.getDegree() + " "); } if (nameString.length() > 1) { nameString.deleteCharAt(nameString.length() - 1); } return nameString.toString(); }  }
HtmlFormEntryUtil { public static String getFullNameWithFamilyNameFirst(PersonName personName) { if (personName == null) { return "[" + Context.getMessageSourceService().getMessage("htmlformentry.unknownProviderName") + "]"; } StringBuffer nameString = new StringBuffer(); if (StringUtils.isNotBlank(personName.getFamilyNamePrefix())) { nameString.append(personName.getFamilyNamePrefix() + " "); } if (StringUtils.isNotBlank(personName.getFamilyName())) { nameString.append(personName.getFamilyName() + " "); } if (StringUtils.isNotBlank(personName.getFamilyName2())) { nameString.append(personName.getFamilyName2() + " "); } if (StringUtils.isNotBlank(personName.getFamilyNameSuffix())) { nameString.append(personName.getFamilyNameSuffix() + " "); } if (nameString.length() > 0) { nameString.deleteCharAt(nameString.length() - 1); nameString.append(", "); } if (StringUtils.isNotBlank(personName.getPrefix())) { nameString.append(personName.getPrefix() + " "); } if (StringUtils.isNotBlank(personName.getGivenName())) { nameString.append(personName.getGivenName() + " "); } if (StringUtils.isNotBlank(personName.getMiddleName())) { nameString.append(personName.getMiddleName() + " "); } if (StringUtils.isNotBlank(personName.getDegree())) { nameString.append(personName.getDegree() + " "); } if (nameString.length() > 1) { nameString.deleteCharAt(nameString.length() - 1); } return nameString.toString(); }  static HtmlFormEntryService getService(); static Object getParameterAsType(HttpServletRequest request, String name, Class<?> clazz); static ComplexData convertToComplexData(HttpServletRequest request, String name); static Object convertToType(String val, Class<?> clazz); static Obs createObs(FormField formField, Object value, Date datetime, String accessionNumber); static Obs createObs(Concept concept, Object value, Date datetime, String accessionNumber); static Document stringToDocument(String xml); static String documentToString(Document document); static Node findChild(Node content, String name); static Node findDescendant(Node node, String tagName); static Map<String, String> getNodeAttributes(Node node); static String getNodeAttribute(Node node, String attributeName, String defaultVal); static String getNodeContentsAsString(Node node); static Patient getFakePerson(); static HtmlFormSchema getHtmlFormSchema(HtmlForm htmlForm, FormEntryContext.Mode mode); static Date combineDateAndTime(Date date, Date time); static Date startOfDay(Date d); static Drug getDrug(String uuid); static Concept getConcept(String id); static Concept getConcept(String id, String errorMessageIfNotFound); static Location getLocation(String id); static Location getLocation(String id, FormEntryContext context); static Program getProgram(String id); static Person getPerson(String id); static PatientIdentifierType getPatientIdentifierType(String id); static ProgramWorkflow getWorkflow(Integer id); @SuppressWarnings("deprecation") static ProgramWorkflow getWorkflow(String identifier); static ProgramWorkflowState getState(String identifier, Program program); static ProgramWorkflowState getState(String identifier, ProgramWorkflow workflow); static List<Location> getLocationsByTags(String attributeName, Map<String, String> parameters); static LocationTag getLocationTag(String identifier); static Location getFirstAncestorWithTag(Location location, LocationTag locationTag); @SuppressWarnings("deprecation") static ProgramWorkflowState getState(String identifier); static boolean isValidUuidFormat(String uuid); static List<PatientIdentifierType> getPatientIdentifierTypes(); static void voidEncounter(Encounter e, HtmlForm htmlform, String voidReason); static void voidEncounterByHtmlFormSchema(Encounter e, HtmlForm htmlform, String voidReason); static Date translateDatetimeParam(String value, String format); static PatientProgram getPatientProgramByProgram(List<PatientProgram> patientPrograms, Program program); static PatientProgram getPatientProgramByWorkflow(Patient patient, ProgramWorkflow workflow); static PatientProgram getPatientProgramByProgramOnDate(Patient patient, Program program, Date date); @SuppressWarnings("rawtypes") static boolean hasProvider(Encounter e); static boolean isEnrolledInProgramOnDate(Patient patient, Program program, Date date); static PatientProgram getClosestFutureProgramEnrollment(Patient patient, Program program, Date date); static Date clearTimeComponent(Date date); static String toCamelCase(String s); static EncounterType getEncounterType(String id); static EncounterRole getEncounterRole(String id); static void removeEmptyObs(Collection<Obs> obsList); static String format(OpenmrsMetadata md); static String format(OpenmrsMetadata md, Locale locale); static String getTestStr(String teststr); static String getArchiveDirPath(); static Object getProviderRole(String id); static List<Provider> getProviders(List<String> providerRoleIds, boolean returnAllIfNoRolesSpecified); static List<Provider> getAllProviders(); static void transitionToState(Patient patient, PatientProgram patientProgram, ProgramWorkflowState state,
	        Encounter encounter); static List<Provider> getProviders(List<ProviderRole> providerRoles); static Provider getProvider(String id); static String getFullNameWithFamilyNameFirst(PersonName personName); static List<ProviderStub> getProviderStubs(Collection<Provider> providers); static List<ProviderStub> getProviderStubs(Collection<Provider> providers, String searchParam, MatchMode mode); }
HtmlFormEntryUtil { public static String getFullNameWithFamilyNameFirst(PersonName personName) { if (personName == null) { return "[" + Context.getMessageSourceService().getMessage("htmlformentry.unknownProviderName") + "]"; } StringBuffer nameString = new StringBuffer(); if (StringUtils.isNotBlank(personName.getFamilyNamePrefix())) { nameString.append(personName.getFamilyNamePrefix() + " "); } if (StringUtils.isNotBlank(personName.getFamilyName())) { nameString.append(personName.getFamilyName() + " "); } if (StringUtils.isNotBlank(personName.getFamilyName2())) { nameString.append(personName.getFamilyName2() + " "); } if (StringUtils.isNotBlank(personName.getFamilyNameSuffix())) { nameString.append(personName.getFamilyNameSuffix() + " "); } if (nameString.length() > 0) { nameString.deleteCharAt(nameString.length() - 1); nameString.append(", "); } if (StringUtils.isNotBlank(personName.getPrefix())) { nameString.append(personName.getPrefix() + " "); } if (StringUtils.isNotBlank(personName.getGivenName())) { nameString.append(personName.getGivenName() + " "); } if (StringUtils.isNotBlank(personName.getMiddleName())) { nameString.append(personName.getMiddleName() + " "); } if (StringUtils.isNotBlank(personName.getDegree())) { nameString.append(personName.getDegree() + " "); } if (nameString.length() > 1) { nameString.deleteCharAt(nameString.length() - 1); } return nameString.toString(); }  static HtmlFormEntryService getService(); static Object getParameterAsType(HttpServletRequest request, String name, Class<?> clazz); static ComplexData convertToComplexData(HttpServletRequest request, String name); static Object convertToType(String val, Class<?> clazz); static Obs createObs(FormField formField, Object value, Date datetime, String accessionNumber); static Obs createObs(Concept concept, Object value, Date datetime, String accessionNumber); static Document stringToDocument(String xml); static String documentToString(Document document); static Node findChild(Node content, String name); static Node findDescendant(Node node, String tagName); static Map<String, String> getNodeAttributes(Node node); static String getNodeAttribute(Node node, String attributeName, String defaultVal); static String getNodeContentsAsString(Node node); static Patient getFakePerson(); static HtmlFormSchema getHtmlFormSchema(HtmlForm htmlForm, FormEntryContext.Mode mode); static Date combineDateAndTime(Date date, Date time); static Date startOfDay(Date d); static Drug getDrug(String uuid); static Concept getConcept(String id); static Concept getConcept(String id, String errorMessageIfNotFound); static Location getLocation(String id); static Location getLocation(String id, FormEntryContext context); static Program getProgram(String id); static Person getPerson(String id); static PatientIdentifierType getPatientIdentifierType(String id); static ProgramWorkflow getWorkflow(Integer id); @SuppressWarnings("deprecation") static ProgramWorkflow getWorkflow(String identifier); static ProgramWorkflowState getState(String identifier, Program program); static ProgramWorkflowState getState(String identifier, ProgramWorkflow workflow); static List<Location> getLocationsByTags(String attributeName, Map<String, String> parameters); static LocationTag getLocationTag(String identifier); static Location getFirstAncestorWithTag(Location location, LocationTag locationTag); @SuppressWarnings("deprecation") static ProgramWorkflowState getState(String identifier); static boolean isValidUuidFormat(String uuid); static List<PatientIdentifierType> getPatientIdentifierTypes(); static void voidEncounter(Encounter e, HtmlForm htmlform, String voidReason); static void voidEncounterByHtmlFormSchema(Encounter e, HtmlForm htmlform, String voidReason); static Date translateDatetimeParam(String value, String format); static PatientProgram getPatientProgramByProgram(List<PatientProgram> patientPrograms, Program program); static PatientProgram getPatientProgramByWorkflow(Patient patient, ProgramWorkflow workflow); static PatientProgram getPatientProgramByProgramOnDate(Patient patient, Program program, Date date); @SuppressWarnings("rawtypes") static boolean hasProvider(Encounter e); static boolean isEnrolledInProgramOnDate(Patient patient, Program program, Date date); static PatientProgram getClosestFutureProgramEnrollment(Patient patient, Program program, Date date); static Date clearTimeComponent(Date date); static String toCamelCase(String s); static EncounterType getEncounterType(String id); static EncounterRole getEncounterRole(String id); static void removeEmptyObs(Collection<Obs> obsList); static String format(OpenmrsMetadata md); static String format(OpenmrsMetadata md, Locale locale); static String getTestStr(String teststr); static String getArchiveDirPath(); static Object getProviderRole(String id); static List<Provider> getProviders(List<String> providerRoleIds, boolean returnAllIfNoRolesSpecified); static List<Provider> getAllProviders(); static void transitionToState(Patient patient, PatientProgram patientProgram, ProgramWorkflowState state,
	        Encounter encounter); static List<Provider> getProviders(List<ProviderRole> providerRoles); static Provider getProvider(String id); static String getFullNameWithFamilyNameFirst(PersonName personName); static List<ProviderStub> getProviderStubs(Collection<Provider> providers); static List<ProviderStub> getProviderStubs(Collection<Provider> providers, String searchParam, MatchMode mode); static Log log; }