From 9753b666100ac0c79d7e3e98e5d63c72232c118f Mon Sep 17 00:00:00 2001
From: Ken Stevens
Date: Wed, 8 Dec 2021 15:18:54 -0500
Subject: [PATCH] 2564 contained resource validation flag (#3225)
* First cut at multithreading bundle validation
* javadoc
* change test to a red-green test
* add daoconfig
* move bundle concurrency config from validationsupport to request validator
* Moved concurrent details from ValidationOptions to FhirValidator
* Remove bundleValidationThreadCount (it's set by creating an appropriate executor)
* validate threadpool prefixes
* FIXME cleanup
* reassign FIXMEs to JB
* only create the threadpool if it will be used
* Add the MdcTaskDectorator to all threadpools
* Add bundle path to concurrently validated bundle resource validation messages.
* Add test to check bundle entry path being added to validation messages
* Threaded validation of contained resources initial checkin
* FHIR validator refactored to maintain correct bundle path and async validation task
* Refactored to use validation complete invoke callback to support raw string resource or resource object
* switch from XML to JSON
* # Conflicts:
# hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java
# hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java
* Updated to use new HAPI-FHIR version
* merge 'validate_contains_change' into issue-3144-multi-threaded-bundle-validation
* Updated to use new HAPI-FHIR version
* Revert "Updated to use new HAPI-FHIR version"
This reverts commit 910b7f676bd3b0bac6603abf758b09f6af819a55.
* Revert "merge 'validate_contains_change' into issue-3144-multi-threaded-bundle-validation"
This reverts commit c7d60fc3e6a560d6263a39ca13469e51a8f5d155.
* Revert "Updated to use new HAPI-FHIR version"
This reverts commit aa8a7af45553f0b3f9ef0a697c0c88b8a8249f5a.
# Conflicts:
# hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java
* Fix Test dependencies after reverting changes.
* merge 'validate_contains_change' to 2564-contained-resource-validation-flag
* Disable threadpool prefix name validate check.
* merge master
* fix thread regexp
* pre-review cleanup
* change log
* fix test
* revert to XML as default validation serialization
* fix test
* fix test
Co-authored-by: Jaison B
---
hapi-deployable-pom/pom.xml | 2 +-
hapi-fhir-android/pom.xml | 2 +-
hapi-fhir-base/pom.xml | 2 +-
.../java/ca/uhn/fhir/context/FhirContext.java | 18 +-
.../fhir/context/IFhirValidatorFactory.java | 27 +++
.../DefaultProfileValidationSupport.java | 1 -
.../context/support/IValidationSupport.java | 2 -
.../ca/uhn/fhir/validation/FhirValidator.java | 165 +++++++++++++----
.../fhir/validation/ValidationOptions.java | 3 +
hapi-fhir-batch/pom.xml | 2 +-
hapi-fhir-bom/pom.xml | 2 +-
hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 2 +-
.../HapiFlywayMigrateDatabaseCommandTest.java | 3 +-
hapi-fhir-cli/hapi-fhir-cli-app/pom.xml | 2 +-
hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml | 2 +-
hapi-fhir-cli/pom.xml | 2 +-
hapi-fhir-client-okhttp/pom.xml | 2 +-
hapi-fhir-client/pom.xml | 2 +-
hapi-fhir-converter/pom.xml | 2 +-
hapi-fhir-dist/pom.xml | 2 +-
hapi-fhir-docs/pom.xml | 2 +-
...ip-contained-multithreaded-validation.yaml | 4 +
hapi-fhir-jacoco/pom.xml | 2 +-
hapi-fhir-jaxrsserver-base/pom.xml | 2 +-
hapi-fhir-jpa/pom.xml | 2 +-
hapi-fhir-jpaserver-base/pom.xml | 2 +-
.../fhir/jpa/binstore/IBinaryStorageSvc.java | 1 -
.../ca/uhn/fhir/jpa/config/BaseConfig.java | 14 +-
.../fhir/jpa/config/BaseConfigDstu3Plus.java | 3 +-
.../fhir/jpa/dao/BaseHapiFhirResourceDao.java | 2 -
.../fhir/jpa/dao/index/IdHelperService.java | 1 -
.../search/ExtendedLuceneIndexExtractor.java | 7 +-
.../jpa/entity/TermConceptDesignation.java | 13 +-
.../entity/TermConceptParentChildLink.java | 15 +-
.../tasks/HapiFhirJpaMigrationTasks.java | 5 -
.../jpa/search/SearchCoordinatorSvcImpl.java | 18 +-
.../fhir/jpa/term/BaseTermReadSvcImpl.java | 2 +-
.../uhn/fhir/jpa/term/TermLoaderSvcImpl.java | 2 +-
.../term/api/ITermCodeSystemStorageSvc.java | 1 -
.../jpa/term/api/ITermDeferredStorageSvc.java | 1 -
...atchTermCodeSystemVersionDeleteWriter.java | 5 -
.../term/job/TermCodeSystemDeleteTasklet.java | 1 -
.../term/job/TermConceptDeleteTasklet.java | 4 +-
.../loinc/LoincLinguisticVariantsHandler.java | 3 +-
.../java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java | 2 +-
.../FhirResourceDaoDstu3TerminologyTest.java | 1 -
.../ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java | 3 -
...rceDaoR4LuceneDisabledStandardQueries.java | 2 -
.../r4/FhirResourceDaoR4TerminologyTest.java | 1 -
.../jpa/dao/r4/FhirResourceDaoR4Test.java | 1 -
.../ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java | 3 -
.../fhir/jpa/provider/r4/ExpungeR4Test.java | 1 -
.../resthook/RestHookTestDstu2Test.java | 3 +-
.../resthook/RestHookTestDstu3Test.java | 3 +-
.../term/TermDeferredStorageSvcImplTest.java | 2 -
.../TerminologyLoaderSvcLoincJpaTest.java | 1 -
...erminologySvcImplCurrentVersionR4Test.java | 2 -
hapi-fhir-jpaserver-cql/pom.xml | 2 +-
hapi-fhir-jpaserver-mdm/pom.xml | 2 +-
.../uhn/fhir/jpa/mdm/dao/MdmLinkDaoSvc.java | 2 +-
.../jpa/mdm/provider/BaseProviderR4Test.java | 1 -
hapi-fhir-jpaserver-model/pom.xml | 2 +-
.../jpa/model/entity/BinaryStorageEntity.java | 8 +-
.../model/search/ExtendedLuceneIndexData.java | 2 -
hapi-fhir-jpaserver-searchparam/pom.xml | 2 +-
.../SearchParamExtractorService.java | 2 +-
hapi-fhir-jpaserver-subscription/pom.xml | 2 +-
.../WebsocketConnectionValidator.java | 4 +-
hapi-fhir-jpaserver-test-utilities/pom.xml | 2 +-
.../fhir/jpa/config/TestJpaDstu3Config.java | 2 -
hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 2 +-
hapi-fhir-server-mdm/pom.xml | 2 +-
.../mdm/provider/MdmProviderDstu3Plus.java | 12 --
.../fhir/mdm/provider/MdmProviderLoader.java | 1 -
hapi-fhir-server-openapi/pom.xml | 2 +-
hapi-fhir-server/pom.xml | 2 +-
.../ResponseValidatingInterceptor.java | 11 +-
.../method/GraphQLQueryBodyParameter.java | 6 -
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../hapi-fhir-spring-boot-samples/pom.xml | 2 +-
.../hapi-fhir-spring-boot-starter/pom.xml | 2 +-
hapi-fhir-spring-boot/pom.xml | 2 +-
hapi-fhir-sql-migrate/pom.xml | 2 +-
hapi-fhir-storage/pom.xml | 2 +-
.../ca/uhn/fhir/jpa/api/config/DaoConfig.java | 24 +++
.../ca/uhn/fhir/jpa/dao/BaseStorageDao.java | 2 +-
.../jpa/dao/BaseTransactionProcessor.java | 10 +-
.../java/ca/uhn/fhir/util/ThreadPoolUtil.java | 47 +++++
hapi-fhir-structures-dstu2.1/pom.xml | 2 +-
hapi-fhir-structures-dstu2/pom.xml | 2 +-
hapi-fhir-structures-dstu3/pom.xml | 2 +-
hapi-fhir-structures-hl7org-dstu2/pom.xml | 2 +-
hapi-fhir-structures-r4/pom.xml | 2 +-
hapi-fhir-structures-r5/pom.xml | 2 +-
hapi-fhir-test-utilities/pom.xml | 2 +-
hapi-fhir-testpage-overlay/pom.xml | 2 +-
.../pom.xml | 2 +-
hapi-fhir-validation-resources-dstu2/pom.xml | 2 +-
hapi-fhir-validation-resources-dstu3/pom.xml | 2 +-
hapi-fhir-validation-resources-r4/pom.xml | 2 +-
hapi-fhir-validation-resources-r5/pom.xml | 2 +-
hapi-fhir-validation/pom.xml | 2 +-
.../support/ValidationSupportChain.java | 4 -
.../FhirInstanceValidatorR4Test.java | 173 ++++++++++++------
.../QuestionnaireResponseValidatorR5Test.java | 1 -
.../StructureDefinitionPatientV1.json | 146 +++++++++++++++
.../r4/concurrent-bundle/patient.json | 73 ++++++++
hapi-tinder-plugin/pom.xml | 16 +-
hapi-tinder-test/pom.xml | 2 +-
pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
116 files changed, 726 insertions(+), 279 deletions(-)
create mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/context/IFhirValidatorFactory.java
create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/2564-skip-contained-multithreaded-validation.yaml
create mode 100644 hapi-fhir-storage/src/main/java/ca/uhn/fhir/util/ThreadPoolUtil.java
create mode 100644 hapi-fhir-validation/src/test/resources/r4/concurrent-bundle/StructureDefinitionPatientV1.json
create mode 100644 hapi-fhir-validation/src/test/resources/r4/concurrent-bundle/patient.json
diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml
index b07c1d30222..c947c601f61 100644
--- a/hapi-deployable-pom/pom.xml
+++ b/hapi-deployable-pom/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml
index 996a6d54ea9..2a12e1be615 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.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml
index f00482585a7..186d4237e7e 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.7.0-PRE4-SNAPSHOT
+ 5.7.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 2c3a93ff048..152ef94d2dc 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
@@ -127,6 +127,7 @@ public class FhirContext {
private volatile Boolean myFormatJsonSupported;
private volatile Boolean myFormatNDJsonSupported;
private volatile Boolean myFormatRdfSupported;
+ private IFhirValidatorFactory myFhirValidatorFactory = fhirContext -> new FhirValidator(fhirContext);
/**
* @deprecated It is recommended that you use one of the static initializer methods instead
@@ -908,7 +909,7 @@ public class FhirContext {
*
*/
public FhirValidator newValidator() {
- return new FhirValidator(this);
+ return myFhirValidatorFactory.newFhirValidator(this);
}
public ViewGenerator newViewGenerator() {
@@ -1072,9 +1073,22 @@ public class FhirContext {
*
* @param theParserErrorHandler The error handler
*/
- public void setParserErrorHandler(final IParserErrorHandler theParserErrorHandler) {
+ public FhirContext setParserErrorHandler(final IParserErrorHandler theParserErrorHandler) {
Validate.notNull(theParserErrorHandler, "theParserErrorHandler must not be null");
myParserErrorHandler = theParserErrorHandler;
+ return this;
+ }
+
+ /**
+ * Set the factory method used to create FhirValidator instances
+ *
+ * @param theFhirValidatorFactory
+ * @return this
+ * @since 5.6.0
+ */
+ public FhirContext setFhirValidatorFactory(IFhirValidatorFactory theFhirValidatorFactory) {
+ myFhirValidatorFactory = theFhirValidatorFactory;
+ return this;
}
@SuppressWarnings({"cast"})
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/IFhirValidatorFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/IFhirValidatorFactory.java
new file mode 100644
index 00000000000..396eff4a2ae
--- /dev/null
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/IFhirValidatorFactory.java
@@ -0,0 +1,27 @@
+package ca.uhn.fhir.context;
+
+/*-
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * 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 ca.uhn.fhir.validation.FhirValidator;
+
+public interface IFhirValidatorFactory {
+ FhirValidator newFhirValidator(FhirContext theFhirContext);
+}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupport.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupport.java
index 93b11b521bd..7ba4a55c067 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupport.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupport.java
@@ -380,5 +380,4 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
ArrayList retVal = new ArrayList<>(theMap.values());
return (List) Collections.unmodifiableList(retVal);
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java
index 677b68f3b9f..69d2b091841 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java
@@ -36,7 +36,6 @@ import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
@@ -340,7 +339,6 @@ public interface IValidationSupport {
return null;
}
-
enum IssueSeverity {
/**
* The issue caused the action to fail, and no further checking could be performed.
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java
index 4fb7129fbca..fde706d9f99 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java
@@ -24,13 +24,25 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.Pointcut;
+import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
+import ca.uhn.fhir.util.BundleUtil;
import ca.uhn.fhir.validation.schematron.SchematronProvider;
import org.apache.commons.lang3.Validate;
+import org.hl7.fhir.instance.model.api.IBase;
+import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
/**
@@ -46,6 +58,7 @@ import java.util.List;
*
*/
public class FhirValidator {
+ private static final Logger ourLog = LoggerFactory.getLogger(FhirValidator.class);
private static final String I18N_KEY_NO_PH_ERROR = FhirValidator.class.getName() + ".noPhError";
@@ -53,6 +66,9 @@ public class FhirValidator {
private final FhirContext myContext;
private List myValidators = new ArrayList<>();
private IInterceptorBroadcaster myInterceptorBroadcaster;
+ private boolean myConcurrentBundleValidation;
+
+ private ExecutorService myExecutorService;
/**
* Constructor (this should not be called directly, but rather {@link FhirContext#newValidator()} should be called to obtain an instance of {@link FhirValidator})
@@ -72,8 +88,7 @@ public class FhirValidator {
registerValidatorModule(theInstance);
}
} else {
- for (Iterator iter = myValidators.iterator(); iter.hasNext(); ) {
- IValidatorModule next = iter.next();
+ for (IValidatorModule next : myValidators) {
if (next.getClass().equals(type)) {
unregisterValidatorModule(next);
}
@@ -86,6 +101,7 @@ public class FhirValidator {
for (IValidatorModule next : myValidators) {
if (next.getClass().equals(type)) {
found = true;
+ break;
}
}
return found;
@@ -202,6 +218,21 @@ public class FhirValidator {
return validateWithResult(theResource, null);
}
+ /**
+ * Validates a resource instance returning a {@link ValidationResult} which contains the results.
+ *
+ * @param theResource the resource to validate
+ * @param theOptions Optionally provides options to the validator
+ * @return the results of validation
+ * @since 4.0.0
+ */
+ public ValidationResult validateWithResult(String theResource, ValidationOptions theOptions) {
+ Validate.notNull(theResource, "theResource must not be null");
+ IValidationContext validationContext = ValidationContext.forText(myContext, theResource, theOptions);
+ Function callback = result -> invokeValidationCompletedHooks(null, theResource, result);
+ return doValidate(validationContext, theOptions, callback);
+ }
+
/**
* Validates a resource instance returning a {@link ValidationResult} which contains the results.
*
@@ -212,18 +243,65 @@ public class FhirValidator {
*/
public ValidationResult validateWithResult(IBaseResource theResource, ValidationOptions theOptions) {
Validate.notNull(theResource, "theResource must not be null");
+ IValidationContext validationContext = ValidationContext.forResource(myContext, theResource, theOptions);
+ Function callback = result -> invokeValidationCompletedHooks(theResource, null, result);
+ return doValidate(validationContext, theOptions, callback);
+ }
+ private ValidationResult doValidate(IValidationContext theValidationContext, ValidationOptions theOptions,
+ Function theValidationCompletionCallback) {
applyDefaultValidators();
- IValidationContext ctx = ValidationContext.forResource(myContext, theResource, theOptions);
-
- for (IValidatorModule next : myValidators) {
- next.validateResource(ctx);
+ ValidationResult result;
+ if (myConcurrentBundleValidation && theValidationContext.getResource() instanceof IBaseBundle
+ && myExecutorService != null) {
+ result = validateBundleEntriesConcurrently(theValidationContext, theOptions);
+ } else {
+ result = validateResource(theValidationContext);
}
- ValidationResult result = ctx.toResult();
- result = invokeValidationCompletedHooks(theResource, null, result);
- return result;
+ return theValidationCompletionCallback.apply(result);
+ }
+
+ private ValidationResult validateBundleEntriesConcurrently(IValidationContext theValidationContext, ValidationOptions theOptions) {
+ List entries = BundleUtil.toListOfResources(myContext, (IBaseBundle) theValidationContext.getResource());
+ // Async validation tasks
+ List validationTasks = IntStream.range(0, entries.size())
+ .mapToObj(index -> {
+ IBaseResource entry = entries.get(index);
+ String entryPathPrefix = String.format("Bundle.entry[%d].resource.ofType(%s)", index, entry.fhirType());
+ Future future = myExecutorService.submit(() -> {
+ IValidationContext entryValidationContext = ValidationContext.forResource(theValidationContext.getFhirContext(), entry, theOptions);
+ return validateResource(entryValidationContext);
+ });
+ return new ConcurrentValidationTask(entryPathPrefix, future);
+ }).collect(Collectors.toList());
+
+ List validationMessages = new ArrayList<>();
+ try {
+ for (ConcurrentValidationTask validationTask : validationTasks) {
+ ValidationResult result = validationTask.getFuture().get();
+ final String bundleEntryPathPrefix = validationTask.getResourcePathPrefix();
+ List messages = result.getMessages().stream()
+ .map(message -> {
+ String currentPath = message.getLocationString().substring(message.getLocationString().indexOf('.'));
+ message.setLocationString(bundleEntryPathPrefix + currentPath);
+ return message;
+ })
+ .collect(Collectors.toList());
+ validationMessages.addAll(messages);
+ }
+ } catch (InterruptedException | ExecutionException exp) {
+ throw new InternalErrorException(exp);
+ }
+ return new ValidationResult(myContext, new ArrayList<>(validationMessages));
+ }
+
+ private ValidationResult validateResource(IValidationContext theValidationContext) {
+ for (IValidatorModule next : myValidators) {
+ next.validateResource(theValidationContext);
+ }
+ return theValidationContext.toResult();
}
private ValidationResult invokeValidationCompletedHooks(IBaseResource theResourceParsed, String theResourceRaw, ValidationResult theValidationResult) {
@@ -242,30 +320,6 @@ public class FhirValidator {
return theValidationResult;
}
- /**
- * Validates a resource instance returning a {@link ValidationResult} which contains the results.
- *
- * @param theResource the resource to validate
- * @param theOptions Optionally provides options to the validator
- * @return the results of validation
- * @since 4.0.0
- */
- public ValidationResult validateWithResult(String theResource, ValidationOptions theOptions) {
- Validate.notNull(theResource, "theResource must not be null");
-
- applyDefaultValidators();
-
- IValidationContext ctx = ValidationContext.forText(myContext, theResource, theOptions);
-
- for (IValidatorModule next : myValidators) {
- next.validateResource(ctx);
- }
-
- ValidationResult result = ctx.toResult();
- result = invokeValidationCompletedHooks(null, theResource, result);
- return result;
- }
-
/**
* Optionally supplies an interceptor broadcaster that will be used to invoke validation related Pointcut events
*
@@ -274,4 +328,47 @@ public class FhirValidator {
public void setInterceptorBroadcaster(IInterceptorBroadcaster theInterceptorBraodcaster) {
myInterceptorBroadcaster = theInterceptorBraodcaster;
}
+
+ public FhirValidator setExecutorService(ExecutorService theExecutorService) {
+ myExecutorService = theExecutorService;
+ return this;
+ }
+
+ /**
+ * If this is true, bundles will be validated in parallel threads. The bundle structure itself will not be validated,
+ * only the resources in its entries.
+ */
+
+ public boolean isConcurrentBundleValidation() {
+ return myConcurrentBundleValidation;
+ }
+
+ /**
+ * If this is true, bundles will be validated in parallel threads. The bundle structure itself will not be validated,
+ * only the resources in its entries.
+ */
+ public FhirValidator setConcurrentBundleValidation(boolean theConcurrentBundleValidation) {
+ myConcurrentBundleValidation = theConcurrentBundleValidation;
+ return this;
+ }
+
+ // Simple Tuple to keep track of bundle path and associate aync future task
+ private static class ConcurrentValidationTask {
+ private final String myResourcePathPrefix;
+ private final Future myFuture;
+
+ private ConcurrentValidationTask(String theResourcePathPrefix, Future theFuture) {
+ myResourcePathPrefix = theResourcePathPrefix;
+ myFuture = theFuture;
+ }
+
+ public String getResourcePathPrefix() {
+ return myResourcePathPrefix;
+ }
+
+ public Future getFuture() {
+ return myFuture;
+ }
+ }
+
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/ValidationOptions.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/ValidationOptions.java
index d8cca3d6b8f..50c032596b6 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/ValidationOptions.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/ValidationOptions.java
@@ -33,6 +33,9 @@ public class ValidationOptions {
private static ValidationOptions ourEmpty;
private Set myProfiles;
+ public ValidationOptions() {
+ }
+
public Set getProfiles() {
return myProfiles != null ? Collections.unmodifiableSet(myProfiles) : Collections.emptySet();
}
diff --git a/hapi-fhir-batch/pom.xml b/hapi-fhir-batch/pom.xml
index 8e9d19e70af..aef49abd551 100644
--- a/hapi-fhir-batch/pom.xml
+++ b/hapi-fhir-batch/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml
index 9f73776f3ae..d108f02965b 100644
--- a/hapi-fhir-bom/pom.xml
+++ b/hapi-fhir-bom/pom.xml
@@ -10,7 +10,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.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 6f753204cac..5acb12af54c 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.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/HapiFlywayMigrateDatabaseCommandTest.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/HapiFlywayMigrateDatabaseCommandTest.java
index a12693fc867..db2420516a8 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/HapiFlywayMigrateDatabaseCommandTest.java
+++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/HapiFlywayMigrateDatabaseCommandTest.java
@@ -13,6 +13,7 @@ import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatemen
import org.springframework.jdbc.support.lob.DefaultLobHandler;
import org.springframework.jdbc.support.lob.LobCreator;
+import javax.annotation.Nonnull;
import javax.validation.constraints.NotNull;
import java.io.File;
import java.io.IOException;
@@ -278,7 +279,7 @@ public class HapiFlywayMigrateDatabaseCommandTest {
assertTrue(JdbcUtils.getTableNames(connectionProperties).contains("HFJ_BLK_EXPORT_JOB")); // Late table
}
- @NotNull
+ @Nonnull
private File getLocation(String theDatabaseName) throws IOException {
File directory = new File(DB_DIRECTORY);
if (directory.exists()) {
diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
index 7a2a4bf5af2..a0c8e5d216b 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.7.0-PRE4-SNAPSHOT
+ 5.7.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 eb4c17a584e..b05bf7d2c20 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.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../../hapi-deployable-pom
diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml
index 80e36a07525..f5b60f0db09 100644
--- a/hapi-fhir-cli/pom.xml
+++ b/hapi-fhir-cli/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml
index 63312aa9e6b..37e8301fe05 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.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml
index 4517466fdc8..8f41896b0dc 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.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml
index 3a45ee6460a..50f88dda261 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.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml
index 172761c09bf..5a0a86e2897 100644
--- a/hapi-fhir-dist/pom.xml
+++ b/hapi-fhir-dist/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-docs/pom.xml b/hapi-fhir-docs/pom.xml
index ae915569734..e59e48fe8a2 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.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/2564-skip-contained-multithreaded-validation.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/2564-skip-contained-multithreaded-validation.yaml
new file mode 100644
index 00000000000..c139b894774
--- /dev/null
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/2564-skip-contained-multithreaded-validation.yaml
@@ -0,0 +1,4 @@
+---
+type: add
+title: "New configuration option added to validate bundle resources concurrently.
+Also new configuration added to skip validation of contained resources."
diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml
index 7f7450cae23..46f05a91fa8 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.7.0-PRE4-SNAPSHOT
+ 5.7.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 91451a758f9..290056b8b65 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.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpa/pom.xml b/hapi-fhir-jpa/pom.xml
index 35ac303adb3..a7d69d03a25 100644
--- a/hapi-fhir-jpa/pom.xml
+++ b/hapi-fhir-jpa/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
4.0.0
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index 3866e88866d..251d39e3436 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.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/binstore/IBinaryStorageSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/binstore/IBinaryStorageSvc.java
index 9100f144d21..df6211f2ede 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/binstore/IBinaryStorageSvc.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/binstore/IBinaryStorageSvc.java
@@ -20,7 +20,6 @@ package ca.uhn.fhir.jpa.binstore;
* #L%
*/
-import ca.uhn.fhir.context.FhirContext;
import org.hl7.fhir.instance.model.api.IBaseBinary;
import org.hl7.fhir.instance.model.api.IIdType;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java
index da5a7bb92af..b8348427857 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java
@@ -125,7 +125,6 @@ import ca.uhn.fhir.jpa.search.cache.DatabaseSearchResultCacheSvcImpl;
import ca.uhn.fhir.jpa.search.cache.ISearchCacheSvc;
import ca.uhn.fhir.jpa.search.cache.ISearchResultCacheSvc;
import ca.uhn.fhir.jpa.search.elastic.IndexNamePrefixLayoutStrategy;
-import ca.uhn.fhir.jpa.search.reindex.BlockPolicy;
import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc;
import ca.uhn.fhir.jpa.search.reindex.ResourceReindexer;
import ca.uhn.fhir.jpa.search.reindex.ResourceReindexingSvcImpl;
@@ -151,6 +150,7 @@ import ca.uhn.fhir.rest.server.interceptor.consent.IConsentContextServices;
import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor;
import ca.uhn.fhir.rest.server.provider.DeleteExpungeProvider;
import ca.uhn.fhir.rest.server.provider.ReindexProvider;
+import ca.uhn.fhir.util.ThreadPoolUtil;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.hl7.fhir.common.hapi.validation.support.UnknownCodeSystemWarningValidationSupport;
import org.hl7.fhir.instance.model.api.IBaseResource;
@@ -181,7 +181,6 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler;
import org.springframework.scheduling.concurrent.ScheduledExecutorFactoryBean;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import javax.annotation.Nullable;
import javax.annotation.PostConstruct;
@@ -426,18 +425,9 @@ public abstract class BaseConfig {
@Bean(name= BatchConstants.JOB_LAUNCHING_TASK_EXECUTOR)
public TaskExecutor jobLaunchingTaskExecutor() {
- ThreadPoolTaskExecutor asyncTaskExecutor = new ThreadPoolTaskExecutor();
- asyncTaskExecutor.setCorePoolSize(0);
- asyncTaskExecutor.setMaxPoolSize(10);
- asyncTaskExecutor.setQueueCapacity(0);
- asyncTaskExecutor.setAllowCoreThreadTimeOut(true);
- asyncTaskExecutor.setThreadNamePrefix("JobLauncher-");
- asyncTaskExecutor.setRejectedExecutionHandler(new BlockPolicy());
- asyncTaskExecutor.initialize();
- return asyncTaskExecutor;
+ return ThreadPoolUtil.newThreadPool(0, 10, "job-launcher-");
}
-
@Bean
public IResourceReindexingSvc resourceReindexingSvc() {
return new ResourceReindexingSvcImpl();
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfigDstu3Plus.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfigDstu3Plus.java
index 845c07d2d70..a744a45fc7a 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfigDstu3Plus.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfigDstu3Plus.java
@@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.config;
import ca.uhn.fhir.context.support.DefaultProfileValidationSupport;
import ca.uhn.fhir.context.support.IValidationSupport;
+import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.dao.JpaPersistedResourceValidationSupport;
import ca.uhn.fhir.jpa.dao.ObservationLastNIndexPersistSvc;
import ca.uhn.fhir.jpa.term.TermCodeSystemStorageSvcImpl;
@@ -66,7 +67,7 @@ public abstract class BaseConfigDstu3Plus extends BaseConfig {
public abstract ITermVersionAdapterSvc terminologyVersionAdapterSvc();
@Bean(name = "myDefaultProfileValidationSupport")
- public DefaultProfileValidationSupport defaultProfileValidationSupport() {
+ public DefaultProfileValidationSupport defaultProfileValidationSupport(DaoConfig theDaoConfig) {
return new DefaultProfileValidationSupport(fhirContext());
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java
index 2dc92b860b5..dd63aeb98a2 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java
@@ -86,7 +86,6 @@ import ca.uhn.fhir.rest.server.IRestfulServerDefaults;
import ca.uhn.fhir.rest.server.RestfulServerUtils;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
-import ca.uhn.fhir.rest.server.exceptions.NotImplementedOperationException;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
@@ -1776,7 +1775,6 @@ public abstract class BaseHapiFhirResourceDao extends B
}
FhirValidator validator = getContext().newValidator();
-
validator.setInterceptorBroadcaster(CompositeInterceptorBroadcaster.newCompositeBroadcaster(myInterceptorBroadcaster, theRequest));
validator.registerValidatorModule(getInstanceValidator());
validator.registerValidatorModule(new IdChecker(theMode));
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java
index 1dbcf630c07..9c1e3779126 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java
@@ -40,7 +40,6 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
-import org.apache.commons.lang3.Functions;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IAnyResource;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedLuceneIndexExtractor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedLuceneIndexExtractor.java
index 4872085ce72..d96c877f36d 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedLuceneIndexExtractor.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedLuceneIndexExtractor.java
@@ -27,7 +27,12 @@ import ca.uhn.fhir.jpa.model.search.ExtendedLuceneIndexData;
import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams;
import org.jetbrains.annotations.NotNull;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
/**
* Extract search params for advanced lucene indexing.
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptDesignation.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptDesignation.java
index a2998fab590..63b2e2ead5b 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptDesignation.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptDesignation.java
@@ -23,7 +23,18 @@ package ca.uhn.fhir.jpa.entity;
import ca.uhn.fhir.util.ValidateUtil;
import javax.annotation.Nonnull;
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.ForeignKey;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
import java.io.Serializable;
import static org.apache.commons.lang3.StringUtils.left;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptParentChildLink.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptParentChildLink.java
index 8b75913bd4a..2a10e78edec 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptParentChildLink.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptParentChildLink.java
@@ -22,7 +22,20 @@ package ca.uhn.fhir.jpa.entity;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField;
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.ForeignKey;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
import java.io.Serializable;
@Entity
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java
index ea8b21df6c6..3e4f847bab4 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java
@@ -41,15 +41,10 @@ import ca.uhn.fhir.jpa.model.entity.SearchParamPresent;
import ca.uhn.fhir.util.VersionEnum;
import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static java.util.stream.Collectors.toSet;
@SuppressWarnings({"SqlNoDataSourceInspection", "SpellCheckingInspection"})
public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java
index 2a7f38d1f67..2dc408c8997 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java
@@ -390,21 +390,9 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
return Optional.empty();
}
- @NotNull
+ @Nonnull
private PersistedJpaSearchFirstPageBundleProvider submitSearch(IDao theCallingDao, SearchParameterMap theParams, String theResourceType, RequestDetails theRequestDetails, String theSearchUuid, ISearchBuilder theSb, String theQueryString, RequestPartitionId theRequestPartitionId, Search theSearch) {
StopWatch w = new StopWatch();
-// Search search = new Search();
- //TODO GGG MOVE THIS POPULATE AND ALSO THE HOOK CALL HIGHER UP IN THE STACK.
-// populateSearchEntity(theParams, theResourceType, theSearchUuid, theQueryString, search, theRequestPartitionId);
-
-// Interceptor call: STORAGE_PRESEARCH_REGISTERED
-// HookParams params = new HookParams()
-// .add(ICachedSearchDetails.class, search)
-// .add(RequestDetails.class, theRequestDetails)
-// .addIfMatchesType(ServletRequestDetails.class, theRequestDetails)
-// .add(SearchParameterMap.class, theParams);
-// CompositeInterceptorBroadcaster.doCallHooks(myInterceptorBroadcaster, theRequestDetails, Pointcut.STORAGE_PRESEARCH_REGISTERED, params);
-
SearchTask task = new SearchTask(theSearch, theCallingDao, theParams, theResourceType, theRequestDetails, theRequestPartitionId);
myIdToSearchTask.put(theSearch.getUuid(), task);
task.call();
@@ -841,7 +829,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
txTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
- protected void doInTransactionWithoutResult(@Nonnull @NotNull TransactionStatus theArg0) {
+ protected void doInTransactionWithoutResult(@Nonnull TransactionStatus theArg0) {
doSaveSearch();
}
@@ -853,7 +841,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
txTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
- protected void doInTransactionWithoutResult(@Nonnull @NotNull TransactionStatus theArg0) {
+ protected void doInTransactionWithoutResult(@Nonnull TransactionStatus theArg0) {
if (mySearch.getId() == null) {
doSaveSearch();
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java
index 9f6b494dd73..453b5271ff8 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java
@@ -2266,7 +2266,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
@Nullable
protected abstract CodeableConcept toCanonicalCodeableConcept(@Nullable IBaseDatatype theCodeableConcept);
- @NotNull
+ @Nonnull
private FhirVersionIndependentConcept toConcept(IPrimitiveType theCodeType, IPrimitiveType theCodeSystemIdentifierType, IBaseCoding theCodingType) {
String code = theCodeType != null ? theCodeType.getValueAsString() : null;
String system = theCodeSystemIdentifierType != null ? getUrlFromIdentifier(theCodeSystemIdentifierType.getValueAsString()) : null;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermLoaderSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermLoaderSvcImpl.java
index 058837541f9..724622dddac 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermLoaderSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermLoaderSvcImpl.java
@@ -413,7 +413,7 @@ public class TermLoaderSvcImpl implements ITermLoaderSvc {
}
@VisibleForTesting
- @NotNull
+ @Nonnull
Properties getProperties(LoadedFileDescriptors theDescriptors, String thePropertiesFile) {
Properties retVal = new Properties();
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermCodeSystemStorageSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermCodeSystemStorageSvc.java
index e5b0b4c131b..89180de4ebf 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermCodeSystemStorageSvc.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermCodeSystemStorageSvc.java
@@ -20,7 +20,6 @@ package ca.uhn.fhir.jpa.term.api;
* #L%
*/
-import ca.uhn.fhir.jpa.entity.TermCodeSystem;
import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
import ca.uhn.fhir.jpa.entity.TermConcept;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermDeferredStorageSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermDeferredStorageSvc.java
index 944a9c8bd76..07ef44692c9 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermDeferredStorageSvc.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermDeferredStorageSvc.java
@@ -20,7 +20,6 @@ package ca.uhn.fhir.jpa.term.api;
* #L%
*/
-import ca.uhn.fhir.jpa.entity.TermCodeSystem;
import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
import ca.uhn.fhir.jpa.entity.TermConcept;
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/BatchTermCodeSystemVersionDeleteWriter.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/BatchTermCodeSystemVersionDeleteWriter.java
index 03dbdf882c3..2a881848494 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/BatchTermCodeSystemVersionDeleteWriter.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/BatchTermCodeSystemVersionDeleteWriter.java
@@ -22,10 +22,6 @@ package ca.uhn.fhir.jpa.term.job;
import ca.uhn.fhir.jpa.dao.data.ITermCodeSystemDao;
import ca.uhn.fhir.jpa.dao.data.ITermCodeSystemVersionDao;
-import ca.uhn.fhir.jpa.dao.data.ITermConceptDao;
-import ca.uhn.fhir.jpa.dao.data.ITermConceptDesignationDao;
-import ca.uhn.fhir.jpa.dao.data.ITermConceptParentChildLinkDao;
-import ca.uhn.fhir.jpa.dao.data.ITermConceptPropertyDao;
import ca.uhn.fhir.jpa.entity.TermCodeSystem;
import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
import org.slf4j.Logger;
@@ -34,7 +30,6 @@ import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.text.DecimalFormat;
import java.util.List;
import java.util.Optional;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemDeleteTasklet.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemDeleteTasklet.java
index 17a0bee5335..854c5ae8cce 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemDeleteTasklet.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemDeleteTasklet.java
@@ -22,7 +22,6 @@ package ca.uhn.fhir.jpa.term.job;
import ca.uhn.fhir.jpa.dao.data.ITermCodeSystemDao;
import ca.uhn.fhir.jpa.dao.data.ITermCodeSystemVersionDao;
-import ca.uhn.fhir.jpa.entity.TermCodeSystem;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/TermConceptDeleteTasklet.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/TermConceptDeleteTasklet.java
index 9052fca2583..dd708bc401d 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/TermConceptDeleteTasklet.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/TermConceptDeleteTasklet.java
@@ -32,6 +32,8 @@ import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import javax.annotation.Nonnull;
+
import static ca.uhn.fhir.jpa.batch.config.BatchConstants.JOB_PARAM_CODE_SYSTEM_ID;
/**
@@ -49,7 +51,7 @@ public class TermConceptDeleteTasklet implements Tasklet {
private ITermCodeSystemVersionDao myCodeSystemVersionDao;
@Override
- public RepeatStatus execute(@NotNull StepContribution contribution, ChunkContext context) throws Exception {
+ public RepeatStatus execute(@Nonnull StepContribution contribution, ChunkContext context) throws Exception {
long codeSystemPid = (Long) context.getStepContext().getJobParameters().get(JOB_PARAM_CODE_SYSTEM_ID);
ourLog.info("Deleting code system {}", codeSystemPid);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/loinc/LoincLinguisticVariantsHandler.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/loinc/LoincLinguisticVariantsHandler.java
index 20972f1f472..79893548d92 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/loinc/LoincLinguisticVariantsHandler.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/loinc/LoincLinguisticVariantsHandler.java
@@ -5,6 +5,7 @@ import static org.apache.commons.lang3.StringUtils.trim;
import java.util.List;
+import javax.annotation.Nonnull;
import javax.validation.constraints.NotNull;
import org.apache.commons.csv.CSVRecord;
@@ -73,7 +74,7 @@ public class LoincLinguisticVariantsHandler implements IZipContentsHandlerCsv {
private String myIsoCountry;
private String myLanguageName;
- public LinguisticVariant(@NotNull String theId, @NotNull String theIsoLanguage, @NotNull String theIsoCountry, @NotNull String theLanguageName) {
+ public LinguisticVariant(@Nonnull String theId, @Nonnull String theIsoLanguage, @Nonnull String theIsoCountry, @Nonnull String theLanguageName) {
this.myId = theId;
this.myIsoLanguage = theIsoLanguage;
this.myIsoCountry = theIsoCountry;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
index e38f38c9001..a6aa030a02b 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
@@ -615,7 +615,7 @@ public abstract class BaseJpaTest extends BaseTest {
}
}
- @NotNull
+ @Nonnull
public static Map buildHibernateSearchProperties(boolean enableLucene) {
Map hibernateSearchProperties;
if (enableLucene) {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3TerminologyTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3TerminologyTest.java
index d733b4bce80..fba4248a897 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3TerminologyTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3TerminologyTest.java
@@ -16,7 +16,6 @@ import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.param.TokenParamModifier;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
-import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.validation.FhirValidator;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
index 75fb6bdc8ed..01c42a9aa91 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
@@ -60,7 +60,6 @@ import ca.uhn.fhir.jpa.entity.TermValueSetConcept;
import ca.uhn.fhir.jpa.interceptor.PerformanceTracingLoggingInterceptor;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
-import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc;
import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc;
import ca.uhn.fhir.jpa.provider.r4.JpaSystemProviderR4;
@@ -93,8 +92,6 @@ import ca.uhn.fhir.util.ClasspathUtil;
import ca.uhn.fhir.util.UrlUtil;
import ca.uhn.fhir.validation.FhirValidator;
import ca.uhn.fhir.validation.ValidationResult;
-import org.hibernate.search.mapper.orm.Search;
-import org.hibernate.search.mapper.orm.session.SearchSession;
import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport;
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
import org.hl7.fhir.instance.model.api.IBaseResource;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4LuceneDisabledStandardQueries.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4LuceneDisabledStandardQueries.java
index 71719b784a6..78d0ffa2eee 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4LuceneDisabledStandardQueries.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4LuceneDisabledStandardQueries.java
@@ -20,8 +20,6 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.PlatformTransactionManager;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {TestR4WithLuceneDisabledConfig.class})
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java
index d3a992782a7..ea39397a73a 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java
@@ -15,7 +15,6 @@ import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.param.TokenParamModifier;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
-import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.validation.FhirValidator;
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 a912f932fd2..ad1a93e57ed 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
@@ -130,7 +130,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_DELETE_JOB_NAME;
import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME;
import static org.apache.commons.lang3.StringUtils.countMatches;
import static org.apache.commons.lang3.StringUtils.defaultString;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java
index 5ee914b618f..d65b62cf94b 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java
@@ -49,7 +49,6 @@ import ca.uhn.fhir.jpa.entity.TermValueSet;
import ca.uhn.fhir.jpa.entity.TermValueSetConcept;
import ca.uhn.fhir.jpa.interceptor.PerformanceTracingLoggingInterceptor;
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
-import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.provider.r5.JpaSystemProviderR5;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.search.IStaleSearchDeletingSvc;
@@ -76,8 +75,6 @@ import ca.uhn.fhir.util.UrlUtil;
import ca.uhn.fhir.validation.FhirValidator;
import ca.uhn.fhir.validation.ValidationResult;
import org.apache.commons.io.IOUtils;
-import org.hibernate.search.mapper.orm.Search;
-import org.hibernate.search.mapper.orm.session.SearchSession;
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java
index a220129f570..7536bd6a87c 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java
@@ -32,7 +32,6 @@ import org.hl7.fhir.r4.model.DateType;
import org.hl7.fhir.r4.model.DecimalType;
import org.hl7.fhir.r4.model.Enumerations;
import org.hl7.fhir.r4.model.IdType;
-import org.hl7.fhir.r4.model.MedicationRequest;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Organization;
import org.hl7.fhir.r4.model.Patient;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu2Test.java
index cde305c056b..7bb3aedd5b4 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu2Test.java
@@ -34,6 +34,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import javax.annotation.Nonnull;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
@@ -109,7 +110,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
return subscription;
}
- @NotNull
+ @Nonnull
private Subscription newSubscription(String criteria, String payload, String endpoint) {
Subscription subscription = new Subscription();
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java
index b5715d7291d..8c586e0566d 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java
@@ -41,6 +41,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import javax.annotation.Nonnull;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
@@ -136,7 +137,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
return (Subscription) methodOutcome.getResource();
}
- @NotNull
+ @Nonnull
private Subscription newSubscription(String theCriteria, String thePayload, String theEndpoint, List headers) {
Subscription subscription = new Subscription();
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImplTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImplTest.java
index a63cb8e21b4..9298b802926 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImplTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImplTest.java
@@ -14,9 +14,7 @@ import org.springframework.batch.core.JobExecution;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.transaction.PlatformTransactionManager;
-import java.util.ArrayList;
import java.util.Collections;
-import java.util.List;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertFalse;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincJpaTest.java
index fe9a4d9ba0a..82f4b63f113 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincJpaTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincJpaTest.java
@@ -13,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.io.IOException;
-import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_DELETE_JOB_NAME;
import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplCurrentVersionR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplCurrentVersionR4Test.java
index b07e1c48610..9a1af779089 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplCurrentVersionR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplCurrentVersionR4Test.java
@@ -27,7 +27,6 @@ import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.UriType;
import org.hl7.fhir.r4.model.ValueSet;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Answers;
@@ -36,7 +35,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.test.annotation.DirtiesContext;
import org.springframework.util.ResourceUtils;
import javax.persistence.EntityManager;
diff --git a/hapi-fhir-jpaserver-cql/pom.xml b/hapi-fhir-jpaserver-cql/pom.xml
index 211b52ce4a1..bffab9b32bd 100644
--- a/hapi-fhir-jpaserver-cql/pom.xml
+++ b/hapi-fhir-jpaserver-cql/pom.xml
@@ -7,7 +7,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml
index e1332e615ca..ddb8c8d3b67 100644
--- a/hapi-fhir-jpaserver-mdm/pom.xml
+++ b/hapi-fhir-jpaserver-mdm/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/dao/MdmLinkDaoSvc.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/dao/MdmLinkDaoSvc.java
index 9c54828efd1..8cb3c57c71c 100644
--- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/dao/MdmLinkDaoSvc.java
+++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/dao/MdmLinkDaoSvc.java
@@ -155,7 +155,7 @@ public class MdmLinkDaoSvc {
return getMdmLinkWithMatchResult(theSourceResource, MdmMatchResultEnum.POSSIBLE_MATCH);
}
- @NotNull
+ @Nonnull
private Optional getMdmLinkWithMatchResult(IBaseResource theSourceResource, MdmMatchResultEnum theMatchResult) {
Long pid = myIdHelperService.getPidOrNull(theSourceResource);
if (pid == null) {
diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java
index 29a5856e53d..83d12933c8c 100644
--- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java
+++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java
@@ -3,7 +3,6 @@ package ca.uhn.fhir.jpa.mdm.provider;
import ca.uhn.fhir.jpa.mdm.BaseMdmR4Test;
import ca.uhn.fhir.mdm.api.IMdmClearJobSubmitter;
import ca.uhn.fhir.mdm.api.IMdmControllerSvc;
-import ca.uhn.fhir.mdm.api.IMdmMatchFinderSvc;
import ca.uhn.fhir.mdm.api.IMdmSubmitSvc;
import ca.uhn.fhir.mdm.provider.MdmControllerHelper;
import ca.uhn.fhir.mdm.provider.MdmProviderDstu3Plus;
diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml
index e813651ba54..37325cb1c11 100644
--- a/hapi-fhir-jpaserver-model/pom.xml
+++ b/hapi-fhir-jpaserver-model/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BinaryStorageEntity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BinaryStorageEntity.java
index d3c9becccbf..5a76ee782ca 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BinaryStorageEntity.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BinaryStorageEntity.java
@@ -20,7 +20,13 @@ package ca.uhn.fhir.jpa.model.entity;
* #L%
*/
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
import java.sql.Blob;
import java.util.Date;
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/ExtendedLuceneIndexData.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/ExtendedLuceneIndexData.java
index 22fa4b0df73..9a665b1ff02 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/ExtendedLuceneIndexData.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/ExtendedLuceneIndexData.java
@@ -21,11 +21,9 @@ package ca.uhn.fhir.jpa.model.search;
*/
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import ca.uhn.fhir.rest.param.TokenParam;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.SetMultimap;
-import org.apache.commons.lang3.StringUtils;
import org.hibernate.search.engine.backend.document.DocumentElement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml
index 3d497c37c01..436cad51e85 100755
--- a/hapi-fhir-jpaserver-searchparam/pom.xml
+++ b/hapi-fhir-jpaserver-searchparam/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java
index f0d163aba07..ccb32b41b9d 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java
@@ -290,7 +290,7 @@ public class SearchParamExtractorService {
theEntity.setHasLinks(theParams.myLinks.size() > 0);
}
- private void extractResourceLinks(@NotNull RequestPartitionId theRequestPartitionId, ResourceIndexedSearchParams theParams, ResourceTable theEntity, TransactionDetails theTransactionDetails, RuntimeSearchParam theRuntimeSearchParam, PathAndRef thePathAndRef, boolean theFailOnInvalidReference, RequestDetails theRequest) {
+ private void extractResourceLinks(@Nonnull RequestPartitionId theRequestPartitionId, ResourceIndexedSearchParams theParams, ResourceTable theEntity, TransactionDetails theTransactionDetails, RuntimeSearchParam theRuntimeSearchParam, PathAndRef thePathAndRef, boolean theFailOnInvalidReference, RequestDetails theRequest) {
IBaseReference nextReference = thePathAndRef.getRef();
IIdType nextId = nextReference.getReferenceElement();
String path = thePathAndRef.getPath();
diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml
index 682b2776489..6ef1c263560 100644
--- a/hapi-fhir-jpaserver-subscription/pom.xml
+++ b/hapi-fhir-jpaserver-subscription/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/websocket/WebsocketConnectionValidator.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/websocket/WebsocketConnectionValidator.java
index 9a07374585a..8be79e2d49d 100644
--- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/websocket/WebsocketConnectionValidator.java
+++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/websocket/WebsocketConnectionValidator.java
@@ -29,6 +29,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import javax.annotation.Nonnull;
+
public class WebsocketConnectionValidator {
private static Logger ourLog = LoggerFactory.getLogger(WebsocketConnectionValidator.class);
@@ -43,7 +45,7 @@ public class WebsocketConnectionValidator {
super();
}
- public WebsocketValidationResponse validate(@NotNull IdType id) {
+ public WebsocketValidationResponse validate(@Nonnull IdType id) {
if (!id.hasIdPart() || !id.isIdPartValid()) {
return WebsocketValidationResponse.INVALID_RESPONSE("Invalid bind request - No ID included: " + id.getValue());
}
diff --git a/hapi-fhir-jpaserver-test-utilities/pom.xml b/hapi-fhir-jpaserver-test-utilities/pom.xml
index 1d859c5deb1..666b04f7009 100644
--- a/hapi-fhir-jpaserver-test-utilities/pom.xml
+++ b/hapi-fhir-jpaserver-test-utilities/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaDstu3Config.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaDstu3Config.java
index 05db35085e5..72d063dcb65 100644
--- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaDstu3Config.java
+++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/config/TestJpaDstu3Config.java
@@ -22,8 +22,6 @@ package ca.uhn.fhir.jpa.config;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.DefaultProfileValidationSupport;
-import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc;
-import ca.uhn.fhir.jpa.binstore.MemoryBinaryStorageSvcImpl;
import ca.uhn.fhir.jpa.search.HapiLuceneAnalysisConfigurer;
import ca.uhn.fhir.jpa.util.CircularQueueCaptureQueriesListener;
import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener;
diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
index 3976c5e8117..22918bd8306 100644
--- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
+++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-server-mdm/pom.xml b/hapi-fhir-server-mdm/pom.xml
index 4cad7ca9b42..2524a791d05 100644
--- a/hapi-fhir-server-mdm/pom.xml
+++ b/hapi-fhir-server-mdm/pom.xml
@@ -7,7 +7,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderDstu3Plus.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderDstu3Plus.java
index 05cd9f12608..7bbba998e60 100644
--- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderDstu3Plus.java
+++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderDstu3Plus.java
@@ -22,10 +22,8 @@ package ca.uhn.fhir.mdm.provider;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.mdm.api.IMdmControllerSvc;
-import ca.uhn.fhir.mdm.api.IMdmMatchFinderSvc;
import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.api.IMdmSubmitSvc;
-import ca.uhn.fhir.mdm.api.MatchedTarget;
import ca.uhn.fhir.mdm.api.MdmConstants;
import ca.uhn.fhir.mdm.api.MdmLinkJson;
import ca.uhn.fhir.mdm.api.paging.MdmPageRequest;
@@ -39,30 +37,20 @@ import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
-import ca.uhn.fhir.util.BundleBuilder;
import ca.uhn.fhir.util.ParametersUtil;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IAnyResource;
-import org.hl7.fhir.instance.model.api.IBase;
-import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
import org.hl7.fhir.instance.model.api.IBaseBundle;
-import org.hl7.fhir.instance.model.api.IBaseDatatype;
-import org.hl7.fhir.instance.model.api.IBaseExtension;
import org.hl7.fhir.instance.model.api.IBaseParameters;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
-import javax.annotation.Nonnull;
import java.math.BigDecimal;
import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Date;
import java.util.List;
-import java.util.UUID;
import java.util.stream.Collectors;
import static ca.uhn.fhir.rest.api.Constants.PARAM_OFFSET;
diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderLoader.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderLoader.java
index 9494312645d..0b1e24f2465 100644
--- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderLoader.java
+++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderLoader.java
@@ -23,7 +23,6 @@ package ca.uhn.fhir.mdm.provider;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.mdm.api.IMdmControllerSvc;
-import ca.uhn.fhir.mdm.api.IMdmMatchFinderSvc;
import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.api.IMdmSubmitSvc;
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
diff --git a/hapi-fhir-server-openapi/pom.xml b/hapi-fhir-server-openapi/pom.xml
index 45ed8028d5e..ca12d2d56ac 100644
--- a/hapi-fhir-server-openapi/pom.xml
+++ b/hapi-fhir-server-openapi/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml
index 44102a79948..6c205e83c0b 100644
--- a/hapi-fhir-server/pom.xml
+++ b/hapi-fhir-server/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/ResponseValidatingInterceptor.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/ResponseValidatingInterceptor.java
index 6a860fcbc39..ab7db6ca3e3 100644
--- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/ResponseValidatingInterceptor.java
+++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/ResponseValidatingInterceptor.java
@@ -20,20 +20,19 @@ package ca.uhn.fhir.rest.server.interceptor;
* #L%
*/
-import java.util.HashSet;
-import java.util.Set;
-
import ca.uhn.fhir.interceptor.api.Hook;
import ca.uhn.fhir.interceptor.api.Pointcut;
-import org.apache.commons.lang3.Validate;
-import org.hl7.fhir.instance.model.api.IBaseResource;
-
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.validation.FhirValidator;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import ca.uhn.fhir.validation.ValidationResult;
+import org.apache.commons.lang3.Validate;
+import org.hl7.fhir.instance.model.api.IBaseResource;
+
+import java.util.HashSet;
+import java.util.Set;
/**
* This interceptor intercepts each outgoing response and if it contains a FHIR resource, validates that resource. The interceptor may be configured to run any validator modules, and will then add
diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/GraphQLQueryBodyParameter.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/GraphQLQueryBodyParameter.java
index 7440a542a41..d9751f3781f 100644
--- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/GraphQLQueryBodyParameter.java
+++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/GraphQLQueryBodyParameter.java
@@ -21,21 +21,15 @@ package ca.uhn.fhir.rest.server.method;
*/
import ca.uhn.fhir.context.ConfigurationException;
-import ca.uhn.fhir.parser.json.JsonLikeObject;
-import ca.uhn.fhir.parser.json.JsonLikeStructure;
-import ca.uhn.fhir.parser.json.JsonLikeValue;
-import ca.uhn.fhir.parser.json.jackson.JacksonStructure;
import ca.uhn.fhir.rest.annotation.Count;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
-import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.IOUtils;
-import javax.annotation.Nullable;
import java.io.IOException;
import java.io.Reader;
import java.lang.reflect.Method;
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
index a84e81bbedc..2c57b33dd22 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
index 514be28ac89..4ffe8120b0e 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot-samples
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
hapi-fhir-spring-boot-sample-client-apache
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
index a4fa7ccba07..ee5a6022524 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot-samples
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
hapi-fhir-spring-boot-sample-client-okhttp
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
index 6c4a4fd16c8..64d99ac4c15 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot-samples
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
hapi-fhir-spring-boot-sample-server-jersey
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
index 7ceda5d7469..63d7e852271 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
hapi-fhir-spring-boot-samples
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
index 6a9fb90dc6f..e55fcf528a4 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml
index 042dd8f5b6e..412c98cc63e 100644
--- a/hapi-fhir-spring-boot/pom.xml
+++ b/hapi-fhir-spring-boot/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-sql-migrate/pom.xml b/hapi-fhir-sql-migrate/pom.xml
index 5f2dbeb7ebf..9933fea8888 100644
--- a/hapi-fhir-sql-migrate/pom.xml
+++ b/hapi-fhir-sql-migrate/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage/pom.xml b/hapi-fhir-storage/pom.xml
index 72d16631ca9..929bac38b1d 100644
--- a/hapi-fhir-storage/pom.xml
+++ b/hapi-fhir-storage/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java
index a88bc7d080b..058f9ba7bfb 100644
--- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java
+++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java
@@ -6,6 +6,7 @@ import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.model.entity.ResourceEncodingEnum;
import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
import ca.uhn.fhir.util.HapiExtensions;
+import ca.uhn.fhir.validation.FhirValidator;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.StringUtils;
@@ -286,6 +287,12 @@ public class DaoConfig {
*/
private int myInlineResourceTextBelowSize = 0;
+ /**
+ * @see FhirValidator#isConcurrentBundleValidation()
+ * @since 5.7.0
+ */
+ private boolean myConcurrentBundleValidation;
+
/**
* Constructor
*/
@@ -2724,6 +2731,23 @@ public class DaoConfig {
this.myAdvancedLuceneIndexing = theAdvancedLuceneIndexing;
}
+ /**
+ * @see FhirValidator#isConcurrentBundleValidation()
+ * @since 5.7.0
+ */
+ public boolean isConcurrentBundleValidation() {
+ return myConcurrentBundleValidation;
+ }
+
+ /**
+ * @see FhirValidator#isConcurrentBundleValidation()
+ * @since 5.7.0
+ */
+ public DaoConfig setConcurrentBundleValidation(boolean theConcurrentBundleValidation) {
+ myConcurrentBundleValidation = theConcurrentBundleValidation;
+ return this;
+ }
+
public enum StoreMetaSourceInformationEnum {
NONE(false, false),
SOURCE_URI(true, false),
diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java
index 6b393a2adf2..b0521c2a7b7 100644
--- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java
+++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java
@@ -431,7 +431,7 @@ public abstract class BaseStorageDao {
return oo;
}
- @NotNull
+ @Nonnull
protected ResourceGoneException createResourceGoneException(IBasePersistedResource theResourceEntity) {
StringBuilder b = new StringBuilder();
b.append("Resource was deleted at ");
diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java
index c26d9ffeafb..25996ce63ad 100644
--- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java
+++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java
@@ -80,6 +80,7 @@ import ca.uhn.fhir.util.ElementUtil;
import ca.uhn.fhir.util.FhirTerser;
import ca.uhn.fhir.util.ResourceReferenceInfo;
import ca.uhn.fhir.util.StopWatch;
+import ca.uhn.fhir.util.ThreadPoolUtil;
import ca.uhn.fhir.util.UrlUtil;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ArrayListMultimap;
@@ -102,7 +103,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.task.SyncTaskExecutor;
import org.springframework.core.task.TaskExecutor;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.support.TransactionCallback;
@@ -193,13 +193,7 @@ public abstract class BaseTransactionProcessor {
private TaskExecutor getTaskExecutor() {
if (myExecutor == null) {
if (myDaoConfig.getBundleBatchPoolSize() > 1) {
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- executor.setThreadNamePrefix("bundle_batch_");
- executor.setCorePoolSize(myDaoConfig.getBundleBatchPoolSize());
- executor.setMaxPoolSize(myDaoConfig.getBundleBatchMaxPoolSize());
- executor.initialize();
- myExecutor = executor;
-
+ myExecutor = ThreadPoolUtil.newThreadPool(myDaoConfig.getBundleBatchPoolSize(), myDaoConfig.getBundleBatchMaxPoolSize(), "bundle-batch-");
} else {
SyncTaskExecutor executor = new SyncTaskExecutor();
myExecutor = executor;
diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/util/ThreadPoolUtil.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/util/ThreadPoolUtil.java
new file mode 100644
index 00000000000..acd67cbca6b
--- /dev/null
+++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/util/ThreadPoolUtil.java
@@ -0,0 +1,47 @@
+package ca.uhn.fhir.util;
+
+/*-
+ * #%L
+ * HAPI FHIR Storage api
+ * %%
+ * 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 ca.uhn.fhir.jpa.search.reindex.BlockPolicy;
+import org.apache.commons.lang3.Validate;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import javax.annotation.Nonnull;
+
+public final class ThreadPoolUtil {
+ private ThreadPoolUtil() {
+ }
+
+
+ @Nonnull
+ public static ThreadPoolTaskExecutor newThreadPool(int theCorePoolSize, int theMaxPoolSize, String theThreadNamePrefix) {
+ Validate.isTrue(theThreadNamePrefix.endsWith("-"), "Thread pool prefix name must end with a hyphen");
+ ThreadPoolTaskExecutor asyncTaskExecutor = new ThreadPoolTaskExecutor();
+ asyncTaskExecutor.setCorePoolSize(theCorePoolSize);
+ asyncTaskExecutor.setMaxPoolSize(theMaxPoolSize);
+ asyncTaskExecutor.setQueueCapacity(0);
+ asyncTaskExecutor.setAllowCoreThreadTimeOut(true);
+ asyncTaskExecutor.setThreadNamePrefix(theThreadNamePrefix);
+ asyncTaskExecutor.setRejectedExecutionHandler(new BlockPolicy());
+ asyncTaskExecutor.initialize();
+ return asyncTaskExecutor;
+ }
+}
diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml
index b4c885d9085..8ce3ca295ff 100644
--- a/hapi-fhir-structures-dstu2.1/pom.xml
+++ b/hapi-fhir-structures-dstu2.1/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml
index 6fc05ae8992..9e4f987ec3b 100644
--- a/hapi-fhir-structures-dstu2/pom.xml
+++ b/hapi-fhir-structures-dstu2/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml
index 201254b359a..10af08f73e8 100644
--- a/hapi-fhir-structures-dstu3/pom.xml
+++ b/hapi-fhir-structures-dstu3/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml
index c891e21b8ba..eb3eaf95ff6 100644
--- a/hapi-fhir-structures-hl7org-dstu2/pom.xml
+++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml
index 297e5dd63f1..847a5c5cf9b 100644
--- a/hapi-fhir-structures-r4/pom.xml
+++ b/hapi-fhir-structures-r4/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-r5/pom.xml b/hapi-fhir-structures-r5/pom.xml
index 99297097151..41e594ea9c7 100644
--- a/hapi-fhir-structures-r5/pom.xml
+++ b/hapi-fhir-structures-r5/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-test-utilities/pom.xml b/hapi-fhir-test-utilities/pom.xml
index ce8135fd093..117520d0661 100644
--- a/hapi-fhir-test-utilities/pom.xml
+++ b/hapi-fhir-test-utilities/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml
index 6ca5fee1675..80afd7decf3 100644
--- a/hapi-fhir-testpage-overlay/pom.xml
+++ b/hapi-fhir-testpage-overlay/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-validation-resources-dstu2.1/pom.xml b/hapi-fhir-validation-resources-dstu2.1/pom.xml
index 6978d7481a7..575dcaac456 100644
--- a/hapi-fhir-validation-resources-dstu2.1/pom.xml
+++ b/hapi-fhir-validation-resources-dstu2.1/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-dstu2/pom.xml b/hapi-fhir-validation-resources-dstu2/pom.xml
index 4fd5c3db3b0..790e17da63b 100644
--- a/hapi-fhir-validation-resources-dstu2/pom.xml
+++ b/hapi-fhir-validation-resources-dstu2/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-dstu3/pom.xml b/hapi-fhir-validation-resources-dstu3/pom.xml
index 81420a315e7..9c31602ad65 100644
--- a/hapi-fhir-validation-resources-dstu3/pom.xml
+++ b/hapi-fhir-validation-resources-dstu3/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-r4/pom.xml b/hapi-fhir-validation-resources-r4/pom.xml
index 11916375761..505e8b10db8 100644
--- a/hapi-fhir-validation-resources-r4/pom.xml
+++ b/hapi-fhir-validation-resources-r4/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-r5/pom.xml b/hapi-fhir-validation-resources-r5/pom.xml
index 8aaaa263fff..361b15a1909 100644
--- a/hapi-fhir-validation-resources-r5/pom.xml
+++ b/hapi-fhir-validation-resources-r5/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml
index 66d258150f6..30c674c3dac 100644
--- a/hapi-fhir-validation/pom.xml
+++ b/hapi-fhir-validation/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java
index 4b1aaca3d97..0789ea7e6d2 100644
--- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java
+++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java
@@ -15,13 +15,11 @@ import org.hl7.fhir.instance.model.api.IPrimitiveType;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
-import static org.apache.commons.lang3.StringUtils.defaultString;
import static org.apache.commons.lang3.StringUtils.isBlank;
public class ValidationSupportChain implements IValidationSupport {
@@ -316,6 +314,4 @@ public class ValidationSupportChain implements IValidationSupport {
}
return null;
}
-
-
}
diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java
index 20f910cbe33..c79b6c85c7f 100644
--- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java
+++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java
@@ -9,6 +9,8 @@ import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.test.BaseTest;
import ca.uhn.fhir.test.utilities.LoggingExtension;
+import ca.uhn.fhir.util.BundleBuilder;
+import ca.uhn.fhir.util.StopWatch;
import ca.uhn.fhir.util.TestUtil;
import ca.uhn.fhir.validation.FhirValidator;
import ca.uhn.fhir.validation.ResultSeverityEnum;
@@ -85,6 +87,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -114,7 +118,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
public LoggingExtension myLoggingExtension = new LoggingExtension();
private FhirInstanceValidator myInstanceVal;
private Map mySupportedCodeSystemsForExpansion;
- private FhirValidator myVal;
+ private FhirValidator myFhirValidator;
private ArrayList myValidConcepts;
private Set myValidSystems = new HashSet<>();
private Map myStructureDefinitionMap = new HashMap<>();
@@ -136,7 +140,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
resource.setSubject(new Reference("#invalid-ref"));
- ValidationResult output = myVal.validateWithResult(resource);
+ ValidationResult output = myFhirValidator.validateWithResult(resource);
List nonInfo = logResultsAndReturnNonInformationalOnes(output);
assertThat(nonInfo, hasSize(2));
}
@@ -144,9 +148,11 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
@SuppressWarnings("unchecked")
@BeforeEach
public void before() {
- myVal = ourCtx.newValidator();
- myVal.setValidateAgainstStandardSchema(false);
- myVal.setValidateAgainstStandardSchematron(false);
+ myFhirValidator = ourCtx.newValidator();
+ myFhirValidator.setValidateAgainstStandardSchema(false);
+ myFhirValidator.setValidateAgainstStandardSchematron(false);
+ // This is only used if the validation is performed with validationOptions.isConcurrentBundleValidation = true
+ myFhirValidator.setExecutorService(Executors.newFixedThreadPool(4));
IValidationSupport mockSupport = mock(IValidationSupport.class);
when(mockSupport.getFhirContext()).thenReturn(ourCtx);
@@ -155,7 +161,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
myValidationSupport = new CachingValidationSupport(chain);
myInstanceVal = new FhirInstanceValidator(myValidationSupport);
- myVal.registerValidatorModule(myInstanceVal);
+ myFhirValidator.registerValidatorModule(myInstanceVal);
mySupportedCodeSystemsForExpansion = new HashMap<>();
@@ -527,7 +533,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
ourLog.info("Encoded: {}", encoded);
- ValidationResult output = myVal.validateWithResult(encoded);
+ ValidationResult output = myFhirValidator.validateWithResult(encoded);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertEquals(1, errors.size());
assertEquals("The value '%%%2@()()' is not a valid Base64 value", errors.get(0).getMessage());
@@ -538,7 +544,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
public void testValidateBundleWithNoFullUrl() throws IOException {
String encoded = loadResource("/r4/r4-caredove-bundle.json");
- ValidationResult output = myVal.validateWithResult(encoded);
+ ValidationResult output = myFhirValidator.validateWithResult(encoded);
List errors = logResultsAndReturnNonInformationalOnes(output);
errors = errors
.stream()
@@ -560,7 +566,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
ourLog.info("Encoded: {}", encoded);
- ValidationResult output = myVal.validateWithResult(encoded);
+ ValidationResult output = myFhirValidator.validateWithResult(encoded);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertEquals(0, errors.size());
@@ -604,7 +610,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
t.setSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.URL);
t.setValue("http://infoway-inforoute.ca");
- ValidationResult results = myVal.validateWithResult(p);
+ ValidationResult results = myFhirValidator.validateWithResult(p);
List outcome = logResultsAndReturnNonInformationalOnes(results);
assertThat(outcome, empty());
@@ -616,7 +622,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
@Test
public void testExtensionUrlWithHl7Url() throws IOException {
String input = IOUtils.toString(FhirInstanceValidator.class.getResourceAsStream("/bug872-ext-with-hl7-url.json"), Charsets.UTF_8);
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List nonInfo = logResultsAndReturnNonInformationalOnes(output);
assertThat(nonInfo, empty());
}
@@ -631,7 +637,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
@Test
public void testLargeBase64() throws IOException {
String input = IOUtils.toString(FhirInstanceValidatorR4Test.class.getResourceAsStream("/r4/diagnosticreport-example-gingival-mass.json"), Constants.CHARSET_UTF8);
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List errors = logResultsAndReturnAll(output);
assertEquals(1, errors.size());
assertEquals("None of the codings provided are in the value set 'LOINC Diagnostic Report Codes' (http://hl7.org/fhir/ValueSet/report-codes), and a coding is recommended to come from this value set) (codes = http://loinc.org#1-8)", errors.get(0).getMessage());
@@ -647,7 +653,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
int passes = 1;
for (int i = 0; i < passes; i++) {
ourLog.info("Pass {}", i + 1);
- output = myVal.validateWithResult(input);
+ output = myFhirValidator.validateWithResult(input);
}
long delay = System.currentTimeMillis() - start;
@@ -684,7 +690,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
ourLog.info("Validating {}", next.getId());
ourLog.trace(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(next));
- ValidationResult output = myVal.validateWithResult(next);
+ ValidationResult output = myFhirValidator.validateWithResult(next);
List results = logResultsAndReturnAll(output);
// This isn't a validator problem but a definition problem.. it should get fixed at some point and
@@ -712,7 +718,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
public void testValidateBundleWithNoType() throws Exception {
String vsContents = loadResource("/r4/bundle-with-no-type.json");
- ValidationResult output = myVal.validateWithResult(vsContents);
+ ValidationResult output = myFhirValidator.validateWithResult(vsContents);
logResultsAndReturnNonInformationalOnes(output);
assertThat(output.getMessages().toString(), containsString("Bundle.type: minimum required = 1, but only found 0"));
}
@@ -729,7 +735,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
"\"name\":[ {\"family\":\"bar\"} ]" +
"}";
- ValidationResult output = myVal.validateWithResult(patient);
+ ValidationResult output = myFhirValidator.validateWithResult(patient);
logResultsAndReturnNonInformationalOnes(output);
assertThat(output.getMessages().toString(), containsString("Error parsing JSON source: Duplicated property name"));
}
@@ -757,7 +763,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
// bool = (BooleanType) fpOutput.get(0);
// assertTrue(bool.getValue());
- ValidationResult output = myVal.validateWithResult(inputString);
+ ValidationResult output = myFhirValidator.validateWithResult(inputString);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertThat(errors, empty());
@@ -768,7 +774,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
public void testValidateDocument() throws Exception {
String vsContents = loadResource("/sample-document.xml");
- ValidationResult output = myVal.validateWithResult(vsContents);
+ ValidationResult output = myFhirValidator.validateWithResult(vsContents);
logResultsAndReturnNonInformationalOnes(output);
assertTrue(output.isSuccessful());
}
@@ -820,7 +826,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
public void testValidateQuestionnaireResponse() throws IOException {
String input = loadResource("/qr_jon.xml");
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
logResultsAndReturnAll(output);
assertThat(output.getMessages().toString(), containsString("Items not of type group should not have items - Item with linkId 5.1 of type BOOLEAN has 1 item(s)"));
@@ -837,7 +843,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
" \"id\":\"123\"" +
"}";
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
assertEquals(0, output.getMessages().size(), output.toString());
}
@@ -854,7 +860,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
"\"foo\":\"123\"" +
"}";
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
assertEquals(1, output.getMessages().size(), output.toString());
ourLog.info(output.getMessages().get(0).getLocationString());
ourLog.info(output.getMessages().get(0).getMessage());
@@ -873,7 +879,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
public void testValidateRawJsonResourceFromExamples() throws Exception {
String input = loadResource("/testscript-search.json");
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
logResultsAndReturnNonInformationalOnes(output);
// assertEquals(output.toString(), 1, output.getMessages().size());
// ourLog.info(output.getMessages().get(0).getLocationString());
@@ -909,7 +915,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
* }
*/
- ValidationResult output = myVal.validateWithResult(encoded);
+ ValidationResult output = myFhirValidator.validateWithResult(encoded);
assertEquals(1, output.getMessages().size(), output.toString());
assertEquals("Unknown extension http://hl7.org/fhir/v3/ethnicity", output.getMessages().get(0).getMessage());
@@ -944,7 +950,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
*/
myInstanceVal.setAnyExtensionsAllowed(false);
- ValidationResult output = myVal.validateWithResult(encoded);
+ ValidationResult output = myFhirValidator.validateWithResult(encoded);
assertEquals(1, output.getMessages().size(), output.toString());
assertEquals("The extension http://hl7.org/fhir/v3/ethnicity is unknown, and not allowed here", output.getMessages().get(0).getMessage());
@@ -961,7 +967,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
" " +
"";
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
assertEquals(0, output.getMessages().size(), output.toString());
}
@@ -977,7 +983,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
"" +
"";
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
assertEquals(1, output.getMessages().size(), output.toString());
ourLog.info(output.getMessages().get(0).getLocationString());
ourLog.info(output.getMessages().get(0).getMessage());
@@ -997,7 +1003,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
"" +
"";
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List messages = logResultsAndReturnNonInformationalOnes(output);
assertEquals(3, messages.size(), output.toString());
assertThat(messages.get(0).getMessage(), containsString("Element must have some content"));
@@ -1032,7 +1038,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
" \n" +
" ";
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List res = logResultsAndReturnNonInformationalOnes(output);
assertEquals(1, res.size(), output.toString());
assertEquals("A code with no system has no defined meaning. A system should be provided", output.getMessages().get(0).getMessage());
@@ -1047,7 +1053,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
p.getText().setDiv(new XhtmlNode().setValue("AA
")).setStatus(Narrative.NarrativeStatus.GENERATED);
p.getManagingOrganization().setDisplay("HELLO");
- ValidationResult output = myVal.validateWithResult(p);
+ ValidationResult output = myFhirValidator.validateWithResult(p);
List nonInfo = logResultsAndReturnNonInformationalOnes(output);
assertThat(nonInfo, empty());
}
@@ -1062,7 +1068,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
p.getManagingOrganization().getIdentifier().setSystem("http://acme.org");
p.getManagingOrganization().getIdentifier().setValue("foo");
- ValidationResult output = myVal.validateWithResult(p);
+ ValidationResult output = myFhirValidator.validateWithResult(p);
List nonInfo = logResultsAndReturnNonInformationalOnes(output);
assertThat(nonInfo, empty());
}
@@ -1082,7 +1088,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
rp.getPatient().setReference("Patient/1");
rp.addRelationship().addCoding().setSystem("http://terminology.hl7.org/CodeSystem/v2-0131").setCode("C");
- ValidationResult results = myVal.validateWithResult(rp);
+ ValidationResult results = myFhirValidator.validateWithResult(rp);
List outcome = logResultsAndReturnNonInformationalOnes(results);
assertThat(outcome, empty());
@@ -1093,7 +1099,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
rp.getPatient().setReference("Patient/1");
rp.addRelationship().addCoding().setSystem("http://terminology.hl7.org/CodeSystem/v2-0131").setCode("GAGAGAGA");
- results = myVal.validateWithResult(rp);
+ results = myFhirValidator.validateWithResult(rp);
outcome = logResultsAndReturnNonInformationalOnes(results);
assertThat(outcome, not(empty()));
@@ -1112,7 +1118,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345");
myInstanceVal.setValidationSupport(myValidationSupport);
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List errors = logResultsAndReturnAll(output);
assertEquals(ResultSeverityEnum.ERROR, errors.get(0).getSeverity());
@@ -1133,7 +1139,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345");
myInstanceVal.setValidationSupport(myValidationSupport);
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertThat(errors.toString(), containsString("Observation.subject: minimum required = 1, but only found 0"));
@@ -1153,7 +1159,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
input.setStatus(ObservationStatus.FINAL);
myInstanceVal.setValidationSupport(myValidationSupport);
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertEquals(1, errors.size());
@@ -1170,7 +1176,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345");
input.setValue(new StringType("AAA"));
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
assertThat(output.getMessages().size(), greaterThan(0));
assertEquals("Observation.status: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/Observation)", output.getMessages().get(0).getMessage());
@@ -1186,7 +1192,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(input));
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
assertEquals(output.getMessages().size(), 0);
}
@@ -1203,7 +1209,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
" \n" +
" \n" +
"";
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
logResultsAndReturnAll(output);
assertEquals(
"The value provided ('notvalidcode') is not in the value set 'ObservationStatus' (http://hl7.org/fhir/ValueSet/observation-status|4.0.1), and a code is required from this value set) (error message = Unknown code 'notvalidcode' for in-memory expansion of ValueSet 'http://hl7.org/fhir/ValueSet/observation-status')",
@@ -1233,7 +1239,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
" ]" +
"}";
ourLog.info(input);
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
logResultsAndReturnAll(output);
assertEquals(
"",
@@ -1250,7 +1256,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
input.setStatus(ObservationStatus.FINAL);
input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345");
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertEquals(0, errors.size(), errors.toString());
@@ -1267,7 +1273,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
input.setStatus(ObservationStatus.FINAL);
input.getCode().addCoding().setSystem("http://acme.org").setCode("9988877");
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List errors = logResultsAndReturnAll(output);
assertThat(errors.toString(), errors.size(), greaterThan(0));
assertEquals("Unknown code for 'http://acme.org#9988877'", errors.get(0).getMessage());
@@ -1285,7 +1291,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
input.setStatus(ObservationStatus.FINAL);
input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345");
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertEquals(0, errors.size(), errors.toString());
}
@@ -1305,7 +1311,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
input.setStatus(ObservationStatus.FINAL);
input.getCode().addCoding().setSystem("http://loinc.org").setCode("1234");
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertEquals(1, errors.size());
assertEquals("Unknown code for 'http://loinc.org#1234'", errors.get(0).getMessage());
@@ -1322,7 +1328,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
input.setStatus(ObservationStatus.FINAL);
input.getCode().addCoding().setSystem("http://acme.org").setCode("12345");
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List errors = logResultsAndReturnAll(output);
assertEquals(0, errors.size(), errors.toString());
}
@@ -1334,7 +1340,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
p.getText().setDiv(new XhtmlNode().setValue("AA
")).setStatus(Narrative.NarrativeStatus.GENERATED);
p.addIdentifier().setSystem("http://example.com/").setValue("12345").getType().addCoding().setSystem("http://example.com/foo/bar").setCode("bar");
- ValidationResult output = myVal.validateWithResult(p);
+ ValidationResult output = myFhirValidator.validateWithResult(p);
List all = logResultsAndReturnAll(output);
assertEquals(1, all.size());
assertEquals("Patient.identifier[0].type", all.get(0).getLocationString());
@@ -1349,13 +1355,13 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
addValidConcept("http://loinc.org", "8310-5");
Observation input = loadResource(ourCtx, Observation.class, "/r4/observation-with-body-temp-ucum.json");
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List all = logResultsAndReturnNonInformationalOnes(output);
assertThat(all, empty());
// Change the unit to something not supported
input.getValueQuantity().setCode("Heck");
- output = myVal.validateWithResult(input);
+ output = myFhirValidator.validateWithResult(input);
all = logResultsAndReturnNonInformationalOnes(output);
assertEquals(2, all.size());
assertThat(all.get(0).getMessage(), containsString("Validation failed for 'http://unitsofmeasure.org#Heck'"));
@@ -1372,7 +1378,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
o.addPerformer(new Reference(p1));
o.addPerformer(new Reference(p2));
- ValidationResult output = myVal.validateWithResult(o);
+ ValidationResult output = myFhirValidator.validateWithResult(o);
List valMessages = logResultsAndReturnAll(output);
for (SingleValidationMessage msg : valMessages) {
assertThat(msg.getMessage(), not(containsString("have a performer")));
@@ -1392,7 +1398,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
.setSystem("http://terminology.hl7.org/CodeSystem/v2-0203")
.setCode("MR");
- ValidationResult output = myVal.validateWithResult(patient);
+ ValidationResult output = myFhirValidator.validateWithResult(patient);
List all = logResultsAndReturnAll(output);
assertEquals(0, all.size());
}
@@ -1409,7 +1415,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
when(policyAdvisor.policyForContained(any(), any(), any(), any(), any(), any(), any())).thenReturn(ContainedReferenceValidationPolicy.CHECK_TYPE);
myInstanceVal.setValidatorResourceFetcher(resourceFetcher);
myInstanceVal.setValidatorPolicyAdvisor(policyAdvisor);
- myVal.validateWithResult(encoded);
+ myFhirValidator.validateWithResult(encoded);
verify(resourceFetcher, times(12)).resolveURL(any(), any(), anyString(), anyString(), anyString());
verify(policyAdvisor, times(12)).policyForContained(any(), any(), any(), any(), any(), any(), any());
@@ -1420,7 +1426,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
public void testValidateStructureDefinition() throws IOException {
String input = loadResource("/sdc-questionnaire.profile.xml");
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
logResultsAndReturnAll(output);
assertEquals(3, output.getMessages().size(), output.toString());
@@ -1439,7 +1445,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
" \"currency\": \"USD\"\n" +
" }\n" +
"}";
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertEquals(0, errors.size(), errors.toString());
@@ -1457,7 +1463,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
" \"currency\": \"BLAH\"\n" +
" }\n" +
"}";
- ValidationResult output = myVal.validateWithResult(input);
+ ValidationResult output = myFhirValidator.validateWithResult(input);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertEquals(1, errors.size(), errors.toString());
assertThat(errors.get(0).getMessage(), containsString("The value provided ('BLAH') is not in the value set 'CurrencyCode' (http://hl7.org/fhir/ValueSet/currencies|4.0.1), and a code is required from this value set) (error message = Unknown code 'BLAH' for in-memory expansion of ValueSet 'http://hl7.org/fhir/ValueSet/currencies')"));
@@ -1477,7 +1483,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
.setText("This is text")
.setAuthor(new Reference("Patient/123"));
- ValidationResult output = myVal.validateWithResult(allergy);
+ ValidationResult output = myFhirValidator.validateWithResult(allergy);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertEquals(0, errors.size(), errors.toString());
@@ -1496,13 +1502,70 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
.setText("This is text")
.setAuthor(new Reference("CodeSystems/123"));
- ValidationResult output = myVal.validateWithResult(allergy);
+ ValidationResult output = myFhirValidator.validateWithResult(allergy);
List errors = logResultsAndReturnNonInformationalOnes(output);
assertEquals(0, errors.size(), errors.toString());
assertThat(errors.get(0).getMessage(), containsString("The value provided ('BLAH') is not in the value set http://hl7.org/fhir/ValueSet/currencies"));
}
+ @Disabled
+ @Test
+ public void testValidateBundleMultithreaded() throws IOException {
+ // setup
+ StructureDefinition sd = loadStructureDefinition(myDefaultValidationSupport, "/r4/concurrent-bundle/StructureDefinitionPatientV1.json");
+
+ myStructureDefinitionMap.put("https://example.com/StructureDefinition/Patient-v1", sd);
+
+ int entriesCount = 300;
+
+ // We deliberately create an invalid bundle to confirm we are indeed running multithreaded
+ Bundle bundle = buildBundle(entriesCount, false);
+ assertThat(bundle.getEntry(), hasSize(entriesCount));
+
+ try {
+ // RED-GREEN set ConcurrentBundleValidation to false to see the test fail
+ myFhirValidator.setConcurrentBundleValidation(true);
+ myFhirValidator.setExecutorService(Executors.newFixedThreadPool(4));
+ // Run once to exclude initialization from time
+ myFhirValidator.validateWithResult(bundle);
+
+ // execute
+ StopWatch stopwatch = new StopWatch();
+ ValidationResult output = myFhirValidator.validateWithResult(bundle);
+ ourLog.info("Validation time: {}", stopwatch);
+ // assert that validation messages include the bundle entry path
+ assertTrue(output.getMessages().stream().anyMatch(message -> message.getLocationString().contains("Bundle.entry[0].resource.ofType(Patient)")));
+ assertTrue(output.getMessages().stream().anyMatch(message -> message.getLocationString().contains("Bundle.entry[1].resource.ofType(Patient)")));
+ // validate
+ List all = logResultsAndReturnErrorOnes(output);
+ assertThat(output.getMessages(), hasSize(entriesCount * 2));
+ // This assert proves that we did a multi-threaded validation since the outer bundle fails validation
+ // due to lack of unique fullUrl values on the entries. If you setConcurrentBundleValidation(false)
+ // above this test will fail.
+ assertEquals(0, all.size(), all.toString());
+ } finally {
+ myFhirValidator.setConcurrentBundleValidation(false);
+ myFhirValidator.setExecutorService(null);
+ }
+ }
+
+ private Bundle buildBundle(int theSize, boolean theValidBundle) throws IOException {
+ BundleBuilder bundleBuilder = new BundleBuilder(ourCtx);
+ Patient p = ourCtx.newJsonParser().parseResource(Patient.class, loadResource("/r4/concurrent-bundle/patient.json"));
+ for (int i = 0; i < theSize; ++i) {
+ bundleBuilder.addTransactionCreateEntry(p);
+ }
+ if (theValidBundle) {
+ Bundle retval = (Bundle) bundleBuilder.getBundle();
+ AtomicInteger count = new AtomicInteger(1);
+ retval.getEntry().stream().forEach(entry -> entry.setFullUrl("urn:uuid:" + count.getAndIncrement()));
+ return retval;
+ } else {
+ return (Bundle) bundleBuilder.getBundle();
+ }
+ }
+
@AfterAll
public static void afterClassClearContext() {
myDefaultValidationSupport.flush();
diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/QuestionnaireResponseValidatorR5Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/QuestionnaireResponseValidatorR5Test.java
index 9540e9fe168..5564e86d538 100644
--- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/QuestionnaireResponseValidatorR5Test.java
+++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/QuestionnaireResponseValidatorR5Test.java
@@ -4,7 +4,6 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.DefaultProfileValidationSupport;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.parser.IParser;
-import ca.uhn.fhir.util.TestUtil;
import ca.uhn.fhir.validation.FhirValidator;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import ca.uhn.fhir.validation.SingleValidationMessage;
diff --git a/hapi-fhir-validation/src/test/resources/r4/concurrent-bundle/StructureDefinitionPatientV1.json b/hapi-fhir-validation/src/test/resources/r4/concurrent-bundle/StructureDefinitionPatientV1.json
new file mode 100644
index 00000000000..ceea6a9e675
--- /dev/null
+++ b/hapi-fhir-validation/src/test/resources/r4/concurrent-bundle/StructureDefinitionPatientV1.json
@@ -0,0 +1,146 @@
+{
+ "resourceType": "StructureDefinition",
+ "meta": {
+ "versionId": "25",
+ "lastUpdated": "2021-02-19T07:29:29.911+00:00"
+ },
+ "extension": [
+ {
+ "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-category",
+ "valueString": "Base.Individuals"
+ },
+ {
+ "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category",
+ "valueCode": "patient"
+ }
+ ],
+ "url": "https://example.com/StructureDefinition/Patient-v1",
+ "version": "1",
+ "name": "EXAMPLE_Patient_v1",
+ "title": "EXAMPLE Patient",
+ "status": "active",
+ "date": "2021-01-28",
+ "description": "A profile on the Patient resource for EXAMPLE Project",
+ "purpose": "This profile is created for the EXAMPLE Integration project.",
+ "fhirVersion": "4.0.1",
+ "mapping": [
+ {
+ "identity": "rim",
+ "uri": "http://hl7.org/v3",
+ "name": "RIM Mapping"
+ },
+ {
+ "identity": "cda",
+ "uri": "http://hl7.org/v3/cda",
+ "name": "CDA (R2)"
+ },
+ {
+ "identity": "w5",
+ "uri": "http://hl7.org/fhir/fivews",
+ "name": "FiveWs Pattern Mapping"
+ },
+ {
+ "identity": "v2",
+ "uri": "http://hl7.org/v2",
+ "name": "HL7 v2 Mapping"
+ },
+ {
+ "identity": "loinc",
+ "uri": "http://loinc.org",
+ "name": "LOINC code for the element"
+ }
+ ],
+ "kind": "resource",
+ "abstract": false,
+ "type": "Patient",
+ "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient",
+ "derivation": "constraint",
+ "differential": {
+ "element": [
+ {
+ "id": "Patient.meta",
+ "path": "Patient.meta",
+ "min": 1
+ },
+ {
+ "id": "Patient.meta.tag",
+ "path": "Patient.meta.tag",
+ "min": 3,
+ "max": "4"
+ },
+ {
+ "id": "Patient.meta.tag.system",
+ "path": "Patient.meta.tag.system",
+ "min": 1
+ },
+ {
+ "id": "Patient.meta.tag.code",
+ "path": "Patient.meta.tag.code",
+ "min": 1
+ },
+ {
+ "id": "Patient.meta.tag.display",
+ "path": "Patient.meta.tag.display",
+ "min": 1
+ },
+ {
+ "id": "Patient.identifier",
+ "path": "Patient.identifier",
+ "min": 1
+ },
+ {
+ "id": "Patient.identifier.system",
+ "path": "Patient.identifier.system",
+ "min": 1
+ },
+ {
+ "id": "Patient.identifier.value",
+ "path": "Patient.identifier.value",
+ "min": 1
+ },
+ {
+ "id": "Patient.active",
+ "path": "Patient.active",
+ "min": 1
+ },
+ {
+ "id": "Patient.name",
+ "path": "Patient.name",
+ "min": 1
+ },
+ {
+ "id": "Patient.name.family",
+ "path": "Patient.name.family",
+ "min": 1
+ },
+ {
+ "id": "Patient.name.given",
+ "path": "Patient.name.given",
+ "min": 1
+ },
+ {
+ "id": "Patient.birthDate",
+ "path": "Patient.birthDate",
+ "min": 1
+ },
+ {
+ "id": "Patient.communication.language",
+ "path": "Patient.communication.language",
+ "binding": {
+ "strength": "required",
+ "valueSet": "http://hl7.org/fhir/ValueSet/languages"
+ }
+ },
+ {
+ "id": "Patient.generalPractitioner",
+ "path": "Patient.generalPractitioner",
+ "min": 1
+ },
+ {
+ "id": "Patient.managingOrganization",
+ "path": "Patient.managingOrganization",
+ "min": 1
+ }
+ ]
+ }
+}
diff --git a/hapi-fhir-validation/src/test/resources/r4/concurrent-bundle/patient.json b/hapi-fhir-validation/src/test/resources/r4/concurrent-bundle/patient.json
new file mode 100644
index 00000000000..7bb5ec94cc5
--- /dev/null
+++ b/hapi-fhir-validation/src/test/resources/r4/concurrent-bundle/patient.json
@@ -0,0 +1,73 @@
+{
+ "resourceType": "Patient",
+ "meta": {
+ "profile": [
+ "https://example.com/StructureDefinition/Patient-v1"
+ ],
+ "tag": [
+ {
+ "system": "https://example.org/region",
+ "code": "ax2",
+ "display": "REGION"
+ },
+ {
+ "system": "https://example.org/tenant",
+ "code": "a3",
+ "display": "TENANT"
+ },
+ {
+ "system": "https://example.org/deployment",
+ "code": "a2",
+ "display": "DEPLOYMENT"
+ },
+ {
+ "system": "https://example.org/provider",
+ "code": "aabc1234",
+ "display": "PROVIDER"
+ }
+ ]
+ },
+ "identifier": [
+ {
+ "type": {
+ "text": "TESTPatientMRN"
+ },
+ "system": "https://id.example.com/sapmrn",
+ "value": "1234567"
+ },
+ {
+ "type": {
+ "text": "HIE Patient MRN"
+ },
+ "system": "http://mrn.example.com/hiePatientId",
+ "value": "abc123"
+ }
+ ],
+ "active": true,
+ "name": [
+ {
+ "use": "official",
+ "family": "Jones",
+ "given": [
+ "David"
+ ]
+ },
+ {
+ "use": "usual",
+ "family": "Jones",
+ "given": [
+ "David"
+ ]
+ }
+ ],
+ "gender": "male",
+ "birthDate": "1975-01-03",
+ "generalPractitioner": [
+ {
+ "reference": "Organization/abc"
+ }
+ ],
+ "managingOrganization": {
+ "reference": "Organization/abc"
+ }
+}
diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml
index 96008305da8..84865dc2b09 100644
--- a/hapi-tinder-plugin/pom.xml
+++ b/hapi-tinder-plugin/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../pom.xml
@@ -58,37 +58,37 @@
ca.uhn.hapi.fhir
hapi-fhir-structures-dstu3
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-structures-hl7org-dstu2
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-structures-r4
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-structures-r5
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-validation-resources-dstu2
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-validation-resources-dstu3
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-validation-resources-r4
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
org.apache.velocity
diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml
index 001a6f66c9b..171d2cdbc74 100644
--- a/hapi-tinder-test/pom.xml
+++ b/hapi-tinder-test/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../pom.xml
diff --git a/pom.xml b/pom.xml
index 13963b9f57a..053724fa9f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-fhir
pom
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
HAPI-FHIR
An open-source implementation of the FHIR specification in Java.
https://hapifhir.io
diff --git a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml
index 261af428102..cc81bbe4696 100644
--- a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml
+++ b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../../pom.xml
diff --git a/tests/hapi-fhir-base-test-mindeps-client/pom.xml b/tests/hapi-fhir-base-test-mindeps-client/pom.xml
index 4af0ca83262..40a1416a89f 100644
--- a/tests/hapi-fhir-base-test-mindeps-client/pom.xml
+++ b/tests/hapi-fhir-base-test-mindeps-client/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../../pom.xml
diff --git a/tests/hapi-fhir-base-test-mindeps-server/pom.xml b/tests/hapi-fhir-base-test-mindeps-server/pom.xml
index b798c6c927c..07943cd5db9 100644
--- a/tests/hapi-fhir-base-test-mindeps-server/pom.xml
+++ b/tests/hapi-fhir-base-test-mindeps-server/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 5.7.0-PRE4-SNAPSHOT
+ 5.7.0-PRE5-SNAPSHOT
../../pom.xml