Package ca.uhn.fhir.jpa.search.builder
Class SearchBuilder
java.lang.Object
ca.uhn.fhir.jpa.search.builder.SearchBuilder
- All Implemented Interfaces:
ISearchBuilder<JpaPid>
The SearchBuilder is responsible for actually forming the SQL query that handles
searches for resources
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
IncludesIterator, used to recursively fetch resources from the provided list of PIDs -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Deprecated.protected jakarta.persistence.EntityManager
protected final ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster
static Integer
protected final IResourceTagDao
static final String
static final String
Fields inherited from interface ca.uhn.fhir.jpa.dao.ISearchBuilder
SEARCH_BUILDER_BEAN_NAME
-
Constructor Summary
ConstructorDescriptionSearchBuilder
(IDao theDao, String theResourceName, JpaStorageSettings theStorageSettings, ca.uhn.fhir.jpa.config.HapiFhirLocalContainerEntityManagerFactoryBean theEntityManagerFactory, SqlObjectFactory theSqlBuilderFactory, HibernatePropertiesProvider theDialectProvider, ca.uhn.fhir.rest.server.util.ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster, IResourceTagDao theResourceTagDao, DaoRegistry theDaoRegistry, IResourceSearchViewDao theResourceSearchViewDao, ca.uhn.fhir.context.FhirContext theContext, IIdHelperService theIdHelperService, Class<? extends org.hl7.fhir.instance.model.api.IBaseResource> theResourceType) Constructor -
Method Summary
Modifier and TypeMethodDescriptioncreateCountQuery
(SearchParameterMap theParams, String theSearchUuid, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, RequestPartitionId theRequestPartitionId) createQuery
(SearchParameterMap theParams, SearchRuntimeDetails theSearchRuntimeDetails, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, RequestPartitionId theRequestPartitionId) jakarta.persistence.criteria.CriteriaBuilder
static int
Class
<? extends org.hl7.fhir.instance.model.api.IBaseResource> loadIncludes
(ca.uhn.fhir.context.FhirContext theContext, jakarta.persistence.EntityManager theEntityManager, Collection<JpaPid> theMatches, Collection<ca.uhn.fhir.model.api.Include> theIncludes, boolean theReverseMode, ca.uhn.fhir.rest.param.DateRangeParam theLastUpdated, String theSearchIdOrDescription, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, Integer theMaxCount) THIS SHOULD RETURN HASHSET and not just Set because we add to it later so it can't be Collections.emptySet() or some such thing.loadIncludes
(SearchBuilderLoadIncludesParameters<JpaPid> theParameters) void
loadResourcesByPid
(Collection<JpaPid> thePids, Collection<JpaPid> theIncludedPids, List<org.hl7.fhir.instance.model.api.IBaseResource> theResourceListToPopulate, boolean theForHistoryOperation, ca.uhn.fhir.rest.api.server.RequestDetails theDetails) void
setFetchSize
(int theFetchSize) static void
setMaxPageSizeForTest
(Integer theTestSize) void
setMaxResultsToFetch
(Integer theMaxResultsToFetch) void
setPreviouslyAddedResourcePids
(List<JpaPid> thePidSet) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ca.uhn.fhir.jpa.dao.ISearchBuilder
createQueryStream, loadResourcesByPid
-
Field Details
-
MAXIMUM_PAGE_SIZE
Deprecated.See loadResourcesByPid for an explanation of why we use the constant 800- See Also:
-
RESOURCE_ID_ALIAS
- See Also:
-
RESOURCE_VERSION_ALIAS
- See Also:
-
myMaxPageSizeForTests
-
myInterceptorBroadcaster
-
myResourceTagDao
-
myEntityManager
-
-
Constructor Details
-
SearchBuilder
public SearchBuilder(IDao theDao, String theResourceName, JpaStorageSettings theStorageSettings, ca.uhn.fhir.jpa.config.HapiFhirLocalContainerEntityManagerFactoryBean theEntityManagerFactory, SqlObjectFactory theSqlBuilderFactory, HibernatePropertiesProvider theDialectProvider, ca.uhn.fhir.rest.server.util.ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster, IResourceTagDao theResourceTagDao, DaoRegistry theDaoRegistry, IResourceSearchViewDao theResourceSearchViewDao, ca.uhn.fhir.context.FhirContext theContext, IIdHelperService theIdHelperService, Class<? extends org.hl7.fhir.instance.model.api.IBaseResource> theResourceType) Constructor
-
-
Method Details
-
setMaxResultsToFetch
- Specified by:
setMaxResultsToFetch
in interfaceISearchBuilder<JpaPid>
-
createCountQuery
public Long createCountQuery(SearchParameterMap theParams, String theSearchUuid, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, @Nonnull RequestPartitionId theRequestPartitionId) - Specified by:
createCountQuery
in interfaceISearchBuilder<JpaPid>
-
setPreviouslyAddedResourcePids
- Specified by:
setPreviouslyAddedResourcePids
in interfaceISearchBuilder<JpaPid>
- Parameters:
thePidSet
- May be null
-
createQuery
public IResultIterator<JpaPid> createQuery(SearchParameterMap theParams, SearchRuntimeDetails theSearchRuntimeDetails, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, @Nonnull RequestPartitionId theRequestPartitionId) - Specified by:
createQuery
in interfaceISearchBuilder<JpaPid>
-
loadResourcesByPid
public void loadResourcesByPid(Collection<JpaPid> thePids, Collection<JpaPid> theIncludedPids, List<org.hl7.fhir.instance.model.api.IBaseResource> theResourceListToPopulate, boolean theForHistoryOperation, ca.uhn.fhir.rest.api.server.RequestDetails theDetails) - Specified by:
loadResourcesByPid
in interfaceISearchBuilder<JpaPid>
-
loadIncludes
public Set<JpaPid> loadIncludes(ca.uhn.fhir.context.FhirContext theContext, jakarta.persistence.EntityManager theEntityManager, Collection<JpaPid> theMatches, Collection<ca.uhn.fhir.model.api.Include> theIncludes, boolean theReverseMode, ca.uhn.fhir.rest.param.DateRangeParam theLastUpdated, String theSearchIdOrDescription, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, Integer theMaxCount) THIS SHOULD RETURN HASHSET and not just Set because we add to it later so it can't be Collections.emptySet() or some such thing. The JpaPid returned will have resource type populated.- Specified by:
loadIncludes
in interfaceISearchBuilder<JpaPid>
-
loadIncludes
- Specified by:
loadIncludes
in interfaceISearchBuilder<JpaPid>
-
setFetchSize
- Specified by:
setFetchSize
in interfaceISearchBuilder<JpaPid>
-
getParams
-
getBuilder
-
getResourceType
-
getResourceName
-
getMaximumPageSize
-
setMaxPageSizeForTest
-