use of eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventIncomingServiceBean method handleSetPollStatusAcknowledge.
private void handleSetPollStatusAcknowledge(ExchangePluginMethod method, String serviceClassName, AcknowledgeType ack) {
log.debug(method + " was acknowledged in " + serviceClassName);
try {
PollStatus updatedLog = exchangeLog.setPollStatus(ack.getMessageId(), ack.getPollStatus().getPollId(), ack.getPollStatus().getStatus(), serviceClassName);
// Long polling
pollEvent.fire(new NotificationMessage("guid", updatedLog.getPollGuid()));
} catch (ExchangeLogException e) {
log.error(e.getMessage());
}
}
use of eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventIncomingServiceBean method handleProcessedMovement.
// Async response handler for processed movements
@Override
public void handleProcessedMovement(@Observes @HandleProcessedMovementEvent ExchangeMessageEvent message) {
try {
ProcessedMovementResponse request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), ProcessedMovementResponse.class);
log.debug("Received processed movement from Rules:{}", request);
String username;
MovementRefType movementRefType = request.getMovementRefType();
SetReportMovementType orgRequest = request.getOrgRequest();
if (PluginType.MANUAL.equals(orgRequest.getPluginType())) {
username = request.getUsername();
} else {
username = orgRequest.getPluginName();
}
ExchangeLogType log = ExchangeLogMapper.getReceivedMovementExchangeLog(orgRequest, movementRefType.getMovementRefGuid(), movementRefType.getType().value(), username);
ExchangeLogType createdLog = exchangeLog.log(log, username);
LogRefType logTypeRef = createdLog.getTypeRef();
if (logTypeRef != null && logTypeRef.getType() == TypeRefType.POLL) {
String pollGuid = logTypeRef.getRefGuid();
pollEvent.fire(new NotificationMessage("guid", pollGuid));
}
} catch (ExchangeLogException | ExchangeModelMarshallException e) {
log.error(e.getMessage());
}
}
use of eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventIncomingServiceBean method receiveSalesQuery.
@Override
public void receiveSalesQuery(@Observes @ReceiveSalesQueryEvent ExchangeMessageEvent event) {
try {
ReceiveSalesQueryRequest request = JAXBMarshaller.unmarshallTextMessage(event.getJmsMessage(), ReceiveSalesQueryRequest.class);
log.info("Process sales query in Exchange module:{}", request);
String query = request.getQuery();
PluginType plugin = request.getPluginType();
String sender = request.getSenderOrReceiver();
String messageGuid = request.getMessageGuid();
ExchangeLogType log = exchangeLog.log(request, LogType.RECEIVE_SALES_QUERY, ExchangeLogStatusTypeType.ISSUED, TypeRefType.SALES_QUERY, query, true);
forwardToRules(RulesModuleRequestMapper.createReceiveSalesQueryRequest(query, messageGuid, plugin.name(), log.getGuid(), sender, request.getOnValue()));
} catch (ExchangeModelMarshallException e) {
try {
firePluginFault(event, "Couldn't map to SalesQueryRequest when processing sales query from plugin. The message was " + event.getJmsMessage().getText(), e);
} catch (JMSException e1) {
firePluginFault(event, "Couldn't map to SalesQueryRequest when processing sales query from plugin.", e);
}
} catch (ExchangeLogException e) {
firePluginFault(event, "Could not log the incoming sales query.", e);
} catch (RulesModelMarshallException e) {
firePluginFault(event, "Could not create a request for the Rules module for an incoming sales query.", e);
}
}
use of eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventIncomingServiceBean method receiveSalesResponse.
@Override
public void receiveSalesResponse(@Observes @ReceiveSalesResponseEvent ExchangeMessageEvent event) {
try {
ReceiveSalesResponseRequest request = JAXBMarshaller.unmarshallTextMessage(event.getJmsMessage(), ReceiveSalesResponseRequest.class);
String response = request.getResponse();
ExchangeLogType log = exchangeLog.log(request, LogType.RECEIVE_SALES_RESPONSE, ExchangeLogStatusTypeType.ISSUED, TypeRefType.SALES_RESPONSE, response, true);
forwardToRules(RulesModuleRequestMapper.createReceiveSalesResponseRequest(response, log.getGuid(), request.getSenderOrReceiver()));
} catch (ExchangeModelMarshallException e) {
firePluginFault(event, "Error when receiving a Sales response from FLUX", e);
} catch (ExchangeLogException e) {
firePluginFault(event, "Could not log the incoming sales response.", e);
} catch (RulesModelMarshallException e) {
firePluginFault(event, "Could not create a request for the Rules module for an incoming sales response.", e);
}
}
use of eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException 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