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 5bd78b4bd2f..446ae655808 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 @@ -13,6 +13,8 @@ import ca.uhn.fhir.rest.param.QuantityParam; import ca.uhn.fhir.rest.param.SpecialParam; import ca.uhn.fhir.rest.param.TokenParam; import org.hibernate.search.spatial.impl.Point; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.From; @@ -24,6 +26,8 @@ import java.util.List; import static org.apache.commons.lang3.StringUtils.isBlank; +@Component +@Scope("prototype") public class PredicateBuilderCoords extends BasePredicateBuilder { PredicateBuilderCoords(SearchBuilder theSearchBuilder) { 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 16438f6153e..bc7ccabb3ce 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 @@ -10,6 +10,8 @@ import ca.uhn.fhir.rest.param.ParamPrefixEnum; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.From; @@ -19,6 +21,8 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +@Component +@Scope("prototype") public class PredicateBuilderDate extends BasePredicateBuilder { private static final Logger ourLog = LoggerFactory.getLogger(PredicateBuilderDate.class); 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 08049df8c4c..6501a19efef 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 @@ -8,6 +8,8 @@ import ca.uhn.fhir.rest.param.NumberParam; import ca.uhn.fhir.rest.param.ParamPrefixEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import javax.persistence.criteria.*; import java.math.BigDecimal; @@ -16,7 +18,9 @@ import java.util.List; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; -public class PredicateBuilderNumber extends BasePredicateBuilder { +@Component +@Scope("prototype") +class PredicateBuilderNumber extends BasePredicateBuilder { private static final Logger ourLog = LoggerFactory.getLogger(PredicateBuilderNumber.class); PredicateBuilderNumber(SearchBuilder theSearchBuilder) { 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 3c102337133..548cae22933 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 @@ -8,6 +8,8 @@ import ca.uhn.fhir.model.api.IQueryParameterType; import ca.uhn.fhir.model.base.composite.BaseQuantityDt; import ca.uhn.fhir.rest.param.ParamPrefixEnum; import ca.uhn.fhir.rest.param.QuantityParam; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import javax.persistence.criteria.*; import java.math.BigDecimal; @@ -17,16 +19,18 @@ import java.util.List; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; import static org.apache.commons.lang3.StringUtils.isBlank; -public class PredicateBuilderQuantity extends BasePredicateBuilder { +@Component +@Scope("prototype") +class PredicateBuilderQuantity extends BasePredicateBuilder { PredicateBuilderQuantity(SearchBuilder theSearchBuilder) { super(theSearchBuilder); } - public Predicate addPredicateQuantity(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation) { + Predicate addPredicateQuantity(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 6b3b09e25cf..75006b03623 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 @@ -28,6 +28,8 @@ import org.hl7.fhir.instance.model.api.IIdType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import javax.persistence.criteria.*; import java.util.*; @@ -35,7 +37,9 @@ import java.util.*; import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.isNotBlank; -public class PredicateBuilderReference extends BasePredicateBuilder { +@Component +@Scope("prototype") +class PredicateBuilderReference extends BasePredicateBuilder { private static final Logger ourLog = LoggerFactory.getLogger(PredicateBuilderReference.class); @Autowired @@ -55,11 +59,11 @@ public class PredicateBuilderReference extends BasePredicateBuilder { /** * Add reference predicate to the current search */ - public Predicate addPredicateReference(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation, - RequestDetails theRequest) { + Predicate addPredicateReference(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation operation, + RequestDetails theRequest) { assert theParamName.contains(".") == false; 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 14988b7fda5..1ffcbc0628e 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 @@ -11,6 +11,8 @@ import org.hl7.fhir.r4.model.IdType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import javax.annotation.Nullable; import javax.persistence.criteria.Predicate; @@ -23,7 +25,9 @@ import java.util.Set; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; import static org.apache.commons.lang3.StringUtils.isNotBlank; -public class PredicateBuilderResourceId extends BasePredicateBuilder { +@Component +@Scope("prototype") +class PredicateBuilderResourceId extends BasePredicateBuilder { private static final Logger ourLog = LoggerFactory.getLogger(PredicateBuilderResourceId.class); @Autowired 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 d4c148cb1b7..c4c92849c76 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 @@ -10,6 +10,8 @@ import ca.uhn.fhir.rest.param.StringParam; import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.From; @@ -18,16 +20,18 @@ import javax.persistence.criteria.Predicate; import java.util.ArrayList; import java.util.List; -public class PredicateBuilderString extends BasePredicateBuilder { +@Component +@Scope("prototype") +class PredicateBuilderString extends BasePredicateBuilder { PredicateBuilderString(SearchBuilder theSearchBuilder) { super(theSearchBuilder); } - public Predicate addPredicateString(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation) { + Predicate addPredicateString(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 e5d3db0771c..5799c1cb614 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 @@ -18,20 +18,24 @@ import com.google.common.collect.Lists; import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import javax.persistence.criteria.*; import java.util.List; import static org.apache.commons.lang3.StringUtils.isNotBlank; -public class PredicateBuilderTag extends BasePredicateBuilder { +@Component +@Scope("prototype") +class PredicateBuilderTag extends BasePredicateBuilder { private static final Logger ourLog = LoggerFactory.getLogger(PredicateBuilderTag.class); PredicateBuilderTag(SearchBuilder theSearchBuilder) { super(theSearchBuilder); } - public void addPredicateTag(List> theList, String theParamName) { + void addPredicateTag(List> theList, String theParamName) { TagTypeEnum tagType; if (Constants.PARAM_TAG.equals(theParamName)) { tagType = TagTypeEnum.TAG; 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 9731df3c082..d51b341e12c 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 @@ -19,6 +19,8 @@ import com.google.common.collect.Sets; import org.hibernate.query.criteria.internal.CriteriaBuilderImpl; import org.hibernate.query.criteria.internal.predicate.BooleanStaticAssertionPredicate; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import javax.persistence.criteria.*; import java.util.*; @@ -27,7 +29,9 @@ import java.util.stream.Collectors; import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.isBlank; -public class PredicateBuilderToken extends BasePredicateBuilder { +@Component +@Scope("prototype") +class PredicateBuilderToken extends BasePredicateBuilder { @Autowired private ITermReadSvc myTerminologySvc; @Autowired @@ -39,10 +43,10 @@ public class PredicateBuilderToken extends BasePredicateBuilder { myPredicateBuilder = theSearchBuilder.getPredicateBuilder(); } - public Predicate addPredicateToken(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation) { + Predicate addPredicateToken(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation operation) { if (theList.get(0).getMissing() != null) { Join join = createJoin(SearchBuilderJoinEnum.TOKEN, theParamName); 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 d0ead348e43..1bb8843f90e 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 @@ -11,6 +11,8 @@ import ca.uhn.fhir.rest.param.UriParamQualifierEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; import javax.persistence.criteria.Join; import javax.persistence.criteria.Predicate; @@ -18,7 +20,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -public class PredicateBuilderUri extends BasePredicateBuilder { +@Component +@Scope("prototype") +class PredicateBuilderUri extends BasePredicateBuilder { private static final Logger ourLog = LoggerFactory.getLogger(PredicateBuilderUri.class); @Autowired private IResourceIndexedSearchParamUriDao myResourceIndexedSearchParamUriDao; @@ -27,10 +31,10 @@ public class PredicateBuilderUri extends BasePredicateBuilder { super(theSearchBuilder); } - public Predicate addPredicateUri(String theResourceName, - String theParamName, - List theList, - SearchFilterParser.CompareOperation operation) { + Predicate addPredicateUri(String theResourceName, + String theParamName, + List theList, + SearchFilterParser.CompareOperation operation) { Join join = createJoin(SearchBuilderJoinEnum.URI, theParamName);