
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 TypeClassDescriptionclass
IncludesIterator, used to recursively fetch resources from the provided list of PIDs -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Deprecated.static final int
protected javax.persistence.EntityManager
protected final ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster
protected final IResourceTagDao
static boolean
static final String
static final String
Fields 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.CriteriaBuilder
static int
Class<? 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) 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
setMaxPageSize50ForTest
(boolean theIsTest) void
setMaxResultsToFetch
(Integer theMaxResultsToFetch) void
setPreviouslyAddedResourcePids
(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:
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 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, 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:
loadIncludes
in interfaceISearchBuilder<JpaPid>
-
loadIncludes
- Specified by:
loadIncludes
in interfaceISearchBuilder<JpaPid>
-
setFetchSize
- Specified by:
setFetchSize
in interfaceISearchBuilder<JpaPid>
-
getParams
-
getBuilder
-
getResourceType
-
getResourceName
-
getMaximumPageSize
-
setMaxPageSize50ForTest
-