Search in sources :

Example 6 with FluxLocationEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingActivityMapper method getFluxLocationEntities.

protected Set<FluxLocationEntity> getFluxLocationEntities(List<FLUXLocation> fluxLocations, FishingActivityEntity fishingActivityEntity) {
    if (fluxLocations == null || fluxLocations.isEmpty()) {
        return Collections.emptySet();
    }
    Set<FluxLocationEntity> fluxLocationEntities = new HashSet<>();
    for (FLUXLocation fluxLocation : fluxLocations) {
        FluxLocationEntity fluxLocationEntity = FluxLocationMapper.INSTANCE.mapToFluxLocationEntity(fluxLocation);
        fluxLocationEntity.setFluxLocationType(FluxLocationCatchTypeEnum.FA_RELATED.getType());
        fluxLocationEntity.setFishingActivity(fishingActivityEntity);
        fluxLocationEntities.add(fluxLocationEntity);
    }
    return fluxLocationEntities;
}
Also used : FLUXLocation(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) HashSet(java.util.HashSet)

Example 7 with FluxLocationEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class BaseMapper method extractPositionDtoFromFishingActivity.

@NotNull
protected PositionDto extractPositionDtoFromFishingActivity(FishingActivityEntity faEntity) {
    if (faEntity == null) {
        return null;
    }
    PositionDto positionDto = new PositionDto();
    positionDto.setOccurence(faEntity.getOccurence());
    if (CollectionUtils.isNotEmpty(faEntity.getFluxLocations())) {
        FluxLocationEntity locationEntity = extractFLUXPosition(faEntity.getFluxLocations());
        if (locationEntity != null && locationEntity.getGeom() != null) {
            positionDto.setGeometry(GeometryMapper.INSTANCE.geometryToWkt(locationEntity.getGeom()).getValue());
        }
    }
    return positionDto;
}
Also used : PositionDto(eu.europa.ec.fisheries.ers.service.dto.view.PositionDto) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) NotNull(javax.validation.constraints.NotNull)

Example 8 with FluxLocationEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity 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)

Example 9 with FluxLocationEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class GearProblemMapper method mapToFluxLocations.

protected Set<FluxLocationEntity> mapToFluxLocations(List<FLUXLocation> flLocList, GearProblemEntity gearProbEntity) {
    if (CollectionUtils.isEmpty(flLocList)) {
        return Collections.emptySet();
    }
    Set<FluxLocationEntity> entitiesSet = new HashSet<>();
    for (FLUXLocation flLocAct : flLocList) {
        FluxLocationEntity fluxLocationEntity = FluxLocationMapper.INSTANCE.mapToFluxLocationEntity(flLocAct);
        fluxLocationEntity.setFluxLocationType(FluxLocationCatchTypeEnum.GEAR_PROBLEM.getType());
        fluxLocationEntity.setGearProblem(gearProbEntity);
        FluxLocationMapper.INSTANCE.mapToFluxLocationEntity(flLocAct);
        entitiesSet.add(FluxLocationMapper.INSTANCE.mapToFluxLocationEntity(flLocAct));
    }
    return entitiesSet;
}
Also used : FLUXLocation(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) HashSet(java.util.HashSet)

Example 10 with FluxLocationEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingActivityMapper method getAreasForFishingActivity.

protected List<String> getAreasForFishingActivity(FishingActivityEntity entity) {
    if (entity == null || entity.getFluxLocations() == null) {
        return Collections.emptyList();
    }
    Set<String> areas = new HashSet<>();
    Set<FluxLocationEntity> fluxLocations = entity.getFluxLocations();
    for (FluxLocationEntity location : fluxLocations) {
        if (LOCATION_AREA.equalsIgnoreCase(location.getTypeCode())) {
            areas.add(location.getFluxLocationIdentifier());
        }
    }
    areas.remove(null);
    return new ArrayList<>(areas);
}
Also used : ArrayList(java.util.ArrayList) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) HashSet(java.util.HashSet)

Aggregations

FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)16 Test (org.junit.Test)7 HashSet (java.util.HashSet)5 FLUXLocation (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation)5 FluxLocationDto (eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto)4 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)3 ArrayList (java.util.ArrayList)3 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)2 FishingGearEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity)2 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)2 FluxCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)2 BaseUnitilsTest (eu.europa.ec.fisheries.uvms.BaseUnitilsTest)2 Geometry (com.vividsolutions.jts.geom.Geometry)1 AapProcessEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity)1 AapStockEntity (eu.europa.ec.fisheries.ers.fa.entities.AapStockEntity)1 DelimitedPeriodEntity (eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity)1 FishingActivityIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)1 StructuredAddressEntity (eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity)1 FluxLocationCatchTypeEnum (eu.europa.ec.fisheries.ers.fa.utils.FluxLocationCatchTypeEnum)1 DestinationLocationDto (eu.europa.ec.fisheries.ers.service.dto.facatch.DestinationLocationDto)1