Search in sources :

Example 1 with ActivityUniquinessList

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

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

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

the class ActivityMatchingIdsServiceBean method getActivityNonUniqueIdsList.

private ActivityUniquinessList getActivityNonUniqueIdsList(ActivityUniquinessList actRequestUniqueReq) {
    ActivityUniquinessList respUniqList = new ActivityUniquinessList();
    respUniqList.setActivityTableType(actRequestUniqueReq.getActivityTableType());
    List<ActivityIDType> ids = actRequestUniqueReq.getIds();
    respUniqList.setIds(mapIDsListToActivityIDTypeList(fluxRepIdentDao.getMatchingIdentifiers(ids, actRequestUniqueReq.getActivityTableType())));
    return respUniqList;
}
Also used : ActivityUniquinessList(eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList) ActivityIDType(eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityIDType)

Example 4 with ActivityUniquinessList

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

the class FluxReportIdentifierDaoTest method testGetMatchingIdentifiers.

@Test
public void testGetMatchingIdentifiers() {
    when(dao.getEntityManager().createNamedQuery(anyString(), any(FluxReportIdentifierEntity.class.getClass()))).thenReturn(query);
    ActivityUniquinessList reqElem = getMockedRequest().iterator().next();
    final List<FluxReportIdentifierEntity> matchingIdentifiers = dao.getMatchingIdentifiers(reqElem.getIds(), reqElem.getActivityTableType());
    assertNotNull(matchingIdentifiers);
    assertTrue(matchingIdentifiers.size() == 0);
}
Also used : ActivityUniquinessList(eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList) FluxReportIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity) Test(org.junit.Test)

Aggregations

ActivityUniquinessList (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList)4 GetNonUniqueIdsResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsResponse)2 FluxReportIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity)1 ActivityModelMarshallException (eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException)1 ActivityIDType (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityIDType)1 GetNonUniqueIdsRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsRequest)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 FAReportDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)1