log4j-api (JPA): 2.11.1 -> 2.15.0 (Addresses CVE-2021-44228 - HAPI FHIR was not vulnerable to this issue but this upgrade avoids unnecessary OWASP scan notices)
+
log4j-api (JPA): 2.11.1 -> 2.17.1 (Addresses CVE-2021-44228 - HAPI FHIR was not vulnerable to this issue but this upgrade avoids unnecessary OWASP scan notices)
H2 (JPA): 1.4.200 -> 2.0.204 (Note that this change requires the use of the HapiFhirH2Dialect instead of the built-in Hibernate H2Dialect due to Hibernate issue HHH-15002
Jetty Server (CLI): 9.4.43.v20210629 -> 9.4.44.v20210927
+
Spring Boot (Boot): 2.5.0 -> 2.6.2
+
Swagger UI (OpenAPI): 3.46.0 -> 4.1.3
"
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/getting_started/versions.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/getting_started/versions.md
index e5e71fb65d4..402614d0d78 100644
--- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/getting_started/versions.md
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/getting_started/versions.md
@@ -25,6 +25,36 @@ Note also that after the release of the FHIR DSTU2 specification, the FHIR
+
+
HAPI FHIR 5.7.0
+
JDK8
+
+
1.0.2
+
1.4.0
+
3.0.2
+
4.0.1
+
5.0.0-snapshot1 0394b96b14
+
+
+
HAPI FHIR 5.6.0
+
JDK8
+
+
1.0.2
+
1.4.0
+
3.0.2
+
4.0.1
+
4.6.0 9b829d9714
+
+
+
HAPI FHIR 5.5.0
+
JDK8
+
+
1.0.2
+
1.4.0
+
3.0.2
+
4.0.1
+
4.6.0 9b829d9714
+
HAPI FHIR 5.4.0
JDK8
diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml
index ddeafb42d33..9719106ec4f 100644
--- a/hapi-fhir-jacoco/pom.xml
+++ b/hapi-fhir-jacoco/pom.xml
@@ -11,7 +11,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 5.7.0-PRE8-SNAPSHOT
+ 5.7.0-PRE9-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml
index c489233c51d..4e86e70a461 100644
--- a/hapi-fhir-jaxrsserver-base/pom.xml
+++ b/hapi-fhir-jaxrsserver-base/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 5.7.0-PRE8-SNAPSHOT
+ 5.7.0-PRE9-SNAPSHOT../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
index 497a458c860..5879df0fb89 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
@@ -46,7 +46,6 @@ import org.junit.jupiter.api.TestMethodOrder;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatcher;
import org.mockito.ArgumentMatchers;
-import org.mockito.Matchers;
import java.util.ArrayList;
import java.util.Arrays;
@@ -178,7 +177,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
toCreate.getIdentifier().add(new Identifier().setValue("myIdentifier"));
outcome.setResource(toCreate);
- when(mock.create(patientCaptor.capture(), isNull(String.class))).thenReturn(outcome);
+ when(mock.create(patientCaptor.capture(), isNull())).thenReturn(outcome);
client.setEncoding(EncodingEnum.JSON);
final MethodOutcome response = client.create().resource(toCreate).prefer(PreferReturnEnum.REPRESENTATION)
.execute();
@@ -295,11 +294,11 @@ public class AbstractJaxRsResourceProviderDstu3Test {
@Test
public void testSearchUsingGenericClientBySearch() {
// Perform a search
- when(mock.search(any(StringParam.class), Matchers.isNull(StringAndListParam.class)))
+ when(mock.search(any(StringParam.class), isNull()))
.thenReturn(Arrays.asList(createPatient(1)));
final Bundle results = client.search().forResource(Patient.class)
.where(Patient.NAME.matchesExactly().value(PATIENT_NAME)).returnBundle(Bundle.class).execute();
- verify(mock).search(any(StringParam.class), Matchers.isNull(StringAndListParam.class));
+ verify(mock).search(any(StringParam.class), isNull());
IBaseResource resource = results.getEntry().get(0).getResource();
compareResultId(1, resource);
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
index d852ac00dd7..c6271d0bb60 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
@@ -43,7 +43,6 @@ import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.mockito.ArgumentCaptor;
-import org.mockito.Matchers;
import java.util.ArrayList;
import java.util.Arrays;
@@ -169,7 +168,7 @@ public class AbstractJaxRsResourceProviderTest {
toCreate.getIdentifierFirstRep().setValue("myIdentifier");
outcome.setResource(toCreate);
- when(mock.create(patientCaptor.capture(), isNull(String.class))).thenReturn(outcome);
+ when(mock.create(patientCaptor.capture(), isNull())).thenReturn(outcome);
client.setEncoding(EncodingEnum.JSON);
final MethodOutcome response = client.create().resource(toCreate).prefer(PreferReturnEnum.REPRESENTATION)
.execute();
@@ -269,11 +268,11 @@ public class AbstractJaxRsResourceProviderTest {
@Test
public void testSearchUsingGenericClientBySearch() {
// Perform a search
- when(mock.search(any(StringParam.class), Matchers.isNull(StringAndListParam.class)))
+ when(mock.search(any(StringParam.class), isNull()))
.thenReturn(Arrays.asList(createPatient(1)));
Bundle results = client.search().forResource(Patient.class)
.where(Patient.NAME.matchesExactly().value(PATIENT_NAME)).returnBundle(Bundle.class).execute();
- verify(mock).search(any(StringParam.class), Matchers.isNull(StringAndListParam.class));
+ verify(mock).search(any(StringParam.class), isNull());
IResource resource = results.getEntry().get(0).getResource();
compareResultId(1, resource);
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptorTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptorTest.java
index 249fe726368..044d00b10b7 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptorTest.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptorTest.java
@@ -1,8 +1,8 @@
package ca.uhn.fhir.jaxrs.server.interceptor;
import static org.junit.jupiter.api.Assertions.*;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.isNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.*;
import java.net.URI;
@@ -10,7 +10,6 @@ import java.util.HashMap;
import javax.interceptor.InvocationContext;
import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.*;
import org.junit.jupiter.api.BeforeEach;
@@ -57,10 +56,10 @@ public class JaxRsExceptionInterceptorTest {
}
@Test
- public void testIntercepWithServletError() throws Throwable {
+ public void testInterceptorWithServletError() throws Throwable {
ExceptionHandlingInterceptor exceptionHandler = mock(ExceptionHandlingInterceptor.class);
when(exceptionHandler.preProcessOutgoingException(any(RequestDetails.class), any(Throwable.class),
- isNull(HttpServletRequest.class))).thenThrow(new ServletException("someMessage"));
+ isNull())).thenThrow(new ServletException("someMessage"));
interceptor = new JaxRsExceptionInterceptor(exceptionHandler);
when(context.proceed()).thenThrow(new ServletException());
try {
diff --git a/hapi-fhir-jpa/pom.xml b/hapi-fhir-jpa/pom.xml
index 79eb51c0eab..d097a52b6d9 100644
--- a/hapi-fhir-jpa/pom.xml
+++ b/hapi-fhir-jpa/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 5.7.0-PRE8-SNAPSHOT
+ 5.7.0-PRE9-SNAPSHOT../hapi-deployable-pom/pom.xml4.0.0
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index 9c654cd6d35..84322581d08 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirhapi-deployable-pom
- 5.7.0-PRE8-SNAPSHOT
+ 5.7.0-PRE9-SNAPSHOT../hapi-deployable-pom/pom.xml
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 b8348427857..70f6eb4f7e0 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
@@ -156,6 +156,7 @@ import org.hl7.fhir.common.hapi.validation.support.UnknownCodeSystemWarningValid
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
+import org.hl7.fhir.utilities.npm.PackageClient;
import org.springframework.batch.core.configuration.JobRegistry;
import org.springframework.batch.core.configuration.annotation.BatchConfigurer;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
@@ -377,8 +378,8 @@ public abstract class BaseConfig {
public IHapiPackageCacheManager packageCacheManager() {
JpaPackageCache retVal = new JpaPackageCache();
retVal.getPackageServers().clear();
- retVal.getPackageServers().add(FilesystemPackageCacheManager.PRIMARY_SERVER);
- retVal.getPackageServers().add(FilesystemPackageCacheManager.SECONDARY_SERVER);
+ retVal.getPackageServers().add(PackageClient.PRIMARY_SERVER);
+ retVal.getPackageServers().add(PackageClient.SECONDARY_SERVER);
return retVal;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IPartitionDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IPartitionDao.java
index 95efe95f065..526c985b4e0 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IPartitionDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IPartitionDao.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.dao.data;
import ca.uhn.fhir.jpa.entity.PartitionEntity;
-import org.checkerframework.checker.nullness.Opt;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/ISearchDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/ISearchDao.java
index 32db55df2f1..14031005250 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/ISearchDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/ISearchDao.java
@@ -43,7 +43,7 @@ public interface ISearchDao extends JpaRepository, IHapiFhirJpaRep
@Query("SELECT s.myId FROM Search s WHERE s.myDeleted = TRUE")
Slice findDeleted(Pageable thePage);
- @Query("SELECT s FROM Search s WHERE s.myResourceType = :type AND mySearchQueryStringHash = :hash AND (s.myCreated > :cutoff) AND s.myDeleted = false AND s.myStatus <> 'FAILED'")
+ @Query("SELECT s FROM Search s WHERE s.myResourceType = :type AND mySearchQueryStringHash = :hash AND (s.myCreated > :cutoff) AND s.myDeleted = FALSE AND s.myStatus <> 'FAILED'")
Collection findWithCutoffOrExpiry(@Param("type") String theResourceType, @Param("hash") int theHashCode, @Param("cutoff") Date theCreatedCutoff);
@Query("SELECT COUNT(s) FROM Search s WHERE s.myDeleted = TRUE")
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ResourceForeignKey.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ResourceForeignKey.java
index badf4632278..362144dd913 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ResourceForeignKey.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ResourceForeignKey.java
@@ -23,6 +23,7 @@ package ca.uhn.fhir.jpa.dao.expunge;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
public class ResourceForeignKey {
public final String table;
@@ -57,7 +58,7 @@ public class ResourceForeignKey {
@Override
public String toString() {
- return new ToStringBuilder(this)
+ return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
.append("table", table)
.append("key", key)
.toString();
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoCodeSystemR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoCodeSystemR5.java
index ba39c889c70..883407de993 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoCodeSystemR5.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoCodeSystemR5.java
@@ -74,7 +74,7 @@ public class FhirResourceDaoCodeSystemR5 extends BaseHapiFhirResourceDao findCodeSystemIdsContainingSystemAndCode(String theCode, String theSystem, RequestDetails theRequest) {
List valueSetIds;
- Set ids = searchForIds(new SearchParameterMap(CodeSystem.SP_CODE, new TokenParam(theSystem, theCode)), theRequest);
+ Set ids = searchForIds(new SearchParameterMap(org.hl7.fhir.r4.model.CodeSystem.SP_CODE, new TokenParam(theSystem, theCode)), theRequest);
valueSetIds = new ArrayList<>();
for (ResourcePersistentId next : ids) {
IIdType id = myIdHelperService.translatePidIdToForcedId(myFhirContext, "CodeSystem", next);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoObservationR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoObservationR5.java
index 535697e9d87..38ba0d55610 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoObservationR5.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoObservationR5.java
@@ -54,22 +54,22 @@ public class FhirResourceDaoObservationR5 extends BaseHapiFhirResourceDaoObserva
@Override
protected String getEffectiveParamName() {
- return Observation.SP_DATE;
+ return org.hl7.fhir.r4.model.Observation.SP_DATE;
}
@Override
protected String getCodeParamName() {
- return Observation.SP_CODE;
+ return org.hl7.fhir.r4.model.Observation.SP_CODE;
}
@Override
protected String getSubjectParamName() {
- return Observation.SP_SUBJECT;
+ return org.hl7.fhir.r4.model.Observation.SP_SUBJECT;
}
@Override
protected String getPatientParamName() {
- return Observation.SP_PATIENT;
+ return org.hl7.fhir.r4.model.Observation.SP_PATIENT;
}
@Override
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderObservationR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderObservationR5.java
index 1fd9b0665c0..de70ad9fd50 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderObservationR5.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderObservationR5.java
@@ -81,14 +81,14 @@ public class BaseJpaResourceProviderObservationR5 extends JpaResourceProviderR5<
startRequest(theServletRequest);
try {
SearchParameterMap paramMap = new SearchParameterMap();
- paramMap.add(Observation.SP_CATEGORY, theCategory);
- paramMap.add(Observation.SP_CODE, theCode);
- paramMap.add(Observation.SP_DATE, theDate);
+ paramMap.add(org.hl7.fhir.r4.model.Observation.SP_CATEGORY, theCategory);
+ paramMap.add(org.hl7.fhir.r4.model.Observation.SP_CODE, theCode);
+ paramMap.add(org.hl7.fhir.r4.model.Observation.SP_DATE, theDate);
if (thePatient != null) {
- paramMap.add(Observation.SP_PATIENT, thePatient);
+ paramMap.add(org.hl7.fhir.r4.model.Observation.SP_PATIENT, thePatient);
}
if (theSubject != null) {
- paramMap.add(Observation.SP_SUBJECT, theSubject);
+ paramMap.add(org.hl7.fhir.r4.model.Observation.SP_SUBJECT, theSubject);
}
if (theMax != null) {
paramMap.setLastNMax(theMax.getValue());
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderStructureDefinitionR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderStructureDefinitionR5.java
index bdde58dd11f..2bd3025fab0 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderStructureDefinitionR5.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderStructureDefinitionR5.java
@@ -60,7 +60,7 @@ public class BaseJpaResourceProviderStructureDefinitionR5 extends JpaResourcePro
} else {
SearchParameterMap map = new SearchParameterMap();
map.setLoadSynchronousUpTo(2);
- map.add(StructureDefinition.SP_URL, new UriParam(theUrl.getValue()));
+ map.add(org.hl7.fhir.r4.model.StructureDefinition.SP_URL, new UriParam(theUrl.getValue()));
IBundleProvider outcome = getDao().search(map, theRequestDetails);
Integer numResults = outcome.size();
assert numResults != null;
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 854c5ae8cce..06b65d7a439 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,6 +22,7 @@ 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;
@@ -41,15 +42,13 @@ public class TermCodeSystemDeleteTasklet implements Tasklet {
@Autowired
private ITermCodeSystemDao myTermCodeSystemDao;
- @Autowired
- private ITermCodeSystemVersionDao myCodeSystemVersionDao;
-
@Override
public RepeatStatus execute(@NotNull StepContribution contribution, ChunkContext context) throws Exception {
long codeSystemPid = (Long) context.getStepContext().getJobParameters().get(JOB_PARAM_CODE_SYSTEM_ID);
- ourLog.info("Deleting code system {}", codeSystemPid);
- myTermCodeSystemDao.findById(codeSystemPid).orElseThrow(IllegalStateException::new);
+ TermCodeSystem cs = myTermCodeSystemDao.findById(codeSystemPid).orElseThrow(IllegalStateException::new);
+ ourLog.info("Deleting code system {} / {}", codeSystemPid, cs.getCodeSystemUri());
+
myTermCodeSystemDao.deleteById(codeSystemPid);
ourLog.info("Code system {} deleted", codeSystemPid);
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
deleted file mode 100644
index dd708bc401d..00000000000
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/job/TermConceptDeleteTasklet.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package ca.uhn.fhir.jpa.term.job;
-
-/*
- * #%L
- * HAPI FHIR JPA Server
- * %%
- * Copyright (C) 2014 - 2021 Smile CDR, Inc.
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-import ca.uhn.fhir.jpa.dao.data.ITermCodeSystemDao;
-import ca.uhn.fhir.jpa.dao.data.ITermCodeSystemVersionDao;
-import org.jetbrains.annotations.NotNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.batch.core.StepContribution;
-import org.springframework.batch.core.scope.context.ChunkContext;
-import org.springframework.batch.core.step.tasklet.Tasklet;
-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;
-
-/**
- * Deletes the TermConcept(s) related to the TermCodeSystemVersion being deleted
- * Executes in its own step to be in own transaction because it is a DB-heavy operation
- */
-@Component
-public class TermConceptDeleteTasklet implements Tasklet {
- private static final Logger ourLog = LoggerFactory.getLogger(TermConceptDeleteTasklet.class);
-
- @Autowired
- private ITermCodeSystemDao myTermCodeSystemDao;
-
- @Autowired
- private ITermCodeSystemVersionDao myCodeSystemVersionDao;
-
- @Override
- 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);
-
- myTermCodeSystemDao.findById(codeSystemPid).orElseThrow(IllegalStateException::new);
- myTermCodeSystemDao.deleteById(codeSystemPid);
-
- return RepeatStatus.FINISHED;
- }
-
-}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ElasticsearchWithPrefixConfig.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ElasticsearchWithPrefixConfig.java
index 0014407fb09..9253de45a58 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ElasticsearchWithPrefixConfig.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ElasticsearchWithPrefixConfig.java
@@ -20,7 +20,7 @@ import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.PutIndexTemplateRequest;
import org.elasticsearch.common.settings.Settings;
-import org.hibernate.dialect.H2Dialect;
+import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchBackendSettings;
import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchIndexSettings;
@@ -101,7 +101,7 @@ public class ElasticsearchWithPrefixConfig {
extraProperties.put("hibernate.format_sql", "false");
extraProperties.put("hibernate.show_sql", "false");
extraProperties.put("hibernate.hbm2ddl.auto", "update");
- extraProperties.put("hibernate.dialect", H2Dialect.class.getName());
+ extraProperties.put("hibernate.dialect", HapiFhirH2Dialect.class.getName());
//Override default lucene settings
// Force elasticsearch to start first
int httpPort = elasticContainer().getMappedPort(9200);//9200 is the HTTP port
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu2Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu2Config.java
index fa6f055c222..cf0013d8113 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu2Config.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu2Config.java
@@ -9,7 +9,7 @@ import ca.uhn.fhir.validation.ResultSeverityEnum;
import net.ttddyy.dsproxy.listener.ThreadQueryCountHolder;
import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;
import org.apache.commons.dbcp2.BasicDataSource;
-import org.hibernate.dialect.H2Dialect;
+import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
@@ -148,7 +148,7 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 {
extraProperties.put("hibernate.format_sql", "true");
extraProperties.put("hibernate.show_sql", "false");
extraProperties.put("hibernate.hbm2ddl.auto", "update");
- extraProperties.put("hibernate.dialect", H2Dialect.class.getName());
+ extraProperties.put("hibernate.dialect", HapiFhirH2Dialect.class.getName());
boolean enableLucene = myEnv.getProperty(BaseJpaTest.CONFIG_ENABLE_LUCENE, Boolean.TYPE, BaseJpaTest.CONFIG_ENABLE_LUCENE_DEFAULT_VALUE);
Map hibernateSearchProperties = BaseJpaTest.buildHibernateSearchProperties(enableLucene);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java
index 393c22b5ec5..d710671edea 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java
@@ -12,7 +12,7 @@ import ca.uhn.fhir.rest.server.mail.MailSvc;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;
import org.apache.commons.dbcp2.BasicDataSource;
-import org.hibernate.dialect.H2Dialect;
+import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -154,7 +154,7 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 {
extraProperties.put("hibernate.format_sql", "false");
extraProperties.put("hibernate.show_sql", "false");
extraProperties.put("hibernate.hbm2ddl.auto", "update");
- extraProperties.put("hibernate.dialect", H2Dialect.class.getName());
+ extraProperties.put("hibernate.dialect", HapiFhirH2Dialect.class.getName());
boolean enableLucene = myEnv.getProperty(BaseJpaTest.CONFIG_ENABLE_LUCENE, Boolean.TYPE, BaseJpaTest.CONFIG_ENABLE_LUCENE_DEFAULT_VALUE);
Map hibernateSearchProperties = BaseJpaTest.buildHibernateSearchProperties(enableLucene);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java
index a86d3b1d25f..83c82755bb1 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java
@@ -14,7 +14,7 @@ import net.ttddyy.dsproxy.listener.SingleQueryCountHolder;
import net.ttddyy.dsproxy.listener.logging.SLF4JLogLevel;
import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;
import org.apache.commons.dbcp2.BasicDataSource;
-import org.hibernate.dialect.H2Dialect;
+import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.annotation.Bean;
@@ -166,7 +166,7 @@ public class TestR4Config extends BaseJavaConfigR4 {
extraProperties.put("hibernate.format_sql", "false");
extraProperties.put("hibernate.show_sql", "false");
extraProperties.put("hibernate.hbm2ddl.auto", "update");
- extraProperties.put("hibernate.dialect", H2Dialect.class.getName());
+ extraProperties.put("hibernate.dialect", HapiFhirH2Dialect.class.getName());
boolean enableLucene = myEnv.getProperty(BaseJpaTest.CONFIG_ENABLE_LUCENE, Boolean.TYPE, BaseJpaTest.CONFIG_ENABLE_LUCENE_DEFAULT_VALUE);
Map hibernateSearchProperties = BaseJpaTest.buildHibernateSearchProperties(enableLucene);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java
index 8786552e85c..8203307d705 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4WithLuceneDisabledConfig.java
@@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.config;
import java.util.Properties;
-import org.hibernate.dialect.H2Dialect;
+import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
import org.hibernate.search.backend.elasticsearch.index.layout.IndexLayoutStrategy;
import org.hibernate.search.backend.lucene.cfg.LuceneBackendSettings;
import org.hibernate.search.engine.cfg.BackendSettings;
@@ -42,7 +42,7 @@ public class TestR4WithLuceneDisabledConfig extends TestR4Config {
extraProperties.put("hibernate.format_sql", "false");
extraProperties.put("hibernate.show_sql", "false");
extraProperties.put("hibernate.hbm2ddl.auto", "update");
- extraProperties.put("hibernate.dialect", H2Dialect.class.getName());
+ extraProperties.put("hibernate.dialect", HapiFhirH2Dialect.class.getName());
extraProperties.put(HibernateOrmMapperSettings.ENABLED, "false");
return extraProperties;
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR5Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR5Config.java
index fba231423d6..3ad3351ef23 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR5Config.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR5Config.java
@@ -10,7 +10,7 @@ import ca.uhn.fhir.validation.ResultSeverityEnum;
import net.ttddyy.dsproxy.listener.SingleQueryCountHolder;
import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;
import org.apache.commons.dbcp2.BasicDataSource;
-import org.hibernate.dialect.H2Dialect;
+import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.annotation.Bean;
@@ -149,7 +149,7 @@ public class TestR5Config extends BaseJavaConfigR5 {
extraProperties.put("hibernate.format_sql", "false");
extraProperties.put("hibernate.show_sql", "false");
extraProperties.put("hibernate.hbm2ddl.auto", "update");
- extraProperties.put("hibernate.dialect", H2Dialect.class.getName());
+ extraProperties.put("hibernate.dialect", HapiFhirH2Dialect.class.getName());
boolean enableLucene = myEnv.getProperty(BaseJpaTest.CONFIG_ENABLE_LUCENE, Boolean.TYPE, BaseJpaTest.CONFIG_ENABLE_LUCENE_DEFAULT_VALUE);
Map hibernateSearchProperties = BaseJpaTest.buildHibernateSearchProperties(enableLucene);
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 a6aa030a02b..9d33c2b666c 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
@@ -11,7 +11,6 @@ import ca.uhn.fhir.jpa.api.model.ExpungeOptions;
import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc;
import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportSvc;
import ca.uhn.fhir.jpa.config.BaseConfig;
-import ca.uhn.fhir.jpa.config.TestDstu2Config;
import ca.uhn.fhir.jpa.dao.data.IForcedIdDao;
import ca.uhn.fhir.jpa.dao.data.IResourceHistoryTableDao;
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedComboTokensNonUniqueDao;
@@ -72,7 +71,6 @@ import org.hl7.fhir.dstu3.model.Resource;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
-import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java
index 84a951e8185..9cabd9fdb35 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java
@@ -17,7 +17,6 @@ import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamTokenDao;
import ca.uhn.fhir.jpa.dao.data.IResourceLinkDao;
import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
-import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc;
@@ -61,8 +60,6 @@ import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
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.instance.model.api.IBaseResource;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java
index 9ad9d7ab388..38d10588ec4 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java
@@ -33,7 +33,6 @@ import ca.uhn.fhir.jpa.dao.data.ITermValueSetDao;
import ca.uhn.fhir.jpa.dao.dstu2.FhirResourceDaoDstu2SearchNoFtTest;
import ca.uhn.fhir.jpa.dao.r4.BaseJpaR4Test;
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
-import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.search.IStaleSearchDeletingSvc;
@@ -55,8 +54,6 @@ import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.util.UrlUtil;
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.convertors.advisors.impl.BaseAdvisor_30_40;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
import org.hl7.fhir.dstu3.model.AllergyIntolerance;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValueSetMultiVersionTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValueSetMultiVersionTest.java
index 25bb507169c..7e93f1b5151 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValueSetMultiVersionTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValueSetMultiVersionTest.java
@@ -199,7 +199,10 @@ public class FhirResourceDaoDstu3ValueSetMultiVersionTest extends BaseJpaDstu3Te
if (optionalTermValueSet.isPresent()) {
fail();
}
- myTermValueSetDao.findTermValueSetByUrlAndVersion(URL_MY_VALUE_SET, "v2").orElseThrow(() -> new IllegalArgumentException("No TerValueSet found for " + URL_MY_VALUE_SET + " version v2"));
+ optionalTermValueSet = myTermValueSetDao.findTermValueSetByUrlAndVersion(URL_MY_VALUE_SET, "v2");
+ if (!optionalTermValueSet.isPresent()) {
+ fail("No TerValueSet found for " + URL_MY_VALUE_SET + " version v2");
+ }
myValueSetDao.delete(myValueSets.get(ValueSetVersions.V2).getResource().getIdElement());
assertEquals(0, myTermValueSetDao.findTermValueSetByUrl(PageRequest.of(0, 10), URL_MY_VALUE_SET).size());
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ResourceTableFKProviderTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ResourceTableFKProviderTest.java
index e93f912da3b..722e3f46d38 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ResourceTableFKProviderTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ResourceTableFKProviderTest.java
@@ -5,13 +5,18 @@ import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashSet;
import java.util.List;
-import java.util.stream.Collectors;
+import java.util.Set;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
@@ -24,21 +29,45 @@ class ResourceTableFKProviderTest extends BaseJpaR4Test {
protected EntityManager myEntityManager;
@Autowired
ResourceTableFKProvider myResourceTableFKProvider;
+ @Autowired
+ private DataSource myDataSource;
+
@Test
- public void testWeHaveAllForeignKeys() {
- runInTransaction(()-> {
- List