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;
}
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;
}
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);
}
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;
}
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);
}
Aggregations