Interface SearchQueryVisitor<T>
-
- All Known Implementing Classes:
SearchQueryRenderer
public interface SearchQueryVisitor<T>
Used by theSearchQuery
domain model to render the model into another form (such as a Select statement).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
addCanonicalParam(T query, java.lang.String resourceType, QueryParameter queryParm)
Filter the query using the given canonical parameterT
addChained(T currentSubQuery, QueryParameter currentParm)
Add a chain subquery element as part of a chained parameter searchT
addCompositeParam(T query, QueryParameter queryParm)
Add a composite query parameter filter to the queryT
addCompositeParam(T query, QueryParameter queryParm, boolean isMissing)
Add a composite query which only tests missing/not missing, not the actual parameter valueT
addDateParam(T queryData, java.lang.String resourceType, QueryParameter queryParm)
Filter the query using the given date parametervoid
addFilter(T currentSubQuery, java.lang.String resourceType, QueryParameter currentParm)
Add a filter predicate to the given chained sub-query element.T
addIncludeFilter(T query, InclusionParameter inclusionParm, java.util.List<java.lang.Long> logicalResourceIds)
T
addInclusionParam(T query, java.lang.String resourceType, QueryParameter queryParm)
Special case to handle inclusion related to compartment-based searchesT
addLocationParam(T queryData, java.lang.String resourceType, QueryParameter queryParm)
Filter the query using the given location (lat/lng) paramT
addLocationPosition(T queryData, java.util.List<QueryParameter> queryParameters)
T
addMissingParam(T query, QueryParameter queryParm, boolean isMissing)
Add a missing (NOT EXISTS) parameter clause to the queryT
addNumberParam(T queryData, java.lang.String resourceType, QueryParameter queryParm)
Filter the query using the given number parameterT
addPagination(T query)
Add pagination (LIMIT/OFFSET) to the queryT
addQuantityParam(T queryData, java.lang.String resourceType, QueryParameter queryParm)
Filter the query using the given quantity parameterT
addReferenceParam(T queryData, java.lang.String resourceType, QueryParameter queryParm)
Filter the query using the given reference parameterT
addReverseChained(T currentSubQuery, QueryParameter currentParm)
Add a reverse chain subquery element as part of a chained parameter searchT
addRevIncludeFilter(T query, InclusionParameter inclusionParm, java.util.List<java.lang.Long> logicalResourceIds)
T
addSecurityParam(T query, java.lang.String resourceType, QueryParameter queryParm)
Filter the query using the given security query parameterT
addSorting(T query, java.lang.String lrAlias)
Add sorting (order by) to the queryvoid
addSortParam(T queryData, java.lang.String code, SearchConstants.Type type, Sort.Direction direction)
Add the given sort parameter to the sort queryT
addStringParam(T query, java.lang.String resourceType, QueryParameter queryParm)
Filter the query using the given string parameterT
addTagParam(T query, java.lang.String resourceType, QueryParameter queryParm)
Filter the query using the given tag query parameterT
addTokenParam(T query, java.lang.String resourceType, QueryParameter queryParm)
Filter the query using the given parameter id and token valueT
addWholeSystemDataFilter(T query, java.lang.String resourceType, java.util.List<java.lang.Long> logicalResourceIds)
T
addWholeSystemResourceTypeFilter(T query, java.util.List<java.lang.Integer> resourceTypeIds)
T
addWholeSystemSorting(T query, java.util.List<DomainSortParameter> sortParms, java.lang.String lrAlias)
Add sorting (order by) for whole-system search to the queryT
countRoot(java.lang.String rootResourceType)
The root query (select statement) for a count queryT
dataRoot(java.lang.String rootResourceType, int resourceTypeId)
The root query (select statement) for the data queryT
getParameterBaseQuery(T queryData)
Get the join to which we want to attach all the parameter tables.T
includeRoot(java.lang.String rootResourceType)
The root query (select statement) for the include query.T
joinResources(T queryData, boolean includeResourceTypeId)
Finish the data query by wrapping the root and joining the resources tableT
sortRoot(java.lang.String rootResourceType)
The root of the FHIR search sort queryT
wholeSystemDataRoot(java.lang.String rootResourceType, int rootResourceTypeId)
The root of the FHIR whole-system data search queryT
wholeSystemFilterRoot()
The root of the FHIR whole-system filter search queryT
wrapInclude(T query)
T
wrapWholeSystem(java.util.List<T> queries, boolean isCountQuery)
The wrapper for whole-system search
-
-
-
Method Detail
-
countRoot
T countRoot(java.lang.String rootResourceType)
The root query (select statement) for a count query- Parameters:
rootResourceType
-- Returns:
-
dataRoot
T dataRoot(java.lang.String rootResourceType, int resourceTypeId)
The root query (select statement) for the data query- Parameters:
rootResourceType
-resourceTypeId
-- Returns:
-
joinResources
T joinResources(T queryData, boolean includeResourceTypeId)
Finish the data query by wrapping the root and joining the resources table- Parameters:
queryData
-includeResourceTypeId
- include the resource_type_id in the select column list- Returns:
-
getParameterBaseQuery
T getParameterBaseQuery(T queryData)
Get the join to which we want to attach all the parameter tables. This makes it easier to build different styles of joins- Parameters:
queryData
-- Returns:
-
includeRoot
T includeRoot(java.lang.String rootResourceType)
The root query (select statement) for the include query. This query is different than the data root because of the need to support version references for _include searches. For this, we join: xx_RESOURCES.LOGICAL_RESOURCE_ID = xx_LOGICAL_RESOURCES.LOGICAL_RESOURCE_ID and allow the filter to specify the version_id constraint. However, we still need to assert that the resource has not been deleted, so we keep: xx_LOGICAL_RESOURCES.IS_DELETED = 'N'- Parameters:
rootResourceType
-- Returns:
-
sortRoot
T sortRoot(java.lang.String rootResourceType)
The root of the FHIR search sort query- Parameters:
rootResourceType
-- Returns:
-
wholeSystemFilterRoot
T wholeSystemFilterRoot()
The root of the FHIR whole-system filter search query- Returns:
-
wholeSystemDataRoot
T wholeSystemDataRoot(java.lang.String rootResourceType, int rootResourceTypeId)
The root of the FHIR whole-system data search query- Parameters:
rootResourceType
-rootResourceTypeId
-- Returns:
-
wrapWholeSystem
T wrapWholeSystem(java.util.List<T> queries, boolean isCountQuery)
The wrapper for whole-system search- Parameters:
queries
-isCountQuery
-- Returns:
-
addTokenParam
T addTokenParam(T query, java.lang.String resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Filter the query using the given parameter id and token value- Parameters:
query
-resourceType
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addTagParam
T addTagParam(T query, java.lang.String resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Filter the query using the given tag query parameter- Parameters:
query
-resourceType
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addSecurityParam
T addSecurityParam(T query, java.lang.String resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Filter the query using the given security query parameter- Parameters:
query
-resourceType
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addStringParam
T addStringParam(T query, java.lang.String resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Filter the query using the given string parameter- Parameters:
query
-resourceType
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addCanonicalParam
T addCanonicalParam(T query, java.lang.String resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Filter the query using the given canonical parameter- Parameters:
query
-resourceType
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addNumberParam
T addNumberParam(T queryData, java.lang.String resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Filter the query using the given number parameter- Parameters:
queryData
-resourceType
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addQuantityParam
T addQuantityParam(T queryData, java.lang.String resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Filter the query using the given quantity parameter- Parameters:
queryData
-resourceType
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addDateParam
T addDateParam(T queryData, java.lang.String resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Filter the query using the given date parameter- Parameters:
queryData
-resourceType
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addReferenceParam
T addReferenceParam(T queryData, java.lang.String resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Filter the query using the given reference parameter- Parameters:
queryData
-resourceType
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addLocationParam
T addLocationParam(T queryData, java.lang.String resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Filter the query using the given location (lat/lng) param- Parameters:
queryData
-resourceType
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addMissingParam
T addMissingParam(T query, QueryParameter queryParm, boolean isMissing) throws FHIRPersistenceException
Add a missing (NOT EXISTS) parameter clause to the query- Parameters:
query
-queryParm
-isMissing
- true if the condition should be that the parameter does not exist- Returns:
- Throws:
FHIRPersistenceException
-
addCompositeParam
T addCompositeParam(T query, QueryParameter queryParm) throws FHIRPersistenceException
Add a composite query parameter filter to the query- Parameters:
query
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addCompositeParam
T addCompositeParam(T query, QueryParameter queryParm, boolean isMissing) throws FHIRPersistenceException
Add a composite query which only tests missing/not missing, not the actual parameter value- Parameters:
query
-queryParm
-isMissing
-- Returns:
- Throws:
FHIRPersistenceException
-
addInclusionParam
T addInclusionParam(T query, java.lang.String resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Special case to handle inclusion related to compartment-based searches- Parameters:
query
-resourceType
-queryParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addSorting
T addSorting(T query, java.lang.String lrAlias)
Add sorting (order by) to the query- Parameters:
query
-lrAlias
-- Returns:
-
addWholeSystemSorting
T addWholeSystemSorting(T query, java.util.List<DomainSortParameter> sortParms, java.lang.String lrAlias)
Add sorting (order by) for whole-system search to the query- Parameters:
query
-sortParms
-lrAlias
-- Returns:
-
addPagination
T addPagination(T query)
Add pagination (LIMIT/OFFSET) to the query- Parameters:
query
-- Returns:
-
addChained
T addChained(T currentSubQuery, QueryParameter currentParm) throws FHIRPersistenceException
Add a chain subquery element as part of a chained parameter search- Parameters:
currentSubQuery
-currentParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addReverseChained
T addReverseChained(T currentSubQuery, QueryParameter currentParm) throws FHIRPersistenceException
Add a reverse chain subquery element as part of a chained parameter search- Parameters:
currentSubQuery
-currentParm
-- Returns:
- Throws:
FHIRPersistenceException
-
addFilter
void addFilter(T currentSubQuery, java.lang.String resourceType, QueryParameter currentParm) throws FHIRPersistenceException
Add a filter predicate to the given chained sub-query element. This must be the last element of the chain.- Parameters:
currentSubQuery
-resourceType
-currentParm
-- Throws:
FHIRPersistenceException
-
addLocationPosition
T addLocationPosition(T queryData, java.util.List<QueryParameter> queryParameters) throws FHIRPersistenceException
- Parameters:
queryData
-queryParameters
-- Returns:
- Throws:
FHIRPersistenceException
-
addIncludeFilter
T addIncludeFilter(T query, InclusionParameter inclusionParm, java.util.List<java.lang.Long> logicalResourceIds) throws FHIRPersistenceException
- Parameters:
query
-inclusionParm
-logicalResourceIds
-- Returns:
- Throws:
FHIRPersistenceException
-
addRevIncludeFilter
T addRevIncludeFilter(T query, InclusionParameter inclusionParm, java.util.List<java.lang.Long> logicalResourceIds) throws FHIRPersistenceException
- Parameters:
query
-inclusionParm
-logicalResourceIds
-- Returns:
- Throws:
FHIRPersistenceException
-
addWholeSystemDataFilter
T addWholeSystemDataFilter(T query, java.lang.String resourceType, java.util.List<java.lang.Long> logicalResourceIds) throws FHIRPersistenceException
- Parameters:
query
-resourceType
-logicalResourceIds
-- Returns:
- Throws:
FHIRPersistenceException
-
addWholeSystemResourceTypeFilter
T addWholeSystemResourceTypeFilter(T query, java.util.List<java.lang.Integer> resourceTypeIds) throws FHIRPersistenceException
- Parameters:
query
-resourceTypeIds
-- Returns:
- Throws:
FHIRPersistenceException
-
addSortParam
void addSortParam(T queryData, java.lang.String code, SearchConstants.Type type, Sort.Direction direction) throws FHIRPersistenceException
Add the given sort parameter to the sort query- Parameters:
queryData
-code
-type
-direction
-- Throws:
FHIRPersistenceException
-
-