public class VelocityServices
extends java.lang.Object
implements java.io.Serializable
VelocityServices
provides static methods to invoke a Velocity template.Modifier and Type | Field and Description |
---|---|
static int |
LOG_LEVEL_DEBUG
Debug log level (value 0)
|
static int |
LOG_LEVEL_ERROR
Error log level (value 3)
|
static int |
LOG_LEVEL_INFO
Info log level (value 1)
|
static int |
LOG_LEVEL_WARN
Warn log level (value 2)
|
Constructor and Description |
---|
VelocityServices() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
invokeTemplateFromFile(java.lang.String fileName)
This is equivalent to invoking method
invokeTemplateFromFile(String, int) with log level warn. |
static java.lang.String |
invokeTemplateFromFile(java.lang.String fileName,
int logLevel)
Invokes the Velocity template contained in the file specified by
fileName . |
static java.lang.String |
invokeTemplateFromInlineString(java.lang.String templateString)
This is equivalent to invoking method
invokeTemplateFromInlineString(String, int) with log level warn. |
static java.lang.String |
invokeTemplateFromInlineString(java.lang.String templateString,
int logLevel)
Invokes the Velocity template contained in parameter
templateString . |
public static final int LOG_LEVEL_DEBUG
public static final int LOG_LEVEL_INFO
public static final int LOG_LEVEL_WARN
public static final int LOG_LEVEL_ERROR
public static java.lang.String invokeTemplateFromInlineString(java.lang.String templateString) throws com.ebasetech.xi.exceptions.FormRuntimeException
invokeTemplateFromInlineString(String, int)
with log level warn.com.ebasetech.xi.exceptions.FormRuntimeException
public static java.lang.String invokeTemplateFromInlineString(java.lang.String templateString, int logLevel) throws com.ebasetech.xi.exceptions.FormRuntimeException
templateString
.
This provides integration with the Velocity template engine supplied by Apache.
The logging level controls the level of generated messages, and any such messages are written to the designer execution log (View > Execution log). Available log levels are:
LOG_LEVEL_DEBUG
)LOG_LEVEL_INFO
)LOG_LEVEL_WARN
)LOG_LEVEL_ERROR
)Javascript example:
var template = "<table border='0'> " + "#foreach ( $row in $ORDERS ) " + "<tr> " + "<td>Order Number: ${ORDERS-ORDER_NUMBER}</td>" + "<td>Order Value: ${ORDERS-ORDER_VALUE}</td> " + "</tr> " + "#end " + "</table>"; fields.RESULT.value = VelocityServices.invokeTemplateFromInlineString(template, VelocityServices.LOG_LEVEL_WARN);
templateString
- the Velocity template stringlogLevel
- see abovecom.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurspublic static java.lang.String invokeTemplateFromFile(java.lang.String fileName) throws com.ebasetech.xi.exceptions.FormRuntimeException
invokeTemplateFromFile(String, int)
with log level warn.com.ebasetech.xi.exceptions.FormRuntimeException
public static java.lang.String invokeTemplateFromFile(java.lang.String fileName, int logLevel) throws com.ebasetech.xi.exceptions.FormRuntimeException
fileName
.
This provides integration with the Velocity template engine supplied by Apache.
Only a file name can be specified for the template location, not a complete file path. All templates must be located
in the directory specified in parameter file.resource.loader.path
of properties file velocity.properties
.
The logging level controls the level of generated messages, and any such messages are written to the designer execution log (View > Execution log). Available log levels are:
LOG_LEVEL_DEBUG
)LOG_LEVEL_INFO
)LOG_LEVEL_WARN
)LOG_LEVEL_ERROR
)Javascript example:
fields.F1.value = VelocityServices.invokeTemplateFromFile("template1.vm", VelocityServices.LOG_LEVEL_DEBUG);
fileName
- the file name of the Velocity templatelogLevel
- see abovecom.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs