Resolve issue with test
This commit is contained in:
parent
6a5b96d05f
commit
2da64119bb
|
@ -46,6 +46,8 @@ public class EmpiCandidateSearchCriteriaBuilderSvc {
|
||||||
public Optional<String> buildResourceQueryString(String theResourceType, IAnyResource theResource, List<String> theFilterCriteria, EmpiResourceSearchParamJson resourceSearchParam) {
|
public Optional<String> buildResourceQueryString(String theResourceType, IAnyResource theResource, List<String> theFilterCriteria, EmpiResourceSearchParamJson resourceSearchParam) {
|
||||||
List<String> criteria = new ArrayList<>();
|
List<String> criteria = new ArrayList<>();
|
||||||
|
|
||||||
|
//If there is no candidateSearchParams, then we want to just use the filters.
|
||||||
|
if (resourceSearchParam != null) {
|
||||||
resourceSearchParam.iterator().forEachRemaining(searchParam -> {
|
resourceSearchParam.iterator().forEachRemaining(searchParam -> {
|
||||||
//to compare it to all known PERSON objects, using the overlapping search parameters that they have.
|
//to compare it to all known PERSON objects, using the overlapping search parameters that they have.
|
||||||
List<String> valuesFromResourceForSearchParam = myEmpiSearchParamSvc.getValueFromResourceForSearchParam(theResource, searchParam);
|
List<String> valuesFromResourceForSearchParam = myEmpiSearchParamSvc.getValueFromResourceForSearchParam(theResource, searchParam);
|
||||||
|
@ -53,9 +55,8 @@ public class EmpiCandidateSearchCriteriaBuilderSvc {
|
||||||
criteria.add(buildResourceMatchQuery(searchParam, valuesFromResourceForSearchParam));
|
criteria.add(buildResourceMatchQuery(searchParam, valuesFromResourceForSearchParam));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (criteria.isEmpty()) {
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria.addAll(theFilterCriteria);
|
criteria.addAll(theFilterCriteria);
|
||||||
return Optional.of(theResourceType + "?" + String.join("&", criteria));
|
return Optional.of(theResourceType + "?" + String.join("&", criteria));
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,11 @@ public class EmpiCandidateSearchSvc {
|
||||||
|
|
||||||
List<String> filterCriteria = buildFilterQuery(filterSearchParams, theResourceType);
|
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)) {
|
if (!isSearchParamForResource(theResourceType, resourceSearchParam)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -88,6 +92,7 @@ public class EmpiCandidateSearchSvc {
|
||||||
|
|
||||||
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.
|
//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,
|
//Sometimes, we are running this function on a resource that has not yet been persisted,
|
||||||
//so it may not have an ID yet, precluding the need to remove it.
|
//so it may not have an ID yet, precluding the need to remove it.
|
||||||
|
|
Loading…
Reference in New Issue