Example
The following example is the dynamic Velocity template for the default template used by Optimize to generate e-mail alerts. The [SUBJECT] and [BODY] tags denote the two currently supported sections of this template. Each section defines a separate Velocity template that uses the same action context.
[SUBJECT] $rule.instanceName
[BODY]
------------------------------------------------------------------
Rule Details:
Name: ${rule.name}
Instance name: ${rule.instanceName}
Description: ${rule.description}
Status: ${rule.status}
Severity: ${rule.severity}
Definition: ${rule.definition}
Evaluation: ${rule.evaluation}
URL: ${rule.URL}
Rule type: ${rule.ruleTypeString}
SLA: ${rule.sla}
Customer: ${rule.customer}
------------------------------------------------------------------
Diagnosis Details:
Start date: ${diagnosis.startDate}
End date: ${diagnosis.endDate}
Violation count: ${diagnosis.violationCount}
Violation id: ${diagnosis.violationId}
------------------------------------------------------------------
#foreach ($mapName in $context.getEvents().keySet())
#if ($rule.ruleTypeId == 1)
Event Details for Event Map: $mapName
#else
Event Details for KPI: $mapName
#end
#foreach ($event in $context.getEvents().get($mapName))
#if ($event.getDimensions().size() == 0)
Monitor dimensions: N/A
#else
Monitor dimensions:
#foreach ($dim in $event.dimensions)
$dim.dimensionName: $dim.dimensionValue
#end
#end
Attributes:
#foreach ($attrKey in $event.getAttributes().keySet())
#foreach ($attrValue in $event.getAttributes().get($attrKey))
$attrKey: $attrValue
#end
#end
#if ($event.getProcessInfo().size() > 0)
Number of Processes: $event.getProcessInfo().size()
#foreach ($procInfo in $event.processInfo)
#if ($procInfo.name)
Process info:
Name: $procInfo.name
Id: $procInfo.instanceExternalId
#if ($procInfo.stepName)
Step name: $procInfo.stepName
#end
URL: $procInfo.getURL()
#else
Process info: N/A
#end
#end
#end
#end
#end
------------------------------------------------------------------
For an example e-mail alert generated from this template, see webMethods Optimize User’s Guide.