@FunctionalInterface public static interface ContextInfo.QueryInfluencer
NarrowExecutor
will invoke to generate a Node
filter string that can be parsed and set as a predicate on the ultimate query it is
processing.
This is different from ContextInfo.QueryHints
, which are static and defined well before the
narrowing logic is invoked. ContextInfo.QueryInfluencer
can be more powerful since it has
knowledge of exactly what persisted-domain type is being read and can conditionally
apply/not-apply.
ContextInfo.queryInfluencers
Modifier and Type | Method and Description |
---|---|
String |
buildFilter(Class<?> entityBeingRead,
PolicyInformation currentPolicyRequirements,
ContextInfo contextInfo)
Produce a
Node filter string that the NarrowExecutor can parse and add as
a predicate for the query it is currently processing. |
@Nullable String buildFilter(Class<?> entityBeingRead, @Nullable PolicyInformation currentPolicyRequirements, ContextInfo contextInfo)
Node
filter string that the NarrowExecutor
can parse and add as
a predicate for the query it is currently processing.entityBeingRead
- the persisted-domain type of the entity that is currently being
queried by the NarrowExecutor
currentPolicyRequirements
- the most-derived policy requirements that are currently
active (if any). Some implementations may find it useful to leverage this
information when building the filter.contextInfo
- in the event the query influencer needs access to the parent context
info to inform its behavior, it will be passed in as an argument here. By
definition, it won't be null.Node
filter string that should be added to the query. Alternatively,
return null
if the influencer shouldn't/can't produce a filter for the
given inputs.Copyright © 2021. All rights reserved.