com.sun.portal.wireless.taglibs.mail
Class MailContext

java.lang.Object
  extended bycom.sun.portal.wireless.taglibs.base.Context
      extended bycom.sun.portal.wireless.taglibs.mail.MailContext

public class MailContext
extends Context

Context class for tracking user state across multiple mail requests.

See Also:
ContextCache

Field Summary
static java.lang.String CONTEXT_CACHE_CLASS_NAME
          The mail context cache class name.
static java.lang.String CONTEXT_CLASS_NAME
          The mail context class name.
static java.lang.String CONTEXT_TYPE
          The type of context represented by this class.
static java.lang.String SSO_CONFIG_TYPE
          The SSO configuration type.
 
Fields inherited from class com.sun.portal.wireless.taglibs.base.Context
charSetString, errorCode, parentContext, session, ssoAdapter, timezone
 
Constructor Summary
MailContext()
           
 
Method Summary
 boolean doPresetMessagesFetch()
          Gets the preset messages from the user's profile, and encapsulates them in PresetMsg beans.
 java.lang.String getCharset()
          Gets the charset.
 java.util.Vector getConfigsCollection()
          Gets a Vector that lists the names of SSOAdapter Configurations that canbe used for the purpose of POP mail collection.
static MailContext getContext(PageContext pageContext)
          Gets the MailContext for this session.
 FolderBean getCurrentFolder()
          Gets the current folder.
 ViewBean getCurrentViewBean()
          Gets the current view from this context.
 FolderBean[] getFoldersCollection()
          Gets the folders collection.
 java.lang.String getFrom()
          Gets the user's "from address".
 Folder getInbox()
          Gets the Inbox.
 int getInboxNumMsgs()
          Gets the total number of messages in the Inbox.
 int getInboxNumNewMsgs()
          Gets the number of new messages in the Inbox.
 int getInboxNumUnreadMsgs()
          Gets the number of unread messages in the Inbox.
 int getLineLength()
          Gets the line length.
 LineBean[] getLinesCollection()
          Gets the lines collection.
 javax.mail.Session getMailSession()
          Gets the mail session from this context.
 Store getMailStore()
          Gets the mail store from this context.
 MsgBean getMsg()
          Gets the current message.
 int getMsgIdx()
          Gets the index of the current message.
 MsgBean[] getMsgsCollection()
          Gets the messages collection.
 int getNextmsgidx()
          Gets the index of the next message.
 int getNumMsgs()
          Gets the total number of messages in the current folder.
 int getNumNewMsgs()
          Gets the number of new messages in the current folder.
 int getNumOfViews()
          Gets the number of views from this context.
 int getNumUnreadMsgs()
          Gets the number of unread messages in the current folder.
 java.util.Vector getPresetMessages()
          Gets the preset messages vector.
 int getPrevmsgidx()
          Gets the index of the previous message.
 java.lang.String getSignature()
          Gets the signature from this context.
 ViewBean[] getViewCollection()
          Gets the views collection from this context.
 boolean includeMsg()
          Indicates whether or not the original message will be included in a reply.
 boolean includeSig()
          Indicates whether or not the user's signature will be included in outgoing messages.
 void init(HttpServletRequest request, SSOToken session, SSOAdapter ssoAdapter)
          Initializes a context with the specified session.
 boolean isAtmsgend()
          Indicates whether or not this is the last message.
 boolean isAtmsgstart()
          Indicates whether or not this is the first message.
 boolean isPopEmpty()
          Indicates whether or not the POP3 configuration list is empty.
 boolean isPresetEmpty()
          Indicates whether or not the preset messages list is empty.
 boolean saveSentMail()
          Indicates whether or not sent mail will be saved.
 void setCurrentFolder(FolderBean folder)
          Sets the current folder.
 void setCurrentView(java.lang.String idx)
          Sets the current view for this context.
 void setDefaultView(java.lang.String str)
          Sets the default view.
 void setDoMsgInclude(java.lang.String flag)
          Sets message inclusion on or off.
 void setFoldersCollection(FolderBean[] folders)
          Sets the folders collection.
 void setIncludeSig(java.lang.String flag)
          Sets signature inclusion on or off.
 void setLinesCollection(LineBean[] vlines)
          Sets the lines collection.
 void setMsg(MsgBean m)
          Sets the current message.
 void setMsgIdx(int idx)
          Sets the index of the current message.
 void setMsgsCollection(MsgBean[] msgs)
          Sets the collection of messages for this context.
 void ssoTokenChanged(SSOTokenEvent evt)
          Handles events from the Portal Session, and cleans up the context when the session goes invalid.
 
Methods inherited from class com.sun.portal.wireless.taglibs.base.Context
getAttributeSet, getAttributeString, getAttributeString, getClientType, getConfigName, getContentType, getContext, getErrorCode, getLocale, getParentContext, getSession, getSessionID, getSSOAdapter, getTimeZone, getUserLocale, getUserLocaleString, init, setErrorCode, setParentContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_CLASS_NAME

public static final java.lang.String CONTEXT_CLASS_NAME
The mail context class name. The value of this field is: com.sun.portal.wireless.taglibs.mail.MailContext

See Also:
Constant Field Values

CONTEXT_CACHE_CLASS_NAME

public static final java.lang.String CONTEXT_CACHE_CLASS_NAME
The mail context cache class name. The value of this field is: com.sun.portal.wireless.taglibs.mail.MailContextCache

See Also:
Constant Field Values

CONTEXT_TYPE

public static final java.lang.String CONTEXT_TYPE
The type of context represented by this class. The value of this field is: mailcontext

See Also:
Constant Field Values

SSO_CONFIG_TYPE

public static final java.lang.String SSO_CONFIG_TYPE
The SSO configuration type. The value of this field is MAIL-TYPE.

See Also:
Constant Field Values
Constructor Detail

MailContext

public MailContext()
Method Detail

init

public void init(HttpServletRequest request,
                 SSOToken session,
                 SSOAdapter ssoAdapter)
          throws java.lang.Exception
Initializes a context with the specified session.

The user's "from address" is computed in the following fashion:

  1. If mail app preference "fromAddress" is set, use that as the "from address", otherwise...
  2. Determine email username. If "imap uid" is set, use that, else use SSOToken principal.
  3. If the resulting username has a "@" character in it, use that as the "from address", otherwise...
  4. Determine mail domain. If the org level attr "sunMobileAppMailDefaultMailDomain" is is set, use that, else, if the sso adapter property "smtpServer" is set, use that, else, use the imap host name.
  5. Combine the resulting user and mail domain names to form a "from address".

Overrides:
init in class Context
Parameters:
request - the HTTP servlet request
session - the user's session
ssoAdapter -
Throws:
java.lang.Exception

getContext

public static MailContext getContext(PageContext pageContext)
                              throws java.lang.Exception
Gets the MailContext for this session.

Parameters:
pageContext - the page context
Returns:
the mail context
Throws:
java.lang.Exception

getLineLength

public int getLineLength()
Gets the line length.

Returns:
the line length as an int.

getInboxNumMsgs

public int getInboxNumMsgs()
                    throws MessagingException
Gets the total number of messages in the Inbox.

Returns:
the number of messages as an int.
Throws:
MessagingException -

getInboxNumUnreadMsgs

public int getInboxNumUnreadMsgs()
                          throws MessagingException
Gets the number of unread messages in the Inbox.

Returns:
the number of unread messages as an int
Throws:
MessagingException -

getInboxNumNewMsgs

public int getInboxNumNewMsgs()
                       throws MessagingException
Gets the number of new messages in the Inbox.

Returns:
the number of new messages as an int.
Throws:
MessagingException

getNumMsgs

public int getNumMsgs()
               throws MessagingException
Gets the total number of messages in the current folder.

Returns:
the total number of messages as an int.
Throws:
MessagingException -

getNumUnreadMsgs

public int getNumUnreadMsgs()
                     throws MessagingException
Gets the number of unread messages in the current folder.

Returns:
the number of unread messages as an int.
Throws:
MessagingException -

getNumNewMsgs

public int getNumNewMsgs()
                  throws MessagingException
Gets the number of new messages in the current folder.

Returns:
the number of new messages as an int
Throws:
MessagingException

getInbox

public Folder getInbox()
Gets the Inbox.

Returns:
the Inbox as a Folder object.

getCurrentFolder

public FolderBean getCurrentFolder()
Gets the current folder.

Returns:
the current folder as a FolderBean object.
See Also:
setCurrentFolder(FolderBean)

setCurrentFolder

public void setCurrentFolder(FolderBean folder)
Sets the current folder.

Parameters:
folder - the folder to set as current.
See Also:
getCurrentFolder()

getMsg

public MsgBean getMsg()
Gets the current message.

Returns:
the current message as a MessageBean object.
See Also:
#setMsg(MessageBean)

setMsg

public void setMsg(MsgBean m)
Sets the current message.

Parameters:
m - the message to set as the current message.
See Also:
getMsg()

getMsgIdx

public int getMsgIdx()
Gets the index of the current message.

Returns:
the current message index as an int
See Also:
setMsgIdx(int)

setMsgIdx

public void setMsgIdx(int idx)
Sets the index of the current message.

Parameters:
idx - the index to set
See Also:
getMsgIdx()

getFrom

public java.lang.String getFrom()
Gets the user's "from address".

Returns:
the user's from address, as a String

getCharset

public java.lang.String getCharset()
Gets the charset.

Overrides:
getCharset in class Context
Returns:
the charset string

getMailStore

public Store getMailStore()
Gets the mail store from this context.

Returns:
the mail store as a Store object.

getMailSession

public javax.mail.Session getMailSession()
Gets the mail session from this context.

Returns:
the mail session as a Session object.

getSignature

public java.lang.String getSignature()
Gets the signature from this context.

Returns:
the signature as a String
See Also:
setIncludeSig(String)

saveSentMail

public boolean saveSentMail()
Indicates whether or not sent mail will be saved.

Returns:
true is saved, false if not

includeMsg

public boolean includeMsg()
Indicates whether or not the original message will be included in a reply.

Returns:
true if included, false if not.
See Also:
setDoMsgInclude(String)

setDoMsgInclude

public void setDoMsgInclude(java.lang.String flag)
Sets message inclusion on or off.

Parameters:
flag - a String indicating "true" for inclusion, or "false" for exclusion.
See Also:
includeMsg()

includeSig

public boolean includeSig()
Indicates whether or not the user's signature will be included in outgoing messages.

Returns:
true if included, false if not
See Also:
setIncludeSig(String)

setIncludeSig

public void setIncludeSig(java.lang.String flag)
Sets signature inclusion on or off.

Parameters:
flag - a String indicating "true" for inclusion, or "false" for exclusion.
See Also:
includeSig()

isAtmsgend

public boolean isAtmsgend()
Indicates whether or not this is the last message.

Returns:
true if this is the last message, false if not

isAtmsgstart

public boolean isAtmsgstart()
Indicates whether or not this is the first message.

Returns:
true if this is the first message, false if not

getNextmsgidx

public int getNextmsgidx()
Gets the index of the next message. If the current message is the last message, its index will be returned.

Returns:
the message index as an int

getPrevmsgidx

public int getPrevmsgidx()
Gets the index of the previous message. If the current message is the first message, its index will be returned.

Returns:
the message index as an int

isPresetEmpty

public boolean isPresetEmpty()
Indicates whether or not the preset messages list is empty.

Returns:
true if empty, false if not

getPresetMessages

public java.util.Vector getPresetMessages()
Gets the preset messages vector.

Returns:
the Vector of preset messages.

doPresetMessagesFetch

public boolean doPresetMessagesFetch()
Gets the preset messages from the user's profile, and encapsulates them in PresetMsg beans.

Returns:
true if the fetch succeeded, false if it failed

isPopEmpty

public boolean isPopEmpty()
Indicates whether or not the POP3 configuration list is empty.

Returns:
true if empty, false if not

getConfigsCollection

public java.util.Vector getConfigsCollection()
Gets a Vector that lists the names of SSOAdapter Configurations that canbe used for the purpose of POP mail collection.

Returns:
the Vector

getNumOfViews

public int getNumOfViews()
Gets the number of views from this context.

Returns:
the number of views as an int

getViewCollection

public ViewBean[] getViewCollection()
Gets the views collection from this context.

Returns:
the views collection as an array of ViewBean objects.

getCurrentViewBean

public ViewBean getCurrentViewBean()
Gets the current view from this context.

Returns:
the current view as a ViewBean object

setCurrentView

public void setCurrentView(java.lang.String idx)
Sets the current view for this context.

Parameters:
idx - the index to set, such as "1", "2", etc.

setDefaultView

public void setDefaultView(java.lang.String str)
Sets the default view. The str parameter must be set to one of the following:

Parameters:
str - the default view name to set

getFoldersCollection

public FolderBean[] getFoldersCollection()
Gets the folders collection.

Returns:
the folders collection, as an array of FolderBean objects.
See Also:
setFoldersCollection(FolderBean[])

setFoldersCollection

public void setFoldersCollection(FolderBean[] folders)
Sets the folders collection.

Parameters:
folders - the array of FolderBean objects to set
See Also:
getFoldersCollection()

getMsgsCollection

public MsgBean[] getMsgsCollection()
Gets the messages collection.

Returns:
the messages collection, as an array of MsgBean objects.
See Also:
setMsgsCollection(MsgBean[] msgs)

setMsgsCollection

public void setMsgsCollection(MsgBean[] msgs)
Sets the collection of messages for this context.

Parameters:
msgs - the message bean collection

getLinesCollection

public LineBean[] getLinesCollection()
Gets the lines collection.

Returns:
the lines collection, as an array of LineBean objects.
See Also:
setLinesCollection(LineBean[] vlines)

setLinesCollection

public void setLinesCollection(LineBean[] vlines)
Sets the lines collection.

Parameters:
vlines - the lines collection to set
See Also:
getLinesCollection()

ssoTokenChanged

public void ssoTokenChanged(SSOTokenEvent evt)
Handles events from the Portal Session, and cleans up the context when the session goes invalid.

Overrides:
ssoTokenChanged in class Context
Parameters:
evt - the session event