From f9b8432d65f7b0541ac977a5edaec251ec2bbfb4 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Tue, 24 Mar 2015 18:39:19 -0400 Subject: [PATCH] Searching in JPA server with no search parameters returns deleted resources when it should exclude them --- hapi-fhir-android/dependency-reduced-pom.xml | 6 +- .../ca/uhn/fhir/context/ModelScanner.java | 8 +- .../uhn/fhir/context/RuntimeSearchParam.java | 10 +- .../fhir/rest/method/IncludeParameter.java | 3 +- .../method/RestSearchParameterTypeEnum.java} | 30 +++--- .../uhn/fhir/rest/method/SearchParameter.java | 93 +++++++++---------- .../uhn/fhir/rest/param/BaseAndListParam.java | 4 +- .../fhir/rest/param/BaseQueryParameter.java | 4 +- .../rest/param/CompositeAndListParam.java | 6 +- .../uhn/fhir/rest/param/DateAndListParam.java | 6 +- .../fhir/rest/param/NumberAndListParam.java | 6 +- .../fhir/rest/param/QuantityAndListParam.java | 6 +- .../rest/param/ReferenceAndListParam.java | 6 +- .../fhir/rest/param/StringAndListParam.java | 6 +- .../fhir/rest/param/TokenAndListParam.java | 6 +- .../uhn/fhir/rest/param/UriAndListParam.java | 6 +- .../java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java | 4 +- .../uhn/fhir/jpa/dao/BaseFhirResourceDao.java | 8 +- .../jpa/dao/SearchParamExtractorDstu1.java | 12 +-- .../jpa/dao/SearchParamExtractorDstu2.java | 12 +-- .../jpa/dao/FhirResourceDaoDstu2Test.java | 42 ++++++--- .../java/ca/uhn/fhir/context/NameChanges.java | 4 +- .../fhir/rest/server/DynamicSearchTest.java | 6 +- src/changes/changes.xml | 5 +- 24 files changed, 157 insertions(+), 142 deletions(-) rename hapi-fhir-base/src/main/java/ca/uhn/fhir/{model/dstu/valueset/RestSearchParameterType.java => rest/method/RestSearchParameterTypeEnum.java} (77%) diff --git a/hapi-fhir-android/dependency-reduced-pom.xml b/hapi-fhir-android/dependency-reduced-pom.xml index 75c68235a10..1e0c0d8a940 100644 --- a/hapi-fhir-android/dependency-reduced-pom.xml +++ b/hapi-fhir-android/dependency-reduced-pom.xml @@ -94,7 +94,7 @@ maven-assembly-plugin - 2.5.3 + ${maven_assembly_plugin_version} package @@ -104,8 +104,8 @@ true - /Users/t3903uhn/git/hapi-fhir/hapi-fhir-android/src/assembly/android-sources.xml - /Users/t3903uhn/git/hapi-fhir/hapi-fhir-android/src/assembly/android-javadoc.xml + ${project.basedir}/src/assembly/android-sources.xml + ${project.basedir}/src/assembly/android-javadoc.xml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java index 556faf1f89a..9f08d39687b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java @@ -78,10 +78,10 @@ import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; import ca.uhn.fhir.model.base.composite.BaseContainedDt; import ca.uhn.fhir.model.base.composite.BaseNarrativeDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.ICodedDatatype; import ca.uhn.fhir.model.primitive.XhtmlDt; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; import ca.uhn.fhir.util.ReflectionUtil; class ModelScanner { @@ -681,11 +681,11 @@ class ModelScanner { for (Field nextField : theClass.getFields()) { SearchParamDefinition searchParam = pullAnnotation(nextField, SearchParamDefinition.class); if (searchParam != null) { - RestSearchParameterType paramType = RestSearchParameterType.valueOf(searchParam.type().toUpperCase()); + RestSearchParameterTypeEnum paramType = RestSearchParameterTypeEnum.valueOf(searchParam.type().toUpperCase()); if (paramType == null) { throw new ConfigurationException("Search param " + searchParam.name() + " has an invalid type: " + searchParam.type()); } - if (paramType == RestSearchParameterType.COMPOSITE) { + if (paramType == RestSearchParameterTypeEnum.COMPOSITE) { compositeFields.put(nextField, searchParam); continue; } @@ -708,7 +708,7 @@ class ModelScanner { compositeOf.add(param); } - RuntimeSearchParam param = new RuntimeSearchParam(searchParam.name(), searchParam.description(), searchParam.path(), RestSearchParameterType.COMPOSITE, compositeOf); + RuntimeSearchParam param = new RuntimeSearchParam(searchParam.name(), searchParam.description(), searchParam.path(), RestSearchParameterTypeEnum.COMPOSITE, compositeOf); theResourceDef.addSearchParam(param); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java index 1f9ab186d12..374cf0cbe52 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java @@ -5,7 +5,7 @@ import java.util.Collections; import java.util.List; import java.util.StringTokenizer; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; /* * #%L @@ -31,15 +31,15 @@ public class RuntimeSearchParam { private String myDescription; private String myName; - private RestSearchParameterType myParamType; + private RestSearchParameterTypeEnum myParamType; private String myPath; private List myCompositeOf; - public RuntimeSearchParam(String theName, String theDescription, String thePath, RestSearchParameterType theParamType) { + public RuntimeSearchParam(String theName, String theDescription, String thePath, RestSearchParameterTypeEnum theParamType) { this(theName, theDescription, thePath, theParamType, null); } - public RuntimeSearchParam(String theName, String theDescription, String thePath, RestSearchParameterType theParamType, List theCompositeOf) { + public RuntimeSearchParam(String theName, String theDescription, String thePath, RestSearchParameterTypeEnum theParamType, List theCompositeOf) { super(); myName = theName; myDescription = theDescription; @@ -60,7 +60,7 @@ public class RuntimeSearchParam { return myName; } - public RestSearchParameterType getParamType() { + public RestSearchParameterTypeEnum getParamType() { return myParamType; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IncludeParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IncludeParameter.java index adea401d1ee..161754149cb 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IncludeParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IncludeParameter.java @@ -32,7 +32,6 @@ import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.PathSpecification; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; import ca.uhn.fhir.rest.annotation.IncludeParam; import ca.uhn.fhir.rest.param.BaseQueryParameter; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; @@ -99,7 +98,7 @@ class IncludeParameter extends BaseQueryParameter { } @Override - public RestSearchParameterType getParamType() { + public RestSearchParameterTypeEnum getParamType() { return null; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/RestSearchParameterType.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/RestSearchParameterTypeEnum.java similarity index 77% rename from hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/RestSearchParameterType.java rename to hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/RestSearchParameterTypeEnum.java index 4c13d9d61cc..e262936ecd8 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/RestSearchParameterType.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/RestSearchParameterTypeEnum.java @@ -1,5 +1,5 @@ -package ca.uhn.fhir.model.dstu.valueset; +package ca.uhn.fhir.rest.method; /* * #%L @@ -26,7 +26,7 @@ import java.util.Map; import ca.uhn.fhir.model.api.IValueSetEnumBinder; -public enum RestSearchParameterType { +public enum RestSearchParameterTypeEnum { /** * Code Value: number @@ -98,18 +98,18 @@ public enum RestSearchParameterType { */ public static final String VALUESET_NAME = "SearchParamType"; - private static Map CODE_TO_ENUM = new HashMap(); - private static Map> SYSTEM_TO_CODE_TO_ENUM = new HashMap>(); + private static Map CODE_TO_ENUM = new HashMap(); + private static Map> SYSTEM_TO_CODE_TO_ENUM = new HashMap>(); private final String myCode; private final String mySystem; static { - for (RestSearchParameterType next : RestSearchParameterType.values()) { + for (RestSearchParameterTypeEnum next : RestSearchParameterTypeEnum.values()) { CODE_TO_ENUM.put(next.getCode(), next); if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { - SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap()); + SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap()); } SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); } @@ -132,33 +132,33 @@ public enum RestSearchParameterType { /** * Returns the enumerated value associated with this code */ - public RestSearchParameterType forCode(String theCode) { - RestSearchParameterType retVal = CODE_TO_ENUM.get(theCode); + public RestSearchParameterTypeEnum forCode(String theCode) { + RestSearchParameterTypeEnum retVal = CODE_TO_ENUM.get(theCode); return retVal; } /** * Converts codes to their respective enumerated values */ - public static final IValueSetEnumBinder VALUESET_BINDER = new IValueSetEnumBinder() { + public static final IValueSetEnumBinder VALUESET_BINDER = new IValueSetEnumBinder() { @Override - public String toCodeString(RestSearchParameterType theEnum) { + public String toCodeString(RestSearchParameterTypeEnum theEnum) { return theEnum.getCode(); } @Override - public String toSystemString(RestSearchParameterType theEnum) { + public String toSystemString(RestSearchParameterTypeEnum theEnum) { return theEnum.getSystem(); } @Override - public RestSearchParameterType fromCodeString(String theCodeString) { + public RestSearchParameterTypeEnum fromCodeString(String theCodeString) { return CODE_TO_ENUM.get(theCodeString); } @Override - public RestSearchParameterType fromCodeString(String theCodeString, String theSystemString) { - Map map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); + public RestSearchParameterTypeEnum fromCodeString(String theCodeString, String theSystemString) { + Map map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); if (map == null) { return null; } @@ -170,7 +170,7 @@ public enum RestSearchParameterType { /** * Constructor */ - RestSearchParameterType(String theCode, String theSystem) { + RestSearchParameterTypeEnum(String theCode, String theSystem) { myCode = theCode; mySystem = theSystem; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchParameter.java index b139bde9434..dd717ff7264 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchParameter.java @@ -39,7 +39,6 @@ import ca.uhn.fhir.model.api.IQueryParameterType; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.base.composite.BaseIdentifierDt; import ca.uhn.fhir.model.base.composite.BaseQuantityDt; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.rest.annotation.OptionalParam; import ca.uhn.fhir.rest.param.BaseQueryParameter; @@ -81,56 +80,56 @@ import ca.uhn.fhir.util.CollectionUtil; public class SearchParameter extends BaseQueryParameter { private static final String EMPTY_STRING = ""; - private static HashMap> ourParamQualifiers; - private static HashMap, RestSearchParameterType> ourParamTypes; + private static HashMap> ourParamQualifiers; + private static HashMap, RestSearchParameterTypeEnum> ourParamTypes; static final String QUALIFIER_ANY_TYPE = ":*"; static { - ourParamTypes = new HashMap, RestSearchParameterType>(); - ourParamQualifiers = new HashMap>(); + ourParamTypes = new HashMap, RestSearchParameterTypeEnum>(); + ourParamQualifiers = new HashMap>(); - ourParamTypes.put(StringParam.class, RestSearchParameterType.STRING); - ourParamTypes.put(StringOrListParam.class, RestSearchParameterType.STRING); - ourParamTypes.put(StringAndListParam.class, RestSearchParameterType.STRING); - ourParamQualifiers.put(RestSearchParameterType.STRING, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); + ourParamTypes.put(StringParam.class, RestSearchParameterTypeEnum.STRING); + ourParamTypes.put(StringOrListParam.class, RestSearchParameterTypeEnum.STRING); + ourParamTypes.put(StringAndListParam.class, RestSearchParameterTypeEnum.STRING); + ourParamQualifiers.put(RestSearchParameterTypeEnum.STRING, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); - ourParamTypes.put(UriParam.class, RestSearchParameterType.URI); - ourParamTypes.put(UriOrListParam.class, RestSearchParameterType.URI); - ourParamTypes.put(UriAndListParam.class, RestSearchParameterType.URI); + ourParamTypes.put(UriParam.class, RestSearchParameterTypeEnum.URI); + ourParamTypes.put(UriOrListParam.class, RestSearchParameterTypeEnum.URI); + ourParamTypes.put(UriAndListParam.class, RestSearchParameterTypeEnum.URI); // TODO: are these right for URI? - ourParamQualifiers.put(RestSearchParameterType.URI, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); + ourParamQualifiers.put(RestSearchParameterTypeEnum.URI, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); - ourParamTypes.put(TokenParam.class, RestSearchParameterType.TOKEN); - ourParamTypes.put(TokenOrListParam.class, RestSearchParameterType.TOKEN); - ourParamTypes.put(TokenAndListParam.class, RestSearchParameterType.TOKEN); - ourParamQualifiers.put(RestSearchParameterType.TOKEN, CollectionUtil.newSet(Constants.PARAMQUALIFIER_TOKEN_TEXT, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); + ourParamTypes.put(TokenParam.class, RestSearchParameterTypeEnum.TOKEN); + ourParamTypes.put(TokenOrListParam.class, RestSearchParameterTypeEnum.TOKEN); + ourParamTypes.put(TokenAndListParam.class, RestSearchParameterTypeEnum.TOKEN); + ourParamQualifiers.put(RestSearchParameterTypeEnum.TOKEN, CollectionUtil.newSet(Constants.PARAMQUALIFIER_TOKEN_TEXT, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); - ourParamTypes.put(DateParam.class, RestSearchParameterType.DATE); - ourParamTypes.put(DateOrListParam.class, RestSearchParameterType.DATE); - ourParamTypes.put(DateAndListParam.class, RestSearchParameterType.DATE); - ourParamTypes.put(DateRangeParam.class, RestSearchParameterType.DATE); - ourParamQualifiers.put(RestSearchParameterType.DATE, CollectionUtil.newSet(Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); + ourParamTypes.put(DateParam.class, RestSearchParameterTypeEnum.DATE); + ourParamTypes.put(DateOrListParam.class, RestSearchParameterTypeEnum.DATE); + ourParamTypes.put(DateAndListParam.class, RestSearchParameterTypeEnum.DATE); + ourParamTypes.put(DateRangeParam.class, RestSearchParameterTypeEnum.DATE); + ourParamQualifiers.put(RestSearchParameterTypeEnum.DATE, CollectionUtil.newSet(Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); - ourParamTypes.put(QuantityParam.class, RestSearchParameterType.QUANTITY); - ourParamTypes.put(QuantityOrListParam.class, RestSearchParameterType.QUANTITY); - ourParamTypes.put(QuantityAndListParam.class, RestSearchParameterType.QUANTITY); - ourParamQualifiers.put(RestSearchParameterType.QUANTITY, CollectionUtil.newSet(Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); + ourParamTypes.put(QuantityParam.class, RestSearchParameterTypeEnum.QUANTITY); + ourParamTypes.put(QuantityOrListParam.class, RestSearchParameterTypeEnum.QUANTITY); + ourParamTypes.put(QuantityAndListParam.class, RestSearchParameterTypeEnum.QUANTITY); + ourParamQualifiers.put(RestSearchParameterTypeEnum.QUANTITY, CollectionUtil.newSet(Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); - ourParamTypes.put(NumberParam.class, RestSearchParameterType.NUMBER); - ourParamTypes.put(NumberOrListParam.class, RestSearchParameterType.NUMBER); - ourParamTypes.put(NumberAndListParam.class, RestSearchParameterType.NUMBER); - ourParamQualifiers.put(RestSearchParameterType.NUMBER, CollectionUtil.newSet(Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); + ourParamTypes.put(NumberParam.class, RestSearchParameterTypeEnum.NUMBER); + ourParamTypes.put(NumberOrListParam.class, RestSearchParameterTypeEnum.NUMBER); + ourParamTypes.put(NumberAndListParam.class, RestSearchParameterTypeEnum.NUMBER); + ourParamQualifiers.put(RestSearchParameterTypeEnum.NUMBER, CollectionUtil.newSet(Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); - ourParamTypes.put(ReferenceParam.class, RestSearchParameterType.REFERENCE); - ourParamTypes.put(ReferenceOrListParam.class, RestSearchParameterType.REFERENCE); - ourParamTypes.put(ReferenceAndListParam.class, RestSearchParameterType.REFERENCE); + ourParamTypes.put(ReferenceParam.class, RestSearchParameterTypeEnum.REFERENCE); + ourParamTypes.put(ReferenceOrListParam.class, RestSearchParameterTypeEnum.REFERENCE); + ourParamTypes.put(ReferenceAndListParam.class, RestSearchParameterTypeEnum.REFERENCE); // --vvvv-- no empty because that gets added from OptionalParam#chainWhitelist - ourParamQualifiers.put(RestSearchParameterType.REFERENCE, CollectionUtil.newSet(Constants.PARAMQUALIFIER_MISSING)); + ourParamQualifiers.put(RestSearchParameterTypeEnum.REFERENCE, CollectionUtil.newSet(Constants.PARAMQUALIFIER_MISSING)); - ourParamTypes.put(CompositeParam.class, RestSearchParameterType.COMPOSITE); - ourParamTypes.put(CompositeOrListParam.class, RestSearchParameterType.COMPOSITE); - ourParamTypes.put(CompositeAndListParam.class, RestSearchParameterType.COMPOSITE); - ourParamQualifiers.put(RestSearchParameterType.COMPOSITE, CollectionUtil.newSet(Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); + ourParamTypes.put(CompositeParam.class, RestSearchParameterTypeEnum.COMPOSITE); + ourParamTypes.put(CompositeOrListParam.class, RestSearchParameterTypeEnum.COMPOSITE); + ourParamTypes.put(CompositeAndListParam.class, RestSearchParameterTypeEnum.COMPOSITE); + ourParamQualifiers.put(RestSearchParameterTypeEnum.COMPOSITE, CollectionUtil.newSet(Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); } private List> myCompositeTypes; @@ -138,7 +137,7 @@ public class SearchParameter extends BaseQueryParameter { private String myDescription; private String myName; private IParamBinder myParamBinder; - private RestSearchParameterType myParamType; + private RestSearchParameterTypeEnum myParamType; private Set myQualifierBlacklist; private Set myQualifierWhitelist; private boolean myRequired; @@ -188,7 +187,7 @@ public class SearchParameter extends BaseQueryParameter { } @Override - public RestSearchParameterType getParamType() { + public RestSearchParameterTypeEnum getParamType() { return myParamType; } @@ -283,12 +282,12 @@ public class SearchParameter extends BaseQueryParameter { myParamBinder = new QueryParameterAndBinder((Class>) type, myCompositeTypes); } else if (String.class.equals(type)) { myParamBinder = new StringBinder(); - myParamType = RestSearchParameterType.STRING; + myParamType = RestSearchParameterTypeEnum.STRING; } else { throw new ConfigurationException("Unsupported data type for parameter: " + type.getCanonicalName()); } - RestSearchParameterType typeEnum = ourParamTypes.get(type); + RestSearchParameterTypeEnum typeEnum = ourParamTypes.get(type); if (typeEnum != null) { Set builtInQualifiers = ourParamQualifiers.get(typeEnum); if (builtInQualifiers != null) { @@ -310,15 +309,15 @@ public class SearchParameter extends BaseQueryParameter { if (myParamType != null) { // ok } else if (StringDt.class.isAssignableFrom(type)) { - myParamType = RestSearchParameterType.STRING; + myParamType = RestSearchParameterTypeEnum.STRING; } else if (QualifiedDateParam.class.isAssignableFrom(type)) { - myParamType = RestSearchParameterType.DATE; + myParamType = RestSearchParameterTypeEnum.DATE; } else if (BaseIdentifierDt.class.isAssignableFrom(type)) { - myParamType = RestSearchParameterType.TOKEN; + myParamType = RestSearchParameterTypeEnum.TOKEN; } else if (BaseQuantityDt.class.isAssignableFrom(type)) { - myParamType = RestSearchParameterType.QUANTITY; + myParamType = RestSearchParameterTypeEnum.QUANTITY; } else if (ReferenceParam.class.isAssignableFrom(type)) { - myParamType = RestSearchParameterType.REFERENCE; + myParamType = RestSearchParameterTypeEnum.REFERENCE; } else { throw new ConfigurationException("Unknown search parameter type: " + type); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseAndListParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseAndListParam.java index ecbf0a72f2b..f8561788295 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseAndListParam.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseAndListParam.java @@ -25,8 +25,8 @@ import java.util.List; import ca.uhn.fhir.model.api.IQueryParameterAnd; import ca.uhn.fhir.model.api.IQueryParameterOr; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; import ca.uhn.fhir.rest.method.QualifiedParamList; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; public abstract class BaseAndListParam> implements IQueryParameterAnd { @@ -47,7 +47,7 @@ public abstract class BaseAndListParam> implement } } - public abstract RestSearchParameterType getSearchParamType(); + public abstract RestSearchParameterTypeEnum getSearchParamType(); abstract T newInstance(); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseQueryParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseQueryParameter.java index 6c206e78994..117d1c88831 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseQueryParameter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/BaseQueryParameter.java @@ -31,11 +31,11 @@ import org.apache.commons.lang3.StringUtils; import org.hl7.fhir.instance.model.IBaseResource; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; import ca.uhn.fhir.rest.method.IParameter; import ca.uhn.fhir.rest.method.QualifiedParamList; import ca.uhn.fhir.rest.method.Request; import ca.uhn.fhir.rest.method.RequestDetails; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; import ca.uhn.fhir.rest.method.SearchMethodBinding; import ca.uhn.fhir.rest.method.SearchMethodBinding.QualifierDetails; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; @@ -49,7 +49,7 @@ public abstract class BaseQueryParameter implements IParameter { public abstract String getName(); - public abstract RestSearchParameterType getParamType(); + public abstract RestSearchParameterTypeEnum getParamType(); /** * Returns null if blacklist is "none" diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/CompositeAndListParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/CompositeAndListParam.java index 8a45e89c59b..f5da3b6d9de 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/CompositeAndListParam.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/CompositeAndListParam.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.rest.param; import ca.uhn.fhir.model.api.IQueryParameterType; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; /* * #%L @@ -41,8 +41,8 @@ public class CompositeAndListParam { } @Override - public RestSearchParameterType getSearchParamType() { - return RestSearchParameterType.DATE; + public RestSearchParameterTypeEnum getSearchParamType() { + return RestSearchParameterTypeEnum.DATE; } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/NumberAndListParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/NumberAndListParam.java index f2daae4420d..bd528ebf069 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/NumberAndListParam.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/NumberAndListParam.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.rest.param; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; /* * #%L @@ -31,8 +31,8 @@ public class NumberAndListParam extends BaseAndListParam { } @Override - public RestSearchParameterType getSearchParamType() { - return RestSearchParameterType.NUMBER; + public RestSearchParameterTypeEnum getSearchParamType() { + return RestSearchParameterTypeEnum.NUMBER; } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/QuantityAndListParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/QuantityAndListParam.java index 516480502ba..5ced5983490 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/QuantityAndListParam.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/QuantityAndListParam.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.rest.param; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; /* * #%L @@ -31,8 +31,8 @@ public class QuantityAndListParam extends BaseAndListParam } @Override - public RestSearchParameterType getSearchParamType() { - return RestSearchParameterType.QUANTITY; + public RestSearchParameterTypeEnum getSearchParamType() { + return RestSearchParameterTypeEnum.QUANTITY; } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ReferenceAndListParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ReferenceAndListParam.java index 033a97453df..9834b98e245 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ReferenceAndListParam.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ReferenceAndListParam.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.rest.param; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; /* * #%L @@ -31,8 +31,8 @@ public class ReferenceAndListParam extends BaseAndListParam { } @Override - public RestSearchParameterType getSearchParamType() { - return RestSearchParameterType.STRING; + public RestSearchParameterTypeEnum getSearchParamType() { + return RestSearchParameterTypeEnum.STRING; } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/TokenAndListParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/TokenAndListParam.java index 0e7f25c67a8..33606496da5 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/TokenAndListParam.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/TokenAndListParam.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.rest.param; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; /* * #%L @@ -31,8 +31,8 @@ public class TokenAndListParam extends BaseAndListParam { } @Override - public RestSearchParameterType getSearchParamType() { - return RestSearchParameterType.TOKEN; + public RestSearchParameterTypeEnum getSearchParamType() { + return RestSearchParameterTypeEnum.TOKEN; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/UriAndListParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/UriAndListParam.java index 720169f1231..4bc0f1522a3 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/UriAndListParam.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/UriAndListParam.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.rest.param; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; /* * #%L @@ -31,8 +31,8 @@ public class UriAndListParam extends BaseAndListParam { } @Override - public RestSearchParameterType getSearchParamType() { - return RestSearchParameterType.URI; + public RestSearchParameterTypeEnum getSearchParamType() { + return RestSearchParameterTypeEnum.URI; } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java index 4eab5aa0b02..809299db977 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java @@ -90,7 +90,6 @@ import ca.uhn.fhir.model.api.Tag; import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.base.composite.BaseCodingDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; import ca.uhn.fhir.model.dstu2.composite.MetaDt; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.InstantDt; @@ -98,6 +97,7 @@ import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.method.MethodUtil; import ca.uhn.fhir.rest.method.QualifiedParamList; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; import ca.uhn.fhir.rest.server.IBundleProvider; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -160,7 +160,7 @@ public abstract class BaseFhirDao implements IDao { RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource); for (RuntimeSearchParam nextSpDef : def.getSearchParams()) { - if (nextSpDef.getParamType() != RestSearchParameterType.REFERENCE) { + if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.REFERENCE) { continue; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirResourceDao.java index 5b7ec559317..79e876a5e1b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirResourceDao.java @@ -96,7 +96,6 @@ import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.dstu.resource.OperationOutcome; import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum; import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; import ca.uhn.fhir.model.dstu2.composite.CodingDt; import ca.uhn.fhir.model.dstu2.composite.MetaDt; import ca.uhn.fhir.model.primitive.IdDt; @@ -105,6 +104,7 @@ import ca.uhn.fhir.model.primitive.UriDt; import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum; import ca.uhn.fhir.rest.api.SortOrderEnum; import ca.uhn.fhir.rest.api.SortSpec; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; import ca.uhn.fhir.rest.param.CompositeParam; import ca.uhn.fhir.rest.param.DateParam; import ca.uhn.fhir.rest.param.DateRangeParam; @@ -1150,7 +1150,7 @@ public abstract class BaseFhirResourceDao extends BaseFhirD if (sp == null) { throw new ConfigurationException("Unknown search param on resource[" + myResourceName + "] for secondary key[" + mySecondaryPrimaryKeyParamName + "]"); } - if (sp.getParamType() != RestSearchParameterType.TOKEN) { + if (sp.getParamType() != RestSearchParameterTypeEnum.TOKEN) { throw new ConfigurationException("Search param on resource[" + myResourceName + "] for secondary key[" + mySecondaryPrimaryKeyParamName + "] is not a token type, only token is supported"); } @@ -1278,7 +1278,9 @@ public abstract class BaseFhirResourceDao extends BaseFhirD CriteriaQuery cq = builder.createTupleQuery(); Root from = cq.from(ResourceTable.class); cq.multiselect(from.get("myId").as(Long.class)); - cq.where(builder.equal(from.get("myResourceType"), myResourceName)); + Predicate typeEquals = builder.equal(from.get("myResourceType"), myResourceName); + Predicate notDeleted = builder.isNotNull(from.get("myDeleted")); + cq.where(builder.and(typeEquals, notDeleted)); TypedQuery query = myEntityManager.createQuery(cq); for (Tuple next : query.getResultList()) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParamExtractorDstu1.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParamExtractorDstu1.java index dfbd1c61811..33ebb63a792 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParamExtractorDstu1.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParamExtractorDstu1.java @@ -59,11 +59,11 @@ import ca.uhn.fhir.model.dstu.composite.HumanNameDt; import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.PeriodDt; import ca.uhn.fhir.model.dstu.composite.QuantityDt; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; import ca.uhn.fhir.model.primitive.BaseDateTimeDt; import ca.uhn.fhir.model.primitive.IntegerDt; import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.UriDt; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; class SearchParamExtractorDstu1 extends BaseSearchParamExtractor implements ISearchParamExtractor { @@ -77,7 +77,7 @@ class SearchParamExtractorDstu1 extends BaseSearchParamExtractor implements ISea RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource); for (RuntimeSearchParam nextSpDef : def.getSearchParams()) { - if (nextSpDef.getParamType() != RestSearchParameterType.DATE) { + if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.DATE) { continue; } @@ -134,7 +134,7 @@ class SearchParamExtractorDstu1 extends BaseSearchParamExtractor implements ISea RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource); for (RuntimeSearchParam nextSpDef : def.getSearchParams()) { - if (nextSpDef.getParamType() != RestSearchParameterType.NUMBER) { + if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.NUMBER) { continue; } @@ -231,7 +231,7 @@ class SearchParamExtractorDstu1 extends BaseSearchParamExtractor implements ISea RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource); for (RuntimeSearchParam nextSpDef : def.getSearchParams()) { - if (nextSpDef.getParamType() != RestSearchParameterType.QUANTITY) { + if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.QUANTITY) { continue; } @@ -281,7 +281,7 @@ class SearchParamExtractorDstu1 extends BaseSearchParamExtractor implements ISea RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource); for (RuntimeSearchParam nextSpDef : def.getSearchParams()) { - if (nextSpDef.getParamType() != RestSearchParameterType.STRING) { + if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.STRING) { continue; } @@ -369,7 +369,7 @@ class SearchParamExtractorDstu1 extends BaseSearchParamExtractor implements ISea RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource); for (RuntimeSearchParam nextSpDef : def.getSearchParams()) { - if (nextSpDef.getParamType() != RestSearchParameterType.TOKEN) { + if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.TOKEN) { continue; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParamExtractorDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParamExtractorDstu2.java index 26297a73ad8..0683a51b025 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParamExtractorDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParamExtractorDstu2.java @@ -49,7 +49,6 @@ import ca.uhn.fhir.model.api.IDatatype; import ca.uhn.fhir.model.api.IPrimitiveDatatype; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.base.composite.BaseHumanNameDt; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; import ca.uhn.fhir.model.dstu2.composite.AddressDt; import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu2.composite.CodingDt; @@ -65,6 +64,7 @@ import ca.uhn.fhir.model.primitive.BaseDateTimeDt; import ca.uhn.fhir.model.primitive.IntegerDt; import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.UriDt; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; class SearchParamExtractorDstu2 extends BaseSearchParamExtractor implements ISearchParamExtractor { @@ -84,7 +84,7 @@ class SearchParamExtractorDstu2 extends BaseSearchParamExtractor implements ISea RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource); for (RuntimeSearchParam nextSpDef : def.getSearchParams()) { - if (nextSpDef.getParamType() != RestSearchParameterType.DATE) { + if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.DATE) { continue; } @@ -147,7 +147,7 @@ class SearchParamExtractorDstu2 extends BaseSearchParamExtractor implements ISea RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource); for (RuntimeSearchParam nextSpDef : def.getSearchParams()) { - if (nextSpDef.getParamType() != RestSearchParameterType.NUMBER) { + if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.NUMBER) { continue; } @@ -250,7 +250,7 @@ class SearchParamExtractorDstu2 extends BaseSearchParamExtractor implements ISea RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource); for (RuntimeSearchParam nextSpDef : def.getSearchParams()) { - if (nextSpDef.getParamType() != RestSearchParameterType.QUANTITY) { + if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.QUANTITY) { continue; } @@ -306,7 +306,7 @@ class SearchParamExtractorDstu2 extends BaseSearchParamExtractor implements ISea RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource); for (RuntimeSearchParam nextSpDef : def.getSearchParams()) { - if (nextSpDef.getParamType() != RestSearchParameterType.STRING) { + if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.STRING) { continue; } @@ -400,7 +400,7 @@ class SearchParamExtractorDstu2 extends BaseSearchParamExtractor implements ISea RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource); for (RuntimeSearchParam nextSpDef : def.getSearchParams()) { - if (nextSpDef.getParamType() != RestSearchParameterType.TOKEN) { + if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.TOKEN) { continue; } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu2Test.java index b8251b9a4b9..a7c4f1db3b6 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu2Test.java @@ -1753,21 +1753,6 @@ public class FhirResourceDaoDstu2Test { } - @Test - public void testSearchWithNoResults() { - IBundleProvider value = ourDeviceDao.search(new SearchParameterMap()); - for (IResource next : value.getResources(0, value.size())) { - ourDeviceDao.delete(next.getId()); - } - - value = ourDeviceDao.search(new SearchParameterMap()); - assertEquals(0, value.size()); - - List res = value.getResources(0, 0); - assertTrue(res.isEmpty()); - - } - @Test public void testSortByDate() { Patient p = new Patient(); @@ -2343,4 +2328,31 @@ public class FhirResourceDaoDstu2Test { FhirSystemDaoDstu2Test.doDeleteEverything(ourSystemDao); } + + @Test + public void testSearchWithNoResults() { + Device dev = new Device(); + dev.addIdentifier().setSystem("Foo"); + ourDeviceDao.create(dev); + + + IBundleProvider value = ourDeviceDao.search(new SearchParameterMap()); + ourLog.info("Initial size: " + value.size()); + for (IResource next : value.getResources(0, value.size())) { + ourLog.info("Deleting: {}", next.getId()); + ourDeviceDao.delete(next.getId()); + } + + value = ourDeviceDao.search(new SearchParameterMap()); + if (value.size() > 0) { + ourLog.info("Found: " + (value.getResources(0, 1).get(0).getId())); + fail(ourFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(value.getResources(0, 1).get(0))); + } + assertEquals(0, value.size()); + + List res = value.getResources(0, 0); + assertTrue(res.isEmpty()); + + } + } diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/context/NameChanges.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/context/NameChanges.java index 9dbac7ac9f2..809a83ce99b 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/context/NameChanges.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/context/NameChanges.java @@ -8,7 +8,7 @@ import org.junit.Test; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.dstu.resource.Patient; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.ClassPath; @@ -30,7 +30,7 @@ public class NameChanges { RuntimeResourceDefinition def = ctx.getResourceDefinition((Class) Class.forName(classInfo.getName())); for (RuntimeSearchParam nextParam : def.getSearchParams()) { - if (nextParam.getParamType() == RestSearchParameterType.COMPOSITE) { + if (nextParam.getParamType() == RestSearchParameterTypeEnum.COMPOSITE) { continue; } diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/DynamicSearchTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/DynamicSearchTest.java index e69c6813b9d..278bdbb4855 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/DynamicSearchTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/DynamicSearchTest.java @@ -26,9 +26,9 @@ import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.dstu.resource.Conformance; import ca.uhn.fhir.model.dstu.resource.Patient; -import ca.uhn.fhir.model.dstu.valueset.RestSearchParameterType; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.rest.annotation.Search; +import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum; import ca.uhn.fhir.rest.param.StringAndListParam; import ca.uhn.fhir.rest.param.StringOrListParam; import ca.uhn.fhir.rest.param.StringParam; @@ -173,8 +173,8 @@ public class DynamicSearchTest { @Override public List getSearchParameters() { ArrayList retVal = new ArrayList(); - retVal.add(new RuntimeSearchParam("param1", "This is the first parameter", "Patient.param1", RestSearchParameterType.STRING)); - retVal.add(new RuntimeSearchParam("param2", "This is the second parameter", "Patient.param2", RestSearchParameterType.DATE)); + retVal.add(new RuntimeSearchParam("param1", "This is the first parameter", "Patient.param1", RestSearchParameterTypeEnum.STRING)); + retVal.add(new RuntimeSearchParam("param2", "This is the second parameter", "Patient.param2", RestSearchParameterTypeEnum.DATE)); return retVal; } diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 391e6f519c0..e737a56e7dc 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -64,11 +64,14 @@ reference if the base matches the base for the server giving the response. - + Narrative generator incorrectly sets the Resource.text.status to 'generated' even if the given resource type does not have a template (and therefore no narrative is actually generated). Thanks to Bill de Beaubien for reporting! + + Searching in JPA server with no search parameter returns deleted resources when it should exclude them. +