|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rakeshv.mail.MailPreferences
public class MailPreferences
This class stores the mail account preferences for the user(s)
currently logged on to the application. This class populates the
class fields from the information stored in the
underlying preferences XML file that conforms to the
mail
preferences XML schema using JDOM.
You can use the createMailPreferences( String ) method
to create a default mail preferences file.
Modifiying the class fields do not modify the contents of the
preferences file. Use saveMailPreferences() to write the
modified XML data back to the preferences file.
Copyright 2003, Rakesh Vidyadharan
| Field Summary | |
|---|---|
static boolean |
COPY_SENT_MESSAGES
A flag that is used to indicate that messages being sent should be copied to the WebMailBean.sentFolderName. |
private boolean |
copySentMessages
This field is used to indicate whether message being sent by the user are to be copied to the WebMailBean.sentFolderName
folder or not. |
private int |
daysToKeepDeletedMessages
This field is used to indicate the number of days until which deleted messages in the WebMailBean.trashFolderName folder
should be kept. |
static int |
DELETE_PERMANENTLY
A constant that is used to indicate that message being deleted should be deleted permanently from the store. |
private int |
deleteAction
This field is used to indicate the type of action the user desires when deleting a mail message. |
static int |
DISPLAY_ALL_MESSAGES
A constant that is used to indicate that all available messages for the chosen folder should be displayed on the page. |
static boolean |
DO_NOT_COPY_SENT_MESSAGES
A flag that is used to indicate that messages being sent should not be copied to the WebMailBean.sentFolderName. |
private org.jdom.Document |
document
The JDOM XML document representation. |
private java.lang.String |
fileName
The fully qualified name of the file that contains the mail preferences. |
static int |
MARK_AS_DELETED
A constant that is used to indicate that the message being deleted should be marked as deleted (while left in the current folder). |
private int |
messagesPerPage
This field is used to store the user preference for the number of messages to be displayed on a page. |
static int |
MOVE_TO_TRASH
A constant that is used to indicate that messages being deleted should be moved to the WebMailBean.trashFolderName folder. |
private org.jdom.Namespace |
namespace
The target namespace for the mail preferences XML data. |
| Constructor Summary | |
|---|---|
protected |
MailPreferences()
Default constructor. |
|
MailPreferences(java.lang.String fileName)
Just invoke MailPreferences( String, String ) with a value
of null for the preferred SAX Parser to use. |
|
MailPreferences(java.lang.String fileName,
java.lang.String saxParser)
Load the specified address book XML file using the specified SAX Parser. |
| Method Summary | |
|---|---|
static MailPreferences |
createMailPreferences(java.lang.String file)
Just invokes createMailPreferences( String, String ) with
a null value for the default SAX Parser. |
static MailPreferences |
createMailPreferences(java.lang.String file,
java.lang.String saxParser)
Create a new mail preferences file using the fully qualified file name specified, and using the specified SAX Parser to load the XML file that has been created. |
boolean |
getCopySentMessages()
Return the value/reference of the copySentMessages. |
int |
getDaysToKeepDeletedMessages()
Return the value/reference of the daysToKeepDeletedMessages. |
int |
getDeleteAction()
Return the value/reference of the deleteAction. |
int |
getMessagesPerPage()
Return the value/reference of the messagesPerPage. |
private void |
loadMailPreferences(java.lang.String saxParser)
Load the address book XML file ( fileName) using JDOM,
and populate the instance variables. |
void |
saveMailPreferences()
Write the JDOM tree back to the address book file. |
void |
setCopySentMessages(boolean copySentMessages)
Set the value of copySentMessages. |
void |
setDaysToKeepDeletedMessages(int daysToKeepDeletedMessages)
Set the value of daysToKeepDeletedMessages. |
void |
setDeleteAction(int deleteAction)
Set the value of deleteAction. |
void |
setFileName(java.lang.String fileName)
Set the value of fileName. |
void |
setMessagesPerPage(int messagesPerPage)
Set the value of messagesPerPage. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MOVE_TO_TRASH
WebMailBean.trashFolderName folder.
This constant is currently defined as 0.
public static final int DELETE_PERMANENTLY
1.
public static final int MARK_AS_DELETED
2.
public static final boolean COPY_SENT_MESSAGES
WebMailBean.sentFolderName. At present
a value of true indicates that messages should be
copied to the folder.
public static final boolean DO_NOT_COPY_SENT_MESSAGES
WebMailBean.sentFolderName.
At present a value of true indicates that messages
should not be copied to the folder.
public static final int DISPLAY_ALL_MESSAGES
private java.lang.String fileName
private int deleteAction
MOVE_TO_TRASH, DELETE_PERMANENTLY, and MARK_AS_DELETED. Setting this
field to other values will cause undefined behaviour. This field
maps to the deleteAction element in the schema.
private boolean copySentMessages
WebMailBean.sentFolderName
folder or not. This field maps to the copySentMessages
element in the schema.
private int daysToKeepDeletedMessages
WebMailBean.trashFolderName folder
should be kept. Message older than the configured number of days
will be automatically deleted when the user logs out of the
web-mail application. This value will by default be 30 days.
private int messagesPerPage
messagesPerPage element. This field is set by default
to DISPLAY_ALL_MESSAGES. This field maps to the
messagesPerPage element in the schema.
private org.jdom.Document document
private org.jdom.Namespace namespace
| Constructor Detail |
|---|
protected MailPreferences()
public MailPreferences(java.lang.String fileName)
throws MailException
MailPreferences( String, String ) with a value
of null for the preferred SAX Parser to use.
fileName - - The fully qualified name of the address
book XML file.
MailException - - If any JDOM/IOExceptions are encountered
while processing the address book XML file.
public MailPreferences(java.lang.String fileName,
java.lang.String saxParser)
throws MailException
fileName - - The fully qualified name of the address
book XML file.saxParser - - The full class name of the preferred
SAX Parser to use.
MailException - - If any JDOM/IOExceptions are encountered
while processing the address book XML file.loadMailPreferences( String )| Method Detail |
|---|
private void loadMailPreferences(java.lang.String saxParser)
throws MailException
fileName) using JDOM,
and populate the instance variables.
saxParser - - The full class name of the SAX Parser
to use. If this is null the default JAXP SAX
Parser will be used.
MailException - - If any JDOM/IOExceptions are encountered
while processing the address book XML file.
public static MailPreferences createMailPreferences(java.lang.String file)
throws MailException
createMailPreferences( String, String ) with
a null value for the default SAX Parser.
file - - The fully qualified name of the file ie. the
full path and name of file to use as the address book.
MailException - - If any exceptions are encountered while
creating or writing to the specified file.
public void saveMailPreferences()
throws MailException
MailException - - If any exceptions are encountered while
serialising the JDOM tree to the mail preferences file.
public static MailPreferences createMailPreferences(java.lang.String file,
java.lang.String saxParser)
throws MailException
file - - The fully qualified name of the file ie. the
full path and name of file to use as the address book.saxParser - - The full class name of the preferred
SAX Parser. If this is null the default JAXP
SAX Parser will be used.
MailException - - If any exceptions are encountered while
creating or writing to the specified file.public final void setFileName(java.lang.String fileName)
fileName.
fileName - - The value to set.public final int getDeleteAction()
deleteAction.
public final void setDeleteAction(int deleteAction)
deleteAction. Also updates the
underlying JDOM tree with the new value. Use saveMailPreferences() to actually write the modified XML data
back to the mail preferences file.
deleteAction - - The value to set.public final boolean getCopySentMessages()
copySentMessages.
public final void setCopySentMessages(boolean copySentMessages)
copySentMessages. Also updates the
underlying JDOM tree with the new value. Use saveMailPreferences(), to actually write the modified XML back
to the mail preferences file.
copySentMessages - - The value to set.public final int getMessagesPerPage()
messagesPerPage.
public final void setMessagesPerPage(int messagesPerPage)
messagesPerPage. Use DISPLAY_ALL_MESSAGES if you wish to display all the messages on
one page. This method also updates the underlying JDOM tree with
the new value. Use saveMailPreferences() to actually
write the modified XML back to the mail preferences file.
messagesPerPage - - The value to set.public final int getDaysToKeepDeletedMessages()
daysToKeepDeletedMessages.
public final void setDaysToKeepDeletedMessages(int daysToKeepDeletedMessages)
daysToKeepDeletedMessages. This method
also updates the underlying JDOM tree with the new value. Use
saveMailPreferences() to actually write the modified
XML back to the mail preferences file.
daysToKeepDeletedMessages - - The value to set.
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||