Search in sources :

Example 1 with NamePrefixType

use of gov.ca.cwds.cals.persistence.model.calsns.dictionaries.NamePrefixType in project cals-api by ca-cwds.

the class OtherAdultsInPlacementHomeMapper method afterMapping.

@AfterMapping
default void afterMapping(@MappingTarget OtherAdultsInPlacementHome target, OtherAdultDTO otherAdultDTO) {
    StringBuilder nameBuilder = new StringBuilder();
    NamePrefixType namePrefix = otherAdultDTO.getNamePrefix();
    if (namePrefix != null) {
        nameBuilder.append(namePrefix.getValue());
    }
    String firstName = otherAdultDTO.getFirstName();
    if (StringUtils.isNoneEmpty(firstName)) {
        nameBuilder.append(' ').append(firstName);
    }
    String middleName = otherAdultDTO.getMiddleName();
    if (StringUtils.isNoneEmpty(middleName)) {
        nameBuilder.append(' ').append(middleName);
    }
    String lastName = otherAdultDTO.getLastName();
    if (StringUtils.isNoneEmpty(lastName)) {
        nameBuilder.append(' ').append(lastName);
    }
    NameSuffixType nameSuffix = otherAdultDTO.getNameSuffix();
    if (nameSuffix != null) {
        nameBuilder.append(' ').append(nameSuffix.getValue());
    }
    target.setOthAdltnm(nameBuilder.toString());
}
Also used : NamePrefixType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.NamePrefixType) NameSuffixType(gov.ca.cwds.cals.persistence.model.calsns.dictionaries.NameSuffixType) AfterMapping(org.mapstruct.AfterMapping)

Aggregations

NamePrefixType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.NamePrefixType)1 NameSuffixType (gov.ca.cwds.cals.persistence.model.calsns.dictionaries.NameSuffixType)1 AfterMapping (org.mapstruct.AfterMapping)1