diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu2Config.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu2Config.java index f4ccd0a2bd7..e56d9b078b7 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu2Config.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu2Config.java @@ -7,11 +7,11 @@ import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorDstu2; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry; import ca.uhn.fhir.jpa.searchparam.registry.SearchParamRegistryDstu2; -import ca.uhn.fhir.jpa.term.HapiTerminologySvcDstu2; -import ca.uhn.fhir.jpa.term.IHapiTerminologySvc; +import ca.uhn.fhir.jpa.term.TermReadSvcDstu2; +import ca.uhn.fhir.jpa.term.api.ITermReadSvc; import ca.uhn.fhir.jpa.util.ResourceCountCache; import ca.uhn.fhir.model.dstu2.composite.MetaDt; -import ca.uhn.fhir.validation.IValidatorModule; +import ca.uhn.fhir.validation.IInstanceValidatorModule; import org.apache.commons.lang3.time.DateUtils; import org.hl7.fhir.instance.hapi.validation.CachingValidationSupport; import org.hl7.fhir.instance.hapi.validation.DefaultProfileValidationSupport; @@ -83,7 +83,7 @@ public class BaseDstu2Config extends BaseConfig { @Bean(name = "myInstanceValidatorDstu2") @Lazy - public IValidatorModule instanceValidatorDstu2() { + public IInstanceValidatorModule instanceValidatorDstu2() { FhirInstanceValidator retVal = new FhirInstanceValidator(); retVal.setBestPracticeWarningLevel(IResourceValidator.BestPracticeWarningLevel.Warning); retVal.setValidationSupport(new CachingValidationSupport(new ValidationSupportChain(new DefaultProfileValidationSupport(), jpaValidationSupportDstu2()))); @@ -134,8 +134,8 @@ public class BaseDstu2Config extends BaseConfig { } @Bean(autowire = Autowire.BY_TYPE) - public IHapiTerminologySvc terminologyService() { - return new HapiTerminologySvcDstu2(); + public ITermReadSvc terminologyService() { + return new TermReadSvcDstu2(); } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/dstu3/BaseDstu3Config.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/dstu3/BaseDstu3Config.java index 95499fcb207..6f7fc3b4250 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/dstu3/BaseDstu3Config.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/dstu3/BaseDstu3Config.java @@ -18,6 +18,7 @@ import ca.uhn.fhir.jpa.term.IHapiTerminologySvcDstu3; import ca.uhn.fhir.jpa.term.TerminologyLoaderSvcImpl; import ca.uhn.fhir.jpa.util.ResourceCountCache; import ca.uhn.fhir.jpa.validation.JpaValidationSupportChainDstu3; +import ca.uhn.fhir.validation.IInstanceValidatorModule; import ca.uhn.fhir.validation.IValidatorModule; import org.apache.commons.lang3.time.DateUtils; import org.hl7.fhir.dstu3.hapi.ctx.DefaultProfileValidationSupport; @@ -92,7 +93,7 @@ public class BaseDstu3Config extends BaseConfig { @Bean(name = "myInstanceValidatorDstu3") @Lazy - public IValidatorModule instanceValidatorDstu3() { + public IInstanceValidatorModule instanceValidatorDstu3() { FhirInstanceValidator val = new FhirInstanceValidator(); val.setBestPracticeWarningLevel(IResourceValidator.BestPracticeWarningLevel.Warning); val.setValidationSupport(validationSupportChainDstu3()); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r4/BaseR4Config.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r4/BaseR4Config.java index 9c5cfd5d17b..958c309fb2c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r4/BaseR4Config.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r4/BaseR4Config.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.config.r4; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.ParserOptions; -import ca.uhn.fhir.jpa.config.BaseConfig; +import ca.uhn.fhir.jpa.config.BaseConfigDstu3Plus; import ca.uhn.fhir.jpa.dao.FulltextSearchSvcImpl; import ca.uhn.fhir.jpa.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; @@ -12,13 +12,15 @@ import ca.uhn.fhir.jpa.provider.GraphQLProvider; import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorR4; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry; import ca.uhn.fhir.jpa.searchparam.registry.SearchParamRegistryR4; -import ca.uhn.fhir.jpa.term.HapiTerminologySvcR4; -import ca.uhn.fhir.jpa.term.IHapiTerminologyLoaderSvc; -import ca.uhn.fhir.jpa.term.IHapiTerminologySvcR4; -import ca.uhn.fhir.jpa.term.TerminologyLoaderSvcImpl; +import ca.uhn.fhir.jpa.term.TermLoaderSvcImpl; +import ca.uhn.fhir.jpa.term.TermReadSvcR4; +import ca.uhn.fhir.jpa.term.TermVersionAdapterSvcR4; +import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc; +import ca.uhn.fhir.jpa.term.api.ITermReadSvcR4; +import ca.uhn.fhir.jpa.term.api.ITermVersionAdapterSvc; import ca.uhn.fhir.jpa.util.ResourceCountCache; import ca.uhn.fhir.jpa.validation.JpaValidationSupportChainR4; -import ca.uhn.fhir.validation.IValidatorModule; +import ca.uhn.fhir.validation.IInstanceValidatorModule; import org.apache.commons.lang3.time.DateUtils; import org.hl7.fhir.r4.hapi.ctx.DefaultProfileValidationSupport; import org.hl7.fhir.r4.hapi.ctx.IValidationSupport; @@ -55,13 +57,19 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration @EnableTransactionManagement -public class BaseR4Config extends BaseConfig { +public class BaseR4Config extends BaseConfigDstu3Plus { @Override public FhirContext fhirContext() { return fhirContextR4(); } + @Bean + @Override + public ITermVersionAdapterSvc terminologyVersionAdapterSvc() { + return new TermVersionAdapterSvcR4(); + } + @Bean @Primary public FhirContext fhirContextR4() { @@ -92,7 +100,7 @@ public class BaseR4Config extends BaseConfig { @Bean(name = "myInstanceValidatorR4") @Lazy - public IValidatorModule instanceValidatorR4() { + public IInstanceValidatorModule instanceValidatorR4() { FhirInstanceValidator val = new FhirInstanceValidator(); IResourceValidator.BestPracticeWarningLevel level = IResourceValidator.BestPracticeWarningLevel.Warning; val.setBestPracticeWarningLevel(level); @@ -154,13 +162,13 @@ public class BaseR4Config extends BaseConfig { } @Bean(autowire = Autowire.BY_TYPE) - public IHapiTerminologyLoaderSvc terminologyLoaderService() { - return new TerminologyLoaderSvcImpl(); + public ITermLoaderSvc termLoaderService() { + return new TermLoaderSvcImpl(); } @Bean(autowire = Autowire.BY_TYPE) - public IHapiTerminologySvcR4 terminologyService() { - return new HapiTerminologySvcR4(); + public ITermReadSvcR4 terminologyService() { + return new TermReadSvcR4(); } @Primary diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r5/BaseR5Config.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r5/BaseR5Config.java index 3bce313f662..323a671c15c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r5/BaseR5Config.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r5/BaseR5Config.java @@ -18,6 +18,7 @@ import ca.uhn.fhir.jpa.term.IHapiTerminologySvcR5; import ca.uhn.fhir.jpa.term.TerminologyLoaderSvcImpl; import ca.uhn.fhir.jpa.util.ResourceCountCache; import ca.uhn.fhir.jpa.validation.JpaValidationSupportChainR5; +import ca.uhn.fhir.validation.IInstanceValidatorModule; import ca.uhn.fhir.validation.IValidatorModule; import org.apache.commons.lang3.time.DateUtils; import org.hl7.fhir.r5.hapi.ctx.DefaultProfileValidationSupport; @@ -92,7 +93,7 @@ public class BaseR5Config extends BaseConfig { @Bean(name = "myInstanceValidatorR5") @Lazy - public IValidatorModule instanceValidatorR5() { + public IInstanceValidatorModule instanceValidatorR5() { FhirInstanceValidator val = new FhirInstanceValidator(); IResourceValidator.BestPracticeWarningLevel level = IResourceValidator.BestPracticeWarningLevel.Warning; val.setBestPracticeWarningLevel(level); 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 fd0537edb6a..e6f886295ac 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 @@ -94,6 +94,8 @@ public abstract class BaseHapiFhirResourceDao extends B private MatchResourceUrlService myMatchResourceUrlService; @Autowired private IResourceReindexingSvc myResourceReindexingSvc; + @Autowired + private IInstanceValidatorModule myInstanceValidator; private String myResourceName; private Class myResourceType; @@ -182,9 +184,15 @@ public abstract class BaseHapiFhirResourceDao extends B return createOperationOutcome(OO_SEVERITY_INFO, theMessage, "informational"); } - protected abstract IValidatorModule getInstanceValidator(); + protected final IInstanceValidatorModule getInstanceValidator() { + return myInstanceValidator; + } - protected abstract IBaseOperationOutcome createOperationOutcome(String theSeverity, String theMessage, String theCode); + protected final IBaseOperationOutcome createOperationOutcome(String theSeverity, String theMessage, String theCode) { + IBaseOperationOutcome oo = OperationOutcomeUtil.newInstance(getContext()); + OperationOutcomeUtil.addIssue(getContext(), oo, theSeverity, theMessage, null, theCode); + return oo; + } @Override public DaoMethodOutcome delete(IIdType theId) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoBundleDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoBundleDstu2.java index 66999901fbf..9d41830c5b4 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoBundleDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoBundleDstu2.java @@ -28,7 +28,7 @@ import java.util.Set; import static org.apache.commons.lang3.StringUtils.defaultString; -public class FhirResourceDaoBundleDstu2 extends FhirResourceDaoDstu2 { +public class FhirResourceDaoBundleDstu2 extends BaseHapiFhirResourceDao { @Override protected void preProcessResourceForStorage(Bundle theResource) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoCompositionDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoCompositionDstu2.java index c6b7efe21fe..64de9e50008 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoCompositionDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoCompositionDstu2.java @@ -32,7 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired; import javax.servlet.http.HttpServletRequest; -public class FhirResourceDaoCompositionDstu2 extends FhirResourceDaoDstu2implements IFhirResourceDaoComposition { +public class FhirResourceDaoCompositionDstu2 extends BaseHapiFhirResourceDaoimplements IFhirResourceDaoComposition { @Override public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdate, SortSpec theSort, RequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu2.java deleted file mode 100644 index 697c1deafbf..00000000000 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu2.java +++ /dev/null @@ -1,51 +0,0 @@ -package ca.uhn.fhir.jpa.dao; - -import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; -import ca.uhn.fhir.validation.IValidatorModule; -import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -/* - * #%L - * HAPI FHIR JPA Server - * %% - * Copyright (C) 2014 - 2019 University Health Network - * %% - * 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% - */ - -public class FhirResourceDaoDstu2 extends BaseHapiFhirResourceDao { - - @Autowired - @Qualifier("myInstanceValidatorDstu2") - private IValidatorModule myInstanceValidator; - - @Override - protected IValidatorModule getInstanceValidator() { - return myInstanceValidator; - } - - @Override - protected IBaseOperationOutcome createOperationOutcome(String theSeverity, String theMessage, String theCode) { - OperationOutcome oo = new OperationOutcome(); - oo.getIssueFirstRep().getSeverityElement().setValue(theSeverity); - oo.getIssueFirstRep().getDiagnosticsElement().setValue(theMessage); - oo.getIssueFirstRep().getCodeElement().setValue(theCode); - return oo; - } - - -} diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoEncounterDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoEncounterDstu2.java index d76c4893bd4..d729bb33953 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoEncounterDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoEncounterDstu2.java @@ -36,7 +36,7 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.param.DateRangeParam; import ca.uhn.fhir.rest.param.StringParam; -public class FhirResourceDaoEncounterDstu2 extends FhirResourceDaoDstu2implements IFhirResourceDaoEncounter { +public class FhirResourceDaoEncounterDstu2 extends BaseHapiFhirResourceDaoimplements IFhirResourceDaoEncounter { @Override public IBundleProvider encounterInstanceEverything(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdated, SortSpec theSort) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoMessageHeaderDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoMessageHeaderDstu2.java index 225f1ecac4b..a5d16f10800 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoMessageHeaderDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoMessageHeaderDstu2.java @@ -25,7 +25,7 @@ import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.NotImplementedOperationException; import org.hl7.fhir.instance.model.api.IBaseBundle; -public class FhirResourceDaoMessageHeaderDstu2 extends FhirResourceDaoDstu2 implements IFhirResourceDaoMessageHeader { +public class FhirResourceDaoMessageHeaderDstu2 extends BaseHapiFhirResourceDao implements IFhirResourceDaoMessageHeader { public static IBaseBundle throwProcessMessageNotImplemented() { throw new NotImplementedOperationException("This operation is not yet implemented on this server"); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java index d1a755e4228..0511e20ce1a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java @@ -37,7 +37,7 @@ import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.param.*; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails; -public class FhirResourceDaoPatientDstu2 extends FhirResourceDaoDstu2implements IFhirResourceDaoPatient { +public class FhirResourceDaoPatientDstu2 extends BaseHapiFhirResourceDaoimplements IFhirResourceDaoPatient { public FhirResourceDaoPatientDstu2() { super(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoQuestionnaireResponseDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoQuestionnaireResponseDstu2.java index 2a5c34d446e..9c084a94384 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoQuestionnaireResponseDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoQuestionnaireResponseDstu2.java @@ -43,7 +43,7 @@ import ca.uhn.fhir.validation.FhirValidator; import ca.uhn.fhir.validation.IResourceLoader; import ca.uhn.fhir.validation.ValidationResult; -public class FhirResourceDaoQuestionnaireResponseDstu2 extends FhirResourceDaoDstu2 { +public class FhirResourceDaoQuestionnaireResponseDstu2 extends BaseHapiFhirResourceDao { @Autowired @Qualifier("myFhirContextDstu2Hl7Org") diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java index 52ceb46ccf0..8bfcd9a2e70 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java @@ -35,7 +35,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -public class FhirResourceDaoSearchParameterDstu2 extends FhirResourceDaoDstu2 implements IFhirResourceDaoSearchParameter { +public class FhirResourceDaoSearchParameterDstu2 extends BaseHapiFhirResourceDao implements IFhirResourceDaoSearchParameter { @Autowired private IFhirSystemDao mySystemDao; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoStructureDefinitionDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoStructureDefinitionDstu2.java index cdf335d56f2..c9ed359dfc3 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoStructureDefinitionDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoStructureDefinitionDstu2.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.dao; import ca.uhn.fhir.model.dstu2.resource.StructureDefinition; -public class FhirResourceDaoStructureDefinitionDstu2 extends FhirResourceDaoDstu2 implements IFhirResourceDaoStructureDefinition { +public class FhirResourceDaoStructureDefinitionDstu2 extends BaseHapiFhirResourceDao implements IFhirResourceDaoStructureDefinition { @Override public StructureDefinition generateSnapshot(StructureDefinition theInput, String theUrl, String theWebUrl, String theName) { // FIXME: implement diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSubscriptionDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSubscriptionDstu2.java index ddf27ce58e8..66b66b7a968 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSubscriptionDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSubscriptionDstu2.java @@ -38,7 +38,7 @@ import java.util.Date; import static org.apache.commons.lang3.StringUtils.isBlank; -public class FhirResourceDaoSubscriptionDstu2 extends FhirResourceDaoDstu2 implements IFhirResourceDaoSubscription { +public class FhirResourceDaoSubscriptionDstu2 extends BaseHapiFhirResourceDao implements IFhirResourceDaoSubscription { @Autowired private ISubscriptionTableDao mySubscriptionTableDao; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoValueSetDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoValueSetDstu2.java index 1db5197f8f7..ed3695c1642 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoValueSetDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoValueSetDstu2.java @@ -57,7 +57,7 @@ import java.util.Set; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; -public class FhirResourceDaoValueSetDstu2 extends FhirResourceDaoDstu2 +public class FhirResourceDaoValueSetDstu2 extends BaseHapiFhirResourceDao implements IFhirResourceDaoValueSet, IFhirResourceDaoCodeSystem { private DefaultProfileValidationSupport myDefaultProfileValidationSupport; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java index 830945a6dc3..6f82ffac44c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.jpa.dao.dstu3; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Bundle.BundleType; @@ -29,7 +30,7 @@ import java.util.Set; import static org.apache.commons.lang3.StringUtils.defaultString; -public class FhirResourceDaoBundleDstu3 extends FhirResourceDaoDstu3 { +public class FhirResourceDaoBundleDstu3 extends BaseHapiFhirResourceDao { @Override protected void preProcessResourceForStorage(Bundle theResource) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java index 6759858c732..5efd3f8c4b0 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java @@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; */ import ca.uhn.fhir.context.support.IContextValidationSupport; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem; import ca.uhn.fhir.jpa.dao.data.ITermCodeSystemDao; import ca.uhn.fhir.jpa.entity.TermCodeSystem; @@ -48,7 +49,7 @@ import java.util.Set; import static org.apache.commons.lang3.StringUtils.isNotBlank; -public class FhirResourceDaoCodeSystemDstu3 extends FhirResourceDaoDstu3 implements IFhirResourceDaoCodeSystem { +public class FhirResourceDaoCodeSystemDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoCodeSystem { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoCodeSystemDstu3.class); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCompositionDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCompositionDstu3.java index 7fc21129300..448925a2b75 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCompositionDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCompositionDstu3.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoComposition; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.model.api.IResource; @@ -35,7 +36,7 @@ import org.hl7.fhir.instance.model.api.IPrimitiveType; import javax.servlet.http.HttpServletRequest; import java.util.Collections; -public class FhirResourceDaoCompositionDstu3 extends FhirResourceDaoDstu3 implements IFhirResourceDaoComposition { +public class FhirResourceDaoCompositionDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoComposition { @Override public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdate, SortSpec theSort, RequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java index 087b234cf87..6a1a6501226 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoConceptMap; import ca.uhn.fhir.jpa.term.TranslationMatch; import ca.uhn.fhir.jpa.term.TranslationRequest; @@ -27,7 +28,7 @@ import ca.uhn.fhir.jpa.term.TranslationResult; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.entity.TermConceptMapGroupElement; import ca.uhn.fhir.jpa.entity.TermConceptMapGroupElementTarget; -import ca.uhn.fhir.jpa.term.IHapiTerminologySvc; +import ca.uhn.fhir.jpa.term.api.ITermReadSvc; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import org.hl7.fhir.convertors.VersionConvertor_30_40; @@ -42,11 +43,9 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import static org.apache.commons.lang3.StringUtils.isNotBlank; - -public class FhirResourceDaoConceptMapDstu3 extends FhirResourceDaoDstu3 implements IFhirResourceDaoConceptMap { +public class FhirResourceDaoConceptMapDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoConceptMap { @Autowired - private IHapiTerminologySvc myHapiTerminologySvc; + private ITermReadSvc myHapiTerminologySvc; @Override public TranslationResult translate(TranslationRequest theTranslationRequest, RequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3.java deleted file mode 100644 index f4a5199cd7a..00000000000 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3.java +++ /dev/null @@ -1,65 +0,0 @@ -package ca.uhn.fhir.jpa.dao.dstu3; - -/* - * #%L - * HAPI FHIR JPA Server - * %% - * Copyright (C) 2014 - 2019 University Health Network - * %% - * 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.BaseHapiFhirResourceDao; -import ca.uhn.fhir.rest.api.ValidationModeEnum; -import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; -import ca.uhn.fhir.validation.IValidationContext; -import ca.uhn.fhir.validation.IValidatorModule; -import org.hl7.fhir.dstu3.model.OperationOutcome; -import org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.instance.model.api.IAnyResource; -import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class FhirResourceDaoDstu3 extends BaseHapiFhirResourceDao { - - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoDstu3.class); - - @Autowired() - @Qualifier("myInstanceValidatorDstu3") - private IValidatorModule myInstanceValidator; - - @Override - protected IValidatorModule getInstanceValidator() { - return myInstanceValidator; - } - - @Override - protected IBaseOperationOutcome createOperationOutcome(String theSeverity, String theMessage, String theCode) { - OperationOutcome oo = new OperationOutcome(); - OperationOutcomeIssueComponent issue = oo.addIssue(); - issue.getSeverityElement().setValueAsString(theSeverity); - issue.setDiagnostics(theMessage); - try { - issue.setCode(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.fromCode(theCode)); - } catch (FHIRException e) { - ourLog.error("Unknown code: {}", theCode); - } - return oo; - } - - -} diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoEncounterDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoEncounterDstu3.java index 3fc3fb4c2b8..15172b9a3ff 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoEncounterDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoEncounterDstu3.java @@ -24,6 +24,7 @@ import java.util.Collections; import javax.servlet.http.HttpServletRequest; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import org.hl7.fhir.dstu3.model.Encounter; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; @@ -37,7 +38,7 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.param.DateRangeParam; import ca.uhn.fhir.rest.param.StringParam; -public class FhirResourceDaoEncounterDstu3 extends FhirResourceDaoDstu3implements IFhirResourceDaoEncounter { +public class FhirResourceDaoEncounterDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoEncounter { @Override public IBundleProvider encounterInstanceEverything(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdated, SortSpec theSort) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoMessageHeaderDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoMessageHeaderDstu3.java index f8f48cb989a..9f7dafa5186 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoMessageHeaderDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoMessageHeaderDstu3.java @@ -20,9 +20,10 @@ package ca.uhn.fhir.jpa.dao.dstu3; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoMessageHeader; import org.hl7.fhir.dstu3.model.MessageHeader; -public class FhirResourceDaoMessageHeaderDstu3 extends FhirResourceDaoDstu3 implements IFhirResourceDaoMessageHeader { +public class FhirResourceDaoMessageHeaderDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoMessageHeader { // nothing right now } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java index 87c433c8161..7751bd1d42b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java @@ -39,7 +39,7 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.param.*; -public class FhirResourceDaoPatientDstu3 extends FhirResourceDaoDstu3implements IFhirResourceDaoPatient { +public class FhirResourceDaoPatientDstu3 extends BaseHapiFhirResourceDaoimplements IFhirResourceDaoPatient { private IBundleProvider doEverythingOperation(IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdated, SortSpec theSort, StringAndListParam theContent, StringAndListParam theNarrative, StringAndListParam theFilter, RequestDetails theRequest) { SearchParameterMap paramMap = new SearchParameterMap(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoQuestionnaireResponseDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoQuestionnaireResponseDstu3.java index 2b1139492c8..078acd19ad1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoQuestionnaireResponseDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoQuestionnaireResponseDstu3.java @@ -20,9 +20,10 @@ package ca.uhn.fhir.jpa.dao.dstu3; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import org.hl7.fhir.dstu3.model.QuestionnaireResponse; -public class FhirResourceDaoQuestionnaireResponseDstu3 extends FhirResourceDaoDstu3 { +public class FhirResourceDaoQuestionnaireResponseDstu3 extends BaseHapiFhirResourceDao { // @Override diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java index 4e77ae10f97..8a248f9aaa1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoSearchParameter; import ca.uhn.fhir.jpa.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry; @@ -31,7 +32,7 @@ import java.util.List; * #L% */ -public class FhirResourceDaoSearchParameterDstu3 extends FhirResourceDaoDstu3 implements IFhirResourceDaoSearchParameter { +public class FhirResourceDaoSearchParameterDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoSearchParameter { protected void markAffectedResources(SearchParameter theResource) { Boolean reindex = theResource != null ? CURRENTLY_REINDEXING.get(theResource) : null; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoStructureDefinitionDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoStructureDefinitionDstu3.java index 3883a833d0b..68656eea7a1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoStructureDefinitionDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoStructureDefinitionDstu3.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.jpa.dao.dstu3; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoStructureDefinition; import org.apache.commons.lang3.Validate; import org.hl7.fhir.dstu3.hapi.ctx.IValidationSupport; @@ -26,7 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired; * #L% */ -public class FhirResourceDaoStructureDefinitionDstu3 extends FhirResourceDaoDstu3 implements IFhirResourceDaoStructureDefinition { +public class FhirResourceDaoStructureDefinitionDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoStructureDefinition { @Autowired private IValidationSupport myValidationSupport; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSubscriptionDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSubscriptionDstu3.java index 4d8bbcb00b8..804e3263968 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSubscriptionDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSubscriptionDstu3.java @@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; */ import ca.uhn.fhir.context.RuntimeResourceDefinition; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoSubscription; import ca.uhn.fhir.jpa.dao.data.ISubscriptionTableDao; @@ -43,7 +44,7 @@ import java.util.Date; import static org.apache.commons.lang3.StringUtils.isBlank; -public class FhirResourceDaoSubscriptionDstu3 extends FhirResourceDaoDstu3 implements IFhirResourceDaoSubscription { +public class FhirResourceDaoSubscriptionDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoSubscription { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoSubscriptionDstu3.class); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoValueSetDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoValueSetDstu3.java index 891c243e76a..89a92fc8c5c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoValueSetDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoValueSetDstu3.java @@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; */ import ca.uhn.fhir.context.support.IContextValidationSupport; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.model.entity.ResourceTable; @@ -58,7 +59,7 @@ import java.util.List; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; -public class FhirResourceDaoValueSetDstu3 extends FhirResourceDaoDstu3 implements IFhirResourceDaoValueSet { +public class FhirResourceDaoValueSetDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoValueSet { private static final Logger ourLog = LoggerFactory.getLogger(FhirResourceDaoValueSetDstu3.class); @Autowired diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java index d08ad572e54..693d6e4a904 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Bundle.BundleType; @@ -30,7 +31,7 @@ import java.util.TreeSet; import static org.apache.commons.lang3.StringUtils.defaultString; -public class FhirResourceDaoBundleR4 extends FhirResourceDaoR4 { +public class FhirResourceDaoBundleR4 extends BaseHapiFhirResourceDao { @Override protected void preProcessResourceForStorage(Bundle theResource) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCodeSystemR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCodeSystemR4.java index bc9768ca162..e6dbc6b8b70 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCodeSystemR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCodeSystemR4.java @@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.dao.r4; */ import ca.uhn.fhir.context.support.IContextValidationSupport; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem; import ca.uhn.fhir.jpa.dao.data.ITermCodeSystemDao; import ca.uhn.fhir.jpa.entity.TermCodeSystem; @@ -48,7 +49,7 @@ import java.util.Set; import static org.apache.commons.lang3.StringUtils.isNotBlank; -public class FhirResourceDaoCodeSystemR4 extends FhirResourceDaoR4 implements IFhirResourceDaoCodeSystem { +public class FhirResourceDaoCodeSystemR4 extends BaseHapiFhirResourceDao implements IFhirResourceDaoCodeSystem { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoCodeSystemR4.class); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCompositionR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCompositionR4.java index 1d7951cd901..789c8eb6250 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCompositionR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCompositionR4.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.dao.r4; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoComposition; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.model.api.IResource; @@ -35,7 +36,7 @@ import org.hl7.fhir.r4.model.Composition; import javax.servlet.http.HttpServletRequest; import java.util.Collections; -public class FhirResourceDaoCompositionR4 extends FhirResourceDaoR4implements IFhirResourceDaoComposition { +public class FhirResourceDaoCompositionR4 extends BaseHapiFhirResourceDao implements IFhirResourceDaoComposition { @Override public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdate, SortSpec theSort, RequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoConceptMapR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoConceptMapR4.java index b553e42baa6..8f9ebc9542b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoConceptMapR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoConceptMapR4.java @@ -20,11 +20,12 @@ package ca.uhn.fhir.jpa.dao.r4; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoConceptMap; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.entity.TermConceptMapGroupElement; import ca.uhn.fhir.jpa.entity.TermConceptMapGroupElementTarget; -import ca.uhn.fhir.jpa.term.IHapiTerminologySvc; +import ca.uhn.fhir.jpa.term.api.ITermReadSvc; import ca.uhn.fhir.jpa.term.TranslationMatch; import ca.uhn.fhir.jpa.term.TranslationRequest; import ca.uhn.fhir.jpa.term.TranslationResult; @@ -38,11 +39,9 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import static org.apache.commons.lang3.StringUtils.isNotBlank; - -public class FhirResourceDaoConceptMapR4 extends FhirResourceDaoR4 implements IFhirResourceDaoConceptMap { +public class FhirResourceDaoConceptMapR4 extends BaseHapiFhirResourceDao implements IFhirResourceDaoConceptMap { @Autowired - private IHapiTerminologySvc myHapiTerminologySvc; + private ITermReadSvc myHapiTerminologySvc; @Override public TranslationResult translate(TranslationRequest theTranslationRequest, RequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoEncounterR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoEncounterR4.java index 9d2ba5a51a8..81b9ceb5f47 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoEncounterR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoEncounterR4.java @@ -24,6 +24,7 @@ import java.util.Collections; import javax.servlet.http.HttpServletRequest; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import org.hl7.fhir.r4.model.Encounter; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; @@ -37,7 +38,7 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.param.DateRangeParam; import ca.uhn.fhir.rest.param.StringParam; -public class FhirResourceDaoEncounterR4 extends FhirResourceDaoR4implements IFhirResourceDaoEncounter { +public class FhirResourceDaoEncounterR4 extends BaseHapiFhirResourceDao implements IFhirResourceDaoEncounter { @Override public IBundleProvider encounterInstanceEverything(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdated, SortSpec theSort) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoMessageHeaderR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoMessageHeaderR4.java index 03140675468..f571d1f99ef 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoMessageHeaderR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoMessageHeaderR4.java @@ -20,9 +20,10 @@ package ca.uhn.fhir.jpa.dao.r4; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoMessageHeader; import org.hl7.fhir.r4.model.MessageHeader; -public class FhirResourceDaoMessageHeaderR4 extends FhirResourceDaoR4 implements IFhirResourceDaoMessageHeader { +public class FhirResourceDaoMessageHeaderR4 extends BaseHapiFhirResourceDao implements IFhirResourceDaoMessageHeader { // nothing right now } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java index d3460f7fa57..c1f8102e425 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java @@ -39,7 +39,7 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.param.*; -public class FhirResourceDaoPatientR4 extends FhirResourceDaoR4implements IFhirResourceDaoPatient { +public class FhirResourceDaoPatientR4 extends BaseHapiFhirResourceDaoimplements IFhirResourceDaoPatient { private IBundleProvider doEverythingOperation(IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdated, SortSpec theSort, StringAndListParam theContent, StringAndListParam theNarrative, StringAndListParam theFilter, RequestDetails theRequest) { SearchParameterMap paramMap = new SearchParameterMap(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoQuestionnaireResponseR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoQuestionnaireResponseR4.java index ac5a2ed7f32..fe9cfb84c57 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoQuestionnaireResponseR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoQuestionnaireResponseR4.java @@ -20,9 +20,10 @@ package ca.uhn.fhir.jpa.dao.r4; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import org.hl7.fhir.r4.model.QuestionnaireResponse; -public class FhirResourceDaoQuestionnaireResponseR4 extends FhirResourceDaoR4 { +public class FhirResourceDaoQuestionnaireResponseR4 extends BaseHapiFhirResourceDao { // @Override diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4.java deleted file mode 100644 index f57ed9b2e0c..00000000000 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4.java +++ /dev/null @@ -1,83 +0,0 @@ -package ca.uhn.fhir.jpa.dao.r4; - -/* - * #%L - * HAPI FHIR JPA Server - * %% - * Copyright (C) 2014 - 2019 University Health Network - * %% - * 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.BaseHapiFhirResourceDao; -import ca.uhn.fhir.jpa.dao.IFhirResourceDao; -import ca.uhn.fhir.jpa.delete.DeleteConflictList; -import ca.uhn.fhir.jpa.model.entity.ResourceTable; -import ca.uhn.fhir.rest.api.EncodingEnum; -import ca.uhn.fhir.rest.api.MethodOutcome; -import ca.uhn.fhir.rest.api.RestOperationTypeEnum; -import ca.uhn.fhir.rest.api.ValidationModeEnum; -import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; -import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; -import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; -import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails; -import ca.uhn.fhir.validation.FhirValidator; -import ca.uhn.fhir.validation.IValidationContext; -import ca.uhn.fhir.validation.IValidatorModule; -import ca.uhn.fhir.validation.ValidationResult; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.instance.model.api.IAnyResource; -import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.instance.model.api.IIdType; -import org.hl7.fhir.r4.model.IdType; -import org.hl7.fhir.r4.model.OperationOutcome; -import org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity; -import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -import static org.apache.commons.lang3.StringUtils.isNotBlank; - -public class FhirResourceDaoR4 extends BaseHapiFhirResourceDao { - - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoR4.class); - - @Autowired() - @Qualifier("myInstanceValidatorR4") - private IValidatorModule myInstanceValidator; - - @Override - protected IValidatorModule getInstanceValidator() { - return myInstanceValidator; - } - - @Override - protected IBaseOperationOutcome createOperationOutcome(String theSeverity, String theMessage, String theCode) { - OperationOutcome oo = new OperationOutcome(); - OperationOutcomeIssueComponent issue = oo.addIssue(); - issue.getSeverityElement().setValueAsString(theSeverity); - issue.setDiagnostics(theMessage); - try { - issue.setCode(org.hl7.fhir.r4.model.OperationOutcome.IssueType.fromCode(theCode)); - } catch (FHIRException e) { - ourLog.error("Unknown code: {}", theCode); - } - return oo; - } - - - -} diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java index 3cad569a145..768f61ce068 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSearchParameterR4.java @@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoSearchParameter; import ca.uhn.fhir.jpa.dao.IFhirSystemDao; @@ -44,7 +45,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank; * #L% */ -public class FhirResourceDaoSearchParameterR4 extends FhirResourceDaoR4 implements IFhirResourceDaoSearchParameter { +public class FhirResourceDaoSearchParameterR4 extends BaseHapiFhirResourceDao implements IFhirResourceDaoSearchParameter { public static final DefaultProfileValidationSupport VALIDATION_SUPPORT = new DefaultProfileValidationSupport(); @Autowired diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoStructureDefinitionR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoStructureDefinitionR4.java index 2136a24e6de..bb1f005d737 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoStructureDefinitionR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoStructureDefinitionR4.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoStructureDefinition; import org.apache.commons.lang3.Validate; import org.hl7.fhir.r4.hapi.ctx.IValidationSupport; @@ -26,7 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired; * #L% */ -public class FhirResourceDaoStructureDefinitionR4 extends FhirResourceDaoR4 implements IFhirResourceDaoStructureDefinition { +public class FhirResourceDaoStructureDefinitionR4 extends BaseHapiFhirResourceDao implements IFhirResourceDaoStructureDefinition { @Autowired private IValidationSupport myValidationSupport; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSubscriptionR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSubscriptionR4.java index 286e456dc76..35f487146e9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSubscriptionR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoSubscriptionR4.java @@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.dao.r4; */ import ca.uhn.fhir.context.RuntimeResourceDefinition; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoSubscription; import ca.uhn.fhir.jpa.dao.data.ISubscriptionTableDao; @@ -43,7 +44,7 @@ import java.util.Date; import static org.apache.commons.lang3.StringUtils.isBlank; -public class FhirResourceDaoSubscriptionR4 extends FhirResourceDaoR4 implements IFhirResourceDaoSubscription { +public class FhirResourceDaoSubscriptionR4 extends BaseHapiFhirResourceDao implements IFhirResourceDaoSubscription { @Autowired private ISubscriptionTableDao mySubscriptionTableDao; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoValueSetR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoValueSetR4.java index b881f2a611b..0015bc24b5b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoValueSetR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoValueSetR4.java @@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.dao.r4; */ import ca.uhn.fhir.context.support.IContextValidationSupport; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.model.entity.ResourceTable; @@ -53,7 +54,7 @@ import java.util.List; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; -public class FhirResourceDaoValueSetR4 extends FhirResourceDaoR4 implements IFhirResourceDaoValueSet { +public class FhirResourceDaoValueSetR4 extends BaseHapiFhirResourceDao implements IFhirResourceDaoValueSet { @Autowired private IHapiTerminologySvc myHapiTerminologySvc; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoBundleR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoBundleR5.java index d0743f5829c..8431709466a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoBundleR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoBundleR5.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.jpa.dao.r5; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import org.hl7.fhir.r5.model.Bundle; @@ -27,7 +28,7 @@ import static org.apache.commons.lang3.StringUtils.defaultString; * #L% */ -public class FhirResourceDaoBundleR5 extends FhirResourceDaoR5 { +public class FhirResourceDaoBundleR5 extends BaseHapiFhirResourceDao { @Override protected void preProcessResourceForStorage(Bundle theResource) { 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 515355bc044..136c9f49bb5 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 @@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.dao.r5; */ import ca.uhn.fhir.context.support.IContextValidationSupport; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem; import ca.uhn.fhir.jpa.dao.data.ITermCodeSystemDao; import ca.uhn.fhir.jpa.entity.TermCodeSystem; @@ -48,7 +49,7 @@ import java.util.Set; import static org.apache.commons.lang3.StringUtils.isNotBlank; -public class FhirResourceDaoCodeSystemR5 extends FhirResourceDaoR5 implements IFhirResourceDaoCodeSystem { +public class FhirResourceDaoCodeSystemR5 extends BaseHapiFhirResourceDao implements IFhirResourceDaoCodeSystem { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoCodeSystemR5.class); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoCompositionR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoCompositionR5.java index bfc06d99d6e..dbf6cbcf174 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoCompositionR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoCompositionR5.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.dao.r5; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoComposition; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.rest.api.SortSpec; @@ -35,7 +36,7 @@ import org.hl7.fhir.r5.model.Composition; import javax.servlet.http.HttpServletRequest; import java.util.Collections; -public class FhirResourceDaoCompositionR5 extends FhirResourceDaoR5 implements IFhirResourceDaoComposition { +public class FhirResourceDaoCompositionR5 extends BaseHapiFhirResourceDao implements IFhirResourceDaoComposition { @Override public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdate, SortSpec theSort, RequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoConceptMapR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoConceptMapR5.java index dab3f9c764d..c826c9fae90 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoConceptMapR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoConceptMapR5.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.dao.r5; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoConceptMap; import ca.uhn.fhir.jpa.entity.TermConceptMapGroupElement; import ca.uhn.fhir.jpa.entity.TermConceptMapGroupElementTarget; @@ -39,7 +40,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -public class FhirResourceDaoConceptMapR5 extends FhirResourceDaoR5 implements IFhirResourceDaoConceptMap { +public class FhirResourceDaoConceptMapR5 extends BaseHapiFhirResourceDao implements IFhirResourceDaoConceptMap { @Autowired private IHapiTerminologySvc myHapiTerminologySvc; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoEncounterR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoEncounterR5.java index d1a91f1cd1b..e9ce5a6f6d2 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoEncounterR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoEncounterR5.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.dao.r5; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoEncounter; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum; @@ -35,7 +36,7 @@ import org.hl7.fhir.r5.model.Encounter; import javax.servlet.http.HttpServletRequest; import java.util.Collections; -public class FhirResourceDaoEncounterR5 extends FhirResourceDaoR5 implements IFhirResourceDaoEncounter { +public class FhirResourceDaoEncounterR5 extends BaseHapiFhirResourceDao implements IFhirResourceDaoEncounter { @Override public IBundleProvider encounterInstanceEverything(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdated, SortSpec theSort) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoMessageHeaderR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoMessageHeaderR5.java index 3503fd02314..a4dfe40cc7a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoMessageHeaderR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoMessageHeaderR5.java @@ -20,9 +20,10 @@ package ca.uhn.fhir.jpa.dao.r5; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoMessageHeader; import org.hl7.fhir.r5.model.MessageHeader; -public class FhirResourceDaoMessageHeaderR5 extends FhirResourceDaoR5 implements IFhirResourceDaoMessageHeader { +public class FhirResourceDaoMessageHeaderR5 extends BaseHapiFhirResourceDao implements IFhirResourceDaoMessageHeader { // nothing right now } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoPatientR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoPatientR5.java index 49405daf922..884da16faeb 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoPatientR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoPatientR5.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.dao.r5; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoPatient; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum; @@ -39,7 +40,7 @@ import org.hl7.fhir.r5.model.Patient; import javax.servlet.http.HttpServletRequest; import java.util.Collections; -public class FhirResourceDaoPatientR5 extends FhirResourceDaoR5 implements IFhirResourceDaoPatient { +public class FhirResourceDaoPatientR5 extends BaseHapiFhirResourceDao implements IFhirResourceDaoPatient { private IBundleProvider doEverythingOperation(IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdated, SortSpec theSort, StringAndListParam theContent, StringAndListParam theNarrative, RequestDetails theRequest) { SearchParameterMap paramMap = new SearchParameterMap(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoQuestionnaireResponseR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoQuestionnaireResponseR5.java index a59167e5f34..e1679437ac7 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoQuestionnaireResponseR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoQuestionnaireResponseR5.java @@ -20,9 +20,10 @@ package ca.uhn.fhir.jpa.dao.r5; * #L% */ +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import org.hl7.fhir.r5.model.QuestionnaireResponse; -public class FhirResourceDaoQuestionnaireResponseR5 extends FhirResourceDaoR5 { +public class FhirResourceDaoQuestionnaireResponseR5 extends BaseHapiFhirResourceDao { // @Override diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoR5.java deleted file mode 100644 index e3835ca1d85..00000000000 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoR5.java +++ /dev/null @@ -1,61 +0,0 @@ -package ca.uhn.fhir.jpa.dao.r5; - -/* - * #%L - * HAPI FHIR JPA Server - * %% - * Copyright (C) 2014 - 2019 University Health Network - * %% - * 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.BaseHapiFhirResourceDao; -import ca.uhn.fhir.validation.IValidatorModule; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.instance.model.api.IAnyResource; -import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; -import org.hl7.fhir.r5.model.OperationOutcome; -import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class FhirResourceDaoR5 extends BaseHapiFhirResourceDao { - - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoR5.class); - - @Autowired() - @Qualifier("myInstanceValidatorR5") - private IValidatorModule myInstanceValidator; - - @Override - protected IValidatorModule getInstanceValidator() { - return myInstanceValidator; - } - - @Override - protected IBaseOperationOutcome createOperationOutcome(String theSeverity, String theMessage, String theCode) { - OperationOutcome oo = new OperationOutcome(); - OperationOutcomeIssueComponent issue = oo.addIssue(); - issue.getSeverityElement().setValueAsString(theSeverity); - issue.setDiagnostics(theMessage); - try { - issue.setCode(OperationOutcome.IssueType.fromCode(theCode)); - } catch (FHIRException e) { - ourLog.error("Unknown code: {}", theCode); - } - return oo; - } - - -} diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoSearchParameterR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoSearchParameterR5.java index ee3c942f074..9c1c70f84aa 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoSearchParameterR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoSearchParameterR5.java @@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.dao.r5; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoSearchParameter; import ca.uhn.fhir.jpa.dao.IFhirSystemDao; @@ -44,7 +45,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank; * #L% */ -public class FhirResourceDaoSearchParameterR5 extends FhirResourceDaoR5 implements IFhirResourceDaoSearchParameter { +public class FhirResourceDaoSearchParameterR5 extends BaseHapiFhirResourceDao implements IFhirResourceDaoSearchParameter { public static final DefaultProfileValidationSupport VALIDATION_SUPPORT = new DefaultProfileValidationSupport(); @Autowired diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoStructureDefinitionR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoStructureDefinitionR5.java index d0b4ade1ccb..093b347e331 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoStructureDefinitionR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoStructureDefinitionR5.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.jpa.dao.r5; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoStructureDefinition; import org.apache.commons.lang3.Validate; import org.hl7.fhir.r5.hapi.ctx.IValidationSupport; @@ -26,7 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired; * #L% */ -public class FhirResourceDaoStructureDefinitionR5 extends FhirResourceDaoR5 implements IFhirResourceDaoStructureDefinition { +public class FhirResourceDaoStructureDefinitionR5 extends BaseHapiFhirResourceDao implements IFhirResourceDaoStructureDefinition { @Autowired private IValidationSupport myValidationSupport; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoSubscriptionR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoSubscriptionR5.java index da052fbba12..49c8a5061c4 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoSubscriptionR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoSubscriptionR5.java @@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.dao.r5; */ import ca.uhn.fhir.context.RuntimeResourceDefinition; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoSubscription; import ca.uhn.fhir.jpa.dao.data.ISubscriptionTableDao; @@ -41,7 +42,7 @@ import java.util.Date; import static org.apache.commons.lang3.StringUtils.isBlank; -public class FhirResourceDaoSubscriptionR5 extends FhirResourceDaoR5 implements IFhirResourceDaoSubscription { +public class FhirResourceDaoSubscriptionR5 extends BaseHapiFhirResourceDao implements IFhirResourceDaoSubscription { @Autowired private ISubscriptionTableDao mySubscriptionTableDao; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoValueSetR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoValueSetR5.java index 320d584a177..cbcf630d3c2 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoValueSetR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoValueSetR5.java @@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.dao.r5; */ import ca.uhn.fhir.context.support.IContextValidationSupport; +import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.model.entity.ResourceTable; @@ -53,7 +54,7 @@ import java.util.List; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; -public class FhirResourceDaoValueSetR5 extends FhirResourceDaoR5 implements IFhirResourceDaoValueSet { +public class FhirResourceDaoValueSetR5 extends BaseHapiFhirResourceDao implements IFhirResourceDaoValueSet { @Autowired private IHapiTerminologySvc myHapiTerminologySvc; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java index 2af1e341a75..315fddc14ac 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.dstu2; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.dao.DaoConfig; -import ca.uhn.fhir.jpa.dao.FhirResourceDaoDstu2; +import ca.uhn.fhir.jpa.dao.JpaResourceDao; import ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3Test; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; import ca.uhn.fhir.jpa.model.entity.TagTypeEnum; @@ -359,23 +359,6 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { assertEquals(ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum.WARNING.getCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN); } - @Test - public void testCreateOperationOutcomeError() { - FhirResourceDaoDstu2 dao = new FhirResourceDaoDstu2(); - OperationOutcome oo = (OperationOutcome) dao.createErrorOperationOutcome("my message", "incomplete"); - assertEquals(IssueSeverityEnum.ERROR.getCode(), oo.getIssue().get(0).getSeverity()); - assertEquals("my message", oo.getIssue().get(0).getDiagnostics()); - assertEquals(IssueTypeEnum.INCOMPLETE_RESULTS, oo.getIssue().get(0).getCodeElement().getValueAsEnum()); - } - - @Test - public void testCreateOperationOutcomeInfo() { - FhirResourceDaoDstu2 dao = new FhirResourceDaoDstu2(); - OperationOutcome oo = (OperationOutcome) dao.createInfoOperationOutcome("my message"); - assertEquals(IssueSeverityEnum.INFORMATION.getCode(), oo.getIssue().get(0).getSeverity()); - assertEquals("my message", oo.getIssue().get(0).getDiagnostics()); - } - @Test public void testCreateSummaryFails() { Patient p = new Patient(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/CustomObservationDstu3.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/CustomObservationDstu3.java similarity index 100% rename from hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/CustomObservationDstu3.java rename to hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/CustomObservationDstu3.java diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java index 8183750f0c1..7e7bbf8de12 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java @@ -613,24 +613,6 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirDao.OO_SEVERITY_WARN); } - @Test - public void testCreateOperationOutcomeError() { - FhirResourceDaoDstu3 dao = new FhirResourceDaoDstu3(); - OperationOutcome oo = (OperationOutcome) dao.createErrorOperationOutcome("my message", "incomplete"); - assertEquals(IssueSeverity.ERROR.toCode(), oo.getIssue().get(0).getSeverity().toCode()); - assertEquals("my message", oo.getIssue().get(0).getDiagnostics()); - assertEquals(IssueType.INCOMPLETE, oo.getIssue().get(0).getCode()); - } - - @Test - public void testCreateOperationOutcomeInfo() { - FhirResourceDaoDstu3 dao = new FhirResourceDaoDstu3(); - OperationOutcome oo = (OperationOutcome) dao.createInfoOperationOutcome("my message"); - assertEquals(IssueSeverity.INFORMATION.toCode(), oo.getIssue().get(0).getSeverity().toCode()); - assertEquals("my message", oo.getIssue().get(0).getDiagnostics()); - assertEquals(IssueType.INFORMATIONAL, oo.getIssue().get(0).getCode()); - } - @Test public void testCreateReferenceToDeletedResource() { Organization org = new Organization(); 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 64e942ed78f..09beea31823 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 @@ -1,9 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; -import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; -import ca.uhn.fhir.jpa.dao.DaoConfig; -import ca.uhn.fhir.jpa.dao.IFhirResourceDao; +import ca.uhn.fhir.jpa.dao.*; import ca.uhn.fhir.jpa.entity.Search; import ca.uhn.fhir.jpa.model.entity.*; import ca.uhn.fhir.jpa.model.search.SearchStatusEnum; @@ -769,7 +766,8 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testCreateOperationOutcomeError() { - FhirResourceDaoR4 dao = new FhirResourceDaoR4(); + JpaResourceDao dao = new JpaResourceDao(); + dao.setContext(myFhirCtx); OperationOutcome oo = (OperationOutcome) dao.createErrorOperationOutcome("my message", "incomplete"); assertEquals(IssueSeverity.ERROR.toCode(), oo.getIssue().get(0).getSeverity().toCode()); assertEquals("my message", oo.getIssue().get(0).getDiagnostics()); @@ -778,7 +776,8 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testCreateOperationOutcomeInfo() { - FhirResourceDaoR4 dao = new FhirResourceDaoR4(); + JpaResourceDao dao = new JpaResourceDao(); + dao.setContext(myFhirCtx); OperationOutcome oo = (OperationOutcome) dao.createInfoOperationOutcome("my message"); assertEquals(IssueSeverity.INFORMATION.toCode(), oo.getIssue().get(0).getSeverity().toCode()); assertEquals("my message", oo.getIssue().get(0).getDiagnostics()); diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/FhirInstanceValidator.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/FhirInstanceValidator.java index b14596caf18..037b1369745 100644 --- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/FhirInstanceValidator.java +++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/FhirInstanceValidator.java @@ -1,34 +1,33 @@ package org.hl7.fhir.dstu2016may.hapi.validation; -import java.io.StringReader; -import java.util.*; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.apache.commons.lang3.Validate; -import org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity; -import org.hl7.fhir.dstu2016may.model.StructureDefinition; -import org.hl7.fhir.dstu2016may.validation.*; -import org.hl7.fhir.dstu2016may.validation.IResourceValidator.BestPracticeWarningLevel; -import org.hl7.fhir.utilities.validation.ValidationMessage; -import org.w3c.dom.*; -import org.xml.sax.InputSource; - -import com.google.gson.*; - import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import ca.uhn.fhir.util.XmlUtil; +import ca.uhn.fhir.validation.IInstanceValidatorModule; import ca.uhn.fhir.validation.IValidationContext; -import ca.uhn.fhir.validation.IValidatorModule; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import org.apache.commons.lang3.Validate; +import org.hl7.fhir.dstu2016may.model.StructureDefinition; +import org.hl7.fhir.dstu2016may.validation.IResourceValidator; +import org.hl7.fhir.dstu2016may.validation.IResourceValidator.BestPracticeWarningLevel; +import org.hl7.fhir.dstu2016may.validation.InstanceValidator; +import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; -public class FhirInstanceValidator extends BaseValidatorBridge implements IValidatorModule { +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class FhirInstanceValidator extends BaseValidatorBridge implements IInstanceValidatorModule { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirInstanceValidator.class); private BestPracticeWarningLevel myBestPracticeWarningLevel; - private DocumentBuilderFactory myDocBuilderFactory; private StructureDefinition myStructureDefintion; private IValidationSupport myValidationSupport; @@ -48,8 +47,6 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid * The validation support */ public FhirInstanceValidator(IValidationSupport theValidationSupport) { - myDocBuilderFactory = DocumentBuilderFactory.newInstance(); - myDocBuilderFactory.setNamespaceAware(true); myValidationSupport = theValidationSupport; } @@ -139,9 +136,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid if (theEncoding == EncodingEnum.XML) { Document document; try { - DocumentBuilder builder = myDocBuilderFactory.newDocumentBuilder(); - InputSource src = new InputSource(new StringReader(theInput)); - document = builder.parse(src); + document = XmlUtil.parseDocument(theInput); } catch (Exception e2) { ourLog.error("Failure to parse XML input", e2); ValidationMessage m = new ValidationMessage(); diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java index dbcd525828f..867b54bbf53 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java @@ -3,6 +3,7 @@ package org.hl7.fhir.dstu3.hapi.validation; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import ca.uhn.fhir.validation.IInstanceValidatorModule; import ca.uhn.fhir.validation.IValidationContext; import ca.uhn.fhir.validation.IValidatorModule; import com.github.benmanes.caffeine.cache.Caffeine; @@ -44,7 +45,7 @@ import java.util.*; import java.util.concurrent.TimeUnit; @SuppressWarnings({"PackageAccessibility", "Duplicates"}) -public class FhirInstanceValidator extends BaseValidatorBridge implements IValidatorModule { +public class FhirInstanceValidator extends BaseValidatorBridge implements IInstanceValidatorModule { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirInstanceValidator.class); diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/hapi/validation/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/hapi/validation/FhirInstanceValidator.java index 23145b7314d..c24984dda92 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/hapi/validation/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/hapi/validation/FhirInstanceValidator.java @@ -3,8 +3,9 @@ package org.hl7.fhir.instance.hapi.validation; import ca.uhn.fhir.context.*; import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import ca.uhn.fhir.util.XmlUtil; +import ca.uhn.fhir.validation.IInstanceValidatorModule; import ca.uhn.fhir.validation.IValidationContext; -import ca.uhn.fhir.validation.IValidatorModule; import com.github.benmanes.caffeine.cache.CacheLoader; import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.LoadingCache; @@ -40,13 +41,9 @@ import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; import java.io.IOException; import java.io.InputStream; -import java.io.StringReader; import java.net.MalformedURLException; import java.net.URL; import java.util.*; @@ -54,7 +51,7 @@ import java.util.concurrent.TimeUnit; import static org.apache.commons.lang3.StringUtils.isBlank; -public class FhirInstanceValidator extends BaseValidatorBridge implements IValidatorModule { +public class FhirInstanceValidator extends BaseValidatorBridge implements IInstanceValidatorModule { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirInstanceValidator.class); private static final FhirContext FHIR_CONTEXT = FhirContext.forDstu2(); @@ -62,7 +59,6 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid private boolean myAnyExtensionsAllowed = true; private BestPracticeWarningLevel myBestPracticeWarningLevel; - private DocumentBuilderFactory myDocBuilderFactory; private StructureDefinition myStructureDefintion; private IValidationSupport myValidationSupport; private boolean noTerminologyChecks = false; @@ -84,8 +80,6 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid * @param theValidationSupport The validation support */ public FhirInstanceValidator(IValidationSupport theValidationSupport) { - myDocBuilderFactory = DocumentBuilderFactory.newInstance(); - myDocBuilderFactory.setNamespaceAware(true); myValidationSupport = theValidationSupport; } @@ -280,9 +274,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid if (theEncoding == EncodingEnum.XML) { Document document; try { - DocumentBuilder builder = myDocBuilderFactory.newDocumentBuilder(); - InputSource src = new InputSource(new StringReader(theInput)); - document = builder.parse(src); + document = XmlUtil.parseDocument(theInput); } catch (Exception e2) { ourLog.error("Failure to parse XML input", e2); ValidationMessage m = new ValidationMessage(); diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/FhirInstanceValidator.java index 28b0740fee4..1b44447f8de 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/FhirInstanceValidator.java @@ -2,8 +2,8 @@ package org.hl7.fhir.r4.hapi.validation; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import ca.uhn.fhir.validation.IInstanceValidatorModule; import ca.uhn.fhir.validation.IValidationContext; -import ca.uhn.fhir.validation.IValidatorModule; import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.LoadingCache; import org.apache.commons.lang3.Validate; @@ -37,7 +37,7 @@ import java.util.*; import java.util.concurrent.TimeUnit; @SuppressWarnings({"PackageAccessibility", "Duplicates"}) -public class FhirInstanceValidator extends org.hl7.fhir.r4.hapi.validation.BaseValidatorBridge implements IValidatorModule { +public class FhirInstanceValidator extends org.hl7.fhir.r4.hapi.validation.BaseValidatorBridge implements IInstanceValidatorModule { private boolean myAnyExtensionsAllowed = true; private BestPracticeWarningLevel myBestPracticeWarningLevel; diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/FhirInstanceValidator.java index 9935f8de93e..c148209cbef 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/FhirInstanceValidator.java @@ -2,8 +2,8 @@ package org.hl7.fhir.r5.hapi.validation; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import ca.uhn.fhir.validation.IInstanceValidatorModule; import ca.uhn.fhir.validation.IValidationContext; -import ca.uhn.fhir.validation.IValidatorModule; import com.github.benmanes.caffeine.cache.CacheLoader; import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.LoadingCache; @@ -40,7 +40,7 @@ import java.util.*; import java.util.concurrent.TimeUnit; @SuppressWarnings({"PackageAccessibility", "Duplicates"}) -public class FhirInstanceValidator extends org.hl7.fhir.r5.hapi.validation.BaseValidatorBridge implements IValidatorModule { +public class FhirInstanceValidator extends org.hl7.fhir.r5.hapi.validation.BaseValidatorBridge implements IInstanceValidatorModule { private boolean myAnyExtensionsAllowed = true; private BestPracticeWarningLevel myBestPracticeWarningLevel; 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 1c6c2a175db..1710a2d8784 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 @@ -803,7 +803,6 @@ public class FhirInstanceValidatorR4Test { @Test public void testValidateRawXmlResourceWithPrimitiveContainingOnlyAnExtension() { - // @formatter:off String input = "\n" + " \n" + " \n" + @@ -829,7 +828,6 @@ public class FhirInstanceValidatorR4Test { " \n" + " \n" + " "; - // @formatter:on ValidationResult output = myVal.validateWithResult(input); List res = logResultsAndReturnNonInformationalOnes(output); @@ -838,7 +836,6 @@ public class FhirInstanceValidatorR4Test { @Test public void testValidateRawXmlWithMissingRootNamespace() { - //@formatter:off String input = "" + "" + " " @@ -853,7 +850,6 @@ public class FhirInstanceValidatorR4Test { + " " + " " + ""; - //@formatter:on ValidationResult output = myVal.validateWithResult(input); assertEquals(output.toString(), 1, output.getMessages().size()); @@ -1031,6 +1027,36 @@ public class FhirInstanceValidatorR4Test { output.getMessages().get(0).getMessage()); } + @Test + @Ignore + public void testValidateDecimalWithTrailingDot() { + String input = "{" + + " \"resourceType\": \"Observation\"," + + " \"status\": \"final\"," + + " \"subject\": {\"reference\":\"Patient/123\"}," + + " \"code\": { \"coding\": [{ \"system\":\"http://foo\", \"code\":\"123\" }] }," + + " \"referenceRange\": [\n" + + " {\n" + + " \"low\": {\n" + + " \"value\": 210.0,\n" + + " \"unit\": \"pg/mL\"\n" + + " },\n" + + " \"high\": {\n" + + " \"value\": 925.,\n" + + " \"unit\": \"pg/mL\"\n" + + " },\n" + + " \"text\": \"210.0-925.\"\n" + + " }\n" + + " ]"+ + "}"; + ourLog.info(input); + ValidationResult output = myVal.validateWithResult(input); + logResultsAndReturnAll(output); + assertEquals( + "", + output.getMessages().get(0).getMessage()); + } + @Test public void testValidateResourceWithExampleBindingCodeValidationFailing() { Observation input = new Observation(); diff --git a/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm b/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm index 1939b4d53ed..976ec354e00 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm @@ -71,15 +71,20 @@ public abstract class BaseJavaConfig${versionCapitalized} extends ca.uhn.fhir.jp #else IFhirResourceDao<${resourcePackage}.${res.declaringClassNameComplete}> #end - dao${res.declaringClassNameComplete}${versionCapitalized}() { + dao${res.declaringClassNameComplete}${versionCapitalized}() { + #if ( ${versionCapitalized} == 'Dstu3' && ${res.name} == 'ConceptMap' ) - ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized} retVal = new ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized}(); + ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized} retVal; + retVal = new ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized}(); #elseif ( ${versionCapitalized.startsWith('R')} && ${res.name} == 'ConceptMap' ) - ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized} retVal = new ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized}(); + ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized} retVal; + retVal = new ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized}(); #elseif ( ${res.name} == 'Bundle' || ${res.name} == 'Encounter' || ${res.name} == 'Everything' || ${res.name} == 'Patient' || ${res.name} == 'Subscription' || ${res.name} == 'ValueSet' || ${res.name} == 'QuestionnaireResponse' || ${res.name} == 'SearchParameter' || ${res.name} == 'CodeSystem' || ${res.name} == 'MessageHeader' || ${res.name} == 'Composition' || ${res.name} == 'StructureDefinition') - ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized} retVal = new ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized}(); + ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized} retVal; + retVal = new ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${res.name}${versionCapitalized}(); #else - ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${versionCapitalized}<${resourcePackage}.${res.declaringClassNameComplete}> retVal = new ca.uhn.fhir.jpa.dao${package_suffix}.FhirResourceDao${versionCapitalized}<${resourcePackage}.${res.declaringClassNameComplete}>(); + ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao<${resourcePackage}.${res.declaringClassNameComplete}> retVal; + retVal = new ca.uhn.fhir.jpa.dao.JpaResourceDao<${resourcePackage}.${res.declaringClassNameComplete}>(); #end retVal.setResourceType(${resourcePackage}.${res.declaringClassNameComplete}.class); retVal.setContext(fhirContext${versionCapitalized}());