Skip to content

Commit

Permalink
FM2-653: Add support for searching for Locations by ancestor
Browse files Browse the repository at this point in the history
  • Loading branch information
mogoodrich committed Jan 17, 2025
1 parent 47d35d7 commit 19723f0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void handleLocationReference(Criteria criteria, ReferenceAndListParam lo
if ("below".equalsIgnoreCase(locationReference.getResourceType())) {
List<Criterion> belowReferenceCriteria = new ArrayList<>();

// we need to add a join to the parentLocation for each level of hierarchy we want to search, and add a "equals" criterion for each level
// we need to add a join to the parentLocation for each level of hierarchy we want to search, and add "equals" criterion for each level
int depth = 1;
while (depth <= SUPPORTED_LOCATION_HIERARCHY_SEARCH_DEPTH) {
belowReferenceCriteria.add(eq("ancestor" + depth + ".uuid", locationReference.getIdPart()));
Expand All @@ -161,7 +161,7 @@ private void handleLocationReference(Criteria criteria, ReferenceAndListParam lo
depth++;
}

// or these call together--if any ancestor location uuid matches
// "or" these call together so that we return the location if any of the joined ancestor location uuids match
criteria.add(or(belowReferenceCriteria.toArray(new Criterion[0])));
} else {
// this is to support queries of the type "Location?partof=uuid" or chained search like "Location?partof:Location=Location:name=xxx"
Expand Down

0 comments on commit 19723f0

Please sign in to comment.