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

View File

@ -346,7 +346,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
.returnBundle(Bundle.class)
.execute();
} 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));
// Search param on extension
myCaptureQueriesListener.clear();
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg=" + orgId.getValue());
myCaptureQueriesListener.logSelectQueries();
assertThat(idValues, contains(pid));
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg.name=ORGANIZATION");
assertThat(idValues, contains(pid));
myCaptureQueriesListener.clear();
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg.extorgorg.name=PARENT");
myCaptureQueriesListener.logSelectQueries();
assertThat(idValues, contains(pid));
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient?extpatorg.extorgorg.extorgorg.name=GRANDPARENT");