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
Nested ClassesModifier and TypeClassDescriptionclassIncludesIterator, used to recursively fetch resources from the provided list of PIDs -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDeprecated.static final intprotected javax.persistence.EntityManagerprotected final ca.uhn.fhir.interceptor.api.IInterceptorBroadcasterprotected final IResourceTagDaostatic booleanstatic final Stringstatic final StringFields inherited from interface ca.uhn.fhir.jpa.dao.ISearchBuilder
SEARCH_BUILDER_BEAN_NAME -
Constructor Summary
ConstructorsConstructorDescriptionSearchBuilder(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) javax.persistence.criteria.CriteriaBuilderstatic intClass<? extends org.hl7.fhir.instance.model.api.IBaseResource>loadIncludes(ca.uhn.fhir.context.FhirContext theContext, javax.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) voidloadResourcesByPid(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) voidsetFetchSize(int theFetchSize) static voidsetMaxPageSize50ForTest(boolean theIsTest) voidsetMaxResultsToFetch(Integer theMaxResultsToFetch) voidsetPreviouslyAddedResourcePids(List<JpaPid> thePidSet)
-
Field Details
-
MAXIMUM_PAGE_SIZE
Deprecated.See loadResourcesByPid for an explanation of why we use the constant 800- See Also:
-
MAXIMUM_PAGE_SIZE_FOR_TESTING
- See Also:
-
RESOURCE_ID_ALIAS
- See Also:
-
RESOURCE_VERSION_ALIAS
- See Also:
-
myUseMaxPageSize50ForTest
-
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:
setMaxResultsToFetchin interfaceISearchBuilder<JpaPid>
-
createCountQuery
public Long createCountQuery(SearchParameterMap theParams, String theSearchUuid, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, @Nonnull RequestPartitionId theRequestPartitionId) - Specified by:
createCountQueryin interfaceISearchBuilder<JpaPid>
-
setPreviouslyAddedResourcePids
- Specified by:
setPreviouslyAddedResourcePidsin interfaceISearchBuilder<JpaPid>- Parameters:
thePidSet- May be null
-
createQuery
public IResultIterator createQuery(SearchParameterMap theParams, SearchRuntimeDetails theSearchRuntimeDetails, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, @Nonnull RequestPartitionId theRequestPartitionId) - Specified by:
createQueryin 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:
loadResourcesByPidin interfaceISearchBuilder<JpaPid>
-
loadIncludes
public Set<JpaPid> loadIncludes(ca.uhn.fhir.context.FhirContext theContext, javax.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:
loadIncludesin interfaceISearchBuilder<JpaPid>
-
loadIncludes
- Specified by:
loadIncludesin interfaceISearchBuilder<JpaPid>
-
setFetchSize
- Specified by:
setFetchSizein interfaceISearchBuilder<JpaPid>
-
getParams
-
getBuilder
-
getResourceType
-
getResourceName
-
getMaximumPageSize
-
setMaxPageSize50ForTest
-