From 4ba91e07977c3f52347b2593b880f77292ac182c Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Fri, 24 Jan 2020 13:01:58 -0500 Subject: [PATCH] remove getDao() from Dao --- .../src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java | 7 +------ .../java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java | 3 ++- .../main/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2.java | 2 +- .../src/main/java/ca/uhn/fhir/jpa/dao/IFhirSystemDao.java | 3 --- .../java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java | 4 ++-- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java index cbfbc513b62..785ea06a62a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java @@ -159,7 +159,7 @@ public abstract class BaseHapiFhirDao extends BaseStora @Autowired private ISearchParamPresenceSvc mySearchParamPresenceSvc; @Autowired - private DaoRegistry myDaoRegistry; + protected DaoRegistry myDaoRegistry; @Autowired private SearchParamWithInlineReferencesExtractor mySearchParamWithInlineReferencesExtractor; @Autowired @@ -327,11 +327,6 @@ public abstract class BaseHapiFhirDao extends BaseStora } } - // FIXME KHS remove this method - public IFhirResourceDao getDao(Class theType) { - return myDaoRegistry.getResourceDaoOrNull(theType); - } - protected TagDefinition getTagOrNull(TagTypeEnum theTagType, String theScheme, String theTerm, String theLabel) { if (isBlank(theScheme) && isBlank(theTerm) && isBlank(theLabel)) { return null; 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 78104682f39..5cff484da01 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 @@ -25,6 +25,7 @@ import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.Pointcut; +import ca.uhn.fhir.jpa.api.IDaoRegistry; import ca.uhn.fhir.jpa.delete.DeleteConflictList; import ca.uhn.fhir.jpa.delete.DeleteConflictService; import ca.uhn.fhir.jpa.model.cross.ResourcePersistentId; @@ -1338,7 +1339,7 @@ public abstract class BaseHapiFhirResourceDao extends B IBaseResource resourceToValidateById = null; if (theId != null && theId.hasResourceType() && theId.hasIdPart()) { Class type = getContext().getResourceDefinition(theId.getResourceType()).getImplementingClass(); - IFhirResourceDao dao = getDao(type); + IFhirResourceDao dao = myDaoRegistry.getResourceDaoOrNull(type); resourceToValidateById = dao.read(theId, theRequest); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2.java index 418574f916e..5acd1532d2e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2.java @@ -582,7 +582,7 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao { } IFhirResourceDao dao = null; if (resType != null) { - dao = getDao(resType.getImplementingClass()); + dao = this.myDaoRegistry.getResourceDaoOrNull(resType.getImplementingClass()); } if (dao == null) { String msg = getContext().getLocalizer().getMessage(BaseHapiFhirSystemDao.class, "transactionInvalidUrl", theVerb, theUrl); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirSystemDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirSystemDao.java index ed3327cbdd0..f5fc0c7f61b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirSystemDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirSystemDao.java @@ -43,9 +43,6 @@ public interface IFhirSystemDao extends IDao { ExpungeOutcome expunge(ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails); - @SuppressWarnings("unchecked") - IFhirResourceDao getDao(Class theType); - Map getResourceCounts(); /** diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java index f598fd60c2b..070cbefc0b2 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java @@ -51,7 +51,7 @@ public class JpaStorageServices extends BaseHapiFhirDao implement private IFhirResourceDao getDao(String theResourceType) { RuntimeResourceDefinition typeDef = getContext().getResourceDefinition(theResourceType); - return getDao(typeDef.getImplementingClass()); + return myDaoRegistry.getResourceDaoOrNull(typeDef.getImplementingClass()); } @Transactional(propagation = Propagation.NEVER) @@ -59,7 +59,7 @@ public class JpaStorageServices extends BaseHapiFhirDao implement public void listResources(Object theAppInfo, String theType, List theSearchParams, List theMatches) throws FHIRException { RuntimeResourceDefinition typeDef = getContext().getResourceDefinition(theType); - IFhirResourceDao dao = getDao(typeDef.getImplementingClass()); + IFhirResourceDao dao = myDaoRegistry.getResourceDaoOrNull(typeDef.getImplementingClass()); SearchParameterMap params = new SearchParameterMap(); params.setLoadSynchronousUpTo(MAX_SEARCH_SIZE);