Search in sources :

Example 1 with ConfigMessageException

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;
}
Also used : ConfigMessageException(eu.europa.ec.fisheries.uvms.config.exception.ConfigMessageException) ExchangeModelMarshallException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException) RulesModelMarshallException(eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMarshallException) MessageException(eu.europa.ec.fisheries.uvms.commons.message.api.MessageException) ConfigMessageException(eu.europa.ec.fisheries.uvms.config.exception.ConfigMessageException) ValidationMessageTypeResponse(eu.europa.ec.fisheries.schema.rules.rule.v1.ValidationMessageTypeResponse) ValidationMessageType(eu.europa.ec.fisheries.schema.rules.rule.v1.ValidationMessageType) ExchangeLogWithValidationResults(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogWithValidationResults) TextMessage(javax.jms.TextMessage)

Aggregations

ExchangeLogWithValidationResults (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogWithValidationResults)1 ValidationMessageType (eu.europa.ec.fisheries.schema.rules.rule.v1.ValidationMessageType)1 ValidationMessageTypeResponse (eu.europa.ec.fisheries.schema.rules.rule.v1.ValidationMessageTypeResponse)1 MessageException (eu.europa.ec.fisheries.uvms.commons.message.api.MessageException)1 ConfigMessageException (eu.europa.ec.fisheries.uvms.config.exception.ConfigMessageException)1 ExchangeModelMarshallException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException)1 RulesModelMarshallException (eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMarshallException)1 TextMessage (javax.jms.TextMessage)1