/** * Create HumanNameDataType from KeyPersonInfo object * * @param keyPerson KeyPersonInfo * @return HumanNameDataType corresponding to the KeyPersonInfo object */ public HumanNameDataType getHumanNameDataType(KeyPersonInfo keyPerson) { HumanNameDataType humanName = HumanNameDataType.Factory.newInstance(); if (keyPerson != null) { humanName.setFirstName(keyPerson.getFirstName()); humanName.setLastName(keyPerson.getLastName()); String middleName = keyPerson.getMiddleName(); if (middleName != null && !middleName.equals("")) { humanName.setMiddleName(middleName); } } return humanName; }
/** * Create a HumanNameDataType from Rolodex object * * @param rolodex Rolodex object * @return HumanNameDataType corresponding to the rolodex object. */ public HumanNameDataType getHumanNameDataType(Rolodex rolodex) { HumanNameDataType humanName = HumanNameDataType.Factory.newInstance(); if (rolodex != null) { humanName.setFirstName(rolodex.getFirstName()); humanName.setLastName(rolodex.getLastName()); String middleName = rolodex.getMiddleName(); if (middleName != null && !middleName.equals("")) { humanName.setMiddleName(middleName); } } return humanName; }
/** * Create HumanNameDataType from DepartmentalPerson object * * @param person DepartmentalPerson * @return HumanNameDataType corresponding to the DepartmentalPerson object */ public HumanNameDataType getHumanNameDataType(DepartmentalPerson person) { HumanNameDataType humanName = HumanNameDataType.Factory.newInstance(); if (person != null) { humanName.setFirstName(person.getFirstName()); humanName.setLastName(person.getLastName()); String middleName = person.getMiddleName(); if (middleName != null && !middleName.equals("")) { humanName.setMiddleName(middleName); } } return humanName; }
/** * Create HumanNameDataType from explanation string. The string is expected to be comma separated * values of firstname, lastname, in order. * * @param explanation Comma separated string of first name and last name * @return HumanNameDataType created from the string explanation */ public HumanNameDataType getHumanNameDataType(String explanation) { HumanNameDataType humanNameDataType = HumanNameDataType.Factory.newInstance(); String firstName = null; String lastName = null; String formerName = explanation; if (formerName != null) { int commaPos = formerName.indexOf(","); if (commaPos > 0) { lastName = formerName.substring(0, commaPos); firstName = formerName.substring(commaPos + 1); } else { lastName = formerName; } } humanNameDataType.setLastName(lastName); humanNameDataType.setFirstName(firstName); return humanNameDataType; }