Resolve issue with test

This commit is contained in:
Tadgh 2020-07-23 17:28:20 -07:00
parent 6a5b96d05f
commit 2da64119bb
2 changed files with 20 additions and 14 deletions

View File

@ -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));
}

View File

@ -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,