Class TemplatedExecutableSearchFilterBuilder

All Implemented Interfaces:
ExecutableSearchBuilder<ExecutableSearchFilter>, Component, DestructableComponent, InitializableComponent
Direct Known Subclasses:
V2CompatibleTemplatedExecutableSearchFilterBuilder

public class TemplatedExecutableSearchFilterBuilder
extends AbstractExecutableSearchFilterBuilder
An ExecutableSearchBuilder that generates the search filter to be executed by evaluating a Template against the currently resolved attributes within a AttributeResolutionContext.
  • Field Details

    • log

      private final org.slf4j.Logger log
      Class logger.
    • template

      private Template template
      Template evaluated to generate a search filter.
    • templateText

      private String templateText
      Template (as Text) to be evaluated.
    • engine

      private org.apache.velocity.app.VelocityEngine engine
      VelocityEngine.
    • eventHandler

      private org.apache.velocity.app.event.ReferenceInsertionEventHandler eventHandler
      Event handler used for escaping.
    • v2Compatibility

      private boolean v2Compatibility
      Do we need to make ourself V2 Compatible?
  • Constructor Details

    • TemplatedExecutableSearchFilterBuilder

      public TemplatedExecutableSearchFilterBuilder()
  • Method Details

    • getTemplate

      @NonnullAfterInit public Template getTemplate()
      Gets the template to be evaluated.
      Returns:
      the template
    • getTemplateText

      @NonnullAfterInit public String getTemplateText()
      Gets the template text to be evaluated.
      Returns:
      the template text
    • setTemplateText

      public void setTemplateText​(@Nullable String velocityTemplate)
      Sets the template to be evaluated.
      Parameters:
      velocityTemplate - template to be evaluated
    • getVelocityEngine

      @Nullable @NonnullAfterInit public org.apache.velocity.app.VelocityEngine getVelocityEngine()
      Gets the VelocityEngine to be used.
      Returns:
      the velocity engine
    • setVelocityEngine

      public void setVelocityEngine​(org.apache.velocity.app.VelocityEngine velocityEngine)
      Sets the VelocityEngine to be used.
      Parameters:
      velocityEngine - engine to be used
    • getReferenceInsertionEventHandler

      @Nullable public org.apache.velocity.app.event.ReferenceInsertionEventHandler getReferenceInsertionEventHandler()
      Gets the ReferenceInsertionEventHandler to be used.
      Returns:
      the reference insertion event handler
    • setReferenceInsertionEventHandler

      public void setReferenceInsertionEventHandler​(@Nullable org.apache.velocity.app.event.ReferenceInsertionEventHandler handler)
      Sets the ReferenceInsertionEventHandler to be used.
      Parameters:
      handler - reference insertion event handler to be used
    • isV2Compatibility

      public boolean isV2Compatibility()
      Are we in V2 Compatibility mode?
      Returns:
      Returns the v2Compat.
    • setV2Compatibility

      public void setV2Compatibility​(boolean compat)
      What is out V2 Compatibility mode.
      Parameters:
      compat - The mode to set.
    • addExtraVelocityContext

      protected void addExtraVelocityContext​(@Nonnull org.apache.velocity.VelocityContext velocityContext, @Nonnull AttributeResolutionContext resolutionContext)
      Method to allow private additions to the velocity context.
      Parameters:
      velocityContext - where to add the information
      resolutionContext - current resolution context
    • build

      public ExecutableSearchFilter build​(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull Map<String,​List<IdPAttributeValue>> dependencyAttributes) throws ResolutionException
      Creates an executable search that can be executed against a data source in order to produce results.
      Parameters:
      resolutionContext - current request context
      dependencyAttributes - made available to the executable search
      Returns:
      executable search
      Throws:
      ResolutionException - throw if their is a problem creating the executable search
    • merge

      protected String merge​(@Nonnull org.apache.velocity.VelocityContext context)
      Parameters:
      context - to merge
      Returns:
      result of the merge operation
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractInitializableComponent
      Throws:
      ComponentInitializationException