Search in sources :

Example 1 with ActivityIDType

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

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

the class FluxReportIdentifierDao method getMatchingIdentifiers.

public List<FluxReportIdentifierEntity> getMatchingIdentifiers(List<ActivityIDType> ids, ActivityTableType tableType) {
    String namedQueryToSelect = tableType == ActivityTableType.FLUX_REPORT_DOCUMENT_ENTITY ? FluxReportIdentifierEntity.FIND_MATCHING_IDENTIFIER : FluxReportIdentifierEntity.FIND_RELATED_MATCHING_IDENTIFIER;
    List<FluxReportIdentifierEntity> resultList = new ArrayList<>();
    // FIXME avoid looping ad querying
    for (ActivityIDType idType : ids) {
        TypedQuery<FluxReportIdentifierEntity> query = getEntityManager().createNamedQuery(namedQueryToSelect, FluxReportIdentifierEntity.class);
        query.setParameter(ID, idType.getValue());
        query.setParameter(SCHEME_ID, idType.getIdentifierSchemeId());
        resultList.addAll(query.getResultList());
    }
    resultList.removeAll(Collections.singleton(null));
    return resultList;
}
Also used : ActivityIDType(eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityIDType) FluxReportIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity) ArrayList(java.util.ArrayList)

Example 3 with ActivityIDType

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

the class ActivityEventServiceBean method idExistsInList.

private boolean idExistsInList(IDType idType, List<ActivityIDType> idsToMatch) {
    boolean match = false;
    final String value = idType.getValue();
    final String schemeID = idType.getSchemeID();
    for (ActivityIDType actId : idsToMatch) {
        if (actId.getValue().equals(value) && actId.getIdentifierSchemeId().equals(schemeID)) {
            match = true;
        }
    }
    return match;
}
Also used : ActivityIDType(eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityIDType)

Aggregations

ActivityIDType (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityIDType)3 FluxReportIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity)1 ActivityUniquinessList (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList)1 ArrayList (java.util.ArrayList)1