org.kuali.rice.kew.mail.service.impl
Class StyleableEmailContentServiceImpl

java.lang.Object
  extended by org.kuali.rice.kew.mail.service.impl.BaseEmailContentServiceImpl
      extended by org.kuali.rice.kew.mail.service.impl.StyleableEmailContentServiceImpl
All Implemented Interfaces:
EmailContentService

public class StyleableEmailContentServiceImpl
extends BaseEmailContentServiceImpl

EmailContentService that serves EmailContent customizable via XSLT style sheets The global email style name is: kew.email.style If this style is not found, the resource 'defaultEmailStyle.xsl' will be retrieved relative to this class.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
protected  String DEFAULT_EMAIL_STYLESHEET_RESOURCE_LOC
           
protected  String globalEmailStyleSheet
           
protected  RouteHeaderService routeHeaderService
           
protected  EmailStyleHelper styleHelper
           
protected  StyleService styleService
           
 
Fields inherited from class org.kuali.rice.kew.mail.service.impl.BaseEmailContentServiceImpl
defaultEmailFromAddress, deploymentEnvironment
 
Constructor Summary
StyleableEmailContentServiceImpl()
           
 
Method Summary
protected static void addCDataElement(Document doc, Element baseElement, String elementName, Object elementData)
           
protected static void addDelegatorElement(Document doc, Element baseElement, ActionItem actionItem)
           
protected  void addDocumentHeaderXML(Document document, DocumentRouteHeaderValue documentHeader, Node node, String elementName)
          This method handles converting the DocumentRouteHeaderValue into an XML representation.
protected static void addObjectXML(Document doc, Object o, Node node, String name)
           
protected  void addSummarizedActionItem(Document doc, ActionItem actionItem, Person user, Node node, DocumentRouteHeaderValue routeHeader)
          This method is used to add the given ActionItem to the given Document in a summarized form for use in weekly or daily type reminder e-mails.
protected static void addTextElement(Document doc, Element baseElement, String elementName, Object elementData)
           
protected static void addTimestampElement(Document doc, Element baseElement, String elementName, Date elementData)
           
protected static void addWorkgroupRequestElement(Document doc, Element baseElement, ActionItem actionItem)
           
 EmailContent generateDailyReminder(Person user, Collection<ActionItem> actionItems)
           
protected  EmailContent generateEmailContent(String styleName, Document doc)
           
 EmailContent generateFeedback(FeedbackForm form)
           
 EmailContent generateImmediateReminder(Person user, ActionItem actionItem, DocumentType documentType)
          This method generates an EmailContent object using the given parameters.
protected  EmailContent generateReminderForActionItems(Person user, Collection<ActionItem> actionItems, String name, String style)
           
 EmailContent generateWeeklyReminder(Person user, Collection<ActionItem> actionItems)
           
protected static DocumentBuilder getDocumentBuilder(boolean coalesce)
           
 DocumentRouteHeaderValue getRouteHeader(ActionItem actionItem)
           
protected  Map<String,DocumentRouteHeaderValue> getRouteHeaders(Collection<ActionItem> actionItems)
           
protected  Templates getStyle(String styleName)
          This method retrieves the style from the system using the given name.
 void setGlobalEmailStyleSheet(String globalEmailStyleSheet)
           
protected  void setStandardAttributes(Element e)
           
 void setStyleService(StyleService styleService)
           
protected static String transform(Templates style, Document doc)
           
 
Methods inherited from class org.kuali.rice.kew.mail.service.impl.BaseEmailContentServiceImpl
getActionListUrl, getApplicationEmailAddress, getCustomEmailAttribute, getDeploymentEnvironment, getDocumentTypeEmailAddress, getPreferencesUrl, setDefaultEmailFromAddress, setDeploymentEnvironment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_EMAIL_STYLESHEET_RESOURCE_LOC

protected final String DEFAULT_EMAIL_STYLESHEET_RESOURCE_LOC
See Also:
Constant Field Values

styleService

protected StyleService styleService

styleHelper

protected EmailStyleHelper styleHelper

globalEmailStyleSheet

protected String globalEmailStyleSheet

routeHeaderService

protected RouteHeaderService routeHeaderService
Constructor Detail

StyleableEmailContentServiceImpl

public StyleableEmailContentServiceImpl()
Method Detail

setStyleService

public void setStyleService(StyleService styleService)

setGlobalEmailStyleSheet

public void setGlobalEmailStyleSheet(String globalEmailStyleSheet)

getDocumentBuilder

protected static DocumentBuilder getDocumentBuilder(boolean coalesce)

addObjectXML

protected static void addObjectXML(Document doc,
                                   Object o,
                                   Node node,
                                   String name)
                            throws Exception
Throws:
Exception

addTextElement

protected static void addTextElement(Document doc,
                                     Element baseElement,
                                     String elementName,
                                     Object elementData)

addCDataElement

protected static void addCDataElement(Document doc,
                                      Element baseElement,
                                      String elementName,
                                      Object elementData)

addTimestampElement

protected static void addTimestampElement(Document doc,
                                          Element baseElement,
                                          String elementName,
                                          Date elementData)

addDelegatorElement

protected static void addDelegatorElement(Document doc,
                                          Element baseElement,
                                          ActionItem actionItem)

addWorkgroupRequestElement

protected static void addWorkgroupRequestElement(Document doc,
                                                 Element baseElement,
                                                 ActionItem actionItem)

addSummarizedActionItem

protected void addSummarizedActionItem(Document doc,
                                       ActionItem actionItem,
                                       Person user,
                                       Node node,
                                       DocumentRouteHeaderValue routeHeader)
                                throws Exception
This method is used to add the given ActionItem to the given Document in a summarized form for use in weekly or daily type reminder e-mails.

Parameters:
doc - - Document to have the ActionItem added to
actionItem - - the action item being added
user - - the current user
node - - the node object to add the actionItem XML to (defaults to the doc variable if null is passed in)
Throws:
Exception

getRouteHeader

public DocumentRouteHeaderValue getRouteHeader(ActionItem actionItem)

getRouteHeaders

protected Map<String,DocumentRouteHeaderValue> getRouteHeaders(Collection<ActionItem> actionItems)

transform

protected static String transform(Templates style,
                                  Document doc)

getStyle

protected Templates getStyle(String styleName)
This method retrieves the style from the system using the given name. If none is found the default style xsl file defined by DEFAULT_EMAIL_STYLESHEET_RESOURCE_LOC is used.

Parameters:
styleName -
Returns:
a valid Templates using either the given styleName or the default xsl style file

generateEmailContent

protected EmailContent generateEmailContent(String styleName,
                                            Document doc)

generateReminderForActionItems

protected EmailContent generateReminderForActionItems(Person user,
                                                      Collection<ActionItem> actionItems,
                                                      String name,
                                                      String style)

setStandardAttributes

protected void setStandardAttributes(Element e)

generateImmediateReminder

public EmailContent generateImmediateReminder(Person user,
                                              ActionItem actionItem,
                                              DocumentType documentType)
This method generates an EmailContent object using the given parameters. Part of this operation includes serializing the given ActionItem to XML. The following objects and methods are included in the serialization:

Parameters:
user - - the current user
actionItem - - the action item being added
documentType - - the document type that the custom email style sheet will come from
node - - the node object to add the actionItem XML to (defaults to the doc variable if null is passed in)
Throws:
Exception

addDocumentHeaderXML

protected void addDocumentHeaderXML(Document document,
                                    DocumentRouteHeaderValue documentHeader,
                                    Node node,
                                    String elementName)
                             throws Exception
This method handles converting the DocumentRouteHeaderValue into an XML representation. The reason we can't just use propertiesToXml like we have elsewhere is because the doc header has a String attached to it that has the XML document content in it. The default serialization of this will serialize this as a String so we will end up with escaped XML in our output which we won't be able to process with the email stylesheet. So we need to read the xml content from the document and parse it into a DOM object so it can be appended to our output.

Throws:
Exception

generateWeeklyReminder

public EmailContent generateWeeklyReminder(Person user,
                                           Collection<ActionItem> actionItems)

generateDailyReminder

public EmailContent generateDailyReminder(Person user,
                                          Collection<ActionItem> actionItems)

generateFeedback

public EmailContent generateFeedback(FeedbackForm form)


Copyright © 2005-2015 The Kuali Foundation. All Rights Reserved.