Customize the Default Notification Templates

To customize the default notification templates, complete the following steps:

  1. Customize the Organization by defining the application name. Select a logo for the organization. See "Notification Tokens" in Configure the Default Notification Templates to understand how CSA must be configured so that email templates can pull in data.

  2. Go to csa.war\WEB-INF\classes\notifications and backup the default templates.

    Use the original files for reference as notifications may stop working if the email templates are modified incorrectly.

  3. From the Cloud Service Management Console, get the Organization Identifier of the organization for which notifications must be sent. Use this name as seen in the Provider Portal (case is sensitive) and create a directory using this name under <PERSISTENT_VOLUME_PATH>/sync/csa/jboss-as/csa.war/WEB-INF/classes/notifications. Copy the default email templates to this location. Modify the templates as required.
  4. To create design-specific email templates, use the name of the Service design. Make a copy of ORDER.html in the same location, and rename it as follows:

    <SERVICE DESIGN NAME>$ORDER.html, using $ as a separator between the design name name and ORDER.html. Modify this template as required.

  5. For notifications mentioning new services, data on visible components and their non-encrypted visible properties can be retrieved as follows:

    ${PARENT_COMPONENT_NAME-CHILD_COMPONENT_NAME.propertyName}.

    If a design is created in the Cloud Service Management Console as shown below, then the tokens will be created for the properties in the Server component. For example, a property called “serverCount” stored as a property in the component with the name (not display name!) SERVER_GROUP whose parent name is INFRASTRUCTURE_SERVICE, then the property is accessed in the email template as ${INFRASTRUCTURE_SERVICE-SERVER_GROUP.serverCount}, where is the separator between the two components.

    Note If the component does not have a parent component, then the property can be directly accessed using the component name as ${SERVER_GROUP.serverCount}.

    The approach described above should be used if only one component will be created using the combination. If multiple components will be created using this combination of parent and child components, or if a Clone Pattern will be used to create multiple components of a component type, then use the following approach.

    The values are stored in a Java List object called PARENT_COMPONENT_NAME which contains individual Java Map objects for each child component. Use Apache Velocity’s templating language to iterate through the Java List object and retrieve the value of the properties, as shown in the following sample code:

    #foreach ($map in $SERVER_GROUP-SERVER)
         Hostname: $map.get('hostName')
         Flavor: $map.get('nCPU')CPU and $map.get('memory')Mb RAM
         Storage: $map.get('disk')Gb
    #end