Class TemplatedExecutableStatementBuilder
java.lang.Object
net.shibboleth.utilities.java.support.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
- Direct Known Subclasses:
V2CompatibleTemplatedExecutableStatementBuilder
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 class
Escapes SQL values added to the template context. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.velocity.app.VelocityEngine
VelocityEngine.private org.apache.velocity.app.event.ReferenceInsertionEventHandler
Event handler used for escaping.private final org.slf4j.Logger
Class logger.private Template
Template to be evaluated.private String
Template (as Text) to be evaluated.private boolean
Do we need to make ourself V2 Compatible? -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addExtraVelocityContext
(org.apache.velocity.VelocityContext velocityContext, AttributeResolutionContext resolutionContext) Method to allow private additions to the velocity context.protected void
org.apache.velocity.app.event.ReferenceInsertionEventHandler
Gets theReferenceInsertionEventHandler
to be used.final String
getSQLQuery
(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.VelocityEngine
Gets theVelocityEngine
to be used.boolean
Are we in V2 Compatibility mode?protected String
merge
(org.apache.velocity.VelocityContext context) InvokesTemplate.merge(org.apache.velocity.context.Context)
on the supplied context.void
setReferenceInsertionEventHandler
(org.apache.velocity.app.event.ReferenceInsertionEventHandler handler) Sets theReferenceInsertionEventHandler
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 theVelocityEngine
to be used.Methods inherited from class net.shibboleth.idp.attribute.resolver.dc.rdbms.AbstractExecutableStatementBuilder
build, getQueryTimeout, setQueryTimeout
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, 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
private org.apache.velocity.app.VelocityEngine engineVelocityEngine. -
eventHandler
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 theVelocityEngine
to be used.- Returns:
- the template
-
setVelocityEngine
public void setVelocityEngine(@Nonnull org.apache.velocity.app.VelocityEngine velocityEngine) Sets theVelocityEngine
to be used.- Parameters:
velocityEngine
- engine to be used
-
getReferenceInsertionEventHandler
@Nullable public org.apache.velocity.app.event.ReferenceInsertionEventHandler getReferenceInsertionEventHandler()Gets theReferenceInsertionEventHandler
to be used.- Returns:
- the reference insertion event handler
-
setReferenceInsertionEventHandler
public void setReferenceInsertionEventHandler(@Nullable org.apache.velocity.app.event.ReferenceInsertionEventHandler handler) Sets theReferenceInsertionEventHandler
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.
-
merge
InvokesTemplate.merge(org.apache.velocity.context.Context)
on the supplied context.- Parameters:
context
- to merge- Returns:
- result of the merge operation
-
getSQLQuery
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:
getSQLQuery
in 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
-
doInitialize
- Overrides:
doInitialize
in classAbstractInitializableComponent
- Throws:
ComponentInitializationException
-