Search in sources :

Example 1 with FACatchSummaryReportResponse

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportResponse 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;
}
Also used : FACatchSummaryHelper(eu.europa.ec.fisheries.ers.service.facatch.FACatchSummaryHelper) FACatchSummaryDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryDTO) FACatchSummaryReportResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportResponse)

Example 2 with FACatchSummaryReportResponse

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportResponse in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEventServiceBean method getFACatchSummaryReport.

@Override
public void getFACatchSummaryReport(@Observes @GetFACatchSummaryReportEvent EventMessage message) {
    log.info(GOT_JMS_INSIDE_ACTIVITY_TO_GET + "FACatchSummaryReport:");
    try {
        log.debug("JMS Incoming text message: {}", message.getJmsMessage().getText());
        FACatchSummaryReportRequest baseRequest = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), FACatchSummaryReportRequest.class);
        FACatchSummaryReportResponse faCatchSummaryReportResponse = faCatchReportService.getFACatchSummaryReportResponse(FishingActivityRequestMapper.buildFishingActivityQueryFromRequest(baseRequest));
        String response = JAXBMarshaller.marshallJaxBObjectToString(faCatchSummaryReportResponse);
        producer.sendResponseMessageToSender(message.getJmsMessage(), response);
    } catch (ActivityModelMarshallException | JMSException | ServiceException | MessageException e) {
        sendError(message, e);
    }
}
Also used : ActivityModelMarshallException(eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException) ServiceException(eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException) MessageException(eu.europa.ec.fisheries.uvms.commons.message.api.MessageException) FACatchSummaryReportRequest(eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportRequest) JMSException(javax.jms.JMSException) FACatchSummaryReportResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportResponse)

Example 3 with FACatchSummaryReportResponse

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportResponse in project UVMS-ActivityModule-APP by UnionVMS.

the class FACatchResource method getFACatchSummaryReport.

@POST
@Path("/summary")
@Consumes(value = { MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Interceptors(ActivityExceptionInterceptor.class)
@IUserRoleInterceptor(requiredUserRole = { ActivityFeaturesEnum.LIST_ACTIVITY_REPORTS })
public Response getFACatchSummaryReport(@Context HttpServletRequest request, @HeaderParam("scopeName") String scopeName, @HeaderParam("roleName") String roleName, FishingActivityQuery fishingActivityQuery) throws ServiceException {
    log.info("Query Received to getFACatchSummaryReport. " + fishingActivityQuery);
    if (fishingActivityQuery == null) {
        return createErrorResponse("Query to find list is null.");
    }
    FACatchSummaryReportResponse faCatchSummaryReportResponse = reportService.getFACatchSummaryReportResponse(fishingActivityQuery);
    log.info("Successfully processed");
    return createSuccessResponse(faCatchSummaryReportResponse);
}
Also used : FACatchSummaryReportResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportResponse) Path(javax.ws.rs.Path) Interceptors(javax.interceptor.Interceptors) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) IUserRoleInterceptor(eu.europa.ec.fisheries.uvms.activity.rest.IUserRoleInterceptor)

Aggregations

FACatchSummaryReportResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportResponse)3 FACatchSummaryDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.summary.FACatchSummaryDTO)1 FACatchSummaryHelper (eu.europa.ec.fisheries.ers.service.facatch.FACatchSummaryHelper)1 ActivityModelMarshallException (eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException)1 FACatchSummaryReportRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportRequest)1 IUserRoleInterceptor (eu.europa.ec.fisheries.uvms.activity.rest.IUserRoleInterceptor)1 MessageException (eu.europa.ec.fisheries.uvms.commons.message.api.MessageException)1 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)1 Interceptors (javax.interceptor.Interceptors)1 JMSException (javax.jms.JMSException)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1