public class TemplateEngine extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
TemplateEngine.CharacterEscapingStrategy
Represents a domain specific strategy for escaping values used within a template.
|
| Modifier and Type | Field and Description |
|---|---|
private org.slf4j.Logger |
log
Class logger.
|
private org.apache.velocity.app.VelocityEngine |
velocity
Velocity engine to use to render templates.
|
| Constructor and Description |
|---|
TemplateEngine(org.apache.velocity.app.VelocityEngine engine)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
createStatement(String templateName,
ShibbolethResolutionContext resolutionContext,
List<String> dependencies,
TemplateEngine.CharacterEscapingStrategy escapingStrategy)
Create a statement from a give template by replacing it's macro's with information within the resolution context.
|
protected org.apache.velocity.VelocityContext |
createVelocityContext(ShibbolethResolutionContext resolutionContext,
List<String> dependencies,
TemplateEngine.CharacterEscapingStrategy escapingStrategy)
Creates the velocity context from the given resolution context.
|
protected List<Object> |
prepareAttributeValues(BaseAttribute attribute,
TemplateEngine.CharacterEscapingStrategy escapingStrategy)
Prepares an attributes values for use within a template.
|
void |
registerTemplate(String templateName,
String template)
Registers a template under a given name.
|
private final org.slf4j.Logger log
private final org.apache.velocity.app.VelocityEngine velocity
public TemplateEngine(org.apache.velocity.app.VelocityEngine engine)
engine - velocity engine used to evaluate templatespublic void registerTemplate(String templateName, String template)
templateName - name to register the template undertemplate - template to registerpublic String createStatement(String templateName, ShibbolethResolutionContext resolutionContext, List<String> dependencies, TemplateEngine.CharacterEscapingStrategy escapingStrategy) throws AttributeResolutionException
templateName - name of the templateresolutionContext - the current resolution contextdependencies - the list of resolution plug-in dependencies that will provider attributesescapingStrategy - strategy used to escape values, may be null if no escaping is necessaryAttributeResolutionException - thrown if the given template can not be populated because it is malformed or
the given data connectors or attribute definitions error out during resolutionprotected org.apache.velocity.VelocityContext createVelocityContext(ShibbolethResolutionContext resolutionContext, List<String> dependencies, TemplateEngine.CharacterEscapingStrategy escapingStrategy) throws AttributeResolutionException
resolutionContext - the resolution context containing the currently resolved attribute informationdependencies - resolution plug-in dependencies that will provide attributes to the velocity contextescapingStrategy - strategy used to escape valuesAttributeResolutionException - thrown if a resolution plugin errors out while resolving its attributesprotected List<Object> prepareAttributeValues(BaseAttribute attribute, TemplateEngine.CharacterEscapingStrategy escapingStrategy)
attribute - attribute whose values are to be preparedescapingStrategy - character escaping strategy to be suedCopyright © 1999-2015. All Rights Reserved.