Class BaseHapiFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>

java.lang.Object
ca.uhn.fhir.jpa.dao.BaseStorageDao
ca.uhn.fhir.jpa.dao.BaseHapiFhirDao<T>
ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao<T>
All Implemented Interfaces:
ca.uhn.fhir.jpa.api.dao.IDao, ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T>, ca.uhn.fhir.jpa.api.dao.IJpaDao<T>, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
BaseHapiFhirResourceDaoObservation, FhirResourceDaoBundleDstu2, FhirResourceDaoBundleDstu3, FhirResourceDaoBundleR4, FhirResourceDaoBundleR5, FhirResourceDaoCodeSystemDstu3, FhirResourceDaoCodeSystemR4, FhirResourceDaoCodeSystemR5, FhirResourceDaoCompositionDstu2, FhirResourceDaoCompositionDstu3, FhirResourceDaoCompositionR4, FhirResourceDaoCompositionR5, FhirResourceDaoConceptMapDstu3, FhirResourceDaoConceptMapR4, FhirResourceDaoConceptMapR5, FhirResourceDaoEncounterDstu2, FhirResourceDaoEncounterDstu3, FhirResourceDaoEncounterR4, FhirResourceDaoEncounterR5, FhirResourceDaoMessageHeaderDstu2, FhirResourceDaoMessageHeaderDstu3, FhirResourceDaoMessageHeaderR4, FhirResourceDaoMessageHeaderR5, FhirResourceDaoPatientDstu2, FhirResourceDaoPatientDstu3, FhirResourceDaoPatientR4, FhirResourceDaoPatientR5, FhirResourceDaoQuestionnaireResponseDstu2, FhirResourceDaoQuestionnaireResponseDstu3, FhirResourceDaoQuestionnaireResponseR4, FhirResourceDaoQuestionnaireResponseR5, FhirResourceDaoSearchParameterDstu2, FhirResourceDaoSearchParameterDstu3, FhirResourceDaoSearchParameterR4, FhirResourceDaoSearchParameterR5, FhirResourceDaoStructureDefinitionDstu2, FhirResourceDaoStructureDefinitionDstu3, FhirResourceDaoStructureDefinitionR4, FhirResourceDaoStructureDefinitionR5, FhirResourceDaoSubscriptionDstu2, FhirResourceDaoSubscriptionDstu3, FhirResourceDaoSubscriptionR4, FhirResourceDaoSubscriptionR5, FhirResourceDaoValueSetDstu2, FhirResourceDaoValueSetDstu3, FhirResourceDaoValueSetR4, FhirResourceDaoValueSetR5, JpaResourceDao

public abstract class BaseHapiFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource> extends BaseHapiFhirDao<T> implements ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T>
  • Field Details

  • Constructor Details

  • Method Details

    • create

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome create(T theResource)
      Specified by:
      create in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • create

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome create(T theResource, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Specified by:
      create in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • create

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome create(T theResource, String theIfNoneExist)
      Specified by:
      create in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • create

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome create(T theResource, String theIfNoneExist, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Specified by:
      create in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • setTransactionService

      public void setTransactionService(ca.uhn.fhir.jpa.dao.tx.HapiTransactionService theTransactionService)
    • create

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome create(T theResource, String theIfNoneExist, boolean thePerformIndexing, @Nonnull ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Specified by:
      create in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • setRequestPartitionHelperService

      public void setRequestPartitionHelperService(ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc theRequestPartitionHelperService)
    • doCreateForPost

      protected ca.uhn.fhir.jpa.api.model.DaoMethodOutcome doCreateForPost(T theResource, String theIfNoneExist, boolean thePerformIndexing, ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Called for FHIR create (POST) operations
    • getMessageSanitized

      protected String getMessageSanitized(String theKey, String theIdPart)
    • delete

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome delete(org.hl7.fhir.instance.model.api.IIdType theId)
      Specified by:
      delete in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • delete

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome delete(org.hl7.fhir.instance.model.api.IIdType theId, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Specified by:
      delete in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • delete

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome delete(org.hl7.fhir.instance.model.api.IIdType theId, ca.uhn.fhir.jpa.api.model.DeleteConflictList theDeleteConflicts, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, @Nonnull ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails)
      Specified by:
      delete in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • deleteByUrl

      public ca.uhn.fhir.jpa.api.model.DeleteMethodOutcome deleteByUrl(String theUrl, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      deleteByUrl in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • deleteByUrl

      public ca.uhn.fhir.jpa.api.model.DeleteMethodOutcome deleteByUrl(String theUrl, ca.uhn.fhir.jpa.api.model.DeleteConflictList deleteConflicts, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      This method gets called by deleteByUrl(String, RequestDetails) as well as by transaction processors
      Specified by:
      deleteByUrl in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • deletePidList

      @Nonnull public ca.uhn.fhir.jpa.api.model.DeleteMethodOutcome deletePidList(String theUrl, Collection<ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId> theResourceIds, ca.uhn.fhir.jpa.api.model.DeleteConflictList theDeleteConflicts, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      deletePidList in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • detectSearchDaoDisabled

    • expunge

      @Transactional(propagation=NEVER) public ca.uhn.fhir.jpa.api.model.ExpungeOutcome expunge(org.hl7.fhir.instance.model.api.IIdType theId, ca.uhn.fhir.jpa.api.model.ExpungeOptions theExpungeOptions, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      expunge in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • forceExpungeInExistingTransaction

      public ca.uhn.fhir.jpa.api.model.ExpungeOutcome forceExpungeInExistingTransaction(org.hl7.fhir.instance.model.api.IIdType theId, ca.uhn.fhir.jpa.api.model.ExpungeOptions theExpungeOptions, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      forceExpungeInExistingTransaction in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • expunge

      @Transactional(propagation=NEVER) public ca.uhn.fhir.jpa.api.model.ExpungeOutcome expunge(ca.uhn.fhir.jpa.api.model.ExpungeOptions theExpungeOptions, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Specified by:
      expunge in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • getResourceName

      Specified by:
      getResourceName in class ca.uhn.fhir.jpa.dao.BaseStorageDao
    • getResourceType

      public Class<T> getResourceType()
      Specified by:
      getResourceType in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • setResourceType

      public void setResourceType(Class<? extends org.hl7.fhir.instance.model.api.IBaseResource> theTableType)
    • history

      @Transactional public ca.uhn.fhir.rest.api.server.IBundleProvider history(Date theSince, Date theUntil, Integer theOffset, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Specified by:
      history in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • history

      @Transactional public ca.uhn.fhir.rest.api.server.IBundleProvider history(org.hl7.fhir.instance.model.api.IIdType theId, Date theSince, Date theUntil, Integer theOffset, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      history in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • isPagingProviderDatabaseBacked

      protected boolean isPagingProviderDatabaseBacked(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
    • markResourcesMatchingExpressionAsNeedingReindexing

      protected void markResourcesMatchingExpressionAsNeedingReindexing(Boolean theCurrentlyReindexing, String theExpression)
    • metaAddOperation

      @Transactional public <MT extends org.hl7.fhir.instance.model.api.IBaseMetaType> MT metaAddOperation(org.hl7.fhir.instance.model.api.IIdType theResourceId, MT theMetaAdd, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      metaAddOperation in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • metaDeleteOperation

      @Transactional public <MT extends org.hl7.fhir.instance.model.api.IBaseMetaType> MT metaDeleteOperation(org.hl7.fhir.instance.model.api.IIdType theResourceId, MT theMetaDel, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      metaDeleteOperation in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • metaGetOperation

      @Transactional public <MT extends org.hl7.fhir.instance.model.api.IBaseMetaType> MT metaGetOperation(Class<MT> theType, org.hl7.fhir.instance.model.api.IIdType theId, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      metaGetOperation in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • metaGetOperation

      @Transactional public <MT extends org.hl7.fhir.instance.model.api.IBaseMetaType> MT metaGetOperation(Class<MT> theType, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Specified by:
      metaGetOperation in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • patch

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome patch(org.hl7.fhir.instance.model.api.IIdType theId, String theConditionalUrl, ca.uhn.fhir.rest.api.PatchTypeEnum thePatchType, String thePatchBody, org.hl7.fhir.instance.model.api.IBaseParameters theFhirPatchBody, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      patch in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • start

      @PostConstruct public void start()
      Overrides:
      start in class BaseHapiFhirDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • postConstruct

    • preDelete

      protected void preDelete(T theResourceToDelete, ResourceTable theEntityToDelete)
      Subclasses may override to provide behaviour. Invoked within a delete transaction with the resource that is about to be deleted.
    • readByPid

      @Transactional public T readByPid(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId thePid)
      Specified by:
      readByPid in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • readByPid

      @Transactional public T readByPid(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId thePid, boolean theDeletedOk)
      Specified by:
      readByPid in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • read

      public T read(org.hl7.fhir.instance.model.api.IIdType theId)
      Specified by:
      read in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • read

      public T read(org.hl7.fhir.instance.model.api.IIdType theId, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Specified by:
      read in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • read

      public T read(org.hl7.fhir.instance.model.api.IIdType theId, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, boolean theDeletedOk)
      Specified by:
      read in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • doRead

      public T doRead(org.hl7.fhir.instance.model.api.IIdType theId, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, boolean theDeletedOk)
    • readEntity

      @Transactional public BaseHasResource readEntity(org.hl7.fhir.instance.model.api.IIdType theId, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      readEntity in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
      Overrides:
      readEntity in class BaseHapiFhirDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • getCurrentVersionId

      @Transactional public String getCurrentVersionId(org.hl7.fhir.instance.model.api.IIdType theReferenceElement)
      Specified by:
      getCurrentVersionId in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • readEntity

      @Transactional public BaseHasResource readEntity(org.hl7.fhir.instance.model.api.IIdType theId, boolean theCheckForForcedId, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      readEntity in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • readEntityLatestVersion

      @Nonnull protected ResourceTable readEntityLatestVersion(org.hl7.fhir.instance.model.api.IIdType theId, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails)
    • reindex

      public void reindex(T theResource, ResourceTable theEntity)
      Specified by:
      reindex in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • removeTag

      @Transactional public void removeTag(org.hl7.fhir.instance.model.api.IIdType theId, TagTypeEnum theTagType, String theScheme, String theTerm)
      Specified by:
      removeTag in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • removeTag

      @Transactional public void removeTag(org.hl7.fhir.instance.model.api.IIdType theId, TagTypeEnum theTagType, String theScheme, String theTerm, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      removeTag in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • search

      @Transactional(propagation=SUPPORTS) public ca.uhn.fhir.rest.api.server.IBundleProvider search(SearchParameterMap theParams)
      Specified by:
      search in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • search

      @Transactional(propagation=SUPPORTS) public ca.uhn.fhir.rest.api.server.IBundleProvider search(SearchParameterMap theParams, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      search in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • search

      @Transactional(propagation=SUPPORTS) public ca.uhn.fhir.rest.api.server.IBundleProvider search(SearchParameterMap theParams, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, javax.servlet.http.HttpServletResponse theServletResponse)
      Specified by:
      search in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • searchForIds

      public Set<ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId> searchForIds(SearchParameterMap theParams, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, @Nullable org.hl7.fhir.instance.model.api.IBaseResource theConditionalOperationTargetOrNull)
      Specified by:
      searchForIds in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • toMetaDt

      protected <MT extends org.hl7.fhir.instance.model.api.IBaseMetaType> MT toMetaDt(Class<MT> theType, Collection<TagDefinition> tagDefinitions)
    • update

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome update(T theResource)
      Specified by:
      update in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • update

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome update(T theResource, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Specified by:
      update in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • update

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome update(T theResource, String theMatchUrl)
      Specified by:
      update in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • update

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome update(T theResource, String theMatchUrl, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Specified by:
      update in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • update

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome update(T theResource, String theMatchUrl, boolean thePerformIndexing, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Specified by:
      update in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • update

      public ca.uhn.fhir.jpa.api.model.DaoMethodOutcome update(T theResource, String theMatchUrl, boolean thePerformIndexing, boolean theForceUpdateVersion, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, @Nonnull ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails)
      Specified by:
      update in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • validate

      @Transactional(propagation=SUPPORTS) public ca.uhn.fhir.rest.api.MethodOutcome validate(T theResource, org.hl7.fhir.instance.model.api.IIdType theId, String theRawResource, ca.uhn.fhir.rest.api.EncodingEnum theEncoding, ca.uhn.fhir.rest.api.ValidationModeEnum theMode, String theProfile, ca.uhn.fhir.rest.api.server.RequestDetails theRequest)
      Specified by:
      validate in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • validateCriteriaAndReturnResourceDefinition

      public ca.uhn.fhir.context.RuntimeResourceDefinition validateCriteriaAndReturnResourceDefinition(String criteria)
      Get the resource definition from the criteria which specifies the resource type
      Specified by:
      validateCriteriaAndReturnResourceDefinition in interface ca.uhn.fhir.jpa.api.dao.IFhirResourceDao<T extends org.hl7.fhir.instance.model.api.IBaseResource>
    • setIdHelperSvcForUnitTest

      public void setIdHelperSvcForUnitTest(IdHelperService theIdHelperService)