wt.mail
Class EMailMessage

java.lang.Object
  extended by wt.mail.EMailMessage
All Implemented Interfaces:
Externalizable, Serializable, NetFactor, ObjectMappable, RemoteAccess, Evolvable

public class EMailMessage
extends Object
implements RemoteAccess, ObjectMappable, Evolvable

An instance of this class represents an e-mail message. The subject and text bodies of the e-mail message are defined in terms of resource bundles, keys of entries within the bundles, and arrays of strings to be inserted into the entries. Various types of objects from which principals can be obtained may be added as recipients of the message. The message may be constructed as a multipart message, and the individual parts can be specified as text bodies or as URL's from which objects of any type may be read.

Use the newEMailMessage static factory method(s), not the EMailMessage constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: true

Extendable: false

See Also:
Serialized Form

Field Summary
static String MULTIPART_SUBTYPE
          Label for the attribute.
static String ORIGINATOR
          Label for the attribute.
 
Method Summary
 void addPart(String resource, String key, Object[] inserts, String contentType)
          Add a textual message body of a specific MIME content type to the message.
 void addPart(URL url)
          Add a message body whose content is read from a URL.
 void addRecipient(WTPrincipal recipient)
          Add a specific principal as a recipient of the message.
 void addRecipient(WTPrincipalReference recipient)
          Add a specific principal by reference as a recipient of the message.
 String getMultipartSubtype()
          Gets the value of the attribute: MULTIPART_SUBTYPE.
 WTPrincipalReference getOriginator()
          Gets the value of the attribute: ORIGINATOR.
 Enumeration getRecipients()
          Return the current list of recipients as an enumeration of objects.
protected  void initialize()
          Supports initialization, following construction of an instance.
static EMailMessage newEMailMessage()
          Construct a new instance with no recipients, subject, or content.
 void send(boolean immediate)
          Submit the message for delivery to its intended recipients.
 void setMultipartSubtype(String a_MultipartSubtype)
          Sets the value of the attribute: MULTIPART_SUBTYPE.
 void setOriginator(WTPrincipal originator)
          Set the originator of the message.
 void setOriginator(WTPrincipalReference a_Originator)
          Sets the value of the attribute: ORIGINATOR.
 void setSubject(String resource, String key, Object[] inserts)
          Set the resource bundle, key, and inserts from which the subject of the message will be obtained.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ORIGINATOR

public static final String ORIGINATOR
Label for the attribute.

Supported API: true

See Also:
Constant Field Values

MULTIPART_SUBTYPE

public static final String MULTIPART_SUBTYPE
Label for the attribute.

Supported API: true

See Also:
Constant Field Values
Method Detail

getOriginator

public WTPrincipalReference getOriginator()
Gets the value of the attribute: ORIGINATOR.

Supported API: true

Returns:
WTPrincipalReference

setOriginator

public void setOriginator(WTPrincipalReference a_Originator)
Sets the value of the attribute: ORIGINATOR.

Supported API: true

Parameters:
a_Originator -

getMultipartSubtype

public String getMultipartSubtype()
Gets the value of the attribute: MULTIPART_SUBTYPE.

Supported API: true

Returns:
String

setMultipartSubtype

public void setMultipartSubtype(String a_MultipartSubtype)
Sets the value of the attribute: MULTIPART_SUBTYPE.

Supported API: true

Parameters:
a_MultipartSubtype -

newEMailMessage

public static EMailMessage newEMailMessage()
                                    throws WTException
Construct a new instance with no recipients, subject, or content.

Supported API: true

Returns:
EMailMessage
Throws:
WTException

initialize

protected void initialize()
                   throws WTException
Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

Supported API: true

Throws:
WTException

setOriginator

public void setOriginator(WTPrincipal originator)
                   throws WTException
Set the originator of the message.

Supported API: true

Parameters:
originator - The principal who is designated as the originator of the message.
Throws:
WTException

setSubject

public void setSubject(String resource,
                       String key,
                       Object[] inserts)
Set the resource bundle, key, and inserts from which the subject of the message will be obtained.

Supported API: true

Parameters:
resource - The name of the resource bundle containing the subject.
key - The key that identifies the entry within the resource bundle providing the message subject.
inserts - The objects to be inserted into the resource bundle entry to produce the subject string.

addRecipient

public void addRecipient(WTPrincipal recipient)
                  throws WTException
Add a specific principal as a recipient of the message.

Supported API: true

Parameters:
recipient - The principal to add as recipient.
Throws:
WTException

addRecipient

public void addRecipient(WTPrincipalReference recipient)
                  throws WTException
Add a specific principal by reference as a recipient of the message.

Supported API: true

Parameters:
recipient - The reference to the principal to be added as recipient.
Throws:
WTException

getRecipients

public Enumeration getRecipients()
Return the current list of recipients as an enumeration of objects.

Supported API: true

Returns:
Enumeration

addPart

public void addPart(String resource,
                    String key,
                    Object[] inserts,
                    String contentType)
Add a textual message body of a specific MIME content type to the message. The message body is produced from a resource within a resource bundle.

Supported API: true

Parameters:
resource - The name of the resource bundle.
key - The key of the resource within the bundle that contains the message body.
inserts - The objects, if any, to be inserted into the message body.
contentType - The MIME content type of the message body, .e.g., "text/html" or "text/plain".

addPart

public void addPart(URL url)
Add a message body whose content is read from a URL. The content can have any type. The MIME content type will be obtained from the URL object after a connection to the remote resource is established.

Supported API: true

Parameters:
url - The URL of the remote resource that provides the message body.

send

public void send(boolean immediate)
          throws WTException
Submit the message for delivery to its intended recipients. If immediate is specified as true, the message is submitted to the mail server for delivery immediately. In this case, all recipients are resolved, all message bodies are assembled, and the message is submitted to the mail server before the method returns. Otherwise, if immediate is specified as false, the message is placed in a Windchill queue where it is submitted for delivery as a background process. In this case, the method returns immediately and resolution of recipients and assembly of message bodies are deferred until the background process begins handling the message.

Supported API: true

Parameters:
immediate - Indicates whether to submit the message to the mail server immediately (true), or place the message in a queue where it will be submitted to the mail server by a background process (false).
Throws:
WTException