Search in sources :

Example 1 with DestinationLocationDto

use of eu.europa.ec.fisheries.ers.service.dto.facatch.DestinationLocationDto in project UVMS-ActivityModule-APP by UnionVMS.

the class FaCatchesProcessorMapper method fillSpecifiedAndDestinationLocationsInGroupDetails.

/**
 * Fills the locations on FaCatchGroupDetailsDto DTO.
 *
 * @param fluxLocations
 * @param groupDetailsDto
 */
private static void fillSpecifiedAndDestinationLocationsInGroupDetails(Set<FluxLocationEntity> fluxLocations, FaCatchGroupDetailsDto groupDetailsDto) {
    if (CollectionUtils.isEmpty(fluxLocations)) {
        return;
    }
    List<DestinationLocationDto> destLocDtoList = groupDetailsDto.getDestinationLocation();
    List<FluxLocationDto> specifiedFluxLocDto = groupDetailsDto.getSpecifiedFluxLocations();
    for (FluxLocationEntity actLoc : fluxLocations) {
        String fluxLocationType = actLoc.getFluxLocationType();
        if (StringUtils.equals(fluxLocationType, FluxLocationCatchTypeEnum.FA_CATCH_DESTINATION.getType())) {
            destLocDtoList.add(new DestinationLocationDto(actLoc.getFluxLocationIdentifier(), actLoc.getCountryId(), actLoc.getName()));
        } else if (StringUtils.equals(fluxLocationType, FluxLocationCatchTypeEnum.FA_CATCH_SPECIFIED.getType())) {
            specifiedFluxLocDto.add(FluxLocationMapper.INSTANCE.mapEntityToFluxLocationDto(actLoc));
        }
    }
    groupDetailsDto.setDestinationLocation(destLocDtoList);
    groupDetailsDto.setSpecifiedFluxLocations(specifiedFluxLocDto);
}
Also used : DestinationLocationDto(eu.europa.ec.fisheries.ers.service.dto.facatch.DestinationLocationDto) FluxLocationDto(eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)

Aggregations

FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)1 DestinationLocationDto (eu.europa.ec.fisheries.ers.service.dto.facatch.DestinationLocationDto)1 FluxLocationDto (eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto)1