Search in sources :

Example 1 with ReportDTO

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

the class FishingTripServiceBean method getFishingTripSummaryAndReports.

@Override
public FishingTripSummaryViewDTO getFishingTripSummaryAndReports(String fishingTripId, List<Dataset> datasets) throws ServiceException {
    List<ReportDTO> reportDTOList = new ArrayList<>();
    Geometry multipolygon = getRestrictedAreaGeom(datasets);
    Map<String, FishingActivityTypeDTO> summary = populateFishingActivityReportListAndFishingTripSummary(fishingTripId, reportDTOList, multipolygon, false);
    return populateFishingTripSummary(fishingTripId, reportDTOList, summary);
}
Also used : FishingTripIdWithGeometry(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripIdWithGeometry) Geometry(com.vividsolutions.jts.geom.Geometry) FishingActivityTypeDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.FishingActivityTypeDTO) ArrayList(java.util.ArrayList) ReportDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.ReportDTO)

Example 2 with ReportDTO

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

the class FishingTripServiceBean method populateFishingActivityReportListAndFishingTripSummary.

/**
 * @param fishingTripId     - Fishing trip summary will be collected for this tripID
 * @param reportDTOList     - This DTO will have details about Fishing Activities.Method will process and populate data into this list     *
 * @param multipolygon      - Activities only in this area would be selected
 * @param isOnlyTripSummary - This method you could reuse to only get Fishing trip summary as well
 * @throws ServiceException
 */
@Override
public Map<String, FishingActivityTypeDTO> populateFishingActivityReportListAndFishingTripSummary(String fishingTripId, List<ReportDTO> reportDTOList, Geometry multipolygon, boolean isOnlyTripSummary) throws ServiceException {
    List<FishingActivityEntity> fishingActivityList = fishingActivityDao.getFishingActivityListForFishingTrip(fishingTripId, multipolygon);
    if (CollectionUtils.isEmpty(fishingActivityList)) {
        return Collections.emptyMap();
    }
    Map<String, FishingActivityTypeDTO> tripSummary = new HashMap<>();
    for (FishingActivityEntity activityEntity : fishingActivityList) {
        if (!isOnlyTripSummary) {
            ReportDTO reportDTO = FishingActivityMapper.INSTANCE.mapToReportDTO(activityEntity);
            reportDTOList.add(reportDTO);
        }
        if (activityEntity != null && activityEntity.getFaReportDocument() != null && ActivityConstants.DECLARATION.equalsIgnoreCase(activityEntity.getFaReportDocument().getTypeCode())) {
            // FA Report should be of type Declaration. And Fishing Activity type should be Either Departure,Arrival or Landing
            populateFishingTripSummary(activityEntity, tripSummary);
        }
    }
    return tripSummary;
}
Also used : FishingActivityTypeDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.FishingActivityTypeDTO) HashMap(java.util.HashMap) ReportDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.ReportDTO) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Aggregations

FishingActivityTypeDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.FishingActivityTypeDTO)2 ReportDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.ReportDTO)2 Geometry (com.vividsolutions.jts.geom.Geometry)1 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FishingTripIdWithGeometry (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripIdWithGeometry)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1