use of eu.europa.ec.fisheries.schema.exchange.module.v1.SendSalesReportRequest in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventIncomingServiceBean method sendSalesReport.
@Override
public void sendSalesReport(@Observes @SendSalesReportEvent ExchangeMessageEvent message) {
try {
SendSalesReportRequest request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), SendSalesReportRequest.class);
ExchangeLogStatusTypeType validationStatus = request.getValidationStatus();
exchangeLog.log(request, LogType.SEND_SALES_REPORT, validationStatus, TypeRefType.SALES_REPORT, request.getReport(), false);
if (validationStatus == ExchangeLogStatusTypeType.SUCCESSFUL || validationStatus == ExchangeLogStatusTypeType.SUCCESSFUL_WITH_WARNINGS) {
eu.europa.ec.fisheries.schema.exchange.plugin.v1.SendSalesReportRequest pluginRequest = new eu.europa.ec.fisheries.schema.exchange.plugin.v1.SendSalesReportRequest();
pluginRequest.setRecipient(request.getSenderOrReceiver());
pluginRequest.setReport(request.getReport());
if (request.getSenderOrReceiver() != null) {
pluginRequest.setSenderOrReceiver(request.getSenderOrReceiver());
}
pluginRequest.setMethod(ExchangePluginMethod.SEND_SALES_RESPONSE);
exchangeEventOutgoingService.sendSalesReportToFLUX(pluginRequest);
} else {
log.error("Received invalid report from the Sales module: " + request.getReport());
}
} catch (ExchangeModelMarshallException | ExchangeMessageException e) {
fireExchangeFault(message, "Error when sending a Sales response to FLUX", e);
} catch (ExchangeLogException e) {
fireExchangeFault(message, "Could not log the outgoing sales report.", e);
}
}
Aggregations