use of eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryRecordDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class FACatchSummaryPresentationHelper method buildFACatchSummaryRecordDTOList.
/**
* Post process data received from database to create FACatchSummaryRecordDTO. Every record will have summary calculated for it.
*
* @param groupedMap
* @return List<FACatchSummaryRecordDTO> Processed records having summary data
*/
@Override
public List<FACatchSummaryRecordDTO> buildFACatchSummaryRecordDTOList(Map<FaCatchSummaryCustomProxy, List<FaCatchSummaryCustomProxy>> groupedMap) {
List<FACatchSummaryRecordDTO> faCatchSummaryRecordDTOs = new ArrayList<>();
for (Map.Entry<FaCatchSummaryCustomProxy, List<FaCatchSummaryCustomProxy>> entry : groupedMap.entrySet()) {
FaCatchSummaryCustomProxy customEntity = entry.getKey();
// We dont want Presentation to be part of group criteria. We want to display this information in summmary table so, remove it
customEntity.setPresentation(null);
FACatchSummaryRecordDTO faCatchSummaryDTO = FACatchSummaryMapper.INSTANCE.mapToFACatchSummaryRecordDTOWithPresentation(entry.getKey(), entry.getValue());
if (CollectionUtils.isEmpty(faCatchSummaryDTO.getGroups())) {
// Do not add record to the list if no data for grouping factors found
log.error("No data for the grouping factors found :" + faCatchSummaryDTO);
continue;
}
// If there is Group but no data for Summary table for the group, do not send it to frontend
if (faCatchSummaryDTO.getSummaryTable() == null || (faCatchSummaryDTO.getSummaryTable().getSummaryFaCatchType() == null && faCatchSummaryDTO.getSummaryTable().getSummaryFishSize() == null)) {
log.error("No data for the summary found :" + faCatchSummaryDTO);
continue;
}
faCatchSummaryRecordDTOs.add(faCatchSummaryDTO);
}
return faCatchSummaryRecordDTOs;
}
use of eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryRecordDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class FACatchSummaryReportHelper method buildFACatchSummaryRecordDTOList.
/**
* Post process data received from database to create FACatchSummaryRecordDTO. Every record will have summary calculated for it.
*
* @param groupedMap
* @return List<FACatchSummaryRecordDTO> Processed records having summary data
*/
@Override
public List<FACatchSummaryRecordDTO> buildFACatchSummaryRecordDTOList(Map<FaCatchSummaryCustomProxy, List<FaCatchSummaryCustomProxy>> groupedMap) {
List<FACatchSummaryRecordDTO> faCatchSummaryRecordDTOs = new ArrayList<>();
for (Map.Entry<FaCatchSummaryCustomProxy, List<FaCatchSummaryCustomProxy>> entry : groupedMap.entrySet()) {
FACatchSummaryRecordDTO faCatchSummaryDTO = FACatchSummaryMapper.INSTANCE.mapToFACatchSummaryRecordDTO(entry.getKey(), entry.getValue());
if (CollectionUtils.isEmpty(faCatchSummaryDTO.getGroups())) {
// Do not add record to the list if no data for grouping factors found
log.error("No data for the grouping factors found :" + faCatchSummaryDTO);
continue;
}
// If there is Group but no data for Summary table for the group, do not send it to frontend
if (faCatchSummaryDTO.getSummaryTable() == null || (faCatchSummaryDTO.getSummaryTable().getSummaryFaCatchType() == null && faCatchSummaryDTO.getSummaryTable().getSummaryFishSize() == null)) {
log.error("No data for the summary found :" + faCatchSummaryDTO);
continue;
}
faCatchSummaryRecordDTOs.add(faCatchSummaryDTO);
}
return faCatchSummaryRecordDTOs;
}
use of eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryRecordDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class FACatchSummaryHelper method populateSummaryTableWithTotal.
/**
* Creates Summary table structure for provided DTO list
* @param catchSummaryDTOList list of records to be processed to create summary structure
* @return
*/
public SummaryTableDTO populateSummaryTableWithTotal(List<FACatchSummaryRecordDTO> catchSummaryDTOList) {
SummaryTableDTO summaryTableWithTotals = new SummaryTableDTO();
for (FACatchSummaryRecordDTO faCatchSummaryDTO : catchSummaryDTOList) {
SummaryTableDTO summaryTable = faCatchSummaryDTO.getSummaryTable();
populateTotalFishSizeMap(summaryTableWithTotals, summaryTable);
populateTotalFaCatchMap(summaryTableWithTotals, summaryTable);
}
return summaryTableWithTotals;
}
use of eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryRecordDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class FACatchSummaryHelper method buildFACatchSummaryRecordList.
public List<FACatchSummaryRecord> buildFACatchSummaryRecordList(List<FACatchSummaryRecordDTO> catchSummaryDTOList) {
List<FACatchSummaryRecord> faCatchSummaryRecords = new ArrayList<>();
for (FACatchSummaryRecordDTO faCatchSummaryDTO : catchSummaryDTOList) {
FACatchSummaryRecord faCatchSummaryRecord = new FACatchSummaryRecord();
faCatchSummaryRecord.setGroups(faCatchSummaryDTO.getGroups());
faCatchSummaryRecord.setSummary(FACatchSummaryMapper.INSTANCE.mapToSummaryTable(faCatchSummaryDTO.getSummaryTable()));
faCatchSummaryRecords.add(faCatchSummaryRecord);
}
log.debug("List of FACatchSummaryRecord objects created");
return faCatchSummaryRecords;
}
use of eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryRecordDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class FaCatchReportServiceBean method getCatchSummaryReport.
/**
* This method groups FACatch Data, performs business logic to create summary report
* and creates FacatchSummaryDTO object as expected by web interface.
* isReporting : TRUE indicates that the method should be used to generate result for REPORTING module
* FALSE indicates that the method should be used to generate result from TRIP SUMMARY VIEW
* @param query
* @return
* @throws ServiceException
*/
@Override
public FACatchSummaryDTO getCatchSummaryReport(FishingActivityQuery query, boolean isLanding) throws ServiceException {
// get grouped data
Map<FaCatchSummaryCustomProxy, List<FaCatchSummaryCustomProxy>> groupedData = faCatchDao.getGroupedFaCatchData(query, isLanding);
// post process data to create Summary table part of Catch summary Report
FACatchSummaryHelper faCatchSummaryHelper = isLanding ? FACatchSummaryHelperFactory.getFACatchSummaryHelper(FACatchSummaryHelperFactory.PRESENTATION) : FACatchSummaryHelperFactory.getFACatchSummaryHelper(FACatchSummaryHelperFactory.STANDARD);
List<FACatchSummaryRecordDTO> catchSummaryList = faCatchSummaryHelper.buildFACatchSummaryRecordDTOList(groupedData);
// Post process data to calculate Totals for each column
SummaryTableDTO summaryTableDTOTotal = faCatchSummaryHelper.populateSummaryTableWithTotal(catchSummaryList);
// Create DTO object to send back to the web
FACatchSummaryDTO faCatchSummaryDTO = new FACatchSummaryDTO();
faCatchSummaryDTO.setRecordDTOs(catchSummaryList);
faCatchSummaryDTO.setTotal(summaryTableDTOTotal);
return faCatchSummaryDTO;
}
Aggregations