use of eu.europa.ec.fisheries.uvms.activity.model.schemas.SetFLUXFAReportOrQueryMessageRequest in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEventServiceBean method getFishingActivityMessage.
@Override
public void getFishingActivityMessage(@Observes @ReceiveFishingActivityRequestEvent EventMessage eventMessage) {
log.info(GOT_JMS_INSIDE_ACTIVITY_TO_GET + "SetFLUXFAReportOrQueryMessageRequest");
try {
TextMessage jmsMessage = eventMessage.getJmsMessage();
SetFLUXFAReportOrQueryMessageRequest request = JAXBMarshaller.unmarshallTextMessage(jmsMessage, SetFLUXFAReportOrQueryMessageRequest.class);
log.info("SetFLUXFAReportOrQueryMessageRequest unmarshalled");
if (request == null) {
log.error("Unmarshalled SetFLUXFAReportOrQueryMessageRequest is null. Something went wrong during jms comm?!");
return;
}
switch(eventMessage.getMethod()) {
case GET_FLUX_FA_REPORT:
FLUXFAReportMessage fluxFAReportMessage = JAXBMarshaller.unmarshallTextMessage(request.getRequest(), FLUXFAReportMessage.class);
deleteDuplicatedReportsFromXMLDocument(fluxFAReportMessage);
if (CollectionUtils.isNotEmpty(fluxFAReportMessage.getFAReportDocuments())) {
fluxMessageService.saveFishingActivityReportDocuments(fluxFAReportMessage, extractPluginType(request.getPluginType()));
} else {
log.error("[ERROR] After checking faReportDocuments IDs, all of them exist already in Activity DB.. So nothing will be saved!!");
}
break;
case GET_FLUX_FA_QUERY:
log.error("TODO : FAQUERY mappers NOT implemented yet....");
FLUXFAQueryMessage fluxFAQueryMessage = JAXBMarshaller.unmarshallTextMessage(request.getRequest(), FLUXFAQueryMessage.class);
// TODO : Implement me... Map tp real HQl/SQL query and run the query and map the results to FLUXFAReportMessage and send it to
FLUXFAReportMessage faRepQueryResponseAfterMapping = new FLUXFAReportMessage();
activityRulesModuleServiceBean.sendSyncAsyncFaReportToRules(faRepQueryResponseAfterMapping, "getTheOnValueFromSomewahre", request.getRequestType(), jmsMessage.getJMSMessageID());
break;
}
} catch (ActivityModelMarshallException | ServiceException | ActivityModuleException | JMSException e) {
sendError(eventMessage, e);
}
}
Aggregations