com.waveset.object
Class EmailTemplate

java.lang.Object
  extended bycom.waveset.object.PersistentObject
      extended bycom.waveset.object.EmailTemplate
All Implemented Interfaces:
java.lang.Comparable, Library.Member, javax.naming.Referenceable, XmlObject

public class EmailTemplate
extends PersistentObject
implements Library.Member

A class used to represent email templates. The provisioning engine and other parts of the system need to send email messages at certain points. But since the content of these messages must be configurable, we use message templates stored in the repository.

There will be a collection of built-in email templates that are expected to exist. Their names are defined in Constants.java.

Customer defined templates may also be referenced from workflow processes.

All fields of the template may contain references to "variables" that will be substituted when the template is processed. The names of the available variables will depend on the context in which the template is used. The syntax for a variable reference is $(name) where name is substituted with the name of a variable.

It is recommended that any variable you reference in the body have a corresponding variable definition. This will allow tools to detect unresolved variable references and issue warnings.

Some fields, such as _toAddress are usually not specified in the template object, but instead filled in by the system.


Nested Class Summary
 
Nested classes inherited from class com.waveset.object.PersistentObject
PersistentObject.Comparator, PersistentObject.InitialInstance
 
Field Summary
static java.lang.String ATT_CC
           
static java.lang.String ATT_FROM
           
static java.lang.String ATT_HOST
           
static java.lang.String ATT_HTML
           
static java.lang.String ATT_MIME
           
static java.lang.String ATT_TO
           
static java.lang.String code_id
           
static java.lang.String EL_BODY
           
static java.lang.String EL_COMMENTS
           
static java.lang.String EL_SUBJECT
           
static java.lang.String VAR_BODY
           
static java.lang.String VAR_CC
           
static java.lang.String VAR_FROM
           
static java.lang.String VAR_FROM_ADDRESS
          Deprecated. - use FROM
static java.lang.String VAR_HOST
           
static java.lang.String VAR_MIME_TYPE
           
static java.lang.String VAR_SUBJECT
           
static java.lang.String VAR_TO
           
static java.lang.String VAR_TO_ADDRESS
          Deprecated. - use TO
 
Fields inherited from class com.waveset.object.PersistentObject
_trace, trace
 
Constructor Summary
EmailTemplate()
          Build an empty template object.
EmailTemplate(org.w3c.dom.Element e)
          Flesh out a template object by parsing its XML representation.
 
Method Summary
 java.lang.String getBody()
          Get the string that will used as the body of the email.
 java.lang.String getBody(VariableResolver res)
          Generate the body.
 java.lang.String getCC()
          Get the string that will appear as the "cc address" of the email.
 java.lang.String getComments()
           
 java.lang.String getEffectiveMimeType()
           
 java.lang.String getFrom()
          Get the string that will appear as the "from address" of the email.
 java.lang.String getFromAddress()
          Deprecated. Use getFrom() instead
 Library getLibrary()
          Gets the library.
 java.lang.String getMimeType()
           
 java.lang.String getSmtpHost()
          Get the name of the SMTP host to which mail will be sent.
 java.lang.String getSubject()
          Get the string that will appear as the subject of the email.
 java.lang.String getTo()
          Get the string that will appear as the "to address" of the email.
 java.lang.String getToAddress()
          Deprecated. Use getTo() instead
 Type getType()
          Returns the associated Type object.
 java.lang.Object getVariable(java.lang.String name, ExState state)
          Return the value of a variable.
 java.util.List getVariables()
           
 boolean hasVariable(java.lang.String name)
          Return true if we have a value for a variable.
 boolean isHtmlEnabled()
           
protected  void parseSubclassAttributes(org.w3c.dom.Element e)
          Each concrete subclass should parse from the XML buffer any persisted subclass-specific fields (generally, the same ones that it writes into the buffer).
protected  void parseSubclassElements(org.w3c.dom.Element e)
          Each concrete subclass should parse from the XML buffer any persisted subclass-specific elements (generally, the same ones that it writes into the buffer).
 void setBody(java.lang.String s)
          Set the string that will used as the body of the email.
 void setCC(java.lang.String s)
          Set the string that will appear as the "cc address" of the email.
 void setComments(java.lang.String s)
           
 void setFrom(java.lang.String s)
          Set the string that will appear as the "from address" of the email.
 void setFromAddress(java.lang.String s)
          Deprecated. Use setFrom() instead
 void setHtmlEnabled(boolean isEnabled)
           
 void setLibrary(Library lib)
          Remember when we're placed in a library.
 void setMimeType(java.lang.String s)
           
 void setSmtpHost(java.lang.String s)
          Set the name of the SMTP host to which mail will be sent.
 void setSubject(java.lang.String s)
          Set the string that will appear as the subject of the email.
 void setTo(java.lang.String s)
          Set the string that will appear as the "to address" of the email.
 void setToAddress(java.lang.String s)
          Deprecated. Uset setTo() instead
 void setVariables(java.util.List vars)
           
 void toXml(java.lang.StringBuffer b)
          This is what PersistentObject.toXml calls.
 void toXml(java.lang.StringBuffer b, int indent)
          This is what XmlObjectFactory calls.
 void visit(Visitor v)
          Visitor interface.
 
Methods inherited from class com.waveset.object.PersistentObject
addCommonElements, addEndTag, addMemberObjectGroup, addMemberObjectGroup, addPersistentAttributes, addStartTag, addSubclassAttributes, addSubclassElements, addSummaryAttributes, addXmlHeader, attributesMatch, attributesMatch, attributesMatch, checkReference, checkReferences, clearId, cloneAs, cloneObject, compareTo, create, create, create, create, createLastModItem, createLastModItem, createLastModItemList, directObjectGroupMember, dump, dumpFile, equals, fakeId, getAttribute, getAttributeValues, getAttributeValues, getAuthReferences, getAuthType, getBasicAttributes, getBasicAttributes, getBasicAttributes, getCache, getCounterValue, getCreateDate, getCreator, getDisplayableName, getDisplayName, getElementName, getEncryptedValues, getId, getIdOrName, getInitialInstances, getLastMod, getLastModDate, getLastModifier, getLastModItemId, getLockInfo, getMemberObjectGroupRefs, getMemberObjectGroupRefsUpTo, getMemberObjectGroups, getName, getNameOrId, getProperties, getProperty, getPropertyAsString, getPropertyList, getQueryableAttributes, getReference, getReferences, getRuleDrivenMemberObjectGroupRefs, getRuleDrivenMemberObjectGroupRefsUpTo, getRuleDrivenMemberObjectGroups, getSubtype, getSummaryAttributes, getSummaryString, hasEncryptedData, hashCode, identityEquals, isAlias, isHidden, isId, isProtected, isProtectedFromDelete, isReferencedIn, listOperationalAttributes, listQueryableAttributes, listQueryableReferenceAttributes, listSummaryAttributes, objectGroupMember, objectGroupMemberRef, parseCommonElement, parseCommonElements, parsePersistentAttributes, parseXml, parseXml, prepareForSerialization, prepareToSerialize, println, reEncrypt, reEncryptSubclassAttributes, removeMemberObjectGroup, removeProperty, resolve, resolve, resolve, resolveArray, resolveArrayByFetching, resolveObjectReference, resolveObjectReferences, resolveReference, resolveSummaryAttributes, resolveSummaryAttributes, ruleDrivenObjectGroupMemberRef, setAuthType, setAuthType, setCache, setCreateDate, setCreator, setDisplayName, setDisplayName, setHidden, setIsAlias, setLastMod, setLastMod, setLastModDate, setLastModifier, setMemberObjectGroupRef, setMemberObjectGroupRefs, setMemberObjectGroups, setName, setProperties, setProperty, setPropertyList, setProtected, setProtectedFromDelete, setRuleDrivenMembersCache, setSubtype, setTrace, toString, toXml, toXmlFile
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.waveset.object.Library.Member
getName
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

VAR_HOST

public static final java.lang.String VAR_HOST
See Also:
Constant Field Values

VAR_FROM_ADDRESS

public static final java.lang.String VAR_FROM_ADDRESS
Deprecated. - use FROM

See Also:
Constant Field Values

VAR_FROM

public static final java.lang.String VAR_FROM
See Also:
Constant Field Values

VAR_TO_ADDRESS

public static final java.lang.String VAR_TO_ADDRESS
Deprecated. - use TO

See Also:
Constant Field Values

VAR_TO

public static final java.lang.String VAR_TO
See Also:
Constant Field Values

VAR_CC

public static final java.lang.String VAR_CC
See Also:
Constant Field Values

VAR_SUBJECT

public static final java.lang.String VAR_SUBJECT
See Also:
Constant Field Values

VAR_BODY

public static final java.lang.String VAR_BODY
See Also:
Constant Field Values

VAR_MIME_TYPE

public static final java.lang.String VAR_MIME_TYPE
See Also:
Constant Field Values

ATT_HOST

public static final java.lang.String ATT_HOST
See Also:
Constant Field Values

ATT_FROM

public static final java.lang.String ATT_FROM
See Also:
Constant Field Values

ATT_TO

public static final java.lang.String ATT_TO
See Also:
Constant Field Values

ATT_CC

public static final java.lang.String ATT_CC
See Also:
Constant Field Values

ATT_HTML

public static final java.lang.String ATT_HTML
See Also:
Constant Field Values

ATT_MIME

public static final java.lang.String ATT_MIME
See Also:
Constant Field Values

EL_COMMENTS

public static final java.lang.String EL_COMMENTS
See Also:
Constant Field Values

EL_SUBJECT

public static final java.lang.String EL_SUBJECT
See Also:
Constant Field Values

EL_BODY

public static final java.lang.String EL_BODY
See Also:
Constant Field Values
Constructor Detail

EmailTemplate

public EmailTemplate()
Build an empty template object.


EmailTemplate

public EmailTemplate(org.w3c.dom.Element e)
              throws WavesetException
Flesh out a template object by parsing its XML representation.

Method Detail

getType

public Type getType()
Returns the associated Type object.

Specified by:
getType in class PersistentObject

visit

public void visit(Visitor v)
           throws WavesetException
Visitor interface.

Overrides:
visit in class PersistentObject
Throws:
WavesetException

getFromAddress

public java.lang.String getFromAddress()
Deprecated. Use getFrom() instead

Get the string that will appear as the "from address" of the email.


setFromAddress

public void setFromAddress(java.lang.String s)
Deprecated. Use setFrom() instead

Set the string that will appear as the "from address" of the email.


getFrom

public java.lang.String getFrom()
Get the string that will appear as the "from address" of the email. This may be a csv of either email addresses or lighthouse user names.


setFrom

public void setFrom(java.lang.String s)
Set the string that will appear as the "from address" of the email. This may be a csv of either email addresses or lighthouse user names.


getToAddress

public java.lang.String getToAddress()
Deprecated. Use getTo() instead

Get the string that will appear as the "to address" of the email.


setToAddress

public void setToAddress(java.lang.String s)
Deprecated. Uset setTo() instead

Set the string that will appear as the "to address" of the email.


getTo

public java.lang.String getTo()
Get the string that will appear as the "to address" of the email. This may be a csv of either email addresses or lighthouse user names.


setTo

public void setTo(java.lang.String s)
Set the string that will appear as the "to address" of the email. This may be a csv of either email addresses or lighthouse user names.


getCC

public java.lang.String getCC()
Get the string that will appear as the "cc address" of the email. This may be a csv of either email addresses or lighthouse user names.


setCC

public void setCC(java.lang.String s)
Set the string that will appear as the "cc address" of the email. This may be a csv of either email addresses or lighthouse user names.


getSubject

public java.lang.String getSubject()
Get the string that will appear as the subject of the email.


setSubject

public void setSubject(java.lang.String s)
Set the string that will appear as the subject of the email.


getBody

public java.lang.String getBody()
Get the string that will used as the body of the email.

This string typically contains references to variables.


setBody

public void setBody(java.lang.String s)
Set the string that will used as the body of the email.


getSmtpHost

public java.lang.String getSmtpHost()
Get the name of the SMTP host to which mail will be sent.


setSmtpHost

public void setSmtpHost(java.lang.String s)
Set the name of the SMTP host to which mail will be sent.


isHtmlEnabled

public boolean isHtmlEnabled()

setHtmlEnabled

public void setHtmlEnabled(boolean isEnabled)

getVariables

public java.util.List getVariables()

setVariables

public void setVariables(java.util.List vars)

getComments

public java.lang.String getComments()

setComments

public void setComments(java.lang.String s)

setMimeType

public void setMimeType(java.lang.String s)

getMimeType

public java.lang.String getMimeType()

getEffectiveMimeType

public java.lang.String getEffectiveMimeType()

hasVariable

public boolean hasVariable(java.lang.String name)
Return true if we have a value for a variable. This is used so that we can implement "hard null", where a local variable bound to null can override an external variable. You can't simply assume that if getVariable returns non-null that there isn't a locally bound value.


getVariable

public java.lang.Object getVariable(java.lang.String name,
                                    ExState state)
                             throws WavesetException
Return the value of a variable.

Throws:
WavesetException

setLibrary

public void setLibrary(Library lib)
Remember when we're placed in a library. Will be used later to clean up the XML.

Specified by:
setLibrary in interface Library.Member

getLibrary

public Library getLibrary()
Description copied from interface: Library.Member
Gets the library.

Specified by:
getLibrary in interface Library.Member

getBody

public java.lang.String getBody(VariableResolver res)
                         throws WavesetException
Generate the body.

Throws:
WavesetException

toXml

public void toXml(java.lang.StringBuffer b)
This is what PersistentObject.toXml calls.

Overrides:
toXml in class PersistentObject

toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
This is what XmlObjectFactory calls. If we're within a Library we do not emit the irrelevant PersistentObject data.

Specified by:
toXml in interface XmlObject
Overrides:
toXml in class PersistentObject

parseSubclassAttributes

protected void parseSubclassAttributes(org.w3c.dom.Element e)
                                throws WavesetException
Description copied from class: PersistentObject
Each concrete subclass should parse from the XML buffer any persisted subclass-specific fields (generally, the same ones that it writes into the buffer).

Overrides:
parseSubclassAttributes in class PersistentObject
Throws:
WavesetException
See Also:

PersistentObject's default implementation is a no-op.

, PersistentObject.parseXml(Element)

parseSubclassElements

protected void parseSubclassElements(org.w3c.dom.Element e)
                              throws WavesetException
Description copied from class: PersistentObject
Each concrete subclass should parse from the XML buffer any persisted subclass-specific elements (generally, the same ones that it writes into the buffer).

Overrides:
parseSubclassElements in class PersistentObject
Throws:
WavesetException
See Also:

PersistentObject's default implementation is a no-op.

, PersistentObject.parseXml(Element)