Search in sources :

Example 1 with FacilityAddressDTO

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);
}
Also used : FacilityAddressDTO(gov.ca.cwds.cals.service.dto.FacilityAddressDTO) ArrayList(java.util.ArrayList)

Example 2 with FacilityAddressDTO

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);
}
Also used : FacilityAddressDTO(gov.ca.cwds.cals.service.dto.FacilityAddressDTO) ArrayList(java.util.ArrayList)

Example 3 with FacilityAddressDTO

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);
}
Also used : FacilityAddressDTO(gov.ca.cwds.cals.service.dto.FacilityAddressDTO) AddressDTO(gov.ca.cwds.cals.service.dto.AddressDTO) AfterMapping(org.mapstruct.AfterMapping)

Aggregations

FacilityAddressDTO (gov.ca.cwds.cals.service.dto.FacilityAddressDTO)3 ArrayList (java.util.ArrayList)2 AddressDTO (gov.ca.cwds.cals.service.dto.AddressDTO)1 AfterMapping (org.mapstruct.AfterMapping)1