Package com.saperion.rs.entityprovider
Class VelocityProvider
java.lang.Object
com.saperion.rs.entityprovider.VelocityProvider
This class creates and configures a static velocity instance.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getContent
(String templateName, String placeholderName, Object contextObject) Builds a String using the Velocity template engine with a template by the given templateName.static org.apache.velocity.Template
getTemplate
(String name) Returns the Template by the given name if existing.static org.apache.velocity.VelocityContext
Builds and returns an instance of the VelocityContext.
-
Method Details
-
getVelocity
Builds and returns an instance of the VelocityContext.- Returns:
- an instance of the VelocityContext.
- Throws:
Exception
- if an error occurs.
-
getTemplate
Returns the Template by the given name if existing.- Parameters:
name
- The filename of the template to get.- Returns:
- the required template instance.
- Throws:
Exception
- if an error occurs or the template does not exist.
-
getContent
public static String getContent(String templateName, String placeholderName, Object contextObject) throws Exception Builds a String using the Velocity template engine with a template by the given templateName. The given contextObject will be put to the template context by the name of the given placeholderName.- Parameters:
templateName
- The name of the template to use.placeholderName
- The name of the placeholder to use.contextObject
- The context object to use.- Returns:
- the created String.
- Throws:
Exception
- if an error occurs.
-