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