This commit is contained in:
jamesagnew 2020-03-24 07:55:25 -04:00
parent bb4cbb6af5
commit 718c248c69
3 changed files with 6 additions and 7 deletions

View File

@ -315,8 +315,7 @@ class PredicateBuilderReference extends BasePredicateBuilder {
} }
// Handle chain on _type // Handle chain on _type
String chain = theReferenceParam.getChain(); if (Constants.PARAM_TYPE.equals(theReferenceParam.getChain())) {
if (Constants.PARAM_TYPE.equals(chain)) {
String typeValue = theReferenceParam.getValue(); String typeValue = theReferenceParam.getValue();
Class<? extends IBaseResource> wantedType; Class<? extends IBaseResource> wantedType;
@ -326,8 +325,7 @@ class PredicateBuilderReference extends BasePredicateBuilder {
throw newInvalidResourceTypeException(typeValue); throw newInvalidResourceTypeException(typeValue);
} }
if (!resourceTypes.contains(wantedType)) { if (!resourceTypes.contains(wantedType)) {
InvalidRequestException invalidRequestException = newInvalidTargetTypeForChainException(theResourceName, theParamName, typeValue); throw newInvalidTargetTypeForChainException(theResourceName, theParamName, typeValue);
throw invalidRequestException;
} }
Predicate targetTypeParameter = myCriteriaBuilder.equal(theJoin.get("myTargetResourceType"), typeValue); Predicate targetTypeParameter = myCriteriaBuilder.equal(theJoin.get("myTargetResourceType"), typeValue);
@ -338,6 +336,7 @@ class PredicateBuilderReference extends BasePredicateBuilder {
boolean foundChainMatch = false; boolean foundChainMatch = false;
List<Class<? extends IBaseResource>> candidateTargetTypes = new ArrayList<>(); List<Class<? extends IBaseResource>> candidateTargetTypes = new ArrayList<>();
for (Class<? extends IBaseResource> nextType : resourceTypes) { for (Class<? extends IBaseResource> nextType : resourceTypes) {
String chain = theReferenceParam.getChain();
String remainingChain = null; String remainingChain = null;
int chainDotIndex = chain.indexOf('.'); int chainDotIndex = chain.indexOf('.');

View File

@ -346,7 +346,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
.returnBundle(Bundle.class) .returnBundle(Bundle.class)
.execute(); .execute();
} catch (InvalidRequestException e) { } catch (InvalidRequestException e) {
assertEquals("HTTP 400 Bad Request: Invalid resource type: FOO", e.getMessage()); assertEquals("HTTP 400 Bad Request: Invalid/unsupported resource type: \"FOO\"", e.getMessage());
} }
} }

View File

@ -405,15 +405,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertThat(idValues, contains(pid)); assertThat(idValues, contains(pid));
// Search param on extension // Search param on extension
myCaptureQueriesListener.clear();
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg=" + orgId.getValue()); idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg=" + orgId.getValue());
myCaptureQueriesListener.logSelectQueries();
assertThat(idValues, contains(pid)); assertThat(idValues, contains(pid));
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg.name=ORGANIZATION"); idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg.name=ORGANIZATION");
assertThat(idValues, contains(pid)); assertThat(idValues, contains(pid));
myCaptureQueriesListener.clear();
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg.extorgorg.name=PARENT"); idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg.extorgorg.name=PARENT");
myCaptureQueriesListener.logSelectQueries();
assertThat(idValues, contains(pid)); assertThat(idValues, contains(pid));
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg.extorgorg.extorgorg.name=GRANDPARENT"); idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg.extorgorg.extorgorg.name=GRANDPARENT");