Search in sources :

Example 1 with PositionDto

use of eu.europa.ec.fisheries.ers.service.dto.view.PositionDto 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 2 with PositionDto

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

the class AreaDtoMapper method getTransmission.

protected PositionDto getTransmission(FishingActivityEntity faEntity) {
    if (faEntity == null) {
        return null;
    }
    PositionDto positionDto = new PositionDto();
    if (faEntity.getFaReportDocument() != null && faEntity.getFaReportDocument().getVesselTransportMeans() != null && CollectionUtils.isNotEmpty(faEntity.getFaReportDocument().getVesselTransportMeans()) && CollectionUtils.isNotEmpty(faEntity.getFaReportDocument().getVesselTransportMeans().iterator().next().getVesselPositionEvents())) {
        VesselPositionEventEntity vesselPositionEventEntity = faEntity.getFaReportDocument().getVesselTransportMeans().iterator().next().getVesselPositionEvents().iterator().next();
        positionDto.setOccurence(vesselPositionEventEntity.getObtainedOccurrenceDateTime());
        ;
        positionDto.setGeometry(extractGeometryWkt(vesselPositionEventEntity.getLongitude(), vesselPositionEventEntity.getLatitude()));
    } else if (faEntity.getFaReportDocument() != null) {
        positionDto.setOccurence(faEntity.getFaReportDocument().getAcceptedDatetime());
    }
    return positionDto;
}
Also used : PositionDto(eu.europa.ec.fisheries.ers.service.dto.view.PositionDto) VesselPositionEventEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselPositionEventEntity)

Aggregations

PositionDto (eu.europa.ec.fisheries.ers.service.dto.view.PositionDto)2 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)1 VesselPositionEventEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselPositionEventEntity)1 NotNull (javax.validation.constraints.NotNull)1