com.atlassian.jira.template
Class DefaultTemplateManager

java.lang.Object
  extended by com.atlassian.jira.template.DefaultTemplateManager
All Implemented Interfaces:
TemplateManager

public class DefaultTemplateManager
extends Object
implements TemplateManager

A manager for the email velocity templates within the system.

Currently, the system initialises the tempalte table by reading from the email-template-id-mappings.xml file. Custom templates can be added to this file - ensuring that an appropriate ID is given to the new template (e.g. >= 10000).


Constructor Summary
DefaultTemplateManager(ApplicationProperties applicationProperties, EventTypeManager eventTypeManager)
           
 
Method Summary
 Template getDefaultTemplate(EventType eventType)
          Retrieve the default template for specified event type.
 Template getTemplate(Long templateId)
           
 Template getTemplate(SchemeEntity notificationSchemeEntity)
          Retrieve the template from the notification scheme entity.
 String getTemplateContent(Long templateId, String format)
           
 Map getTemplatesMap(String type)
          Retrieve a map of templates of the specified type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTemplateManager

public DefaultTemplateManager(ApplicationProperties applicationProperties,
                              EventTypeManager eventTypeManager)
Method Detail

getTemplate

public Template getTemplate(Long templateId)
Specified by:
getTemplate in interface TemplateManager

getTemplate

public Template getTemplate(SchemeEntity notificationSchemeEntity)
Retrieve the template from the notification scheme entity.

If the scheme entity is not related to a template id - return the default template for the event type. The eventTypeId corresponds to the default template id if there is no specific template association.

Specified by:
getTemplate in interface TemplateManager
Parameters:
notificationSchemeEntity - a notification scheme entity object

getDefaultTemplate

public Template getDefaultTemplate(EventType eventType)
Retrieve the default template for specified event type.

Parameters:
eventType - event type to retrieve the default template for
Returns:
template default template for specified event type

getTemplatesMap

public Map getTemplatesMap(String type)
Retrieve a map of templates of the specified type.

Specified by:
getTemplatesMap in interface TemplateManager
Parameters:
type - String specifiying the type of template to retrieve
Returns:
Map template IDs -> template objects

getTemplateContent

public String getTemplateContent(Long templateId,
                                 String format)
Specified by:
getTemplateContent in interface TemplateManager


Copyright © 2002-2012 Atlassian. All Rights Reserved.