TsBiff 1.3


ts.mail
Interface MailModel

All Known Implementing Classes:
DefaultMailModel

public interface MailModel

Interface describing an object containing a general mail message (a subset of RFC 822). The interface defines methods that are necessary for handling the mail messsage, but not particular to any transport mechanism.

Version:
$id: $
Author:
Jan-Henrik Haukeland <hauk@tildeslash.com>
See Also:
DefaultMailModel

Field Summary
static java.lang.String NO_FIELD_VALUE
          Constant defining an empty field value
 
Method Summary
 java.util.Enumeration getCCHeaders()
           
 java.lang.String getDateField()
           
 java.lang.String getFromField()
           
 java.lang.String getIdField()
           
 java.lang.String getMailBody()
           
 java.lang.String getOrganizationField()
           
 java.lang.String getReplyToField()
           
 java.lang.String getSubjectField()
           
 java.lang.String getToField()
           
 java.util.Enumeration getXHeaderKeys()
           
 java.lang.String getXHeaderValue(java.lang.String aKey)
           
 boolean hasCCHeaders()
           
 boolean hasXHeaders()
           
 void setCCHeader(java.lang.String aCopy)
          Set a Carbon-copy (cc:) address.
 void setDateField(java.lang.String aDate)
          Set the mail date
 void setFromField(java.lang.String aFromField)
          Set the mail from-field
 void setIdField(java.lang.String id)
          Set the mail message id
 void setMailBody(java.lang.String aMailBody)
          Set the mail content.
 void setOrganizationField(java.lang.String aOrganizationField)
          Set the mail organization field.
 void setReplyToField(java.lang.String aReplyToField)
          Set the mail Reply-to field.
 void setSubjectField(java.lang.String aSubjectField)
          Set the mail subject-field.
 void setToField(java.lang.String aToField)
          Set the mail to-field
 void setXHeader(java.lang.String aXkey, java.lang.String aXvalue)
          Set a X-something header.
 void validate()
          This method validate the mail message fields.
 

Field Detail

NO_FIELD_VALUE

public static final java.lang.String NO_FIELD_VALUE
Constant defining an empty field value
Method Detail

setIdField

public void setIdField(java.lang.String id)
                throws java.lang.IllegalArgumentException
Set the mail message id
Parameters:
aId - - The mail message id
Throws:
java.lang.IllegalArgumentException - Is thrown if the parameter is null

setToField

public void setToField(java.lang.String aToField)
                throws java.lang.IllegalArgumentException
Set the mail to-field
Parameters:
aToField - - The mail to-field
Throws:
java.lang.IllegalArgumentException - Is thrown if the parameter is null

setFromField

public void setFromField(java.lang.String aFromField)
                  throws java.lang.IllegalArgumentException
Set the mail from-field
Parameters:
aFromField - - The mail from-field
Throws:
java.lang.IllegalArgumentException - Is thrown if the parameter is null

setDateField

public void setDateField(java.lang.String aDate)
Set the mail date
Parameters:
aDate - - The mail date as a string

setSubjectField

public void setSubjectField(java.lang.String aSubjectField)
Set the mail subject-field. No exception is thrown since the subject field is allowed to be empty.
Parameters:
aSubjectField - - The mail subject-field

setReplyToField

public void setReplyToField(java.lang.String aReplyToField)
Set the mail Reply-to field. No exception is thrown since this field is allowed to be empty
Parameters:
aReplyToField - - The mail Reply-to field

setOrganizationField

public void setOrganizationField(java.lang.String aOrganizationField)
Set the mail organization field. No exception is thrown since this field is allowed to be empty
Parameters:
aOrganizationField - The mail organization field

setMailBody

public void setMailBody(java.lang.String aMailBody)
Set the mail content. No exception is thrown since the mail body is allowed to be empty.
Parameters:
aMailBody - - The mail content

setCCHeader

public void setCCHeader(java.lang.String aCopy)
                 throws java.lang.IllegalArgumentException
Set a Carbon-copy (cc:) address. This method could be called repeatedly to store several cc: addresses.
Parameters:
aAddress - The cc: mail address
Throws:
java.lang.IllegalArgumentException - Is thrown if the parameter is null

setXHeader

public void setXHeader(java.lang.String aXkey,
                       java.lang.String aXvalue)
                throws java.lang.IllegalArgumentException
Set a X-something header. The method does no syntax checking on the submitted header, because this class should not know the format of any of it's fields. This method could be called repeatedly to store several X-headers.
Parameters:
aXkey - The X-header name
aXvalue - The X-Header's value
Throws:
java.lang.IllegalArgumentException - Is thrown if the parameter is null

getIdField

public java.lang.String getIdField()
Returns:
The mail message id

getToField

public java.lang.String getToField()
Returns:
Return the to field

getFromField

public java.lang.String getFromField()
Returns:
Return the from field

getDateField

public java.lang.String getDateField()
Returns:
The date as a String

getSubjectField

public java.lang.String getSubjectField()
Returns:
Return the subject field

getReplyToField

public java.lang.String getReplyToField()
Returns:
Return the reply-to field

getOrganizationField

public java.lang.String getOrganizationField()
Returns:
Return the organization field

getCCHeaders

public java.util.Enumeration getCCHeaders()
Returns:
An enumeration of the Carbon-copy values

getXHeaderKeys

public java.util.Enumeration getXHeaderKeys()
Returns:
An enumeration of the X-header keys

getXHeaderValue

public java.lang.String getXHeaderValue(java.lang.String aKey)
Returns:
The value for the given X-header key

getMailBody

public java.lang.String getMailBody()
Returns:
Return the mail body

hasCCHeaders

public boolean hasCCHeaders()
Returns:
true if the mail has any cc headers

hasXHeaders

public boolean hasXHeaders()
Returns:
true if the mail has any X- headers

validate

public void validate()
              throws java.lang.IllegalStateException
This method validate the mail message fields. An exception is thrown if any of the required fields is empty. A warning is printed if the subject-field or mail body are empty.
Throws:
java.lang.IllegalStateException - Is thrown if invalid

TsBiff 1.3