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 29a5cb0 commit 47d35d7
Showing 1 changed file with 8 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,8 @@ protected Optional<Criterion> handleGender(@Nonnull String propertyName, TokenAn
});
}

protected Optional<Criterion> handleLocationReference(ReferenceAndListParam locationReference) {
return handleLocationReference(null, locationReference);
}

protected Optional<Criterion> handleLocationReference(String locationAlias, ReferenceAndListParam locationReference) {
protected Optional<Criterion> handleLocationReference(@Nonnull String locationAlias,
ReferenceAndListParam locationReference) {
if (locationReference == null) {
return Optional.empty();
}
Expand All @@ -571,27 +568,18 @@ protected Optional<Criterion> handleLocationReference(String locationAlias, Refe
if (token.getChain() != null) {
switch (token.getChain()) {
case Location.SP_NAME:
return propertyLike(locationAlias != null ? String.format("%s.name", locationAlias) : "name",
token.getValue());
return propertyLike(String.format("%s.name", locationAlias), token.getValue());
case Location.SP_ADDRESS_CITY:
return propertyLike(
locationAlias != null ? String.format("%s.cityVillage", locationAlias) : "cityVillage",
token.getValue());
return propertyLike(String.format("%s.cityVillage", locationAlias), token.getValue());
case Location.SP_ADDRESS_STATE:
return propertyLike(
locationAlias != null ? String.format("%s.stateProvince", locationAlias) : "stateProvince",
token.getValue());
return propertyLike(String.format("%s.stateProvince", locationAlias), token.getValue());
case Location.SP_ADDRESS_POSTALCODE:
return propertyLike(
locationAlias != null ? String.format("%s.postalCode", locationAlias) : "postalCode",
token.getValue());
return propertyLike(String.format("%s.postalCode", locationAlias), token.getValue());
case Location.SP_ADDRESS_COUNTRY:
return propertyLike(locationAlias != null ? String.format("%s.country", locationAlias) : "country",
token.getValue());
return propertyLike(String.format("%s.country", locationAlias), token.getValue());
}
} else {
return Optional
.of(eq(locationAlias != null ? String.format("%s.uuid", locationAlias) : "uuid", token.getValue()));
return Optional.of(eq(String.format("%s.uuid", locationAlias), token.getValue()));
}

return Optional.empty();
Expand Down

0 comments on commit 47d35d7

Please sign in to comment.