use of gov.ca.cwds.cals.service.dto.FacilityAddressDTO in project cals-api by ca-cwds.
the class FacilityMapper method afterAddresses.
default void afterAddresses(@MappingTarget FacilityDTO facilityDTO, BasePlacementHome placementHome, CwsDictionaryEntriesHolder dictionaryEntriesHolder) {
List<FacilityAddressDTO> facilityAddressDTOs = new ArrayList<>(2);
FacilityAddressMapper facilityAddressMapper = Mappers.getMapper(FacilityAddressMapper.class);
if (!StringUtils.isAllBlank(placementHome.getStreetNo(), placementHome.getStreetNm(), placementHome.getCityNm(), placementHome.getZipNo(), placementHome.getZipSfxNo())) {
FacilityAddressDTO residentialAddress = facilityAddressMapper.toResidentialAddress(placementHome, dictionaryEntriesHolder);
facilityAddressMapper.afterMapping(residentialAddress, placementHome, dictionaryEntriesHolder);
facilityAddressDTOs.add(residentialAddress);
}
if (!StringUtils.isAllBlank(placementHome.getPstreetNo(), placementHome.getPstreetNm(), placementHome.getpCityNm(), placementHome.getpZipNo(), placementHome.getPyZipSfx())) {
FacilityAddressDTO mailingAddress = facilityAddressMapper.toMailAddress(placementHome, dictionaryEntriesHolder);
facilityAddressMapper.afterMapping(mailingAddress, placementHome, dictionaryEntriesHolder);
facilityAddressDTOs.add(mailingAddress);
}
facilityDTO.setAddress(facilityAddressDTOs);
}
use of gov.ca.cwds.cals.service.dto.FacilityAddressDTO in project cals-api by ca-cwds.
the class FacilityPostMappingProcessor method mapAddresses.
private void mapAddresses(LisFacFile lisFacFile, FacilityDTO facilityDTO) {
List<FacilityAddressDTO> addresses = new ArrayList<>(2);
if (Utils.Address.checkIfLisResidentialAddressIsValid(lisFacFile)) {
FacilityAddressDTO residentialAddress = RESIDENTIAL_ADDRESS_MAPPER.lisFacilityToFacilityAddressDTO(lisFacFile);
addresses.add(residentialAddress);
}
if (Utils.Address.checkIfLisMailAddressIsValid(lisFacFile)) {
FacilityAddressDTO mailAddress = MAIL_ADDRESS_MAPPER.lisFacilityToFacilityAddressDTO(lisFacFile);
addresses.add(mailAddress);
}
facilityDTO.setAddress(addresses);
}
use of gov.ca.cwds.cals.service.dto.FacilityAddressDTO in project cals-api by ca-cwds.
the class FacilityAddressMapper method afterMapping.
@AfterMapping
default void afterMapping(@TargetType FacilityAddressDTO facilityAddressDTO, BasePlacementHome placementHome, CwsDictionaryEntriesHolder dictionaryEntriesHolder) {
AddressMapper addressMapper = Mappers.getMapper(AddressMapper.class);
AddressDTO addressDTO = null;
if (RESIDENTIAL.equals(facilityAddressDTO.getType())) {
addressDTO = addressMapper.toResidentialAddressDTO(placementHome, dictionaryEntriesHolder);
}
if (MAIL.equals(facilityAddressDTO.getType())) {
addressDTO = addressMapper.toMailAddressDTO(placementHome, dictionaryEntriesHolder);
}
facilityAddressDTO.setAddress(addressDTO);
}
Aggregations