use of eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class FaCatchReportServiceBeanTest method testGetCatchSummaryReport.
@Test
@SneakyThrows
public void testGetCatchSummaryReport() throws ServiceException {
FishingActivityQuery query = new FishingActivityQuery();
List<GroupCriteria> groupByFields = new ArrayList<>();
groupByFields.add(GroupCriteria.DATE_DAY);
groupByFields.add(GroupCriteria.FAO_AREA);
groupByFields.add(GroupCriteria.TERRITORY);
groupByFields.add(GroupCriteria.EFFORT_ZONE);
groupByFields.add(GroupCriteria.GFCM_GSA);
groupByFields.add(GroupCriteria.GFCM_STAT_RECTANGLE);
groupByFields.add(GroupCriteria.ICES_STAT_RECTANGLE);
groupByFields.add(GroupCriteria.RFMO);
groupByFields.add(GroupCriteria.SPECIES);
query.setGroupByFields(groupByFields);
Map<SearchFilter, String> searchCriteriaMap = new EnumMap<SearchFilter, String>(SearchFilter.class);
searchCriteriaMap.put(SearchFilter.TRIP_ID, "NOR-TRP-20160517234053706");
query.setSearchCriteriaMap(searchCriteriaMap);
Map<FaCatchSummaryCustomProxy, List<FaCatchSummaryCustomProxy>> groupedData = MapperUtil.getGroupedFaCatchSummaryCustomEntityData();
when((faCatchDao).getGroupedFaCatchData(any(FishingActivityQuery.class), any(Boolean.class))).thenReturn(groupedData);
// when(faCatchDao.getGroupedFaCatchData(query,true)).thenReturn(MapperUtil.getGroupedFaCatchSummaryCustomEntityData());
// when(vesselIdentifiersDao.getLatestVesselIdByTrip("NOR-TRP-20160517234053706")).thenReturn(MapperUtil.getVesselIdentifiersList());
// Trigger
FACatchSummaryDTO fACatchSummaryDTO = faCatchReportService.getCatchSummaryReport(query, false);
Mockito.verify(faCatchDao, Mockito.times(1)).getGroupedFaCatchData(Mockito.any(FishingActivityQuery.class), Mockito.any(Boolean.class));
// Verify
assertNotNull(fACatchSummaryDTO);
}
use of eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class FaCatchReportServiceBean method getFACatchSummaryReportResponse.
/**
* This method is used to create Catch Details page from Run Report.
* So, To display summary of catches, we need to consider all fishing Activity filters as well as aggregation factors specified by user .
* Aggregation factors could be dynamically selected by user like veesel,period,area etc.
* @param query
* @return
* @throws ServiceException
*/
@Override
public FACatchSummaryReportResponse getFACatchSummaryReportResponse(FishingActivityQuery query) throws ServiceException {
log.debug("FACatchSummaryReportResponse creation starts");
// get processed information in the form of DTO
FACatchSummaryDTO faCatchSummaryDTO = getCatchSummaryReport(query, false);
log.debug("FACatchSummaryDTO created");
// We can not transfter DTO as it is over JMS because of JAVA maps.so, Map DTO to the type transferrable over JMS
FACatchSummaryHelper faCatchSummaryHelper = FACatchSummaryHelperFactory.getFACatchSummaryHelper(FACatchSummaryHelperFactory.STANDARD);
// Create response object for JMS
FACatchSummaryReportResponse faCatchSummaryReportResponse = new FACatchSummaryReportResponse();
faCatchSummaryReportResponse.setSummaryRecords(faCatchSummaryHelper.buildFACatchSummaryRecordList(faCatchSummaryDTO.getRecordDTOs()));
faCatchSummaryReportResponse.setTotal(FACatchSummaryMapper.INSTANCE.mapToSummaryTable(faCatchSummaryDTO.getTotal()));
log.debug("SummaryTable XML Schema response---->" + FACatchSummaryHelper.printJsonstructure(faCatchSummaryReportResponse));
return faCatchSummaryReportResponse;
}
use of eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryDTO 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