use of eu.europa.ec.fisheries.uvms.config.exception.ConfigMessageException 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