Class VelocityProvider

java.lang.Object
com.saperion.rs.entityprovider.VelocityProvider

public final class VelocityProvider extends Object
This class creates and configures a static velocity instance.
  • Method Details

    • getVelocity

      public static org.apache.velocity.VelocityContext getVelocity() throws Exception
      Builds and returns an instance of the VelocityContext.
      Returns:
      an instance of the VelocityContext.
      Throws:
      Exception - if an error occurs.
    • getTemplate

      public static org.apache.velocity.Template getTemplate(String name) throws Exception
      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.