Resolve issue with test
This commit is contained in:
parent
6a5b96d05f
commit
2da64119bb
|
@ -46,16 +46,17 @@ public class EmpiCandidateSearchCriteriaBuilderSvc {
|
|||
public Optional<String> buildResourceQueryString(String theResourceType, IAnyResource theResource, List<String> theFilterCriteria, EmpiResourceSearchParamJson resourceSearchParam) {
|
||||
List<String> criteria = new ArrayList<>();
|
||||
|
||||
resourceSearchParam.iterator().forEachRemaining(searchParam -> {
|
||||
//to compare it to all known PERSON objects, using the overlapping search parameters that they have.
|
||||
List<String> valuesFromResourceForSearchParam = myEmpiSearchParamSvc.getValueFromResourceForSearchParam(theResource, searchParam);
|
||||
if (!valuesFromResourceForSearchParam.isEmpty()) {
|
||||
criteria.add(buildResourceMatchQuery(searchParam, valuesFromResourceForSearchParam));
|
||||
}
|
||||
});
|
||||
if (criteria.isEmpty()) {
|
||||
return Optional.empty();
|
||||
//If there is no candidateSearchParams, then we want to just use the filters.
|
||||
if (resourceSearchParam != null) {
|
||||
resourceSearchParam.iterator().forEachRemaining(searchParam -> {
|
||||
//to compare it to all known PERSON objects, using the overlapping search parameters that they have.
|
||||
List<String> valuesFromResourceForSearchParam = myEmpiSearchParamSvc.getValueFromResourceForSearchParam(theResource, searchParam);
|
||||
if (!valuesFromResourceForSearchParam.isEmpty()) {
|
||||
criteria.add(buildResourceMatchQuery(searchParam, valuesFromResourceForSearchParam));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
criteria.addAll(theFilterCriteria);
|
||||
return Optional.of(theResourceType + "?" + String.join("&", criteria));
|
||||
}
|
||||
|
|
|
@ -80,13 +80,18 @@ public class EmpiCandidateSearchSvc {
|
|||
|
||||
List<String> filterCriteria = buildFilterQuery(filterSearchParams, theResourceType);
|
||||
|
||||
for (EmpiResourceSearchParamJson resourceSearchParam : myEmpiConfig.getEmpiRules().getCandidateSearchParams()) {
|
||||
List<EmpiResourceSearchParamJson> candidateSearchParams = myEmpiConfig.getEmpiRules().getCandidateSearchParams();
|
||||
if (candidateSearchParams == null || candidateSearchParams.isEmpty()) {
|
||||
searchForIdsAndAddToMap(theResourceType, theResource, matchedPidsToResources, filterCriteria, null);
|
||||
} else {
|
||||
for (EmpiResourceSearchParamJson resourceSearchParam : candidateSearchParams) {
|
||||
|
||||
if (!isSearchParamForResource(theResourceType, resourceSearchParam)) {
|
||||
continue;
|
||||
if (!isSearchParamForResource(theResourceType, resourceSearchParam)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
searchForIdsAndAddToMap(theResourceType, theResource, matchedPidsToResources, filterCriteria, resourceSearchParam);
|
||||
}
|
||||
|
||||
searchForIdsAndAddToMap(theResourceType, theResource, matchedPidsToResources, filterCriteria, resourceSearchParam);
|
||||
}
|
||||
//Obviously we don't want to consider the freshly added resource as a potential candidate.
|
||||
//Sometimes, we are running this function on a resource that has not yet been persisted,
|
||||
|
|
Loading…
Reference in New Issue