diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml
index e7b4678dcaf..e70a9982ec0 100644
--- a/hapi-deployable-pom/pom.xml
+++ b/hapi-deployable-pom/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml
index 5080a741de5..fcc0073c6c9 100644
--- a/hapi-fhir-android/pom.xml
+++ b/hapi-fhir-android/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml
index cf2f5a9d5c8..4250734be2e 100644
--- a/hapi-fhir-base/pom.xml
+++ b/hapi-fhir-base/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java
index 168a6995b65..73970ce82fe 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java
@@ -225,6 +225,14 @@ public class FhirContext {
}
+
+ /**
+ * @since 5.6.0
+ */
+ public static FhirContext forDstu2Cached() {
+ return forCached(FhirVersionEnum.DSTU2);
+ }
+
/**
* @since 5.5.0
*/
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 a03d8d39414..e691c080d1c 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
@@ -73,7 +73,6 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
class ModelScanner {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ModelScanner.class);
-
private Map, BaseRuntimeElementDefinition>> myClassToElementDefinitions = new HashMap<>();
private FhirContext myContext;
private Map myIdToResourceDefinition = new HashMap<>();
@@ -90,6 +89,7 @@ class ModelScanner {
@Nonnull Collection> theResourceTypes) throws ConfigurationException {
myContext = theContext;
myVersion = theVersion;
+
Set> toScan = new HashSet<>(theResourceTypes);
init(theExistingDefinitions, toScan);
}
@@ -405,8 +405,8 @@ class ModelScanner {
List components = null;
if (paramType == RestSearchParameterTypeEnum.COMPOSITE) {
components = new ArrayList<>();
- for (String next : searchParam.compositeOf()) {
- String ref = "http://hl7.org/fhir/SearchParameter/" + theResourceDef.getName().toLowerCase() + "-" + next;
+ for (String name : searchParam.compositeOf()) {
+ String ref = toCanonicalSearchParameterUri(theResourceDef, name);
components.add(new RuntimeSearchParam.Component(null, ref));
}
}
@@ -414,7 +414,8 @@ class ModelScanner {
Collection base = Collections.singletonList(theResourceDef.getName());
String url = null;
if (theResourceDef.isStandardType()) {
- url = "http://hl7.org/fhir/SearchParameter/" + theResourceDef.getName().toLowerCase() + "-" + searchParam.name();
+ String name = searchParam.name();
+ url = toCanonicalSearchParameterUri(theResourceDef, name);
}
RuntimeSearchParam param = new RuntimeSearchParam(null, url, searchParam.name(), searchParam.description(), searchParam.path(), paramType, providesMembershipInCompartments, toTargetList(searchParam.target()), RuntimeSearchParamStatusEnum.ACTIVE, null, components, base);
theResourceDef.addSearchParam(param);
@@ -424,6 +425,10 @@ class ModelScanner {
}
+ private String toCanonicalSearchParameterUri(RuntimeResourceDefinition theResourceDef, String theName) {
+ return "http://hl7.org/fhir/SearchParameter/" + theResourceDef.getName() + "-" + theName;
+ }
+
private Set toTargetList(Class extends IBaseResource>[] theTarget) {
HashSet retVal = new HashSet<>();
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 746deccd120..d1cb595f7d4 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
@@ -233,18 +233,7 @@ public class RuntimeSearchParam {
}
public List getPathsSplit() {
- String path = getPath();
- if (path.indexOf('|') == -1) {
- return Collections.singletonList(path);
- }
-
- List retVal = new ArrayList<>();
- StringTokenizer tok = new StringTokenizer(path, "|");
- while (tok.hasMoreElements()) {
- String nextPath = tok.nextToken().trim();
- retVal.add(nextPath.trim());
- }
- return retVal;
+ return getPathsSplitForResourceType(null);
}
/**
@@ -266,6 +255,41 @@ public class RuntimeSearchParam {
return myPhoneticEncoder.encode(theString);
}
+ public List getPathsSplitForResourceType(@Nullable String theResourceName) {
+ String path = getPath();
+ if (path.indexOf('|') == -1) {
+ if (theResourceName != null && !pathMatchesResourceType(theResourceName, path)) {
+ return Collections.emptyList();
+ }
+ return Collections.singletonList(path);
+ }
+
+ List retVal = new ArrayList<>();
+ StringTokenizer tok = new StringTokenizer(path, "|");
+ while (tok.hasMoreElements()) {
+ String nextPath = tok.nextToken().trim();
+ if (theResourceName != null && !pathMatchesResourceType(theResourceName, nextPath)) {
+ continue;
+ }
+ retVal.add(nextPath.trim());
+ }
+ return retVal;
+ }
+
+ private boolean pathMatchesResourceType(String theResourceName, String thePath) {
+ if (thePath.startsWith(theResourceName + ".")) {
+ return true;
+ }
+ if (thePath.startsWith("Resouce.") || thePath.startsWith("DomainResource.")) {
+ return true;
+ }
+ if (Character.isLowerCase(thePath.charAt(0))) {
+ return true;
+ }
+
+ return false;
+ }
+
public enum RuntimeSearchParamStatusEnum {
ACTIVE,
DRAFT,
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java
index 105548d3d99..9fcacdc4ebd 100644
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java
+++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java
@@ -28,13 +28,6 @@ import ca.uhn.fhir.rest.gclient.TokenClientParam;
*/
public interface IAnyResource extends IBaseResource {
- /**
- * Search parameter constant for _language
- */
- @SearchParamDefinition(name="_language", path="", description="The language of the resource", type="string" )
- String SP_RES_LANGUAGE = "_language";
-
-
/**
* Search parameter constant for _id
*/
diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml
index 5b83473d8bd..8fe5cf9a5b4 100644
--- a/hapi-fhir-bom/pom.xml
+++ b/hapi-fhir-bom/pom.xml
@@ -3,14 +3,14 @@
4.0.0
ca.uhn.hapi.fhir
hapi-fhir-bom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
pom
HAPI FHIR BOM
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
index e75639496f0..c03744e91ea 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
index da95c8249b7..5e11c79536a 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-fhir-cli
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml
index 39a65d2c304..a53adf1d7b4 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../../hapi-deployable-pom
diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml
index 918a356bcce..1944f4105b2 100644
--- a/hapi-fhir-cli/pom.xml
+++ b/hapi-fhir-cli/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml
index fc1ff968610..b12089d304e 100644
--- a/hapi-fhir-client-okhttp/pom.xml
+++ b/hapi-fhir-client-okhttp/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml
index 22095a8b31e..50382d3feb9 100644
--- a/hapi-fhir-client/pom.xml
+++ b/hapi-fhir-client/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml
index 3edd8134ceb..ca9ac09d67d 100644
--- a/hapi-fhir-converter/pom.xml
+++ b/hapi-fhir-converter/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml
index 507cc110724..7bd546d13d0 100644
--- a/hapi-fhir-dist/pom.xml
+++ b/hapi-fhir-dist/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-docs/pom.xml b/hapi-fhir-docs/pom.xml
index 9203c8fa4d2..5f99f8bd00b 100644
--- a/hapi-fhir-docs/pom.xml
+++ b/hapi-fhir-docs/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_4_0/2457-fix-single-threaded-search-execution.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_4_0/2457-fix-single-threaded-search-execution.yaml
new file mode 100644
index 00000000000..ccedc14c04b
--- /dev/null
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_4_0/2457-fix-single-threaded-search-execution.yaml
@@ -0,0 +1,5 @@
+---
+type: perf
+issue: 2457
+title: "A regression in HAPI FHIR 5.3.0 resulted in concurrent searches being executed in a sequential
+ (and not parallel) fashion in some circumstances."
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2790-correct-searchparameter-urls-in-jps.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2790-correct-searchparameter-urls-in-jps.yaml
new file mode 100644
index 00000000000..66a1517ac15
--- /dev/null
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2790-correct-searchparameter-urls-in-jps.yaml
@@ -0,0 +1,5 @@
+---
+type: fix
+issue: 2790
+title: "The SearchParameter canonical URLs exported by the JPA server have been adjusted to match the URLs
+ specified in the FHIR specification."
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2790-remove-language-from-jpa.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2790-remove-language-from-jpa.yaml
new file mode 100644
index 00000000000..d6ddb530e75
--- /dev/null
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2790-remove-language-from-jpa.yaml
@@ -0,0 +1,7 @@
+---
+type: change
+issue: 2790
+title: "Support for the `_language` search parameter has been dropped from the JPA server. This search parameter
+ was specified in FHIR DSTU1 but was dropped in later versions. It is rarely used in practice and imposes
+ an indexing cost, so it has now been removed. A custom search parameter may be used in order to achieve
+ the same functionality if needed."
diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml
index 8a4adc9ac2a..e9b53373037 100644
--- a/hapi-fhir-jacoco/pom.xml
+++ b/hapi-fhir-jacoco/pom.xml
@@ -11,7 +11,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml
index 9679ed049c5..2887333a9c8 100644
--- a/hapi-fhir-jaxrsserver-base/pom.xml
+++ b/hapi-fhir-jaxrsserver-base/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-api/pom.xml b/hapi-fhir-jpaserver-api/pom.xml
index 4da1a0f45ee..4f709865c14 100644
--- a/hapi-fhir-jpaserver-api/pom.xml
+++ b/hapi-fhir-jpaserver-api/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index de3950d1860..1c6c860a492 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.6.0-PRE4-SNAPSHOT
+ 5.6.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/job/model/PartitionedUrl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/job/model/PartitionedUrl.java
index ebc69de9d18..cb3240a203e 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/job/model/PartitionedUrl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/job/model/PartitionedUrl.java
@@ -54,4 +54,8 @@ public class PartitionedUrl implements IModelJson {
public void setRequestPartitionId(RequestPartitionId theRequestPartitionId) {
myRequestPartitionId = theRequestPartitionId;
}
+
+ public boolean isPartitioned() {
+ return myRequestPartitionId != null && !myRequestPartitionId.isDefaultPartition();
+ }
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
index 4abd1899274..d612b88fe50 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
@@ -1228,12 +1228,6 @@ public abstract class BaseHapiFhirDao extends BaseStora
}
entity.setUpdated(theTransactionDetails.getTransactionDate());
- if (theResource instanceof IResource) {
- entity.setLanguage(((IResource) theResource).getLanguage().getValue());
- } else {
- entity.setLanguage(((IAnyResource) theResource).getLanguageElement().getValue());
- }
-
newParams.populateResourceTableSearchParamsPresentFlags(entity);
entity.setIndexStatus(INDEX_STATUS_INDEXED);
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoFailureUtil.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoFailureUtil.java
index 03e389ce6f6..ad27290f96c 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoFailureUtil.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoFailureUtil.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.jpa.dao;
+/*-
+ * #%L
+ * HAPI FHIR JPA Server
+ * %%
+ * Copyright (C) 2014 - 2021 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
import org.apache.commons.lang3.StringUtils;
/**
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 1eba216a54c..62ebba77afc 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
@@ -559,11 +559,6 @@ class PredicateBuilderReference extends BasePredicateBuilder {
myPredicateBuilder.addPredicateResourceId(theAndOrParams, theResourceName, theRequestPartitionId);
break;
- case IAnyResource.SP_RES_LANGUAGE:
- addPredicateLanguage(theAndOrParams,
- null);
- break;
-
case Constants.PARAM_HAS:
addPredicateHas(theResourceName, theAndOrParams, theRequest, theRequestPartitionId);
break;
@@ -733,9 +728,6 @@ class PredicateBuilderReference extends BasePredicateBuilder {
null,
theFilter.getValue());
return myPredicateBuilder.addPredicateResourceId(Collections.singletonList(Collections.singletonList(param)), myResourceName, theFilter.getOperation(), theRequestPartitionId);
- } else if (theFilter.getParamPath().getName().equals(IAnyResource.SP_RES_LANGUAGE)) {
- return addPredicateLanguage(Collections.singletonList(Collections.singletonList(new StringParam(theFilter.getValue()))),
- theFilter.getOperation());
}
RuntimeSearchParam searchParam = mySearchParamRegistry.getActiveSearchParam(theResourceName, theFilter.getParamPath().getName());
@@ -828,45 +820,6 @@ class PredicateBuilderReference extends BasePredicateBuilder {
return qp;
}
- private Predicate addPredicateLanguage(List> theList,
- SearchFilterParser.CompareOperation operation) {
- for (List extends IQueryParameterType> nextList : theList) {
-
- Set values = new HashSet<>();
- for (IQueryParameterType next : nextList) {
- if (next instanceof StringParam) {
- String nextValue = ((StringParam) next).getValue();
- if (isBlank(nextValue)) {
- continue;
- }
- values.add(nextValue);
- } else {
- throw new InternalErrorException("Language parameter must be of type " + StringParam.class.getCanonicalName() + " - Got " + next.getClass().getCanonicalName());
- }
- }
-
- if (values.isEmpty()) {
- continue;
- }
-
- Predicate predicate;
- if ((operation == null) ||
- (operation == SearchFilterParser.CompareOperation.eq)) {
- predicate = myQueryStack.get("myLanguage").as(String.class).in(values);
- } else if (operation == SearchFilterParser.CompareOperation.ne) {
- predicate = myQueryStack.get("myLanguage").as(String.class).in(values).not();
- } else {
- throw new InvalidRequestException("Unsupported operator specified in language query, only \"eq\" and \"ne\" are supported");
- }
- myQueryStack.addPredicate(predicate);
- if (operation != null) {
- return predicate;
- }
- }
-
- return null;
- }
-
private void addPredicateSource(List> theAndOrParams, RequestDetails theRequest) {
for (List extends IQueryParameterType> nextAnd : theAndOrParams) {
addPredicateSource(nextAnd, SearchFilterParser.CompareOperation.eq, theRequest);
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 bc5cccb736c..c98eb045a47 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
@@ -261,6 +261,9 @@ class PredicateBuilderToken extends BasePredicateBuilder implements IPredicateBu
if (theSearchParam != null) {
Set valueSetUris = Sets.newHashSet();
for (String nextPath : theSearchParam.getPathsSplit()) {
+ if (!nextPath.startsWith(myResourceType + ".")) {
+ continue;
+ }
BaseRuntimeChildDefinition def = myContext.newTerser().getDefinition(myResourceType, nextPath);
if (def instanceof BaseRuntimeDeclaredChildDefinition) {
String valueSet = ((BaseRuntimeDeclaredChildDefinition) def).getBindingValueSet();
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java
index e6ef352724c..bf9277feb12 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java
@@ -92,8 +92,12 @@ public class FhirResourceDaoSearchParameterR4 extends BaseHapiFhirResourceDao nextBaseType : theResource.getBase()) {
String nextBase = nextBaseType.getValueAsString();
RuntimeSearchParam existingSearchParam = theSearchParamRegistry.getActiveSearchParam(nextBase, theResource.getCode());
- if (existingSearchParam != null && existingSearchParam.getId() == null) {
- throw new UnprocessableEntityException("Can not override built-in search parameter " + nextBase + ":" + theResource.getCode() + " because overriding is disabled on this server");
+ if (existingSearchParam != null) {
+ boolean isBuiltIn = existingSearchParam.getId() == null;
+ isBuiltIn |= existingSearchParam.getUri().startsWith("http://hl7.org/fhir/SearchParameter/");
+ if (isBuiltIn) {
+ throw new UnprocessableEntityException("Can not override built-in search parameter " + nextBase + ":" + theResource.getCode() + " because overriding is disabled on this server");
+ }
}
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java
index 03385f34fb7..82bf3d886fe 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java
@@ -434,9 +434,6 @@ public class QueryStack {
param.setValueAsQueryToken(null, null, null, theFilter.getValue());
return theQueryStack3.createPredicateResourceId(null, Collections.singletonList(Collections.singletonList(param)), theResourceName, theFilter.getOperation(), theRequestPartitionId);
}
- case IAnyResource.SP_RES_LANGUAGE: {
- return theQueryStack3.createPredicateLanguage(Collections.singletonList(Collections.singletonList(new StringParam(theFilter.getValue()))), theFilter.getOperation());
- }
case Constants.PARAM_SOURCE: {
TokenParam param = new TokenParam();
param.setValueAsQueryToken(null, null, null, theFilter.getValue());
@@ -579,44 +576,6 @@ public class QueryStack {
return toAndPredicate(andPredicates);
}
- public Condition createPredicateLanguage(List> theList, Object theOperation) {
-
- ResourceTablePredicateBuilder rootTable = mySqlBuilder.getOrCreateResourceTablePredicateBuilder();
-
- List predicates = new ArrayList<>();
- for (List extends IQueryParameterType> nextList : theList) {
-
- Set values = new HashSet<>();
- for (IQueryParameterType next : nextList) {
- if (next instanceof StringParam) {
- String nextValue = ((StringParam) next).getValue();
- if (isBlank(nextValue)) {
- continue;
- }
- values.add(nextValue);
- } else {
- throw new InternalErrorException("Language parameter must be of type " + StringParam.class.getCanonicalName() + " - Got " + next.getClass().getCanonicalName());
- }
- }
-
- if (values.isEmpty()) {
- continue;
- }
-
- if ((theOperation == null) ||
- (theOperation == SearchFilterParser.CompareOperation.eq)) {
- predicates.add(rootTable.createLanguagePredicate(values, false));
- } else if (theOperation == SearchFilterParser.CompareOperation.ne) {
- predicates.add(rootTable.createLanguagePredicate(values, true));
- } else {
- throw new InvalidRequestException("Unsupported operator specified in language query, only \"eq\" and \"ne\" are supported");
- }
-
- }
-
- return toAndPredicate(predicates);
- }
-
public Condition createPredicateNumber(@Nullable DbColumn theSourceJoinColumn, String theResourceName,
String theSpnamePrefix, RuntimeSearchParam theSearchParam, List extends IQueryParameterType> theList,
SearchFilterParser.CompareOperation theOperation, RequestPartitionId theRequestPartitionId) {
@@ -1099,9 +1058,6 @@ public class QueryStack {
case IAnyResource.SP_RES_ID:
return createPredicateResourceId(theSourceJoinColumn, theAndOrParams, theResourceName, null, theRequestPartitionId);
- case IAnyResource.SP_RES_LANGUAGE:
- return createPredicateLanguage(theAndOrParams, null);
-
case Constants.PARAM_HAS:
return createPredicateHas(theSourceJoinColumn, theResourceName, theAndOrParams, theRequest, theRequestPartitionId);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java
index 87f8a02fcd6..704608e9784 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java
@@ -222,7 +222,7 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder {
if (retVal == null) {
if (theSearchParam != null) {
Set valueSetUris = Sets.newHashSet();
- for (String nextPath : theSearchParam.getPathsSplit()) {
+ for (String nextPath : theSearchParam.getPathsSplitForResourceType(getResourceType())) {
Class extends IBaseResource> type = getFhirContext().getResourceDefinition(getResourceType()).getImplementingClass();
BaseRuntimeChildDefinition def = getFhirContext().newTerser().getDefinition(type, nextPath);
if (def instanceof BaseRuntimeDeclaredChildDefinition) {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportProviderTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportProviderTest.java
index e2ca669a6dd..0783f3cb387 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportProviderTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportProviderTest.java
@@ -1,16 +1,15 @@
package ca.uhn.fhir.jpa.bulk;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
-import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions;
import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportSvc;
-import ca.uhn.fhir.jpa.bulk.export.model.BulkExportResponseJson;
import ca.uhn.fhir.jpa.bulk.export.model.BulkExportJobStatusEnum;
+import ca.uhn.fhir.jpa.bulk.export.model.BulkExportResponseJson;
import ca.uhn.fhir.jpa.bulk.export.provider.BulkDataExportProvider;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.server.RequestDetails;
+import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions;
import ca.uhn.fhir.rest.client.apache.ResourceEntity;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
@@ -55,11 +54,8 @@ import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.times;
@@ -74,7 +70,7 @@ public class BulkDataExportProviderTest {
private static final String GROUP_ID = "Group/G2401";
private static final String G_JOB_ID = "0000000-GGGGGG";
private Server myServer;
- private final FhirContext myCtx = FhirContext.forCached(FhirVersionEnum.R4);
+ private final FhirContext myCtx = FhirContext.forR4Cached();
private int myPort;
@Mock
private IBulkDataExportSvc myBulkDataExportSvc;
@@ -478,9 +474,9 @@ public class BulkDataExportProviderTest {
when(myBulkDataExportSvc.submitJob(any(), any(), nullable(RequestDetails.class))).thenReturn(jobInfo);
String url = "http://localhost:" + myPort + "/" + "Group/123/" +JpaConstants.OPERATION_EXPORT
- + "?" + JpaConstants.PARAM_EXPORT_OUTPUT_FORMAT + "=" + UrlUtil.escapeUrlParam(Constants.CT_FHIR_NDJSON);;
+ + "?" + JpaConstants.PARAM_EXPORT_OUTPUT_FORMAT + "=" + UrlUtil.escapeUrlParam(Constants.CT_FHIR_NDJSON);
- HttpGet get = new HttpGet(url);
+ HttpGet get = new HttpGet(url);
get.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RESPOND_ASYNC);
CloseableHttpResponse execute = myClient.execute(get);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TolerantJsonParserR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TolerantJsonParserR4Test.java
index 7222ce7f83a..e4079c42903 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TolerantJsonParserR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TolerantJsonParserR4Test.java
@@ -1,19 +1,18 @@
package ca.uhn.fhir.jpa.dao;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.parser.LenientErrorHandler;
import org.hl7.fhir.r4.model.Observation;
import org.junit.jupiter.api.Test;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.hamcrest.MatcherAssert.assertThat;
public class TolerantJsonParserR4Test {
- private FhirContext myFhirContext = FhirContext.forCached(FhirVersionEnum.R4);
+ private final FhirContext myFhirContext = FhirContext.forR4Cached();
@Test
public void testParseInvalidNumeric_LeadingDecimal() {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TransactionProcessorTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TransactionProcessorTest.java
index cff84d93d99..f48b4ede91f 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TransactionProcessorTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/TransactionProcessorTest.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.dao;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.interceptor.executor.InterceptorService;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
@@ -123,7 +122,7 @@ public class TransactionProcessorTest {
@Bean
public FhirContext fhirContext() {
- return FhirContext.forCached(FhirVersionEnum.R4);
+ return FhirContext.forR4Cached();
}
@Bean
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchCustomSearchParamTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchCustomSearchParamTest.java
index 3d356be0e42..0047445b92c 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchCustomSearchParamTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchCustomSearchParamTest.java
@@ -1033,7 +1033,7 @@ public class FhirResourceDaoDstu2SearchCustomSearchParamTest extends BaseJpaDstu
myPatientDao.search(map).size();
fail();
} catch (InvalidRequestException e) {
- assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
+ assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
}
}
@@ -1070,7 +1070,7 @@ public class FhirResourceDaoDstu2SearchCustomSearchParamTest extends BaseJpaDstu
myPatientDao.search(map).size();
fail();
} catch (InvalidRequestException e) {
- assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
+ assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
}
// Try with normal gender SP
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java
index c3de91cb14f..a1bfae57c0a 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java
@@ -727,9 +727,6 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
params.add("_id", new StringDt("TEST"));
assertEquals(1, toList(myPatientDao.search(params)).size());
- params.add("_language", new StringParam("TEST"));
- assertEquals(1, toList(myPatientDao.search(params)).size());
-
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
assertEquals(1, toList(myPatientDao.search(params)).size());
@@ -744,9 +741,6 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
params.add("_id", new StringDt("TEST"));
assertEquals(0, toList(myPatientDao.search(params)).size());
- params.add("_language", new StringParam("TEST"));
- assertEquals(0, toList(myPatientDao.search(params)).size());
-
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
assertEquals(0, toList(myPatientDao.search(params)).size());
@@ -766,148 +760,6 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
}
}
- @Test
- public void testSearchLanguageParam() {
- IIdType id1;
- {
- Patient patient = new Patient();
- patient.getLanguage().setValue("en_CA");
- patient.addIdentifier().setSystem("urn:system").setValue("001");
- patient.addName().addFamily("testSearchLanguageParam").addGiven("Joe");
- id1 = myPatientDao.create(patient, mySrd).getId();
- }
- IIdType id2;
- {
- Patient patient = new Patient();
- patient.getLanguage().setValue("en_US");
- patient.addIdentifier().setSystem("urn:system").setValue("002");
- patient.addName().addFamily("testSearchLanguageParam").addGiven("John");
- id2 = myPatientDao.create(patient, mySrd).getId();
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add(BaseResource.SP_RES_LANGUAGE, new StringParam("en_CA"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(1, patients.size());
- assertEquals(id1.toUnqualifiedVersionless(), patients.get(0).getId().toUnqualifiedVersionless());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add(BaseResource.SP_RES_LANGUAGE, new StringParam("en_US"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(1, patients.size());
- assertEquals(id2.toUnqualifiedVersionless(), patients.get(0).getId().toUnqualifiedVersionless());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add(BaseResource.SP_RES_LANGUAGE, new StringParam("en_GB"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(0, patients.size());
- }
- }
-
- @Test
- public void testSearchLanguageParamAndOr() {
- IIdType id1;
- {
- Patient patient = new Patient();
- patient.getLanguage().setValue("en_CA");
- patient.addIdentifier().setSystem("urn:system").setValue("001");
- patient.addName().addFamily("testSearchLanguageParam").addGiven("Joe");
- id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
-
- Date betweenTime = new Date();
-
- IIdType id2;
- {
- Patient patient = new Patient();
- patient.getLanguage().setValue("en_US");
- patient.addIdentifier().setSystem("urn:system").setValue("002");
- patient.addName().addFamily("testSearchLanguageParam").addGiven("John");
- id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add(BaseResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1, id2));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add(BaseResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
- params.setLastUpdated(new DateRangeParam(betweenTime, null));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id2));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add(BaseResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")));
- params.add(BaseResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
- params.add(BaseResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- params.add(BaseResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(BaseResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add("_id", new StringParam(id1.getIdPart()));
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(BaseResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(BaseResource.SP_RES_LANGUAGE, and);
- params.add("_id", new StringParam(id1.getIdPart()));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
-
- }
-
@Test
public void testSearchLastUpdatedParam() throws InterruptedException {
String methodName = "testSearchLastUpdatedParam";
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
index a301fbb49d0..71c2af076fc 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
@@ -224,7 +224,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
}
@Test
- public void testCantSearchForDeletedResourceByLanguageOrTag() {
+ public void testCantSearchForDeletedResourceByTag() {
String methodName = "testCantSearchForDeletedResourceByLanguageOrTag";
Organization org = new Organization();
org.setLanguage(new CodeDt("EN_ca"));
@@ -236,9 +236,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
- SearchParameterMap map = new SearchParameterMap();
- map.add("_language", new StringParam("EN_ca"));
- assertEquals(1, myOrganizationDao.search(map).size().intValue());
+ SearchParameterMap map;
map = new SearchParameterMap();
map.add("_tag", new TokenParam(methodName, methodName));
@@ -246,10 +244,6 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
myOrganizationDao.delete(orgId, mySrd);
- map = new SearchParameterMap();
- map.add("_language", new StringParam("EN_ca"));
- assertEquals(0, myOrganizationDao.search(map).size().intValue());
-
map = new SearchParameterMap();
map.add("_tag", new TokenParam(methodName, methodName));
assertEquals(0, myOrganizationDao.search(map).size().intValue());
@@ -1603,7 +1597,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
found = toList(myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_BIRTHDATE + "AAAA", new DateParam(ParamPrefixEnum.GREATERTHAN, "2000-01-01"))));
assertEquals(0, found.size());
} catch (InvalidRequestException e) {
- assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
+ assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
}
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchCustomSearchParamTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchCustomSearchParamTest.java
index b8159d4c533..f8f68a13526 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchCustomSearchParamTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchCustomSearchParamTest.java
@@ -1015,7 +1015,7 @@ public class FhirResourceDaoDstu3SearchCustomSearchParamTest extends BaseJpaDstu
myPatientDao.search(map).size();
fail();
} catch (InvalidRequestException e) {
- assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
+ assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
}
}
@@ -1053,7 +1053,7 @@ public class FhirResourceDaoDstu3SearchCustomSearchParamTest extends BaseJpaDstu
myPatientDao.search(map).size();
fail();
} catch (InvalidRequestException e) {
- assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
+ assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
}
// Try with normal gender SP
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchNoFtTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchNoFtTest.java
index ba988e02b70..9a544149148 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchNoFtTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchNoFtTest.java
@@ -1192,11 +1192,6 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
params.add("_id", new StringParam("TEST"));
assertEquals(1, toList(myPatientDao.search(params)).size());
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add("_language", new StringParam("TEST"));
- assertEquals(1, toList(myPatientDao.search(params)).size());
-
params = new SearchParameterMap();
params.setLoadSynchronous(true);
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
@@ -1214,11 +1209,6 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
params.add("_id", new StringParam("TEST"));
assertEquals(0, toList(myPatientDao.search(params)).size());
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add("_language", new StringParam("TEST"));
- assertEquals(0, toList(myPatientDao.search(params)).size());
-
params = new SearchParameterMap();
params.setLoadSynchronous(true);
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
@@ -1241,143 +1231,6 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
}
}
- @Test
- public void testSearchLanguageParam() {
- IIdType id1;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_CA");
- patient.addIdentifier().setSystem("urn:system").setValue("001");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
- id1 = myPatientDao.create(patient, mySrd).getId();
- }
- IIdType id2;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_US");
- patient.addIdentifier().setSystem("urn:system").setValue("002");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
- id2 = myPatientDao.create(patient, mySrd).getId();
- }
- SearchParameterMap params;
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_CA"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(1, patients.size());
- assertEquals(id1.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
- }
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_US"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(1, patients.size());
- assertEquals(id2.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
- }
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_GB"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(0, patients.size());
- }
- }
-
- @Test
- public void testSearchLanguageParamAndOr() {
- IIdType id1;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_CA");
- patient.addIdentifier().setSystem("urn:system").setValue("001");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
- id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
- TestUtil.sleepOneClick();
- Date betweenTime = new Date();
-
- IIdType id2;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_US");
- patient.addIdentifier().setSystem("urn:system").setValue("002");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
- id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1, id2));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
- params.setLastUpdated(new DateRangeParam(betweenTime, null));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id2));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add("_id", new StringParam(id1.getIdPart()));
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- params.add("_id", new StringParam(id1.getIdPart()));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
-
- }
-
@Test
public void testSearchLastUpdatedParam() {
String methodName = "testSearchLastUpdatedParam";
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java
index e543d2310f7..7d8793dffe2 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java
@@ -206,21 +206,12 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
SearchParameterMap map = new SearchParameterMap();
- map.add("_language", new StringParam("EN_ca"));
- assertEquals(1, myOrganizationDao.search(map).size().intValue());
-
- map = new SearchParameterMap();
map.setLoadSynchronous(true);
map.add("_tag", new TokenParam(methodName, methodName));
assertEquals(1, myOrganizationDao.search(map).size().intValue());
myOrganizationDao.delete(orgId, mySrd);
- map = new SearchParameterMap();
- map.setLoadSynchronous(true);
- map.add("_language", new StringParam("EN_ca"));
- assertEquals(0, myOrganizationDao.search(map).size().intValue());
-
map = new SearchParameterMap();
map.setLoadSynchronous(true);
map.add("_tag", new TokenParam(methodName, methodName));
@@ -2014,7 +2005,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
found = toList(myPatientDao.search(new SearchParameterMap(Patient.SP_BIRTHDATE + "AAAA", new DateParam(ParamPrefixEnum.GREATERTHAN, "2000-01-01")).setLoadSynchronous(true)));
assertEquals(0, found.size());
} catch (InvalidRequestException e) {
- assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
+ assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
}
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CreateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CreateTest.java
index 254600f7acb..7a1411fd99b 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CreateTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CreateTest.java
@@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantityNormalized;
+import ca.uhn.fhir.jpa.model.entity.ResourceLink;
import ca.uhn.fhir.jpa.model.util.UcumServiceUtil;
import ca.uhn.fhir.jpa.partition.SystemRequestDetails;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
@@ -28,6 +29,7 @@ import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Organization;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.Quantity;
+import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.SampledData;
import org.hl7.fhir.r4.model.SearchParameter;
import org.junit.jupiter.api.AfterEach;
@@ -63,6 +65,30 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test {
myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
}
+
+ @Test
+ public void testCreateLinkCreatesAppropriatePaths() {
+ Patient p = new Patient();
+ p.setId("Patient/A");
+ p.setActive(true);
+ myPatientDao.update(p, mySrd);
+
+ Observation obs = new Observation();
+ obs.setSubject(new Reference("Patient/A"));
+ myObservationDao.create(obs, mySrd);
+
+ runInTransaction(() ->{
+ List allLinks = myResourceLinkDao.findAll();
+ List paths = allLinks
+ .stream()
+ .map(t -> t.getSourcePath())
+ .sorted()
+ .collect(Collectors.toList());
+ assertThat(paths.toString(), paths, contains("Observation.subject", "Observation.subject.where(resolve() is Patient)"));
+ });
+ }
+
+
@Test
public void testConditionalCreateWithPlusInUrl() {
Observation obs = new Observation();
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterLegacySearchBuilderTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterLegacySearchBuilderTest.java
index fd6bb9fdab9..2fced929ab1 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterLegacySearchBuilderTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterLegacySearchBuilderTest.java
@@ -349,28 +349,6 @@ public class FhirResourceDaoR4FilterLegacySearchBuilderTest extends BaseJpaR4Tes
}
- @Test
- public void testLanguageComparatorEq() {
-
- Patient p = new Patient();
- p.setLanguage("en");
- p.addName().setFamily("Smith").addGiven("John");
- p.setBirthDateElement(new DateType("1955-01-01"));
- p.setActive(true);
- String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
-
- SearchParameterMap map;
- List found;
-
- map = new SearchParameterMap();
- map.setLoadSynchronous(true);
- map.add(Constants.PARAM_FILTER, new StringParam("_language eq en"));
- found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
- assertThat(found, containsInAnyOrder(id1));
-
- }
-
-
@Test
public void testStringComparatorCo() {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterTest.java
index eacf7d652e9..edcb41ca62b 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterTest.java
@@ -347,28 +347,6 @@ public class FhirResourceDaoR4FilterTest extends BaseJpaR4Test {
}
- @Test
- public void testLanguageComparatorEq() {
-
- Patient p = new Patient();
- p.setLanguage("en");
- p.addName().setFamily("Smith").addGiven("John");
- p.setBirthDateElement(new DateType("1955-01-01"));
- p.setActive(true);
- String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
-
- SearchParameterMap map;
- List found;
-
- map = new SearchParameterMap();
- map.setLoadSynchronous(true);
- map.add(Constants.PARAM_FILTER, new StringParam("_language eq en"));
- found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
- assertThat(found, containsInAnyOrder(id1));
-
- }
-
-
@Test
public void testStringComparatorCo() {
@@ -1254,7 +1232,7 @@ public class FhirResourceDaoR4FilterTest extends BaseJpaR4Test {
try {
myPatientDao.search(map);
} catch (InvalidRequestException e) {
- assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
+ assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
}
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4LegacySearchBuilderTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4LegacySearchBuilderTest.java
index 7a18b4ed391..5366efa789c 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4LegacySearchBuilderTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4LegacySearchBuilderTest.java
@@ -2369,14 +2369,6 @@ public class FhirResourceDaoR4LegacySearchBuilderTest extends BaseJpaR4Test {
params.add("_id", new StringParam("TEST"));
assertEquals(1, toList(myPatientDao.search(params)).size());
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add("_language", new StringParam("TEST"));
- myCaptureQueriesListener.clear();
- result = toList(myPatientDao.search(params));
- myCaptureQueriesListener.logSelectQueriesForCurrentThread(0);
- assertEquals(1, result.size());
-
params = new SearchParameterMap();
params.setLoadSynchronous(true);
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
@@ -2394,11 +2386,6 @@ public class FhirResourceDaoR4LegacySearchBuilderTest extends BaseJpaR4Test {
params.add("_id", new StringParam("TEST"));
assertEquals(0, toList(myPatientDao.search(params)).size());
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add("_language", new StringParam("TEST"));
- assertEquals(0, toList(myPatientDao.search(params)).size());
-
params = new SearchParameterMap();
params.setLoadSynchronous(true);
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
@@ -2421,149 +2408,6 @@ public class FhirResourceDaoR4LegacySearchBuilderTest extends BaseJpaR4Test {
}
}
- @Test
- public void testSearchLanguageParam() {
- IIdType id1;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_CA");
- patient.addIdentifier().setSystem("urn:system").setValue("001");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
- id1 = myPatientDao.create(patient, mySrd).getId();
- }
- IIdType id2;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_US");
- patient.addIdentifier().setSystem("urn:system").setValue("002");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
- id2 = myPatientDao.create(patient, mySrd).getId();
- }
- SearchParameterMap params;
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_CA"));
- myCaptureQueriesListener.clear();
- List patients = toList(myPatientDao.search(params));
- myCaptureQueriesListener.logSelectQueriesForCurrentThread(0);
- assertEquals(1, patients.size());
- assertEquals(id1.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
- }
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_US"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(1, patients.size());
- assertEquals(id2.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
- }
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_GB"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(0, patients.size());
- }
- }
-
- @Test
- public void testSearchLanguageParamAndOr() {
- IIdType id1;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_CA");
- patient.addIdentifier().setSystem("urn:system").setValue("001");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
- id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
-
- TestUtil.sleepOneClick();
-
- Date betweenTime = new Date();
-
- TestUtil.sleepOneClick();
-
- IIdType id2;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_US");
- patient.addIdentifier().setSystem("urn:system").setValue("002");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
- id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1, id2));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
- params.setLastUpdated(new DateRangeParam(betweenTime, null));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id2));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add("_id", new StringParam(id1.getIdPart()));
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- params.add("_id", new StringParam(id1.getIdPart()));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
-
- }
-
@Test
public void testSearchLastUpdatedParam() {
String methodName = "testSearchLastUpdatedParam";
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchCustomSearchParamTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchCustomSearchParamTest.java
index baa3a2d3a76..251945e4f61 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchCustomSearchParamTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchCustomSearchParamTest.java
@@ -1512,7 +1512,7 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
myPatientDao.search(map).size();
fail();
} catch (InvalidRequestException e) {
- assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
+ assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
}
// Delete the param
@@ -1528,7 +1528,7 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
myPatientDao.search(map).size();
fail();
} catch (InvalidRequestException e) {
- assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
+ assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
}
}
@@ -1605,7 +1605,7 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
myPatientDao.search(map).size();
fail();
} catch (InvalidRequestException e) {
- assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
+ assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
}
// Try with normal gender SP
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java
index 71b3e7bcdc2..5ee19c00c8e 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java
@@ -2464,14 +2464,6 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
params.add("_id", new StringParam("TEST"));
assertEquals(1, toList(myPatientDao.search(params)).size());
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add("_language", new StringParam("TEST"));
- myCaptureQueriesListener.clear();
- result = toList(myPatientDao.search(params));
- myCaptureQueriesListener.logSelectQueriesForCurrentThread(0);
- assertEquals(1, result.size());
-
params = new SearchParameterMap();
params.setLoadSynchronous(true);
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
@@ -2489,11 +2481,6 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
params.add("_id", new StringParam("TEST"));
assertEquals(0, toList(myPatientDao.search(params)).size());
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add("_language", new StringParam("TEST"));
- assertEquals(0, toList(myPatientDao.search(params)).size());
-
params = new SearchParameterMap();
params.setLoadSynchronous(true);
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
@@ -2516,148 +2503,6 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
}
}
- @Test
- public void testSearchLanguageParam() {
- IIdType id1;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_CA");
- patient.addIdentifier().setSystem("urn:system").setValue("001");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
- id1 = myPatientDao.create(patient, mySrd).getId();
- }
- IIdType id2;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_US");
- patient.addIdentifier().setSystem("urn:system").setValue("002");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
- id2 = myPatientDao.create(patient, mySrd).getId();
- }
- SearchParameterMap params;
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_CA"));
- myCaptureQueriesListener.clear();
- List patients = toList(myPatientDao.search(params));
- myCaptureQueriesListener.logSelectQueriesForCurrentThread(0);
- assertEquals(1, patients.size());
- assertEquals(id1.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
- }
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_US"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(1, patients.size());
- assertEquals(id2.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
- }
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_GB"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(0, patients.size());
- }
- }
-
- @Test
- public void testSearchLanguageParamAndOr() {
- IIdType id1;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_CA");
- patient.addIdentifier().setSystem("urn:system").setValue("001");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
- id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
-
- TestUtil.sleepOneClick();
-
- Date betweenTime = new Date();
-
- TestUtil.sleepOneClick();
-
- IIdType id2;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_US");
- patient.addIdentifier().setSystem("urn:system").setValue("002");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
- id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1, id2));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
- params.setLastUpdated(new DateRangeParam(betweenTime, null));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id2));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add("_id", new StringParam(id1.getIdPart()));
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- params.add("_id", new StringParam(id1.getIdPart()));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
-
- }
@Test
public void testSearchLastUpdatedParam() {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java
index 475bf310a5d..86220f8281d 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java
@@ -12,6 +12,7 @@ import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri;
import ca.uhn.fhir.jpa.model.entity.ResourceLink;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
+import ca.uhn.fhir.jpa.model.util.UcumServiceUtil;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum;
import ca.uhn.fhir.jpa.util.TestUtil;
@@ -43,8 +44,6 @@ import ca.uhn.fhir.rest.param.UriParam;
import ca.uhn.fhir.rest.param.UriParamQualifierEnum;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
-import ca.uhn.fhir.jpa.model.util.UcumServiceUtil;
-
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IAnyResource;
@@ -144,8 +143,8 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
myDaoConfig.setFetchSizeDefaultMaximum(new DaoConfig().getFetchSizeDefaultMaximum());
myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches());
myDaoConfig.setDisableHashBasedSearches(false);
- myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
- }
+ myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
+ }
@BeforeEach
public void beforeInitialize() {
@@ -1201,8 +1200,8 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
.setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm")))
.setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm").setValue(1.2));
o1.addComponent()
- .setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m")))
- .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("mm").setValue(2));
+ .setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m")))
+ .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("mm").setValue(2));
IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless();
String param = Observation.SP_COMPONENT_VALUE_QUANTITY;
@@ -1214,7 +1213,7 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
assertThat("Got: " + toUnqualifiedVersionlessIdValues(result), toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue()));
}
}
-
+
@Test
public void testComponentQuantityWithNormalizedQuantityStorageSupported() {
@@ -1224,8 +1223,8 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
.setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm")))
.setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm").setValue(1.2));
o1.addComponent()
- .setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m")))
- .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("mm").setValue(2));
+ .setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m")))
+ .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("mm").setValue(2));
IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless();
String param = Observation.SP_COMPONENT_VALUE_QUANTITY;
@@ -1237,7 +1236,7 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
assertThat("Got: " + toUnqualifiedVersionlessIdValues(result), toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue()));
}
}
-
+
@Test
public void testSearchCompositeParamQuantity() {
Observation o1 = new Observation();
@@ -1344,9 +1343,9 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(param, val));
assertThat(toUnqualifiedVersionlessIdValues(result), empty());
}
-
+
}
-
+
@Test
public void testSearchDateWrongParam() {
Patient p1 = new Patient();
@@ -1391,11 +1390,6 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
params.add("_id", new StringParam("TEST"));
assertEquals(1, toList(myPatientDao.search(params)).size());
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add("_language", new StringParam("TEST"));
- assertEquals(1, toList(myPatientDao.search(params)).size());
-
params = new SearchParameterMap();
params.setLoadSynchronous(true);
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
@@ -1413,11 +1407,6 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
params.add("_id", new StringParam("TEST"));
assertEquals(0, toList(myPatientDao.search(params)).size());
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
- params.add("_language", new StringParam("TEST"));
- assertEquals(0, toList(myPatientDao.search(params)).size());
-
params = new SearchParameterMap();
params.setLoadSynchronous(true);
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
@@ -1440,145 +1429,6 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
}
}
- @Test
- public void testSearchLanguageParam() {
- IIdType id1;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_CA");
- patient.addIdentifier().setSystem("urn:system").setValue("001");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
- id1 = myPatientDao.create(patient, mySrd).getId();
- }
- IIdType id2;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_US");
- patient.addIdentifier().setSystem("urn:system").setValue("002");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
- id2 = myPatientDao.create(patient, mySrd).getId();
- }
- SearchParameterMap params;
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_CA"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(1, patients.size());
- assertEquals(id1.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
- }
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_US"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(1, patients.size());
- assertEquals(id2.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
- }
- {
- params = new SearchParameterMap();
- params.setLoadSynchronous(true);
-
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_GB"));
- List patients = toList(myPatientDao.search(params));
- assertEquals(0, patients.size());
- }
- }
-
- @Test
- public void testSearchLanguageParamAndOr() {
- IIdType id1;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_CA");
- patient.addIdentifier().setSystem("urn:system").setValue("001");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
- id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
-
- TestUtil.sleepOneClick();
-
- Date betweenTime = new Date();
-
- IIdType id2;
- {
- Patient patient = new Patient();
- patient.getLanguageElement().setValue("en_US");
- patient.addIdentifier().setSystem("urn:system").setValue("002");
- patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
- id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1, id2));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
- params.setLastUpdated(new DateRangeParam(betweenTime, null));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id2));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- params.add("_id", new StringParam(id1.getIdPart()));
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
- {
- SearchParameterMap params = new SearchParameterMap();
- StringAndListParam and = new StringAndListParam();
- and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
- and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
- params.add(IAnyResource.SP_RES_LANGUAGE, and);
- params.add("_id", new StringParam(id1.getIdPart()));
- assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
- }
-
- }
-
@Test
public void testSearchLastUpdatedParam() {
String methodName = "testSearchLastUpdatedParam";
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
index 969c47a30ce..e6794b6caea 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
@@ -422,9 +422,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
- SearchParameterMap map = new SearchParameterMap();
- map.add("_language", new StringParam("EN_ca"));
- assertEquals(1, myOrganizationDao.search(map).size().intValue());
+ SearchParameterMap map;
map = new SearchParameterMap();
map.setLoadSynchronous(true);
@@ -433,11 +431,6 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
myOrganizationDao.delete(orgId, mySrd);
- map = new SearchParameterMap();
- map.setLoadSynchronous(true);
- map.add("_language", new StringParam("EN_ca"));
- assertEquals(0, myOrganizationDao.search(map).size().intValue());
-
map = new SearchParameterMap();
map.setLoadSynchronous(true);
map.add("_tag", new TokenParam(methodName, methodName));
@@ -2576,7 +2569,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
found = toList(myPatientDao.search(new SearchParameterMap(Patient.SP_BIRTHDATE + "AAAA", new DateParam(ParamPrefixEnum.GREATERTHAN, "2000-01-01")).setLoadSynchronous(true)));
assertEquals(0, found.size());
} catch (InvalidRequestException e) {
- assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
+ assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
}
}
@@ -3342,7 +3335,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
myObservationDao.search(pm);
fail();
} catch (InvalidRequestException e) {
- assertEquals("Unknown _sort parameter value \"hello\" for resource type \"Observation\" (Note: sort parameters values must use a valid Search Parameter). Valid values for this search are: [_id, _language, _lastUpdated, based-on, category, code, code-value-concept, code-value-date, code-value-quantity, code-value-string, combo-code, combo-code-value-concept, combo-code-value-quantity, combo-data-absent-reason, combo-value-concept, combo-value-quantity, component-code, component-code-value-concept, component-code-value-quantity, component-data-absent-reason, component-value-concept, component-value-quantity, data-absent-reason, date, derived-from, device, encounter, focus, has-member, identifier, method, part-of, patient, performer, specimen, status, subject, value-concept, value-date, value-quantity, value-string]", e.getMessage());
+ assertEquals("Unknown _sort parameter value \"hello\" for resource type \"Observation\" (Note: sort parameters values must use a valid Search Parameter). Valid values for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, based-on, category, code, code-value-concept, code-value-date, code-value-quantity, code-value-string, combo-code, combo-code-value-concept, combo-code-value-quantity, combo-data-absent-reason, combo-value-concept, combo-value-quantity, component-code, component-code-value-concept, component-code-value-quantity, component-data-absent-reason, component-value-concept, component-value-quantity, data-absent-reason, date, derived-from, device, encounter, focus, has-member, identifier, method, part-of, patient, performer, specimen, status, subject, value-concept, value-date, value-quantity, value-string]", e.getMessage());
}
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4Test.java
index 85011502e58..b9ab285fa69 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4Test.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
@@ -32,7 +31,7 @@ public class FhirResourceDaoSearchParameterR4Test {
@BeforeEach
public void before() {
- myCtx = FhirContext.forCached(FhirVersionEnum.R4);
+ myCtx = FhirContext.forR4Cached();
myDao = new FhirResourceDaoSearchParameterR4();
myDao.setContext(myCtx);
@@ -50,9 +49,6 @@ public class FhirResourceDaoSearchParameterR4Test {
if (nextp.getName().equals("_id")) {
continue;
}
- if (nextp.getName().equals("_language")) {
- continue;
- }
if (isBlank(nextp.getPath())) {
continue;
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java
index 7b635e56f1b..150e795a5be 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java
@@ -79,6 +79,7 @@ import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.matchesPattern;
+import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
@@ -409,7 +410,7 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test {
// HFJ_SPIDX_STRING
List strings = myResourceIndexedSearchParamStringDao.findAllForResourceId(patientId);
ourLog.info("\n * {}", strings.stream().map(ResourceIndexedSearchParamString::toString).collect(Collectors.joining("\n * ")));
- assertEquals(10, strings.size());
+ assertEquals(9, strings.size());
assertEquals(myPartitionId, strings.get(0).getPartitionId().getPartitionId().intValue());
assertEquals(myPartitionDate, strings.get(0).getPartitionId().getPartitionDate());
@@ -492,8 +493,11 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test {
// HFJ_SPIDX_STRING
List strings = myResourceIndexedSearchParamStringDao.findAllForResourceId(patientId);
- ourLog.info("\n * {}", strings.stream().map(ResourceIndexedSearchParamString::toString).collect(Collectors.joining("\n * ")));
- assertEquals(10, strings.size());
+ String stringsDesc = strings.stream().map(ResourceIndexedSearchParamString::toString).sorted().collect(Collectors.joining("\n * "));
+ ourLog.info("\n * {}", stringsDesc);
+ assertThat(stringsDesc, not(containsString("_text")));
+ assertThat(stringsDesc, not(containsString("_content")));
+ assertEquals(9, strings.size(), stringsDesc);
assertEquals(null, strings.get(0).getPartitionId().getPartitionId());
assertEquals(myPartitionDate, strings.get(0).getPartitionId().getPartitionDate());
@@ -701,7 +705,7 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test {
// HFJ_SPIDX_STRING
List strings = myResourceIndexedSearchParamStringDao.findAllForResourceId(patientId);
ourLog.info("\n * {}", strings.stream().map(ResourceIndexedSearchParamString::toString).collect(Collectors.joining("\n * ")));
- assertEquals(10, strings.size());
+ assertEquals(9, strings.size());
assertEquals(myPartitionId, strings.get(0).getPartitionId().getPartitionId().intValue());
assertEquals(myPartitionDate, strings.get(0).getPartitionId().getPartitionDate());
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PersistObservationIndexedSearchParamLastNR4IT.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PersistObservationIndexedSearchParamLastNR4IT.java
index bd686231e0c..cbd54dca482 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PersistObservationIndexedSearchParamLastNR4IT.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PersistObservationIndexedSearchParamLastNR4IT.java
@@ -1,24 +1,33 @@
package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.config.TestR4ConfigWithElasticsearchClient;
import ca.uhn.fhir.jpa.dao.ObservationLastNIndexPersistSvc;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
-import ca.uhn.fhir.jpa.model.util.CodeSystemHash;
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl;
import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
import ca.uhn.fhir.jpa.search.lastn.json.ObservationJson;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.parser.IParser;
-import ca.uhn.fhir.rest.param.*;
+import ca.uhn.fhir.rest.param.ReferenceAndListParam;
+import ca.uhn.fhir.rest.param.ReferenceOrListParam;
+import ca.uhn.fhir.rest.param.ReferenceParam;
+import ca.uhn.fhir.rest.param.TokenAndListParam;
+import ca.uhn.fhir.rest.param.TokenOrListParam;
+import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.test.utilities.docker.RequiresDocker;
import com.google.common.base.Charsets;
import org.apache.commons.io.IOUtils;
-import org.aspectj.lang.annotation.Before;
-import org.hl7.fhir.r4.model.*;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.CodeableConcept;
+import org.hl7.fhir.r4.model.Coding;
+import org.hl7.fhir.r4.model.DateTimeType;
+import org.hl7.fhir.r4.model.IdType;
+import org.hl7.fhir.r4.model.Meta;
+import org.hl7.fhir.r4.model.Observation;
+import org.hl7.fhir.r4.model.Reference;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer;
@@ -31,14 +40,18 @@ import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import java.io.IOException;
import java.io.InputStream;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -411,7 +424,7 @@ public class PersistObservationIndexedSearchParamLastNR4IT {
@Order(1)
@Test
public void testSampleBundleInTransaction() throws IOException {
- FhirContext myFhirCtx = FhirContext.forCached(FhirVersionEnum.R4);
+ FhirContext myFhirCtx = FhirContext.forR4Cached();
PathMatchingResourcePatternResolver provider = new PathMatchingResourcePatternResolver();
final Resource[] bundleResources;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParamExtractorR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParamExtractorR4Test.java
index 8dfe6e4a1c7..0481f0b3de3 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParamExtractorR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParamExtractorR4Test.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.context.phonetic.IPhoneticEncoder;
@@ -61,7 +60,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
public class SearchParamExtractorR4Test {
private static final Logger ourLog = LoggerFactory.getLogger(SearchParamExtractorR4Test.class);
- private static FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
+ private static final FhirContext ourCtx = FhirContext.forR4Cached();
private MySearchParamRegistry mySearchParamRegistry;
private PartitionSettings myPartitionSettings;
@@ -398,7 +397,7 @@ public class SearchParamExtractorR4Test {
private static class MySearchParamRegistry implements ISearchParamRegistry, ISearchParamRegistryController {
- private List myExtraSearchParams = new ArrayList<>();
+ private final List myExtraSearchParams = new ArrayList<>();
@Override
public void forceRefresh() {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParameterMapTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParameterMapTest.java
index fcb37e54fe9..090e693af20 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParameterMapTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParameterMapTest.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.param.HasParam;
import ca.uhn.fhir.test.BaseTest;
@@ -11,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
public class SearchParameterMapTest extends BaseTest {
- private FhirContext myContext = FhirContext.forCached(FhirVersionEnum.R4);
+ private final FhirContext myContext = FhirContext.forR4Cached();
@Test
public void toNormalizedQueryStringTest() {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/graphql/JpaStorageServicesTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/graphql/JpaStorageServicesTest.java
index f0560139ff2..27d843abb58 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/graphql/JpaStorageServicesTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/graphql/JpaStorageServicesTest.java
@@ -106,7 +106,7 @@ public class JpaStorageServicesTest extends BaseJpaR4Test {
mySvc.listResources(mySrd, "Appointment", Collections.singletonList(argument), result);
fail();
} catch (InvalidRequestException e) {
- assertEquals("Unknown GraphQL argument \"test\". Value GraphQL argument for this type are: [_id, _language, actor, appointment_type, based_on, date, identifier, location, part_status, patient, practitioner, reason_code, reason_reference, service_category, service_type, slot, specialty, status, supporting_info]", e.getMessage());
+ assertEquals("Unknown GraphQL argument \"test\". Value GraphQL argument for this type are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, actor, appointment_type, based_on, date, identifier, location, part_status, patient, practitioner, reason_code, reason_reference, service_category, service_type, slot, specialty, status, supporting_info]", e.getMessage());
}
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/interceptor/SearchPreferHandlingInterceptorJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/interceptor/SearchPreferHandlingInterceptorJpaTest.java
index 925783d07da..247286c21f6 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/interceptor/SearchPreferHandlingInterceptorJpaTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/interceptor/SearchPreferHandlingInterceptorJpaTest.java
@@ -62,7 +62,7 @@ public class SearchPreferHandlingInterceptorJpaTest extends BaseResourceProvider
.execute();
fail();
} catch (InvalidRequestException e) {
- assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
+ assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
}
}
@@ -81,7 +81,7 @@ public class SearchPreferHandlingInterceptorJpaTest extends BaseResourceProvider
.execute();
fail();
} catch (InvalidRequestException e) {
- assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
+ assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
}
}
@@ -100,7 +100,7 @@ public class SearchPreferHandlingInterceptorJpaTest extends BaseResourceProvider
.execute();
fail();
} catch (InvalidRequestException e) {
- assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
+ assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
}
}
@@ -136,7 +136,7 @@ public class SearchPreferHandlingInterceptorJpaTest extends BaseResourceProvider
.execute();
fail();
} catch (InvalidRequestException e) {
- assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
+ assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
}
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java
index 13cfb4cd620..ed387fed101 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java
@@ -185,7 +185,7 @@ public class NpmR4Test extends BaseJpaR4Test {
assertEquals("Nictiz NL package of FHIR STU3 conformance resources for MedMij information standard Questionnaires. Includes dependency on Zib2017 and SDC.\\n\\nHCIMs: https://zibs.nl/wiki/HCIM_Release_2017(EN)", pkg.description());
// Fetch resource by URL
- FhirContext fhirContext = FhirContext.forCached(FhirVersionEnum.DSTU3);
+ FhirContext fhirContext = FhirContext.forDstu3Cached();
runInTransaction(() -> {
IBaseResource asset = myPackageCacheManager.loadPackageAssetByUrl(FhirVersionEnum.DSTU3, "http://nictiz.nl/fhir/StructureDefinition/vl-QuestionnaireResponse");
assertThat(fhirContext.newJsonParser().encodeResourceToString(asset), containsString("\"url\":\"http://nictiz.nl/fhir/StructureDefinition/vl-QuestionnaireResponse\",\"version\":\"1.0.1\""));
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImplTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImplTest.java
index 2ac98743ab0..93e4e690b5d 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImplTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImplTest.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.packages;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import org.hl7.fhir.r4.model.Enumerations;
import org.hl7.fhir.r4.model.SearchParameter;
import org.junit.jupiter.api.BeforeEach;
@@ -11,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
class PackageInstallerSvcImplTest {
- private final FhirContext myCtx = FhirContext.forCached(FhirVersionEnum.R4);
+ private final FhirContext myCtx = FhirContext.forR4Cached();
private PackageInstallerSvcImpl mySvc;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/partition/PartitionManagementProviderTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/partition/PartitionManagementProviderTest.java
index ad02f5fc22a..3d3f0b2fc37 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/partition/PartitionManagementProviderTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/partition/PartitionManagementProviderTest.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.partition;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.entity.PartitionEntity;
import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
@@ -43,7 +42,7 @@ import static org.mockito.Mockito.when;
public class PartitionManagementProviderTest {
private static final Logger ourLog = LoggerFactory.getLogger(PartitionManagementProviderTest.class);
- private static FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
+ private static final FhirContext ourCtx = FhirContext.forR4Cached();
@RegisterExtension
public static RestfulServerExtension ourServerRule = new RestfulServerExtension(ourCtx);
@MockBean
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchApplyR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchApplyR4Test.java
index 0a9252e986a..51f664bac56 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchApplyR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchApplyR4Test.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.patch;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource;
@@ -24,7 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
public class FhirPatchApplyR4Test {
- private static final FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
+ private static final FhirContext ourCtx = FhirContext.forR4Cached();
private static final Logger ourLog = LoggerFactory.getLogger(FhirPatchApplyR4Test.class);
@Test
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchCoreTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchCoreTest.java
index b044d489485..1da0afb4e49 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchCoreTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchCoreTest.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.patch;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.test.BaseTest;
import ca.uhn.fhir.util.ClasspathUtil;
import ca.uhn.fhir.util.XmlUtil;
@@ -51,10 +50,10 @@ public class FhirPatchCoreTest extends BaseTest {
public static List