@ThreadSafeAfterInit public class TemplateAttributeDefinition extends AbstractAttributeDefinition
The template is inserted into the engine with a unique name derived from this class and from the id supplied for this attribute.
| Modifier and Type | Field and Description |
|---|---|
private VelocityEngine |
engine
VelocityEngine.
|
private org.slf4j.Logger |
log
Class logger.
|
private List<String> |
sourceAttributes
The names of the attributes we need.
|
private Template |
template
Template to be evaluated.
|
private String |
templateText
Template (as Text) to be evaluated.
|
| Constructor and Description |
|---|
TemplateAttributeDefinition()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected IdPAttribute |
doAttributeDefinitionResolve(AttributeResolutionContext resolutionContext,
AttributeResolverWorkContext workContext) |
protected void |
doInitialize() |
List<String> |
getSourceAttributes()
Get the source attribute IDs.
|
Template |
getTemplate()
Get the template text to be evaluated.
|
String |
getTemplateText()
Get the template text to be evaluated.
|
VelocityEngine |
getVelocityEngine()
Get the
VelocityEngine to be used. |
void |
setSourceAttributes(List<String> newSourceAttributes)
Set the source attribute IDs.
|
void |
setTemplateText(String velocityTemplate)
Set the literal text of the template to be evaluated.
|
private int |
setupSourceValues(AttributeResolverWorkContext workContext,
Map<String,Iterator<IdPAttributeValue<?>>> sourceValues)
Set up a map which can be used to populate the template.
|
void |
setVelocityEngine(VelocityEngine velocityEngine)
Set the
VelocityEngine to be used. |
doResolve, getAttributeEncoders, getDisplayDescriptions, getDisplayNames, getLogPrefix, getSourceAttributeId, isDependencyOnly, setAttributeEncoders, setDependencyOnly, setDisplayDescriptions, setDisplayNames, setSourceAttributeIddoDestroy, equals, getActivationCondition, getDependencies, getProfileContextStrategy, hashCode, isPropagateResolutionExceptions, resolve, setActivationCondition, setDependencies, setProfileContextStrategy, setPropagateResolutionExceptionssetIdgetIddestroy, initialize, isDestroyed, isInitializedclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetActivationCondition, getDependencies, isPropagateResolutionExceptions, resolveinitialize, isInitializeddestroy, isDestroyedgetId@Nonnull private final org.slf4j.Logger log
@NonnullAfterInit private Template template
@NonnullAfterInit private String templateText
@NonnullAfterInit private VelocityEngine engine
@Nonnull @NonnullElements private List<String> sourceAttributes
@Nonnull @Unmodifiable @NonnullElements public List<String> getSourceAttributes()
public void setSourceAttributes(@Nonnull@NullableElements List<String> newSourceAttributes)
newSourceAttributes - the source attribute IDs@NonnullAfterInit public Template getTemplate()
@NonnullAfterInit public String getTemplateText()
public void setTemplateText(@Nullable String velocityTemplate)
velocityTemplate - template to be evaluated@NonnullAfterInit public VelocityEngine getVelocityEngine()
VelocityEngine to be used.public void setVelocityEngine(@Nonnull VelocityEngine velocityEngine)
VelocityEngine to be used.velocityEngine - engine to be usedprotected void doInitialize()
throws ComponentInitializationException
doInitialize in class AbstractAttributeDefinitionComponentInitializationException@Nonnull protected IdPAttribute doAttributeDefinitionResolve(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException
doAttributeDefinitionResolve in class AbstractAttributeDefinitionResolutionExceptionprivate int setupSourceValues(@Nonnull AttributeResolverWorkContext workContext, @Nonnull@NonnullElements Map<String,Iterator<IdPAttributeValue<?>>> sourceValues) throws ResolutionException
Finally, the names of the source attributes is checked against the dependency attributes and if there is a mismatch then a warning is emitted.
workContext - source for dependenciessourceValues - to populate with the attribute iteratorsResolutionException - if there is a mismatched count of attributesCopyright © 1999–2017 Shibboleth Consortium. All rights reserved.