Class MailAccount


  • public class MailAccount
    extends java.lang.Object
    Version:
    $Revision: 107554 $
    Author:
    Jean-Philippe Encausse
    • Field Detail

      • name

        protected java.lang.String name
      • label

        protected java.lang.String label
      • host

        protected java.lang.String host
      • port

        protected int port
      • protocol

        protected java.lang.String protocol
      • login

        protected java.lang.String login
      • password

        protected java.lang.String password
      • mbox

        protected java.lang.String mbox
      • schedule

        protected java.lang.String schedule
      • enabled

        protected boolean enabled
      • expunge

        protected boolean expunge
      • ssl

        protected boolean ssl
      • author

        protected Member author
      • fetchDate

        protected long fetchDate
      • fetchCount

        protected int fetchCount
      • expungeSet

        protected java.util.Set<java.lang.String> expungeSet
    • Constructor Detail

      • MailAccount

        public MailAccount()
      • MailAccount

        public MailAccount​(java.lang.String name,
                           java.lang.String label,
                           Member author,
                           Workspace ws,
                           java.lang.String host,
                           int port,
                           java.lang.String protocol,
                           java.lang.String login,
                           java.lang.String password,
                           java.lang.String mbox,
                           java.lang.String schedule,
                           boolean expunge,
                           boolean ssl)
    • Method Detail

      • getMailAccount

        public static MailAccount getMailAccount​(java.lang.String label,
                                                 java.lang.String name,
                                                 LangProperties props)
      • getPropertyFile

        protected java.io.File getPropertyFile()
      • loadProperties

        protected void loadProperties()
      • saveProperties

        protected void saveProperties()
      • fetch

        public java.util.List<javax.mail.Message> fetch​(javax.mail.Folder folder)
                                                 throws javax.mail.MessagingException
        Fetch message from the given folder. Store stats about message count and last fetching date
        Parameters:
        folder - the FOlder to fetch
        Returns:
        List of Message
        Throws:
        javax.mail.MessagingException - if an error occured during fetch
      • doFetch

        protected java.util.List<javax.mail.Message> doFetch​(javax.mail.Folder folder)
                                                      throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • getPorperties

        @Deprecated
        public java.util.Properties getPorperties()
        Deprecated.
        replace by getProperties(), keep for ascendant compatibility
      • getProperties

        public java.util.Properties getProperties()
      • getSession

        public javax.mail.Session getSession()
      • connect

        public javax.mail.Store connect()
                                 throws javax.mail.NoSuchProviderException,
                                        javax.mail.MessagingException
        Throws:
        javax.mail.NoSuchProviderException
        javax.mail.MessagingException
      • connect

        public javax.mail.Folder connect​(int mode)
                                  throws javax.mail.NoSuchProviderException,
                                         javax.mail.MessagingException
        Connect to the account, open the store and retrieve the folder. Do not forget to close() folder
        Parameters:
        mode - the open mode Folder.READ_ONLY or Folder.READ_WRITE
        Returns:
        Folder
        Throws:
        javax.mail.NoSuchProviderException
        javax.mail.MessagingException
      • closeQuietly

        public void closeQuietly​(javax.mail.Folder folder,
                                 boolean expunge)
        Close the given folder catching exceptions
        Parameters:
        folder - the Folder
        expunge - Expunge (permanently remove) messages marked DELETED.
      • expunged

        protected boolean expunged​(javax.mail.Message msg,
                                   java.lang.String msgId)
        Flags the message to remove when the folder is closed Performs additional tasks. Note: Folder must be opened
        Parameters:
        msg - the Message
        msgId - the Message Id
      • markAsExpunge

        public void markAsExpunge​(java.util.Set<java.lang.String> msgIdSet)
        Mark given msg Ids as expunge on next fetch
        Parameters:
        msgIdSet - Set of msgId
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isEnabled

        public boolean isEnabled()
        Retuns true if this account is enable
        Returns:
        boolean
      • getDBMailMessageCount

        public int getDBMailMessageCount()
        Returns the count of DBMailMessage stored in DataBase for this account
        Returns:
        int DB count
      • getLastFetchDate

        public java.util.Date getLastFetchDate()
        Returns Date of latest fetch with this account
        Returns:
        Date last fetch
      • getLastFetchCount

        public int getLastFetchCount()
        Returns the number of mail fetched on latest fetch with this account
        Returns:
        int fetch count
      • getName

        public java.lang.String getName()
      • setName

        public void setName​(java.lang.String name)
      • getLabel

        public java.lang.String getLabel()
      • setLabel

        public void setLabel​(java.lang.String label)
      • getAuthor

        public Member getAuthor()
      • setAuthor

        public void setAuthor​(Member author)
      • getWorkspace

        public Workspace getWorkspace()
      • setWorkspace

        public void setWorkspace​(Workspace ws)
      • getHost

        public java.lang.String getHost()
      • setHost

        public void setHost​(java.lang.String host)
      • getPort

        public int getPort()
      • setPort

        public void setPort​(int port)
      • getProtocol

        public java.lang.String getProtocol()
      • setProtocol

        public void setProtocol​(java.lang.String protocol)
      • getLogin

        public java.lang.String getLogin()
      • setLogin

        public void setLogin​(java.lang.String login)
      • setPassword

        public void setPassword​(java.lang.String password)
      • getMbox

        public java.lang.String getMbox()
      • setMbox

        public void setMbox​(java.lang.String mbox)
      • getSchedule

        public java.lang.String getSchedule()
      • setSchedule

        public void setSchedule​(java.lang.String schedule)
      • isExpunged

        public boolean isExpunged()
      • setExpunge

        public void setExpunge​(boolean expunge)
      • isSSL

        public boolean isSSL()
      • setSSL

        public void setSSL​(boolean ssl)
      • isImapSSL

        @Deprecated
        public boolean isImapSSL()
        Deprecated.
        As release of 9.0.5 and 10.0.1, the method isSSL() should be used instead
      • setImapSSL

        @Deprecated
        public void setImapSSL​(boolean ssl)
        Deprecated.
        As release of 9.0.5 and 10.0.1, the method setImapSSL(boolean) should be used instead