Package com.avoka.tm.util
Class VelTemplate
java.lang.Object
com.avoka.tm.util.VelTemplate
Provides a Apache Velocity templating class.
Examples
Email Template from Service Parameter
Provides an example creating an email body message using a Velocity template provided as a service parameter.
 import com.avoka.tm.util.*
 String emailTemplate = svcDef.paramsMap["emailTemplate"]
 User user = ...
 String emailMessage  = new VelTemplate()
      .setTemplate(emailTemplate)
      .addModelValue("user", user)
      .merge() 
 Email Template from Organization Property
Provides an example creating an email body message using a Velocity template provided from an Organization property.
 import com.avoka.tm.query.*
 import com.avoka.tm.util.*
 String emailTemplate = new PropertyQuery()
      .setName("HTML Email Welcome")
      .setClientCode("maguire")
      .getValue()
 User user = ...
 String emailMessage  = new VelTemplate()
      .setTemplate(emailTemplate)
      .addModelValue("user", user)
      .merge() - Since:
- 5.0.0
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddModelValue(String key, Object value) Set the model key and value to merge with the template.merge()Merge the velocity template with the model and return the evaluated text value.Set the model value to merge with the template.setTemplate(String template) Set the Velocity template value.
- 
Constructor Details- 
VelTemplatepublic VelTemplate()
 
- 
- 
Method Details- 
setTemplateSet the Velocity template value.- Parameters:
- template- the velocity template value
- Returns:
- the vel template
 
- 
setModelSet the model value to merge with the template.- Parameters:
- model- the model value to merge with the template (required)
- Returns:
- the vel template
 
- 
addModelValueSet the model key and value to merge with the template.- Parameters:
- key- the model key to add (required)
- value- the model value to add (required)
- Returns:
- the vel template
 
- 
mergeMerge the velocity template with the model and return the evaluated text value.- Returns:
- the evaluated text value from merging the Velocity template with the model
 
 
-