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;
}
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;
}
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;
}
Aggregations