Class TemplatedExecutableStatementBuilder
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.attribute.resolver.dc.rdbms.AbstractExecutableStatementBuilder
net.shibboleth.idp.attribute.resolver.dc.rdbms.TemplatedExecutableStatementBuilder
- All Implemented Interfaces:
ExecutableSearchBuilder<ExecutableStatement>,Component,DestructableComponent,InitializableComponent
An
ExecutableSearchBuilder that generates the SQL statement to
be executed by evaluating a Template against the currently resolved attributes within a
AttributeResolutionContext.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classEscapes SQL values added to the template context. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.velocity.app.VelocityEngineVelocityEngine.private org.apache.velocity.app.event.ReferenceInsertionEventHandlerEvent handler used for escaping.private final org.slf4j.LoggerClass logger.private TemplateTemplate to be evaluated.private StringTemplate (as Text) to be evaluated.private booleanDo we need to make ourself V2 Compatible? -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddExtraVelocityContext(org.apache.velocity.VelocityContext velocityContext, AttributeResolutionContext resolutionContext) Method to allow private additions to the velocity context.protected voidorg.apache.velocity.app.event.ReferenceInsertionEventHandlerGets theReferenceInsertionEventHandlerto be used.final StringgetSQLQuery(AttributeResolutionContext resolutionContext, Map<String, List<IdPAttributeValue>> dependencyAttributes) Apply the context to the template.Gets the template to be evaluated.Gets the template text to be evaluated.org.apache.velocity.app.VelocityEngineGets theVelocityEngineto be used.booleanAre we in V2 Compatibility mode?protected Stringmerge(org.apache.velocity.VelocityContext context) InvokesTemplate.merge(org.apache.velocity.context.Context)on the supplied context.voidsetReferenceInsertionEventHandler(org.apache.velocity.app.event.ReferenceInsertionEventHandler handler) Sets theReferenceInsertionEventHandlerto be used.voidsetTemplateText(String velocityTemplate) Sets the template to be evaluated.voidsetV2Compatibility(boolean compat) What is out V2 Compatibility mode.voidsetVelocityEngine(org.apache.velocity.app.VelocityEngine velocityEngine) Sets theVelocityEngineto be used.Methods inherited from class net.shibboleth.idp.attribute.resolver.dc.rdbms.AbstractExecutableStatementBuilder
build, getQueryTimeout, setQueryTimeoutMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized
-
Field Details
-
log
private final org.slf4j.Logger logClass logger. -
template
Template to be evaluated. -
templateText
Template (as Text) to be evaluated. -
engine
VelocityEngine. -
eventHandler
@Nullable private org.apache.velocity.app.event.ReferenceInsertionEventHandler eventHandlerEvent handler used for escaping. -
v2Compatibility
private boolean v2CompatibilityDo we need to make ourself V2 Compatible?
-
-
Constructor Details
-
TemplatedExecutableStatementBuilder
public TemplatedExecutableStatementBuilder()
-
-
Method Details
-
getTemplate
Gets the template to be evaluated.- Returns:
- the template
-
getTemplateText
Gets the template text to be evaluated.- Returns:
- the template text
-
setTemplateText
Sets the template to be evaluated.- Parameters:
velocityTemplate- template to be evaluated
-
getVelocityEngine
Gets theVelocityEngineto be used.- Returns:
- the template
-
setVelocityEngine
public void setVelocityEngine(@Nonnull org.apache.velocity.app.VelocityEngine velocityEngine) Sets theVelocityEngineto be used.- Parameters:
velocityEngine- engine to be used
-
getReferenceInsertionEventHandler
@Nullable public org.apache.velocity.app.event.ReferenceInsertionEventHandler getReferenceInsertionEventHandler()Gets theReferenceInsertionEventHandlerto be used.- Returns:
- the reference insertion event handler
-
setReferenceInsertionEventHandler
public void setReferenceInsertionEventHandler(@Nullable org.apache.velocity.app.event.ReferenceInsertionEventHandler handler) Sets theReferenceInsertionEventHandlerto 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.
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
merge
InvokesTemplate.merge(org.apache.velocity.context.Context)on the supplied context.- Parameters:
context- to merge- Returns:
- result of the merge operation
-
getSQLQuery
@Nonnull public final String getSQLQuery(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull Map<String, List<IdPAttributeValue>> dependencyAttributes) throws ResolutionExceptionApply the context to the template. Method to return the query SQL.- Specified by:
getSQLQueryin classAbstractExecutableStatementBuilder- Parameters:
resolutionContext- the context of the resolutiondependencyAttributes- made available to the executable search- Returns:
- the SQL string
- Throws:
ResolutionException- if we get an error building the exception.
-
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 informationresolutionContext- current resolution context
-