diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fb818edbbe8..d3222478c07 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,7 +29,7 @@ jobs: env: JAVA_HOME_11_X64: /usr/local/openjdk-11 inputs: - goals: 'clean install' + goals: 'dependency:resolve clean install' # These are Maven CLI options (and show up in the build logs) - "-nsu"=Don't update snapshots. We can remove this when Maven OSS is more healthy options: '-P ALLMODULES,JACOCO,CI,ERRORPRONE -nsu -e -B -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' # These are JVM options (and don't show up in the build logs) diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/4_3_0/1772-allow-chain-on-type.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/4_3_0/1772-allow-chain-on-type.yaml index e62150f7c46..61454172e40 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/4_3_0/1772-allow-chain-on-type.yaml +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/4_3_0/1772-allow-chain-on-type.yaml @@ -2,4 +2,4 @@ type: add issue: 1772 title: "The JPA server now allows chained searches on the `_type` parameter. For example, the following - could be used to find all Encounters with a context of type Group: `Encounter?context._type=Group`." + could be used to find all Encounters with a context of type Group: `Encounter?subject._type=Group`." 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 12f377485cb..b891b12879f 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 @@ -64,7 +64,6 @@ import ca.uhn.fhir.rest.param.*; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; -import ca.uhn.fhir.util.UrlUtil; import com.google.common.collect.Lists; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -327,9 +326,8 @@ class PredicateBuilderReference extends BasePredicateBuilder { throw newInvalidResourceTypeException(typeValue); } if (!resourceTypes.contains(wantedType)) { - String searchParamName = theResourceName + ":" + theParamName; - String msg = myContext.getLocalizer().getMessage(PredicateBuilderReference.class, "invalidTargetTypeForChain", typeValue, searchParamName); - throw new InvalidRequestException(msg); + InvalidRequestException invalidRequestException = newInvalidTargetTypeForChainException(theResourceName, theParamName, typeValue); + throw invalidRequestException; } Predicate targetTypeParameter = myCriteriaBuilder.equal(theJoin.get("myTargetResourceType"), typeValue); @@ -409,12 +407,6 @@ class PredicateBuilderReference extends BasePredicateBuilder { return predicate; } - @NotNull - private InvalidRequestException newInvalidResourceTypeException(String theResourceType) { - String msg = myContext.getLocalizer().getMessageSanitized(PredicateBuilderReference.class, "invalidResourceType", theResourceType); - throw new InvalidRequestException(msg); - } - private void warnAboutPerformanceOnUnqualifiedResources(String theParamName, RequestDetails theRequest, List> theCandidateTargetTypes) { String message = new StringBuilder() .append("This search uses an unqualified resource(a parameter in a chain without a resource type). ") @@ -996,4 +988,18 @@ class PredicateBuilderReference extends BasePredicateBuilder { return retVal; } + + @NotNull + private InvalidRequestException newInvalidTargetTypeForChainException(String theResourceName, String theParamName, String theTypeValue) { + String searchParamName = theResourceName + ":" + theParamName; + String msg = myContext.getLocalizer().getMessage(PredicateBuilderReference.class, "invalidTargetTypeForChain", theTypeValue, searchParamName); + return new InvalidRequestException(msg); + } + + @NotNull + private InvalidRequestException newInvalidResourceTypeException(String theResourceType) { + String msg = myContext.getLocalizer().getMessageSanitized(PredicateBuilderReference.class, "invalidResourceType", theResourceType); + throw new InvalidRequestException(msg); + } + }