use of oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonNameType in project ddf by codice.
the class PersonNameTypeConverterTest method testConvertFullName.
@Test
public void testConvertFullName() throws Exception {
PersonNameTypeConverter pntConverter = new PersonNameTypeConverter();
Optional<PersonNameType> optionalPersonName = pntConverter.convert(personMap);
assertThat(optionalPersonName, notNullValue());
assertThat(optionalPersonName.isPresent(), is(true));
PersonNameType personName = optionalPersonName.get();
assertThat(personName, notNullValue());
assertThat(personName.getFirstName(), is(equalTo(FIRST_NAME)));
assertThat(personName.getMiddleName(), is(equalTo(MIDDLE_NAME)));
assertThat(personName.getLastName(), is(equalTo(LAST_NAME)));
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonNameType in project ddf by codice.
the class RegistryPackageWebConverterTest method getPersonName.
private PersonNameType getPersonName(String firstName, String lastname, String middleName) {
PersonNameType personName = RIM_FACTORY.createPersonNameType();
personName.setFirstName(firstName);
personName.setLastName(lastname);
personName.setMiddleName(middleName);
return personName;
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonNameType in project ddf by codice.
the class RegistryPackageConverter method parseRegistryPerson.
private static void parseRegistryPerson(PersonType person, MetacardImpl metacard) throws RegistryConversionException {
validateIdentifiable(person);
String name = "no name";
String phone = "no telephone number";
String email = "no email address";
if (person.isSetPersonName()) {
PersonNameType personName = person.getPersonName();
List<String> nameParts = new ArrayList<>();
if (StringUtils.isNotBlank(personName.getFirstName())) {
nameParts.add(personName.getFirstName());
}
if (StringUtils.isNotBlank(personName.getLastName())) {
nameParts.add(personName.getLastName());
}
if (CollectionUtils.isNotEmpty(nameParts)) {
name = String.join(" ", nameParts);
}
}
if (person.isSetTelephoneNumber()) {
List<TelephoneNumberType> phoneNumbers = person.getTelephoneNumber();
if (CollectionUtils.isNotEmpty(phoneNumbers)) {
phone = getPhoneNumber(phoneNumbers.get(0));
}
}
if (person.isSetEmailAddress()) {
List<EmailAddressType> emailAddresses = person.getEmailAddress();
if (CollectionUtils.isNotEmpty(emailAddresses)) {
EmailAddressType emailAddress = emailAddresses.get(0);
if (StringUtils.isNotBlank(emailAddress.getAddress())) {
email = emailAddress.getAddress();
}
}
}
String metacardPoc = String.format("%s, %s, %s", name, phone, email);
metacard.setAttribute(Metacard.POINT_OF_CONTACT, metacardPoc);
}
Aggregations