Search in sources :

Example 1 with GetNonUniqueIdsResponse

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsResponse 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 2 with GetNonUniqueIdsResponse

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsResponse 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 3 with GetNonUniqueIdsResponse

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

the class ActivityMatchingIdsServiceBean method getMatchingIdsResponse.

public GetNonUniqueIdsResponse getMatchingIdsResponse(List<ActivityUniquinessList> activityUniquinessLists) {
    if (CollectionUtils.isEmpty(activityUniquinessLists)) {
        return null;
    }
    GetNonUniqueIdsResponse response = new GetNonUniqueIdsResponse();
    List<ActivityUniquinessList> activityUniquinessResponseLists = new ArrayList<>();
    response.setMethod(ActivityModuleMethod.GET_NON_UNIQUE_IDS);
    response.setActivityUniquinessLists(activityUniquinessResponseLists);
    for (ActivityUniquinessList actUniqueReq : activityUniquinessLists) {
        activityUniquinessResponseLists.add(getActivityNonUniqueIdsList(actUniqueReq));
    }
    return response;
}
Also used : ActivityUniquinessList(eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList) GetNonUniqueIdsResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsResponse) ArrayList(java.util.ArrayList)

Example 4 with GetNonUniqueIdsResponse

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

the class ActivityEventServiceBeanTest method setUp.

@Before
@SneakyThrows
public void setUp() {
    nonUniqueIdsMessage = new ActiveMQTextMessage(session);
    Whitebox.setInternalState(nonUniqueIdsMessage, "text", new SimpleString(getStrRequest1()));
    Whitebox.setInternalState(nonUniqueIdsMessage, "jmsCorrelationID", "SomeCorrId");
    nonUniqueIdsMessageEventMessage = new EventMessage(nonUniqueIdsMessage);
    faAndTripIdsFromTripIdsMessage = new ActiveMQTextMessage(session);
    Whitebox.setInternalState(faAndTripIdsFromTripIdsMessage, "text", new SimpleString(getStrRequest2()));
    Whitebox.setInternalState(faAndTripIdsFromTripIdsMessage, "jmsCorrelationID", "SomeCorrId");
    faAndTripIdsFromTripIdsEventMessage = new EventMessage(faAndTripIdsFromTripIdsMessage);
    getNonUniqueIdsResponse = JAXBMarshaller.unmarshallTextMessage(getResponseStr1(), GetNonUniqueIdsResponse.class);
    getFishingActivitiesForTripResponse = JAXBMarshaller.unmarshallTextMessage(getResponseStr2(), GetFishingActivitiesForTripResponse.class);
}
Also used : EventMessage(eu.europa.ec.fisheries.uvms.activity.message.event.carrier.EventMessage) GetNonUniqueIdsResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsResponse) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) GetFishingActivitiesForTripResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripResponse) ActiveMQTextMessage(org.apache.activemq.artemis.jms.client.ActiveMQTextMessage) Before(org.junit.Before) SneakyThrows(lombok.SneakyThrows)

Aggregations

GetNonUniqueIdsResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsResponse)4 ActivityModelMarshallException (eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException)2 ActivityUniquinessList (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList)2 GetNonUniqueIdsRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsRequest)2 EventMessage (eu.europa.ec.fisheries.uvms.activity.message.event.carrier.EventMessage)1 GetFishingActivitiesForTripResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripResponse)1 MessageException (eu.europa.ec.fisheries.uvms.commons.message.api.MessageException)1 ArrayList (java.util.ArrayList)1 JMSException (javax.jms.JMSException)1 SneakyThrows (lombok.SneakyThrows)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 ActiveMQTextMessage (org.apache.activemq.artemis.jms.client.ActiveMQTextMessage)1 Before (org.junit.Before)1 FAReportDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)1