Search in sources :

Example 1 with VesselPositionEventEntity

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

Example 2 with VesselPositionEventEntity

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

the class VesselTransportMeansMapper method getVesselPositionEventEntities.

protected Set<VesselPositionEventEntity> getVesselPositionEventEntities(List<VesselPositionEvent> specifiedVesselPositionEvents, VesselTransportMeansEntity vesselTransportMeansEntity) {
    if (specifiedVesselPositionEvents == null || specifiedVesselPositionEvents.isEmpty()) {
        return Collections.emptySet();
    }
    Set<VesselPositionEventEntity> vesselPositionEventEntities = new HashSet<>();
    for (VesselPositionEvent vesselPositionEvent : specifiedVesselPositionEvents) {
        VesselPositionEventEntity entity = VesselPositionEventMapper.INSTANCE.mapToVesselPositionEventEntity(vesselPositionEvent, vesselTransportMeansEntity);
        Geometry point = GeometryUtils.createPoint(entity.getLongitude(), entity.getLatitude());
        entity.setGeom(point);
        vesselPositionEventEntities.add(entity);
    }
    return vesselPositionEventEntities;
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) VesselPositionEvent(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselPositionEvent) VesselPositionEventEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselPositionEventEntity) HashSet(java.util.HashSet)

Aggregations

VesselPositionEventEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselPositionEventEntity)2 Geometry (com.vividsolutions.jts.geom.Geometry)1 PositionDto (eu.europa.ec.fisheries.ers.service.dto.view.PositionDto)1 HashSet (java.util.HashSet)1 VesselPositionEvent (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselPositionEvent)1