use of eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMarshallException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventIncomingServiceBean method receiveSalesReport.
@Override
public void receiveSalesReport(@Observes @ReceiveSalesReportEvent ExchangeMessageEvent event) {
try {
ReceiveSalesReportRequest request = JAXBMarshaller.unmarshallTextMessage(event.getJmsMessage(), ReceiveSalesReportRequest.class);
log.info("Receive sales report in Exchange module:{}", request);
String report = request.getReport();
PluginType plugin = request.getPluginType();
String sender = request.getSenderOrReceiver();
String messageGuid = request.getMessageGuid();
ExchangeLogType log = exchangeLog.log(request, LogType.RECEIVE_SALES_REPORT, ExchangeLogStatusTypeType.ISSUED, TypeRefType.SALES_REPORT, report, true);
forwardToRules(RulesModuleRequestMapper.createReceiveSalesReportRequest(report, messageGuid, plugin.name(), log.getGuid(), sender, request.getOnValue()));
} catch (ExchangeModelMarshallException e) {
try {
String errorMessage = "Couldn't map to SetSalesReportRequest when processing sales report from plugin. The event was " + event.getJmsMessage().getText();
firePluginFault(event, errorMessage, e);
} catch (JMSException e1) {
firePluginFault(event, "Couldn't map to SetSalesReportRequest when processing sales report from plugin.", e);
}
} catch (ExchangeLogException e) {
firePluginFault(event, "Could not log the incoming sales report.", e);
} catch (RulesModelMarshallException e) {
firePluginFault(event, "Could not create a request for the Rules module for an incoming sales report.", e);
}
}
use of eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMarshallException 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.rules.model.exception.RulesModelMarshallException 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.rules.model.exception.RulesModelMarshallException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeToRulesSyncMsgBean method getValidationFromRules.
public ExchangeLogWithValidationResults getValidationFromRules(String guid, TypeRefType type) {
if (StringUtils.isEmpty(guid)) {
return new ExchangeLogWithValidationResults();
}
ExchangeLogWithValidationResults resp = new ExchangeLogWithValidationResults();
try {
String getValidationsByGuidRequest = RulesModuleRequestMapper.createGetValidationsByGuidRequest(guid, type == null ? null : type.name());
String correlationId = exchangeProducerBean.sendRulesMessage(getValidationsByGuidRequest);
TextMessage validationRespMsg = exchangeConsumerBean.getMessage(correlationId, TextMessage.class);
ValidationMessageTypeResponse validTypeRespFromRules = JAXBMarshaller.unmarshallTextMessage(validationRespMsg, ValidationMessageTypeResponse.class);
List<ValidationMessageType> validationsListResponse = validTypeRespFromRules.getValidationsListResponse();
if (CollectionUtils.isNotEmpty(validationsListResponse)) {
for (ValidationMessageType validMsgFromRules : validationsListResponse) {
resp.getValidationList().add(mapToLogValidationResult(validMsgFromRules));
}
}
} catch (ConfigMessageException | MessageException | RulesModelMarshallException | ExchangeModelMarshallException e) {
log.error("Error while trying to get Validation Results for RawMessage GUID from Rules!", e);
}
return resp;
}
Aggregations