Interface ContextInfo.QueryInfluencer

Enclosing class:
ContextInfo
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface ContextInfo.QueryInfluencer
A dynamic component that the 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.

See Also:
  • ContextInfo.queryInfluencers
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
  • Method Details

    • buildFilter

      @Nullable String buildFilter(Class<?> entityBeingRead, @Nullable 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.
      Parameters:
      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.
      Returns:
      a 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.