Search in sources :

Example 1 with ActivityModelMarshallException

use of eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException in project UVMS-ActivityModule-APP by UnionVMS.

the class MdrModuleServiceBean method getAcronymFromMdr.

@Override
public Map<String, List<String>> getAcronymFromMdr(String acronym, String filter, List<String> filterColumns, Integer nrOfResults, String... returnColumns) throws ServiceException {
    Map<String, List<String>> columnNameValuesMap = prepareColumnNameValuesMap(returnColumns);
    try {
        String request = MdrModuleMapper.createFluxMdrGetCodeListRequest(acronym, filter, filterColumns, nrOfResults);
        String correlationId = mdrProducer.sendModuleMessage(request, activityConsumer.getDestination());
        TextMessage message = activityConsumer.getMessage(correlationId, TextMessage.class);
        if (null != message) {
            String messageStr = message.getText();
            MdrGetCodeListResponse response = JAXBMarshaller.unmarshallTextMessage(messageStr, MdrGetCodeListResponse.class);
            for (ObjectRepresentation objectRep : response.getDataSets()) {
                for (ColumnDataType nameVal : objectRep.getFields()) {
                    if (columnNameValuesMap.containsKey(nameVal.getColumnName())) {
                        columnNameValuesMap.get(nameVal.getColumnName()).add(nameVal.getColumnValue());
                    }
                }
            }
            return columnNameValuesMap;
        } else {
            throw new ServiceException("Unable to get data from MDR Module");
        }
    } catch (JMSException | MessageException | MdrModelMarshallException | ActivityModelMarshallException e) {
        log.error("MdrModelMarshallException in communication with mdr", e.getCause());
        throw new ServiceException("Exception caught in mdrModuleServiceBean", e.getCause());
    }
}
Also used : MdrModelMarshallException(eu.europa.ec.fisheries.uvms.mdr.model.exception.MdrModelMarshallException) ColumnDataType(un.unece.uncefact.data.standard.mdr.communication.ColumnDataType) JMSException(javax.jms.JMSException) ActivityModelMarshallException(eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException) ServiceException(eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException) MdrGetCodeListResponse(un.unece.uncefact.data.standard.mdr.communication.MdrGetCodeListResponse) MessageException(eu.europa.ec.fisheries.uvms.commons.message.api.MessageException) ArrayList(java.util.ArrayList) List(java.util.List) TextMessage(javax.jms.TextMessage) ObjectRepresentation(un.unece.uncefact.data.standard.mdr.communication.ObjectRepresentation)

Example 2 with ActivityModelMarshallException

use of eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEventServiceBean method getNonUniqueIdsRequest.

@Override
public void getNonUniqueIdsRequest(@Observes @GetNonUniqueIdsRequestEvent EventMessage message) {
    log.info(GOT_JMS_INSIDE_ACTIVITY_TO_GET + "Non Matching Ids of different Tables : ");
    try {
        log.debug(message.getJmsMessage().getText());
        GetNonUniqueIdsRequest getNonUniqueIdsRequest = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), GetNonUniqueIdsRequest.class);
        GetNonUniqueIdsResponse faCatchSummaryReportResponse = matchingIdsService.getMatchingIdsResponse(getNonUniqueIdsRequest.getActivityUniquinessLists());
        String response = JAXBMarshaller.marshallJaxBObjectToString(faCatchSummaryReportResponse);
        producer.sendResponseMessageToSender(message.getJmsMessage(), response);
    } catch (ActivityModelMarshallException | JMSException | MessageException e) {
        sendError(message, e);
    }
}
Also used : ActivityModelMarshallException(eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException) MessageException(eu.europa.ec.fisheries.uvms.commons.message.api.MessageException) GetNonUniqueIdsRequest(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsRequest) GetNonUniqueIdsResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsResponse) JMSException(javax.jms.JMSException)

Example 3 with ActivityModelMarshallException

use of eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEventServiceBean method getFishingActivityForTripsRequest.

@Override
public void getFishingActivityForTripsRequest(@Observes @GetFishingActivityForTripsRequestEvent EventMessage message) {
    log.info(GOT_JMS_INSIDE_ACTIVITY_TO_GET + " Fishing activities related to trips.");
    try {
        log.debug(message.getJmsMessage().getText());
        GetFishingActivitiesForTripRequest request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), GetFishingActivitiesForTripRequest.class);
        GetFishingActivitiesForTripResponse response = activityServiceBean.getFaAndTripIdsFromTripIds(request.getFaAndTripIds());
        String responseStr = JAXBMarshaller.marshallJaxBObjectToString(response);
        producer.sendResponseMessageToSender(message.getJmsMessage(), responseStr);
    } catch (ActivityModelMarshallException | JMSException | ServiceException | MessageException e) {
        sendError(message, e);
    }
}
Also used : ActivityModelMarshallException(eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException) ServiceException(eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException) MessageException(eu.europa.ec.fisheries.uvms.commons.message.api.MessageException) GetFishingActivitiesForTripRequest(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripRequest) GetFishingActivitiesForTripResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripResponse) JMSException(javax.jms.JMSException)

Example 4 with ActivityModelMarshallException

use of eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEventServiceBean method deleteDuplicatedReportsFromXMLDocument.

private void deleteDuplicatedReportsFromXMLDocument(FLUXFAReportMessage repMsg) {
    GetNonUniqueIdsRequest getNonUniqueIdsRequest = null;
    try {
        getNonUniqueIdsRequest = ActivityModuleRequestMapper.mapToGetNonUniqueIdRequestObject(collectAllIdsFromMessage(repMsg));
    } catch (ActivityModelMarshallException e) {
        log.error("[ERROR] Error while trying to get the unique ids from FaReportDocumentIdentifiers table...");
    }
    GetNonUniqueIdsResponse matchingIdsResponse = matchingIdsService.getMatchingIdsResponse(getNonUniqueIdsRequest.getActivityUniquinessLists());
    List<ActivityUniquinessList> activityUniquinessLists = matchingIdsResponse.getActivityUniquinessLists();
    final List<FAReportDocument> faReportDocuments = repMsg.getFAReportDocuments();
    if (CollectionUtils.isNotEmpty(activityUniquinessLists)) {
        for (ActivityUniquinessList unique : activityUniquinessLists) {
            deleteBranchesThatMatchWithTheIdsList(unique.getIds(), faReportDocuments);
        }
    }
}
Also used : ActivityUniquinessList(eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList) ActivityModelMarshallException(eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException) GetNonUniqueIdsRequest(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsRequest) GetNonUniqueIdsResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsResponse) FAReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)

Example 5 with ActivityModelMarshallException

use of eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEventServiceBean method getFishingTripList.

@Override
public void getFishingTripList(@Observes @GetFishingTripListEvent EventMessage message) {
    log.info(GOT_JMS_INSIDE_ACTIVITY_TO_GET + "FishingTripIds:");
    try {
        log.debug("JMS Incoming text message: {}", message.getJmsMessage().getText());
        FishingTripRequest baseRequest = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), FishingTripRequest.class);
        log.debug("FishingTriId Request Unmarshalled");
        FishingTripResponse baseResponse = fishingTripService.filterFishingTripsForReporting(FishingActivityRequestMapper.buildFishingActivityQueryFromRequest(baseRequest));
        log.debug("FishingTripResponse ::: " + FACatchSummaryHelper.printJsonstructure(baseResponse));
        String response = JAXBMarshaller.marshallJaxBObjectToString(baseResponse);
        log.debug("FishingTriId response marshalled");
        producer.sendResponseMessageToSender(message.getJmsMessage(), response);
        log.debug("Response sent back.");
    } catch (ActivityModelMarshallException | JMSException | ServiceException | MessageException e) {
        sendError(message, e);
    }
}
Also used : FishingTripRequest(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripRequest) FishingTripResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripResponse) ActivityModelMarshallException(eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException) ServiceException(eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException) MessageException(eu.europa.ec.fisheries.uvms.commons.message.api.MessageException) JMSException(javax.jms.JMSException)

Aggregations

ActivityModelMarshallException (eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException)10 MessageException (eu.europa.ec.fisheries.uvms.commons.message.api.MessageException)7 JMSException (javax.jms.JMSException)6 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)5 ActivityModuleException (eu.europa.ec.fisheries.ers.service.exception.ActivityModuleException)3 TextMessage (javax.jms.TextMessage)3 GetNonUniqueIdsRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsRequest)2 GetNonUniqueIdsResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsResponse)2 RulesModelMapperException (eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMapperException)2 SubscriptionParameter (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionParameter)2 SubscriptionPermissionResponse (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionPermissionResponse)2 FLUXFAQueryMessage (un.unece.uncefact.data.standard.fluxfaquerymessage._3.FLUXFAQueryMessage)2 EventMessage (eu.europa.ec.fisheries.uvms.activity.message.event.carrier.EventMessage)1 ActivityModuleMethod (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityModuleMethod)1 ActivityModuleRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityModuleRequest)1 ActivityUniquinessList (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList)1 FACatchSummaryReportRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportRequest)1 FACatchSummaryReportResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportResponse)1 FishingTripRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripRequest)1 FishingTripResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripResponse)1