Search in sources :

Example 6 with SubscriptionDataRequest

use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEventServiceBean method getMapToSubscriptionMessage.

@Override
public void getMapToSubscriptionMessage(@Observes @MapToSubscriptionRequestEvent EventMessage message) {
    log.info(GOT_JMS_INSIDE_ACTIVITY_TO_GET + "MapToSubscriptionRequestEvent");
    try {
        TextMessage jmsMessage = message.getJmsMessage();
        String jmsCorrelationID = jmsMessage.getJMSMessageID();
        String messageReceived = jmsMessage.getText();
        SubscriptionDataRequest subscriptionDataRequest = null;
        MapToSubscriptionRequest baseRequest = JAXBUtils.unMarshallMessage(messageReceived, MapToSubscriptionRequest.class);
        switch(baseRequest.getMessageType()) {
            case FLUX_FA_QUERY_MESSAGE:
                FLUXFAQueryMessage fluxfaQueryMessage = JAXBUtils.unMarshallMessage(baseRequest.getRequest(), FLUXFAQueryMessage.class);
                subscriptionDataRequest = SubscriptionMapper.mapToSubscriptionDataRequest(fluxfaQueryMessage.getFAQuery());
                break;
            case FLUX_FA_REPORT_MESSAGE:
                FLUXFAReportMessage fluxFAReportMessage = JAXBUtils.unMarshallMessage(baseRequest.getRequest(), FLUXFAReportMessage.class);
                subscriptionDataRequest = SubscriptionMapper.mapToSubscriptionDataRequest(fluxFAReportMessage);
                break;
            default:
                sendError(message, new IllegalArgumentException("VERBODEN VRUCHT"));
        }
        subscriptionProducer.sendMessageWithSpecificIds(JAXBUtils.marshallJaxBObjectToString(subscriptionDataRequest), subscriptionProducer.getDestination(), JMSUtils.lookupQueue(MessageConstants.QUEUE_RULES), null, jmsCorrelationID);
    } catch (JAXBException | MessageException | JMSException e) {
        sendError(message, e);
    }
}
Also used : FLUXFAQueryMessage(un.unece.uncefact.data.standard.fluxfaquerymessage._3.FLUXFAQueryMessage) FLUXFAReportMessage(un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage) MessageException(eu.europa.ec.fisheries.uvms.commons.message.api.MessageException) JAXBException(javax.xml.bind.JAXBException) MapToSubscriptionRequest(eu.europa.ec.fisheries.uvms.activity.model.schemas.MapToSubscriptionRequest) JMSException(javax.jms.JMSException) SubscriptionDataRequest(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest) TextMessage(javax.jms.TextMessage)

Example 7 with SubscriptionDataRequest

use of eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivitySubscriptionPermissionChecker method checkPermissionForFaReport.

public SubscriptionPermissionResponse checkPermissionForFaReport(FLUXFAReportMessage faReport) throws ActivityModuleException {
    SubscriptionDataRequest subscriptionDataRequest = SubscriptionMapper.mapToSubscriptionDataRequest(faReport);
    String subscrPermissionRequest;
    try {
        subscrPermissionRequest = JAXBUtils.marshallJaxBObjectToString(subscriptionDataRequest);
    } catch (JAXBException e) {
        throw new ActivityModuleException("JAXBException while trying to unmarshall to SubscriptionDataRequest from Subscription Module!", e);
    }
    return getPermissionFromSubscription(subscrPermissionRequest, activityConsumerBean.getDestination());
}
Also used : JAXBException(javax.xml.bind.JAXBException) SubscriptionDataRequest(eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest) ActivityModuleException(eu.europa.ec.fisheries.ers.service.exception.ActivityModuleException)

Aggregations

SubscriptionDataRequest (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataRequest)7 JAXBException (javax.xml.bind.JAXBException)3 ActivityModuleException (eu.europa.ec.fisheries.ers.service.exception.ActivityModuleException)2 SubscriptionDataQuery (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataQuery)2 MapToSubscriptionRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.MapToSubscriptionRequest)1 MessageException (eu.europa.ec.fisheries.uvms.commons.message.api.MessageException)1 SubscriptionDataCriteria (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionDataCriteria)1 JMSException (javax.jms.JMSException)1 TextMessage (javax.jms.TextMessage)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 Produces (javax.ws.rs.Produces)1 Test (org.junit.Test)1 FLUXFAQueryMessage (un.unece.uncefact.data.standard.fluxfaquerymessage._3.FLUXFAQueryMessage)1 FLUXFAReportMessage (un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage)1