Search in sources :

Example 1 with LogRefIdByTypeExistsResponse

use of eu.europa.ec.fisheries.schema.exchange.module.v1.LogRefIdByTypeExistsResponse in project UVMS-ExchangeModule-APP by UnionVMS.

the class ExchangeEventIncomingServiceBean method logRefIdByTypeExists.

@Override
public void logRefIdByTypeExists(@Observes @LogRefIdByTypeExists ExchangeMessageEvent event) {
    try {
        LogRefIdByTypeExistsRequest request = unMarshallMessage(event.getJmsMessage().getText(), LogRefIdByTypeExistsRequest.class);
        String refGuid = request.getRefGuid();
        List<TypeRefType> refTypes = request.getRefTypes();
        List<ExchangeLogStatusType> exchangeStatusHistoryList = exchangeLogModel.getExchangeLogsStatusHistories(refGuid, refTypes);
        LogRefIdByTypeExistsResponse response = new LogRefIdByTypeExistsResponse();
        if (CollectionUtils.isNotEmpty(exchangeStatusHistoryList)) {
            response.setRefGuid(exchangeStatusHistoryList.get(0).getTypeRef().getRefGuid());
        }
        String responseAsString = JAXBUtils.marshallJaxBObjectToString(response);
        producer.sendModuleResponseMessage(event.getJmsMessage(), responseAsString);
    } catch (ExchangeModelException | JAXBException | JMSException e) {
        fireExchangeFault(event, "Could not un-marshall " + LogRefIdByTypeExistsRequest.class, e);
    }
}
Also used : ExchangeLogStatusType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusType) LogRefIdByTypeExistsRequest(eu.europa.ec.fisheries.schema.exchange.module.v1.LogRefIdByTypeExistsRequest) TypeRefType(eu.europa.ec.fisheries.schema.exchange.v1.TypeRefType) LogRefIdByTypeExistsResponse(eu.europa.ec.fisheries.schema.exchange.module.v1.LogRefIdByTypeExistsResponse) JAXBException(javax.xml.bind.JAXBException) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException) JMSException(javax.jms.JMSException)

Aggregations

LogRefIdByTypeExistsRequest (eu.europa.ec.fisheries.schema.exchange.module.v1.LogRefIdByTypeExistsRequest)1 LogRefIdByTypeExistsResponse (eu.europa.ec.fisheries.schema.exchange.module.v1.LogRefIdByTypeExistsResponse)1 ExchangeLogStatusType (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusType)1 TypeRefType (eu.europa.ec.fisheries.schema.exchange.v1.TypeRefType)1 ExchangeModelException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)1 JMSException (javax.jms.JMSException)1 JAXBException (javax.xml.bind.JAXBException)1