From 99949629a8b41ce5460e5f3ab2f3b3e2b186a42e Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Thu, 23 Jan 2020 18:49:09 -0500 Subject: [PATCH] FIXME --- .../dao/predicate/BasePredicateBuilder.java | 1 - .../jpa/dao/predicate/IPredicateBuilder.java | 15 +++++++ .../jpa/dao/predicate/PredicateBuilder.java | 45 +++++-------------- .../dao/predicate/PredicateBuilderCoords.java | 14 +++--- .../dao/predicate/PredicateBuilderDate.java | 11 ++--- .../dao/predicate/PredicateBuilderNumber.java | 11 ++--- .../predicate/PredicateBuilderQuantity.java | 12 ++--- .../predicate/PredicateBuilderReference.java | 17 +++---- .../predicate/PredicateBuilderResourceId.java | 5 ++- .../dao/predicate/PredicateBuilderString.java | 11 ++--- .../dao/predicate/PredicateBuilderTag.java | 23 ---------- .../dao/predicate/PredicateBuilderToken.java | 19 ++++---- .../dao/predicate/PredicateBuilderUri.java | 11 ++--- 13 files changed, 86 insertions(+), 109 deletions(-) create mode 100644 hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/IPredicateBuilder.java diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/BasePredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/BasePredicateBuilder.java index 6889f275466..adc4c3da627 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/BasePredicateBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/BasePredicateBuilder.java @@ -39,7 +39,6 @@ abstract class BasePredicateBuilder { final String myResourceName; final SearchParameterMap myParams; - // FIXME KHS autowire with lookup BasePredicateBuilder(SearchBuilder theSearchBuilder) { myCallingDao = theSearchBuilder.getCallingDao(); myBuilder = theSearchBuilder.getBuilder(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/IPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/IPredicateBuilder.java new file mode 100644 index 00000000000..bcf41be2cb7 --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/IPredicateBuilder.java @@ -0,0 +1,15 @@ +package ca.uhn.fhir.jpa.dao.predicate; + +import ca.uhn.fhir.model.api.IQueryParameterType; + +import javax.annotation.Nullable; +import javax.persistence.criteria.Predicate; +import java.util.List; + +public interface IPredicateBuilder { + @Nullable + Predicate addPredicate(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation operation); +} diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilder.java index c0da5ee5027..14320931288 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilder.java @@ -36,72 +36,47 @@ public class PredicateBuilder { } void addPredicateCoords(String theResourceName, String theParamName, List theNextAnd) { - // FIXME KHS consolidate these predicate builders (e.g. all these mathods should have the same name) - myPredicateBuilderCoords.addPredicateCoords(theResourceName, theParamName, theNextAnd); - } - - private void addPredicateDate(String theResourceName, String theParamName, List theNextAnd) { - myPredicateBuilderDate.addPredicateDate(theResourceName, theParamName, theNextAnd, null); + myPredicateBuilderCoords.addPredicate(theResourceName, theParamName, theNextAnd); } Predicate addPredicateDate(String theResourceName, String theParamName, List theNextAnd, SearchFilterParser.CompareOperation theOperation) { - return myPredicateBuilderDate.addPredicateDate(theResourceName, theParamName, theNextAnd, theOperation); - } - - private void addPredicateNumber(String theResourceName, String theParamName, List theNextAnd) { - myPredicateBuilderNumber.addPredicateNumber(theResourceName, theParamName, theNextAnd, null); + return myPredicateBuilderDate.addPredicate(theResourceName, theParamName, theNextAnd, theOperation); } Predicate addPredicateNumber(String theResourceName, String theParamName, List theNextAnd, SearchFilterParser.CompareOperation theOperation) { - return myPredicateBuilderNumber.addPredicateNumber(theResourceName, theParamName, theNextAnd, theOperation); - } - - private void addPredicateQuantity(String theResourceName, String theParamName, List theNextAnd) { - myPredicateBuilderQuantity.addPredicateQuantity(theResourceName, theParamName, theNextAnd, null); + return myPredicateBuilderNumber.addPredicate(theResourceName, theParamName, theNextAnd, theOperation); } Predicate addPredicateQuantity(String theResourceName, String theParamName, List theNextAnd, SearchFilterParser.CompareOperation theOperation) { - return myPredicateBuilderQuantity.addPredicateQuantity(theResourceName, theParamName, theNextAnd, theOperation); - } - - private Predicate addPredicateReference(String theResourceName, String theParamName, List theList, RequestDetails theRequest) { - return myPredicateBuilderReference.addPredicateReference(theResourceName, theParamName, theList, null, theRequest); + return myPredicateBuilderQuantity.addPredicate(theResourceName, theParamName, theNextAnd, theOperation); } void addPredicateString(String theResourceName, String theParamName, List theNextAnd) { - myPredicateBuilderString.addPredicateString(theResourceName, theParamName, theNextAnd, SearchFilterParser.CompareOperation.sw); + myPredicateBuilderString.addPredicate(theResourceName, theParamName, theNextAnd, SearchFilterParser.CompareOperation.sw); } Predicate addPredicateString(String theResourceName, String theParamName, List theNextAnd, SearchFilterParser.CompareOperation theOperation) { - return myPredicateBuilderString.addPredicateString(theResourceName, theParamName, theNextAnd, theOperation); + return myPredicateBuilderString.addPredicate(theResourceName, theParamName, theNextAnd, theOperation); } void addPredicateTag(List> theAndOrParams, String theParamName) { myPredicateBuilderTag.addPredicateTag(theAndOrParams, theParamName); } - private void addPredicateToken(String theResourceName, String theParamName, List theNextAnd) { - myPredicateBuilderToken.addPredicateToken(theResourceName, theParamName, theNextAnd, null); - } - Predicate addPredicateToken(String theResourceName, String theParamName, List theNextAnd, SearchFilterParser.CompareOperation theOperation) { - return myPredicateBuilderToken.addPredicateToken(theResourceName, theParamName, theNextAnd, theOperation); - } - - private void addPredicateUri(String theResourceName, String theParamName, List theNextAnd) { - myPredicateBuilderUri.addPredicateUri(theResourceName, theParamName, theNextAnd, SearchFilterParser.CompareOperation.eq); + return myPredicateBuilderToken.addPredicate(theResourceName, theParamName, theNextAnd, theOperation); } Predicate addPredicateUri(String theResourceName, String theName, List theSingletonList, SearchFilterParser.CompareOperation theOperation) { - return myPredicateBuilderUri.addPredicateUri(theResourceName, theName, theSingletonList, theOperation); + return myPredicateBuilderUri.addPredicate(theResourceName, theName, theSingletonList, theOperation); } public void searchForIdsWithAndOr(String theResourceName, String theNextParamName, List> theAndOrParams, RequestDetails theRequest) { myPredicateBuilderReference.searchForIdsWithAndOr(theResourceName, theNextParamName, theAndOrParams, theRequest); } - Subquery createLinkSubquery(boolean theFoundChainMatch, String theParameterName, String theTargetResourceType, ArrayList theOrValues, RequestDetails theRequest) { - return myPredicateBuilderReference.createLinkSubquery(theFoundChainMatch, theParameterName, theTargetResourceType, theOrValues, theRequest); + Subquery createLinkSubquery(String theParameterName, String theTargetResourceType, ArrayList theOrValues, RequestDetails theRequest) { + return myPredicateBuilderReference.createLinkSubquery(true, theParameterName, theTargetResourceType, theOrValues, theRequest); } Predicate createResourceLinkPathPredicate(String theTargetResourceType, String theParamReference, Join theJoin) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderCoords.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderCoords.java index 446ae655808..a8506ea3d50 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderCoords.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderCoords.java @@ -28,7 +28,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank; @Component @Scope("prototype") -public class PredicateBuilderCoords extends BasePredicateBuilder { +public class PredicateBuilderCoords extends BasePredicateBuilder implements IPredicateBuilder { PredicateBuilderCoords(SearchBuilder theSearchBuilder) { super(theSearchBuilder); @@ -89,8 +89,8 @@ public class PredicateBuilderCoords extends BasePredicateBuilder { } else if (distanceKm < 0.0) { throw new IllegalArgumentException("Invalid " + Location.SP_NEAR_DISTANCE + " parameter '" + distanceKm + "' must be >= 0.0"); } else { - Double latitudeDegrees = Double.valueOf(latitudeValue); - Double longitudeDegrees = Double.valueOf(longitudeValue); + double latitudeDegrees = Double.parseDouble(latitudeValue); + double longitudeDegrees = Double.parseDouble(longitudeValue); Point northPoint = CoordCalculator.findTarget(latitudeDegrees, longitudeDegrees, 0.0, distanceKm); Point eastPoint = CoordCalculator.findTarget(latitudeDegrees, longitudeDegrees, 90.0, distanceKm); @@ -110,9 +110,11 @@ public class PredicateBuilderCoords extends BasePredicateBuilder { return combineParamIndexPredicateWithParamNamePredicate(theResourceName, theParamName, theFrom, singleCode); } - public Predicate addPredicateCoords(String theResourceName, - String theParamName, - List theList) { + @Override + public Predicate addPredicate(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation theOperation) { Join join = createJoin(SearchBuilderJoinEnum.COORDS, theParamName); if (theList.get(0).getMissing() != null) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderDate.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderDate.java index bc7ccabb3ce..85b83e37aab 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderDate.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderDate.java @@ -23,17 +23,18 @@ import java.util.List; @Component @Scope("prototype") -public class PredicateBuilderDate extends BasePredicateBuilder { +public class PredicateBuilderDate extends BasePredicateBuilder implements IPredicateBuilder { private static final Logger ourLog = LoggerFactory.getLogger(PredicateBuilderDate.class); PredicateBuilderDate(SearchBuilder theSearchBuilder) { super(theSearchBuilder); } - public Predicate addPredicateDate(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation) { + @Override + public Predicate addPredicate(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation operation) { Join join = createJoin(SearchBuilderJoinEnum.DATE, theParamName); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderNumber.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderNumber.java index 6501a19efef..5d40647b3d4 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderNumber.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderNumber.java @@ -20,17 +20,18 @@ import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; @Component @Scope("prototype") -class PredicateBuilderNumber extends BasePredicateBuilder { +class PredicateBuilderNumber extends BasePredicateBuilder implements IPredicateBuilder { private static final Logger ourLog = LoggerFactory.getLogger(PredicateBuilderNumber.class); PredicateBuilderNumber(SearchBuilder theSearchBuilder) { super(theSearchBuilder); } - public Predicate addPredicateNumber(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation) { + @Override + public Predicate addPredicate(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation operation) { Join join = createJoin(SearchBuilderJoinEnum.NUMBER, theParamName); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderQuantity.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderQuantity.java index 548cae22933..edd12474ce7 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderQuantity.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderQuantity.java @@ -21,16 +21,18 @@ import static org.apache.commons.lang3.StringUtils.isBlank; @Component @Scope("prototype") -class PredicateBuilderQuantity extends BasePredicateBuilder { +class PredicateBuilderQuantity extends BasePredicateBuilder implements IPredicateBuilder { PredicateBuilderQuantity(SearchBuilder theSearchBuilder) { super(theSearchBuilder); } - Predicate addPredicateQuantity(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation) { + @Override + public Predicate addPredicate(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation operation) { + Join join = createJoin(SearchBuilderJoinEnum.QUANTITY, theParamName); if (theList.get(0).getMissing() != null) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderReference.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderReference.java index 439d14e3ca0..7272bccf4f5 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderReference.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderReference.java @@ -59,11 +59,12 @@ class PredicateBuilderReference extends BasePredicateBuilder { /** * Add reference predicate to the current search */ - Predicate addPredicateReference(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation, - RequestDetails theRequest) { + + public Predicate addPredicate(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation operation, + RequestDetails theRequest) { assert theParamName.contains(".") == false; @@ -438,7 +439,7 @@ class PredicateBuilderReference extends BasePredicateBuilder { break; case REFERENCE: for (List nextAnd : theAndOrParams) { - addPredicateReference(theResourceName, theParamName, nextAnd, null, theRequest); + addPredicate(theResourceName, theParamName, nextAnd, null, theRequest); } break; case STRING: @@ -597,7 +598,7 @@ class PredicateBuilderReference extends BasePredicateBuilder { String chain = (theFilter.getParamPath().getNext() != null) ? theFilter.getParamPath().getNext().toString() : null; String value = theFilter.getValue(); ReferenceParam referenceParam = new ReferenceParam(resourceType, chain, value); - return addPredicateReference(theResourceName, paramName, Collections.singletonList(referenceParam), operation, theRequest); + return addPredicate(theResourceName, paramName, Collections.singletonList(referenceParam), operation, theRequest); } else if (typeEnum == RestSearchParameterTypeEnum.QUANTITY) { return myPredicateBuilder.addPredicateQuantity(theResourceName, theFilter.getParamPath().getName(), Collections.singletonList(new QuantityParam(theFilter.getValue())), theFilter.getOperation()); } else if (typeEnum == RestSearchParameterTypeEnum.COMPOSITE) { @@ -786,7 +787,7 @@ class PredicateBuilderReference extends BasePredicateBuilder { orValues.addAll(next.getValuesAsQueryTokens()); } - Subquery subQ = myPredicateBuilder.createLinkSubquery(true, parameterName, targetResourceType, orValues, theRequest); + Subquery subQ = myPredicateBuilder.createLinkSubquery(parameterName, targetResourceType, orValues, theRequest); Join join = myQueryRoot.join("myResourceLinksAsTarget", JoinType.LEFT); Predicate pathPredicate = myPredicateBuilder.createResourceLinkPathPredicate(targetResourceType, paramReference, join); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderResourceId.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderResourceId.java index 1ffcbc0628e..0c4055d68d3 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderResourceId.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderResourceId.java @@ -37,9 +37,10 @@ class PredicateBuilderResourceId extends BasePredicateBuilder { super(theSearchBuilder); } + @Nullable Predicate addPredicateResourceId(List> theValues, String theResourceName, SearchFilterParser.CompareOperation theOperation, RequestDetails theRequest) { - Predicate nextPredicate = createPredicateResourceId(myQueryRoot.getRoot(), theResourceName, theValues, theOperation, theRequest); + Predicate nextPredicate = createPredicate(myQueryRoot.getRoot(), theResourceName, theValues, theOperation, theRequest); if (nextPredicate != null) { myQueryRoot.addPredicate(nextPredicate); @@ -50,7 +51,7 @@ class PredicateBuilderResourceId extends BasePredicateBuilder { } @Nullable - private Predicate createPredicateResourceId(Root theRoot, String theResourceName, List> theValues, SearchFilterParser.CompareOperation theOperation, RequestDetails theRequest) { + private Predicate createPredicate(Root theRoot, String theResourceName, List> theValues, SearchFilterParser.CompareOperation theOperation, RequestDetails theRequest) { Predicate nextPredicate = null; Set allOrPids = null; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderString.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderString.java index c4c92849c76..72e75266502 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderString.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderString.java @@ -22,16 +22,17 @@ import java.util.List; @Component @Scope("prototype") -class PredicateBuilderString extends BasePredicateBuilder { +class PredicateBuilderString extends BasePredicateBuilder implements IPredicateBuilder { PredicateBuilderString(SearchBuilder theSearchBuilder) { super(theSearchBuilder); } - Predicate addPredicateString(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation) { + @Override + public Predicate addPredicate(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation operation) { Join join = createJoin(SearchBuilderJoinEnum.STRING, theParamName); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderTag.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderTag.java index aaf157de92f..8d8ec10f566 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderTag.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderTag.java @@ -61,29 +61,6 @@ class PredicateBuilderTag extends BasePredicateBuilder { } } - /* - * We have a parameter of ResourceType?_tag:not=foo This means match resources that don't have the given tag(s) - */ - if (notTags.isEmpty() == false) { - // CriteriaBuilder builder = myEntityManager.getCriteriaBuilder(); - // CriteriaQuery cq = builder.createQuery(Long.class); - // Root from = cq.from(ResourceTable.class); - // cq.select(from.get("myId").as(Long.class)); - // - // Subquery subQ = cq.subquery(Long.class); - // Root subQfrom = subQ.from(ResourceTag.class); - // subQ.select(subQfrom.get("myResourceId").as(Long.class)); - // Predicate subQname = builder.equal(subQfrom.get("myParamName"), theParamName); - // Predicate subQtype = builder.equal(subQfrom.get("myResourceType"), myResourceName); - // subQ.where(builder.and(subQtype, subQname)); - // - // List predicates = new ArrayList(); - // predicates.add(builder.not(builder.in(from.get("myId")).value(subQ))); - // predicates.add(builder.equal(from.get("myResourceType"), myResourceName)); - // predicates.add(builder.isNull(from.get("myDeleted"))); - // createPredicateResourceId(builder, cq, predicates, from.get("myId").as(Long.class)); - } - for (List nextAndParams : theList) { boolean haveTags = false; for (IQueryParameterType nextParamUncasted : nextAndParams) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderToken.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderToken.java index 115cccf6129..90ccb2ddacb 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderToken.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderToken.java @@ -31,7 +31,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank; @Component @Scope("prototype") -class PredicateBuilderToken extends BasePredicateBuilder { +class PredicateBuilderToken extends BasePredicateBuilder implements IPredicateBuilder { @Autowired private ITermReadSvc myTerminologySvc; @Autowired @@ -43,10 +43,11 @@ class PredicateBuilderToken extends BasePredicateBuilder { myPredicateBuilder = thePredicateBuilder; } - Predicate addPredicateToken(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation) { + @Override + public Predicate addPredicate(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation operation) { if (theList.get(0).getMissing() != null) { Join join = createJoin(SearchBuilderJoinEnum.TOKEN, theParamName); @@ -178,19 +179,19 @@ class PredicateBuilderToken extends BasePredicateBuilder { // System only List systemOnlyCodes = sortedCodesList.stream().filter(t -> isBlank(t.getCode())).collect(Collectors.toList()); if (!systemOnlyCodes.isEmpty()) { - retVal.add(addPredicateToken(theResourceName, theParamName, theBuilder, theFrom, systemOnlyCodes, modifier, SearchBuilderTokenModeEnum.SYSTEM_ONLY)); + retVal.add(addPredicate(theResourceName, theParamName, theBuilder, theFrom, systemOnlyCodes, modifier, SearchBuilderTokenModeEnum.SYSTEM_ONLY)); } // Code only List codeOnlyCodes = sortedCodesList.stream().filter(t -> t.getSystem() == null).collect(Collectors.toList()); if (!codeOnlyCodes.isEmpty()) { - retVal.add(addPredicateToken(theResourceName, theParamName, theBuilder, theFrom, codeOnlyCodes, modifier, SearchBuilderTokenModeEnum.VALUE_ONLY)); + retVal.add(addPredicate(theResourceName, theParamName, theBuilder, theFrom, codeOnlyCodes, modifier, SearchBuilderTokenModeEnum.VALUE_ONLY)); } // System and code List systemAndCodeCodes = sortedCodesList.stream().filter(t -> isNotBlank(t.getCode()) && t.getSystem() != null).collect(Collectors.toList()); if (!systemAndCodeCodes.isEmpty()) { - retVal.add(addPredicateToken(theResourceName, theParamName, theBuilder, theFrom, systemAndCodeCodes, modifier, SearchBuilderTokenModeEnum.SYSTEM_AND_VALUE)); + retVal.add(addPredicate(theResourceName, theParamName, theBuilder, theFrom, systemAndCodeCodes, modifier, SearchBuilderTokenModeEnum.SYSTEM_AND_VALUE)); } return retVal; @@ -240,7 +241,7 @@ class PredicateBuilderToken extends BasePredicateBuilder { } } - private Predicate addPredicateToken(String theResourceName, String theParamName, CriteriaBuilder theBuilder, From theFrom, List theTokens, TokenParamModifier theModifier, SearchBuilderTokenModeEnum theTokenMode) { + private Predicate addPredicate(String theResourceName, String theParamName, CriteriaBuilder theBuilder, From theFrom, List theTokens, TokenParamModifier theModifier, SearchBuilderTokenModeEnum theTokenMode) { if (myDontUseHashesForSearch) { final Path systemExpression = theFrom.get("mySystem"); final Path valueExpression = theFrom.get("myValue"); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderUri.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderUri.java index 1bb8843f90e..c52ff10f4f5 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderUri.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderUri.java @@ -22,7 +22,7 @@ import java.util.List; @Component @Scope("prototype") -class PredicateBuilderUri extends BasePredicateBuilder { +class PredicateBuilderUri extends BasePredicateBuilder implements IPredicateBuilder { private static final Logger ourLog = LoggerFactory.getLogger(PredicateBuilderUri.class); @Autowired private IResourceIndexedSearchParamUriDao myResourceIndexedSearchParamUriDao; @@ -31,10 +31,11 @@ class PredicateBuilderUri extends BasePredicateBuilder { super(theSearchBuilder); } - Predicate addPredicateUri(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation) { + @Override + public Predicate addPredicate(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation operation) { Join join = createJoin(SearchBuilderJoinEnum.URI, theParamName);