Package net.shibboleth.idp.attribute.resolver.dc.ldap

# Class TemplatedExecutableSearchFilterBuilder

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.attribute.resolver.dc.ldap.AbstractExecutableSearchFilterBuilder
net.shibboleth.idp.attribute.resolver.dc.ldap.TemplatedExecutableSearchFilterBuilder

All Implemented Interfaces:
  `ExecutableSearchBuilder<ExecutableSearchFilter>`, `Component`, `DestructableComponent`, `InitializableComponent`

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`.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected static class`
`TemplatedExecutableSearchFilterBuilder.EscapingReferenceInsertionEventHandler`
Escapes LDAP attribute values added to the template context.

## Field Summary

Fields
Modifier and Type
Field
Description
`private org.apache.velocity.app.VelocityEngine`
`engine`
VelocityEngine.
`private org.apache.velocity.app.event.ReferenceInsertionEventHandler`
`eventHandler`
Event handler used for escaping.
`private final org.slf4j.Logger`
`log`
Class logger.
`private Template`
`template`
Template evaluated to generate a search filter.
`private String`
`templateText`
Template (as Text) to be evaluated.
`private boolean`
`v2Compatibility`
Do we need to make ourself V2 Compatible?

## Constructor Summary

Constructors
Constructor
Description
`TemplatedExecutableSearchFilterBuilder()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`addExtraVelocityContext(org.apache.velocity.VelocityContext velocityContext, AttributeResolutionContext resolutionContext)`
Method to allow private additions to the velocity context.
`ExecutableSearchFilter`
`build(AttributeResolutionContext resolutionContext, Map<String,List<IdPAttributeValue>> dependencyAttributes)`
Creates an executable search that can be executed against a data source in order to produce results.
`protected void`
`doInitialize()`
`org.apache.velocity.app.event.ReferenceInsertionEventHandler`
`getReferenceInsertionEventHandler()`
Gets the `ReferenceInsertionEventHandler` to be used.
`Template`
`getTemplate()`
Gets the template to be evaluated.
`String`
`getTemplateText()`
Gets the template text to be evaluated.
`org.apache.velocity.app.VelocityEngine`
`getVelocityEngine()`
Gets the `VelocityEngine` to be used.
`boolean`
`isV2Compatibility()`
Are we in V2 Compatibility mode?
`protected String`
`merge(org.apache.velocity.VelocityContext context)`
Invokes `Template.merge(org.apache.velocity.context.Context)` on the supplied context.
`void`
`setReferenceInsertionEventHandler(org.apache.velocity.app.event.ReferenceInsertionEventHandler handler)`
Sets the `ReferenceInsertionEventHandler` to be used.
`void`
`setTemplateText(String velocityTemplate)`
Sets the template to be evaluated.
`void`
`setV2Compatibility(boolean compat)`
What is out V2 Compatibility mode.
`void`
`setVelocityEngine(org.apache.velocity.app.VelocityEngine velocityEngine)`
Sets the `VelocityEngine` to be used.

### Methods inherited from class net.shibboleth.idp.attribute.resolver.dc.ldap.AbstractExecutableSearchFilterBuilder

`build`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### template

@NonnullAfterInit private Template template
Template evaluated to generate a search filter.

### templateText

@NonnullAfterInit private String templateText
Template (as Text) to be evaluated.

### engine

@NonnullAfterInit 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

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractInitializableComponent`
Throws:
  `ComponentInitializationException`

### build

@Nonnull 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

@Nonnull protected String merge(@Nonnull org.apache.velocity.VelocityContext context)
Invokes `Template.merge(org.apache.velocity.context.Context)` on the supplied context.

Parameters:
  `context` - to merge
Returns:
  result of the merge operation