org.exoplatform.mail.service.impl
Class MailServiceImpl

java.lang.Object
  extended by org.exoplatform.mail.service.impl.MailServiceImpl
All Implemented Interfaces:
MailService, org.picocontainer.Startable

public class MailServiceImpl
extends java.lang.Object
implements MailService, org.picocontainer.Startable

Created by The eXo Platform SARL Author : Tuan Nguyen tuan.nguyen@exoplatform.com Jun 23, 2007


Field Summary
 java.util.List<MailUpdateStorageEventListener> listeners_
           
 
Constructor Summary
MailServiceImpl(org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, org.exoplatform.services.scheduler.JobSchedulerService schedulerService, org.exoplatform.services.jcr.RepositoryService reposervice)
           
 
Method Summary
 void addListenerPlugin(org.exoplatform.container.component.ComponentPlugin listener)
           
 void addTag(java.lang.String username, java.lang.String accountId, java.util.List<Message> messages, java.util.List<Tag> tag)
          Check the tag name to see if the tag name is configured in the account Check to see if the tag is already set in the message Add the tag to the message and save the message.
 void addTag(java.lang.String username, java.lang.String accountId, Tag tag)
          Check the tag name to see if the tag name is configured in the account If not create a new tag
 void checkMail(java.lang.String username, java.lang.String accountId)
          Getting new mail from server and store to JCR
 void checkMail(java.lang.String username, java.lang.String accountId, java.lang.String folderId)
          Getting new mail from server and store to JCR
 java.util.List<Message> checkNewMessage(java.lang.String username, java.lang.String accountId)
          This method should check for the new message in the mail server, download and save them in the Inbox folder
 java.util.List<Message> checkNewMessage(java.lang.String username, java.lang.String accountId, java.lang.String folderId)
          This method should check for the new message in the mail server, download and save them in the Inbox folder
 java.util.List<Message> checkPop3Server(java.lang.String username, java.lang.String accountId)
           
 void createAccount(java.lang.String username, Account account)
          Use save for create and update This method should: 1.
 java.io.OutputStream exportMessage(java.lang.String username, java.lang.String accountId, Message message)
          Export message from eXo Mail.
 Account getAccountById(java.lang.String username, java.lang.String id)
          This method should: 1.
 java.util.List<AccountData> getAccountDatas(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
           
 java.util.List<Account> getAccounts(java.lang.String username)
          This method should: 1.
 CheckingInfo getCheckingInfo(java.lang.String username, java.lang.String accountId)
           
 Account getDefaultAccount(java.lang.String username)
          Get default account
 MessageFilter getFilterById(java.lang.String username, java.lang.String accountId, java.lang.String filterId)
          Get MessageFilter by id of filter
 java.util.List<MessageFilter> getFilters(java.lang.String username, java.lang.String accountId)
          Get all MessageFilter in special account
 Folder getFolder(java.lang.String username, java.lang.String accountId, java.lang.String folderId)
          This method uses to get a folder object by folderId
 java.lang.String getFolderHomePath(java.lang.String username, java.lang.String accountId)
          Get path of node, that contains all folders
 java.lang.String getFolderParentId(java.lang.String username, java.lang.String accountId, java.lang.String folderId)
          This method get id of parent folder by id of child folder
 java.util.List<Folder> getFolders(java.lang.String username, java.lang.String accountId)
           
 java.util.List<Folder> getFolders(java.lang.String username, java.lang.String accountId, boolean isPersonal)
          Get folders depend on they are personal folders or default folders
 java.lang.String getMailHierarchyNode()
           
 MailSetting getMailSetting(java.lang.String username)
          This method get mail settings
 Message getMessageById(java.lang.String username, java.lang.String accountId, java.lang.String msgId)
          Load the message from the database if it existed and return.
 java.util.List<Message> getMessageByTag(java.lang.String username, java.lang.String accountId, java.lang.String tagName)
          Get all messages of the given tag id
 MessagePageList getMessagePageList(java.lang.String username, MessageFilter filter)
          Find all the message according the parameter that is specified in the filter object
 MessagePageList getMessagePageListByFolder(java.lang.String username, java.lang.String accountId, java.lang.String folderId)
          Get MessagePageList by folder id.
 MessagePageList getMessagePagelistByTag(java.lang.String username, java.lang.String accountId, java.lang.String tagId)
          Get MessagePageList by tag id.
 java.util.List<Message> getMessages(java.lang.String username, MessageFilter filter)
          Get messages by given filter.
 java.util.List<Message> getMessagesByFolder(java.lang.String username, java.lang.String accountId, java.lang.String folderId)
          Get all messages by given folder id.
 java.util.List<Message> getMessagesByTag(java.lang.String username, java.lang.String accountId, java.lang.String tagId)
          Get all messages by tag id.
 java.util.List<Message> getReferencedMessages(java.lang.String username, java.lang.String accountId, java.lang.String msgPath)
          Get all referenced messages of give message path
 javax.mail.search.SearchTerm getSearchTerm(javax.mail.search.SearchTerm sTerm, MessageFilter filter)
           
 SpamFilter getSpamFilter(java.lang.String username, java.lang.String accountId)
           
 java.util.List<Folder> getSubFolders(java.lang.String username, java.lang.String accountId, java.lang.String parentPath)
          Get all sub folders of the given folder path
 Tag getTag(java.lang.String username, java.lang.String accountId, java.lang.String tagId)
          Get tag by tagId
 java.util.List<Tag> getTags(java.lang.String username, java.lang.String accountId)
          Get all tags of account
 boolean importMessage(java.lang.String username, java.lang.String accountId, java.lang.String folderId, java.io.InputStream inputStream, java.lang.String type)
          Import message to eXo Mail.
 boolean isExistFolder(java.lang.String username, java.lang.String accountId, java.lang.String parentId, java.lang.String folderName)
          Check whether the folder contains one child folder with identify id string
 Message loadTotalMessage(java.lang.String username, java.lang.String accountId, Message msg)
          If the message object didn't load attachment yet, then this method will load it's attachment from JCR and return it's message
 Message moveMessage(java.lang.String userName, java.lang.String accountId, Message msg, java.lang.String currentFolderId, java.lang.String destFolderId)
          Move a message from the current folder to the given folder
 void moveMessage(java.lang.String userName, java.lang.String accountId, Message msg, java.lang.String currentFolderId, java.lang.String destFolderId, boolean updateReference)
           
 java.util.List<Message> moveMessages(java.lang.String userName, java.lang.String accountId, java.util.List<Message> msgList, java.lang.String currentFolderId, java.lang.String destFolderId)
          Move a list of message from the current folder to the given folder
 java.util.List<Message> moveMessages(java.lang.String userName, java.lang.String accountId, java.util.List<Message> msgList, java.lang.String currentFolderId, java.lang.String destFolderId, boolean updateReference)
          Move message(s) to Trash folder
 com.sun.mail.imap.IMAPStore openIMAPConnection(java.lang.String username, Account account)
           
 com.sun.mail.imap.IMAPStore openIMAPConnection(java.lang.String username, Account account, CheckingInfo info)
           
 void removeAccount(java.lang.String username, java.lang.String accountId)
          Remove the account from the database Update the cache
 void removeCheckingInfo(java.lang.String username, java.lang.String accountId)
           
 void removeFilter(java.lang.String username, java.lang.String accountId, java.lang.String filterId)
          Remove filter by filter id
 void removeMessage(java.lang.String username, java.lang.String accountId, Message message)
          This method should: 1.
 void removeMessages(java.lang.String username, java.lang.String accountId, java.util.List<Message> messages, boolean moveReference)
          This method should: 1.
 void removeTag(java.lang.String username, java.lang.String accountId, java.lang.String tag)
          Find all the message that has the tag , remove the tag from the message and save Remove the tag from the account and save Update or invalidate the cache if needed
 void removeTagsInMessages(java.lang.String username, java.lang.String accountId, java.util.List<Message> msgList, java.util.List<java.lang.String> tagIdList)
          Remove the tag from the message Save the message into the database Update or invalidate the cache
 void removeUserFolder(java.lang.String username, java.lang.String accountId, java.lang.String folderId)
           
 void renameFolder(java.lang.String username, java.lang.String accountId, java.lang.String newName, java.lang.String folderId)
          This method remove all the messages in the folder then remove the folder of the account Save the account into the database
 void saveAccount(java.lang.String username, Account account, boolean isNew)
           
 void saveFilter(java.lang.String username, java.lang.String accountId, MessageFilter filter, boolean applyAll)
          Save filter to JCR
 void saveFolder(java.lang.String username, java.lang.String accountId, Folder folder)
          Save folder under special account
 void saveFolder(java.lang.String username, java.lang.String accountId, java.lang.String parentId, Folder folder)
          Save folder to JCR as child of given folder
 void saveMailSetting(java.lang.String username, MailSetting newSetting)
          This method to update mail setting
 boolean saveMessage(java.lang.String username, Account account, java.lang.String targetMsgPath, Message message, boolean isNew)
          Save message to Account/Messages/Year/Month/Day tree node.
 void saveMessage(java.lang.String username, java.lang.String accountId, Message message, boolean isNew)
           
 void saveSpamFilter(java.lang.String username, java.lang.String accountId, SpamFilter spamFilter)
          Save the given spam filter to JCR
 void sendMessage(Message message)
          This method should send out the message
 Message sendMessage(java.lang.String username, Account acc, Message message)
           
 Message sendMessage(java.lang.String username, Message message)
          This method should send out the message
 Message sendMessage(java.lang.String username, java.lang.String accId, Message message)
           
 void sendMessages(java.util.List<Message> msgList, ServerConfiguration serverConfig)
          Use smtp to send message with given server configuration
 boolean sendReturnReceipt(java.lang.String username, java.lang.String accId, java.lang.String msgId, java.util.ResourceBundle res)
           
 void start()
           
 void stop()
           
 void stopAllJobs(java.lang.String username, java.lang.String accountId)
           
 void stopCheckMail(java.lang.String username, java.lang.String accountId)
          Requests to stop mail checking
 void synchImapFolders(java.lang.String username, java.lang.String accountId)
           
 void toggleMessageProperty(java.lang.String username, java.lang.String accountId, java.util.List<Message> msgList, java.lang.String folderId, java.lang.String property, boolean value)
          Toggle the property of message.
 void updateAccount(java.lang.String username, Account account)
          This method should: 1.
 void updateTag(java.lang.String username, java.lang.String accountId, Tag tag)
          Update a tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners_

public java.util.List<MailUpdateStorageEventListener> listeners_
Constructor Detail

MailServiceImpl

public MailServiceImpl(org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator,
                       org.exoplatform.services.scheduler.JobSchedulerService schedulerService,
                       org.exoplatform.services.jcr.RepositoryService reposervice)
                throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getMailHierarchyNode

public java.lang.String getMailHierarchyNode()
                                      throws java.lang.Exception
Specified by:
getMailHierarchyNode in interface MailService
Throws:
java.lang.Exception

removeCheckingInfo

public void removeCheckingInfo(java.lang.String username,
                               java.lang.String accountId)
                        throws java.lang.Exception
Specified by:
removeCheckingInfo in interface MailService
Throws:
java.lang.Exception

getCheckingInfo

public CheckingInfo getCheckingInfo(java.lang.String username,
                                    java.lang.String accountId)
Specified by:
getCheckingInfo in interface MailService

getAccounts

public java.util.List<Account> getAccounts(java.lang.String username)
                                    throws java.lang.Exception
Description copied from interface: MailService
This method should: 1. The service should load the accounts belong to the user and cache in the service. 2. The service should return the list of the account in the cache. If the user hasn't configured an account, an empty list will be cached and return.

Specified by:
getAccounts in interface MailService
Parameters:
username -
Returns:
Throws:
java.lang.Exception

getAccountById

public Account getAccountById(java.lang.String username,
                              java.lang.String id)
                       throws java.lang.Exception
Description copied from interface: MailService
This method should: 1. Check if the list of the accounts is cached. If not call the method List getAccounts(String username) to load all the account belong to the user and cached 2. Find the account in the list of the account and return. 3. return null if no account is found.

Specified by:
getAccountById in interface MailService
Returns:
Account
Throws:
java.lang.Exception

saveAccount

public void saveAccount(java.lang.String username,
                        Account account,
                        boolean isNew)
                 throws java.lang.Exception
Throws:
java.lang.Exception

updateAccount

public void updateAccount(java.lang.String username,
                          Account account)
                   throws java.lang.Exception
Description copied from interface: MailService
This method should: 1. This method check the madatory field and save the updated account into the database 2. This method should update the cache if the data is updated successfully.

Specified by:
updateAccount in interface MailService
Throws:
java.lang.Exception

removeAccount

public void removeAccount(java.lang.String username,
                          java.lang.String accountId)
                   throws java.lang.Exception
Description copied from interface: MailService
Remove the account from the database Update the cache

Specified by:
removeAccount in interface MailService
Throws:
java.lang.Exception

getFolder

public Folder getFolder(java.lang.String username,
                        java.lang.String accountId,
                        java.lang.String folderId)
                 throws java.lang.Exception
Description copied from interface: MailService
This method uses to get a folder object by folderId

Specified by:
getFolder in interface MailService
Returns:
exo Folder object
Throws:
java.lang.Exception

getFolderParentId

public java.lang.String getFolderParentId(java.lang.String username,
                                          java.lang.String accountId,
                                          java.lang.String folderId)
                                   throws java.lang.Exception
Description copied from interface: MailService
This method get id of parent folder by id of child folder

Specified by:
getFolderParentId in interface MailService
Returns:
string Id of parent folder
Throws:
java.lang.Exception

isExistFolder

public boolean isExistFolder(java.lang.String username,
                             java.lang.String accountId,
                             java.lang.String parentId,
                             java.lang.String folderName)
                      throws java.lang.Exception
Description copied from interface: MailService
Check whether the folder contains one child folder with identify id string

Specified by:
isExistFolder in interface MailService
Returns:
boolean
Throws:
java.lang.Exception

saveFolder

public void saveFolder(java.lang.String username,
                       java.lang.String accountId,
                       Folder folder)
                throws java.lang.Exception
Description copied from interface: MailService
Save folder under special account

Specified by:
saveFolder in interface MailService
Throws:
java.lang.Exception

saveFolder

public void saveFolder(java.lang.String username,
                       java.lang.String accountId,
                       java.lang.String parentId,
                       Folder folder)
                throws java.lang.Exception
Description copied from interface: MailService
Save folder to JCR as child of given folder

Specified by:
saveFolder in interface MailService
Throws:
java.lang.Exception

renameFolder

public void renameFolder(java.lang.String username,
                         java.lang.String accountId,
                         java.lang.String newName,
                         java.lang.String folderId)
                  throws java.lang.Exception
Description copied from interface: MailService
This method remove all the messages in the folder then remove the folder of the account Save the account into the database

Specified by:
renameFolder in interface MailService
Throws:
java.lang.Exception

removeUserFolder

public void removeUserFolder(java.lang.String username,
                             java.lang.String accountId,
                             java.lang.String folderId)
                      throws java.lang.Exception
Specified by:
removeUserFolder in interface MailService
Throws:
java.lang.Exception

getFilters

public java.util.List<MessageFilter> getFilters(java.lang.String username,
                                                java.lang.String accountId)
                                         throws java.lang.Exception
Description copied from interface: MailService
Get all MessageFilter in special account

Specified by:
getFilters in interface MailService
Returns:
list of all filters
Throws:
java.lang.Exception

getFilterById

public MessageFilter getFilterById(java.lang.String username,
                                   java.lang.String accountId,
                                   java.lang.String filterId)
                            throws java.lang.Exception
Description copied from interface: MailService
Get MessageFilter by id of filter

Specified by:
getFilterById in interface MailService
Returns:
MessageFilter
Throws:
java.lang.Exception

saveFilter

public void saveFilter(java.lang.String username,
                       java.lang.String accountId,
                       MessageFilter filter,
                       boolean applyAll)
                throws java.lang.Exception
Description copied from interface: MailService
Save filter to JCR

Specified by:
saveFilter in interface MailService
Throws:
java.lang.Exception

removeFilter

public void removeFilter(java.lang.String username,
                         java.lang.String accountId,
                         java.lang.String filterId)
                  throws java.lang.Exception
Description copied from interface: MailService
Remove filter by filter id

Specified by:
removeFilter in interface MailService
Throws:
java.lang.Exception

getMessageById

public Message getMessageById(java.lang.String username,
                              java.lang.String accountId,
                              java.lang.String msgId)
                       throws java.lang.Exception
Description copied from interface: MailService
Load the message from the database if it existed and return. This method should implement a cache to cache the message by the message id and the username

Specified by:
getMessageById in interface MailService
Returns:
message
Throws:
java.lang.Exception

removeMessage

public void removeMessage(java.lang.String username,
                          java.lang.String accountId,
                          Message message)
                   throws java.lang.Exception
Description copied from interface: MailService
This method should: 1. Remove the message from the database if it is existed 2. Update or invalidate the cache if the message is cached

Specified by:
removeMessage in interface MailService
Throws:
java.lang.Exception

removeMessages

public void removeMessages(java.lang.String username,
                           java.lang.String accountId,
                           java.util.List<Message> messages,
                           boolean moveReference)
                    throws java.lang.Exception
Description copied from interface: MailService
This method should: 1. Remove all the messages 2. Update or invalidate the cache

Specified by:
removeMessages in interface MailService
Throws:
java.lang.Exception

moveMessages

public java.util.List<Message> moveMessages(java.lang.String userName,
                                            java.lang.String accountId,
                                            java.util.List<Message> msgList,
                                            java.lang.String currentFolderId,
                                            java.lang.String destFolderId)
                                     throws java.lang.Exception
Description copied from interface: MailService
Move a list of message from the current folder to the given folder

Specified by:
moveMessages in interface MailService
Throws:
java.lang.Exception

moveMessages

public java.util.List<Message> moveMessages(java.lang.String userName,
                                            java.lang.String accountId,
                                            java.util.List<Message> msgList,
                                            java.lang.String currentFolderId,
                                            java.lang.String destFolderId,
                                            boolean updateReference)
                                     throws java.lang.Exception
Description copied from interface: MailService
Move message(s) to Trash folder

Specified by:
moveMessages in interface MailService
Throws:
java.lang.Exception

moveMessage

public Message moveMessage(java.lang.String userName,
                           java.lang.String accountId,
                           Message msg,
                           java.lang.String currentFolderId,
                           java.lang.String destFolderId)
                    throws java.lang.Exception
Description copied from interface: MailService
Move a message from the current folder to the given folder

Specified by:
moveMessage in interface MailService
Returns:
the moved/deleted message, and return null value if that message hasn't moved/deleted
Throws:
java.lang.Exception

moveMessage

public void moveMessage(java.lang.String userName,
                        java.lang.String accountId,
                        Message msg,
                        java.lang.String currentFolderId,
                        java.lang.String destFolderId,
                        boolean updateReference)
                 throws java.lang.Exception
Specified by:
moveMessage in interface MailService
Throws:
java.lang.Exception

getMessagePageList

public MessagePageList getMessagePageList(java.lang.String username,
                                          MessageFilter filter)
                                   throws java.lang.Exception
Description copied from interface: MailService
Find all the message according the parameter that is specified in the filter object

Specified by:
getMessagePageList in interface MailService
Returns:
MessagePageList
Throws:
java.lang.Exception

saveMessage

public boolean saveMessage(java.lang.String username,
                           Account account,
                           java.lang.String targetMsgPath,
                           Message message,
                           boolean isNew)
                    throws java.lang.Exception
Description copied from interface: MailService
Save message to Account/Messages/Year/Month/Day tree node. If message is new then Day node will create a new node if not it will update the exist message.

Specified by:
saveMessage in interface MailService
targetMsgPath - this param is path of node Account/Messages/Year/Month/Day
Returns:
true if save message success. false if else
Throws:
java.lang.Exception

getMessagesByTag

public java.util.List<Message> getMessagesByTag(java.lang.String username,
                                                java.lang.String accountId,
                                                java.lang.String tagId)
                                         throws java.lang.Exception
Description copied from interface: MailService
Get all messages by tag id.

Specified by:
getMessagesByTag in interface MailService
Returns:
List of messages
Throws:
java.lang.Exception

getMessagesByFolder

public java.util.List<Message> getMessagesByFolder(java.lang.String username,
                                                   java.lang.String accountId,
                                                   java.lang.String folderId)
                                            throws java.lang.Exception
Description copied from interface: MailService
Get all messages by given folder id.

Specified by:
getMessagesByFolder in interface MailService
Returns:
List of messages
Throws:
java.lang.Exception

getMessages

public java.util.List<Message> getMessages(java.lang.String username,
                                           MessageFilter filter)
                                    throws java.lang.Exception
Description copied from interface: MailService
Get messages by given filter. This method get all message which are statisfied all conditions of filter

Specified by:
getMessages in interface MailService
Returns:
List of messages
Throws:
java.lang.Exception

saveMessage

public void saveMessage(java.lang.String username,
                        java.lang.String accountId,
                        Message message,
                        boolean isNew)
                 throws java.lang.Exception
Specified by:
saveMessage in interface MailService
Throws:
java.lang.Exception

sendMessage

public Message sendMessage(java.lang.String username,
                           java.lang.String accId,
                           Message message)
                    throws java.lang.Exception
Specified by:
sendMessage in interface MailService
Throws:
java.lang.Exception

sendMessage

public Message sendMessage(java.lang.String username,
                           Account acc,
                           Message message)
                    throws java.lang.Exception
Specified by:
sendMessage in interface MailService
Throws:
java.lang.Exception

sendMessage

public Message sendMessage(java.lang.String username,
                           Message message)
                    throws java.lang.Exception
Description copied from interface: MailService
This method should send out the message

Specified by:
sendMessage in interface MailService
Returns:
Message
Throws:
java.lang.Exception

sendMessage

public void sendMessage(Message message)
                 throws java.lang.Exception
Description copied from interface: MailService
This method should send out the message

Specified by:
sendMessage in interface MailService
Throws:
java.lang.Exception

sendMessages

public void sendMessages(java.util.List<Message> msgList,
                         ServerConfiguration serverConfig)
                  throws java.lang.Exception
Description copied from interface: MailService
Use smtp to send message with given server configuration

Specified by:
sendMessages in interface MailService
Throws:
java.lang.Exception

checkMail

public void checkMail(java.lang.String username,
                      java.lang.String accountId)
               throws java.lang.Exception
Description copied from interface: MailService
Getting new mail from server and store to JCR

Specified by:
checkMail in interface MailService
Throws:
java.lang.Exception

checkMail

public void checkMail(java.lang.String username,
                      java.lang.String accountId,
                      java.lang.String folderId)
               throws java.lang.Exception
Description copied from interface: MailService
Getting new mail from server and store to JCR

Specified by:
checkMail in interface MailService
Throws:
java.lang.Exception

stopCheckMail

public void stopCheckMail(java.lang.String username,
                          java.lang.String accountId)
Description copied from interface: MailService
Requests to stop mail checking

Specified by:
stopCheckMail in interface MailService
Parameters:
username - userid
accountId - mail account

stopAllJobs

public void stopAllJobs(java.lang.String username,
                        java.lang.String accountId)
                 throws java.lang.Exception
Specified by:
stopAllJobs in interface MailService
Throws:
java.lang.Exception

synchImapFolders

public void synchImapFolders(java.lang.String username,
                             java.lang.String accountId)
                      throws java.lang.Exception
Specified by:
synchImapFolders in interface MailService
Throws:
java.lang.Exception

openIMAPConnection

public com.sun.mail.imap.IMAPStore openIMAPConnection(java.lang.String username,
                                                      Account account)

openIMAPConnection

public com.sun.mail.imap.IMAPStore openIMAPConnection(java.lang.String username,
                                                      Account account,
                                                      CheckingInfo info)

checkNewMessage

public java.util.List<Message> checkNewMessage(java.lang.String username,
                                               java.lang.String accountId)
                                        throws java.lang.Exception
Description copied from interface: MailService
This method should check for the new message in the mail server, download and save them in the Inbox folder

Specified by:
checkNewMessage in interface MailService
Returns:
List
Throws:
java.lang.Exception

checkNewMessage

public java.util.List<Message> checkNewMessage(java.lang.String username,
                                               java.lang.String accountId,
                                               java.lang.String folderId)
                                        throws java.lang.Exception
Description copied from interface: MailService
This method should check for the new message in the mail server, download and save them in the Inbox folder

Specified by:
checkNewMessage in interface MailService
Returns:
List
Throws:
java.lang.Exception

checkPop3Server

public java.util.List<Message> checkPop3Server(java.lang.String username,
                                               java.lang.String accountId)
                                        throws java.lang.Exception
Throws:
java.lang.Exception

getSearchTerm

public javax.mail.search.SearchTerm getSearchTerm(javax.mail.search.SearchTerm sTerm,
                                                  MessageFilter filter)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

createAccount

public void createAccount(java.lang.String username,
                          Account account)
                   throws java.lang.Exception
Description copied from interface: MailService
Use save for create and update This method should: 1. Check all the madatory field of the account and save the account into the database. The method should throw exception , if any mandatory field is missing. 2. The method should update or invalidate the list of account of the user in the cache

Specified by:
createAccount in interface MailService
Throws:
java.lang.Exception

getFolders

public java.util.List<Folder> getFolders(java.lang.String username,
                                         java.lang.String accountId)
                                  throws java.lang.Exception
Specified by:
getFolders in interface MailService
Returns:
List folder
Throws:
java.lang.Exception

getFolders

public java.util.List<Folder> getFolders(java.lang.String username,
                                         java.lang.String accountId,
                                         boolean isPersonal)
                                  throws java.lang.Exception
Description copied from interface: MailService
Get folders depend on they are personal folders or default folders

Specified by:
getFolders in interface MailService
Returns:
List of folders
Throws:
java.lang.Exception

addTag

public void addTag(java.lang.String username,
                   java.lang.String accountId,
                   Tag tag)
            throws java.lang.Exception
Description copied from interface: MailService
Check the tag name to see if the tag name is configured in the account If not create a new tag

Specified by:
addTag in interface MailService
Throws:
java.lang.Exception

addTag

public void addTag(java.lang.String username,
                   java.lang.String accountId,
                   java.util.List<Message> messages,
                   java.util.List<Tag> tag)
            throws java.lang.Exception
Description copied from interface: MailService
Check the tag name to see if the tag name is configured in the account Check to see if the tag is already set in the message Add the tag to the message and save the message. Invalidate or update the cache.

Specified by:
addTag in interface MailService
Throws:
java.lang.Exception

getTags

public java.util.List<Tag> getTags(java.lang.String username,
                                   java.lang.String accountId)
                            throws java.lang.Exception
Description copied from interface: MailService
Get all tags of account

Specified by:
getTags in interface MailService
Returns:
List of Tag
Throws:
java.lang.Exception

getTag

public Tag getTag(java.lang.String username,
                  java.lang.String accountId,
                  java.lang.String tagId)
           throws java.lang.Exception
Description copied from interface: MailService
Get tag by tagId

Specified by:
getTag in interface MailService
Returns:
List of Tag
Throws:
java.lang.Exception

removeTagsInMessages

public void removeTagsInMessages(java.lang.String username,
                                 java.lang.String accountId,
                                 java.util.List<Message> msgList,
                                 java.util.List<java.lang.String> tagIdList)
                          throws java.lang.Exception
Description copied from interface: MailService
Remove the tag from the message Save the message into the database Update or invalidate the cache

Specified by:
removeTagsInMessages in interface MailService
Throws:
java.lang.Exception

removeTag

public void removeTag(java.lang.String username,
                      java.lang.String accountId,
                      java.lang.String tag)
               throws java.lang.Exception
Description copied from interface: MailService
Find all the message that has the tag , remove the tag from the message and save Remove the tag from the account and save Update or invalidate the cache if needed

Specified by:
removeTag in interface MailService
Throws:
java.lang.Exception

updateTag

public void updateTag(java.lang.String username,
                      java.lang.String accountId,
                      Tag tag)
               throws java.lang.Exception
Description copied from interface: MailService
Update a tag.

Specified by:
updateTag in interface MailService
Throws:
java.lang.Exception

getMessageByTag

public java.util.List<Message> getMessageByTag(java.lang.String username,
                                               java.lang.String accountId,
                                               java.lang.String tagName)
                                        throws java.lang.Exception
Description copied from interface: MailService
Get all messages of the given tag id

Specified by:
getMessageByTag in interface MailService
Throws:
java.lang.Exception

getMessagePagelistByTag

public MessagePageList getMessagePagelistByTag(java.lang.String username,
                                               java.lang.String accountId,
                                               java.lang.String tagId)
                                        throws java.lang.Exception
Description copied from interface: MailService
Get MessagePageList by tag id. This method get all message and put it to MessagePageList object this object will use getPage() method to return a list of messages.

Specified by:
getMessagePagelistByTag in interface MailService
Returns:
MessagePageList that hold message by page
Throws:
java.lang.Exception

getMessagePageListByFolder

public MessagePageList getMessagePageListByFolder(java.lang.String username,
                                                  java.lang.String accountId,
                                                  java.lang.String folderId)
                                           throws java.lang.Exception
Description copied from interface: MailService
Get MessagePageList by folder id. This method get all message and put it to MessagePageList object this object will use getPage() method to return a list of messages.

Specified by:
getMessagePageListByFolder in interface MailService
Returns:
MessagePageList
Throws:
java.lang.Exception

getMailSetting

public MailSetting getMailSetting(java.lang.String username)
                           throws java.lang.Exception
Description copied from interface: MailService
This method get mail settings

Specified by:
getMailSetting in interface MailService
Returns:
MailSetting
Throws:
java.lang.Exception

saveMailSetting

public void saveMailSetting(java.lang.String username,
                            MailSetting newSetting)
                     throws java.lang.Exception
Description copied from interface: MailService
This method to update mail setting

Specified by:
saveMailSetting in interface MailService
Throws:
java.lang.Exception

importMessage

public boolean importMessage(java.lang.String username,
                             java.lang.String accountId,
                             java.lang.String folderId,
                             java.io.InputStream inputStream,
                             java.lang.String type)
                      throws java.lang.Exception
Description copied from interface: MailService
Import message to eXo Mail. This method get InputStream and parse it to eXo Message object in special type

Specified by:
importMessage in interface MailService
Throws:
java.lang.Exception

exportMessage

public java.io.OutputStream exportMessage(java.lang.String username,
                                          java.lang.String accountId,
                                          Message message)
                                   throws java.lang.Exception
Description copied from interface: MailService
Export message from eXo Mail. The exported file can reimport to eXo Mail or import to other mail system

Specified by:
exportMessage in interface MailService
Returns:
OutputStream
Throws:
java.lang.Exception

getSpamFilter

public SpamFilter getSpamFilter(java.lang.String username,
                                java.lang.String accountId)
                         throws java.lang.Exception
Specified by:
getSpamFilter in interface MailService
Throws:
java.lang.Exception

saveSpamFilter

public void saveSpamFilter(java.lang.String username,
                           java.lang.String accountId,
                           SpamFilter spamFilter)
                    throws java.lang.Exception
Description copied from interface: MailService
Save the given spam filter to JCR

Specified by:
saveSpamFilter in interface MailService
Throws:
java.lang.Exception

toggleMessageProperty

public void toggleMessageProperty(java.lang.String username,
                                  java.lang.String accountId,
                                  java.util.List<Message> msgList,
                                  java.lang.String folderId,
                                  java.lang.String property,
                                  boolean value)
                           throws java.lang.Exception
Description copied from interface: MailService
Toggle the property of message. For example read/unread, star/unstar

Specified by:
toggleMessageProperty in interface MailService
Throws:
java.lang.Exception

getAccountDatas

public java.util.List<AccountData> getAccountDatas(org.exoplatform.services.jcr.ext.common.SessionProvider sProvider)
                                            throws java.lang.Exception
Throws:
java.lang.Exception

getFolderHomePath

public java.lang.String getFolderHomePath(java.lang.String username,
                                          java.lang.String accountId)
                                   throws java.lang.Exception
Description copied from interface: MailService
Get path of node, that contains all folders

Specified by:
getFolderHomePath in interface MailService
Returns:
String
Throws:
java.lang.Exception

getSubFolders

public java.util.List<Folder> getSubFolders(java.lang.String username,
                                            java.lang.String accountId,
                                            java.lang.String parentPath)
                                     throws java.lang.Exception
Description copied from interface: MailService
Get all sub folders of the given folder path

Specified by:
getSubFolders in interface MailService
Returns:
List
Throws:
java.lang.Exception

getReferencedMessages

public java.util.List<Message> getReferencedMessages(java.lang.String username,
                                                     java.lang.String accountId,
                                                     java.lang.String msgPath)
                                              throws java.lang.Exception
Description copied from interface: MailService
Get all referenced messages of give message path

Specified by:
getReferencedMessages in interface MailService
Returns:
List
Throws:
java.lang.Exception

getDefaultAccount

public Account getDefaultAccount(java.lang.String username)
                          throws java.lang.Exception
Description copied from interface: MailService
Get default account

Specified by:
getDefaultAccount in interface MailService
Returns:
Account
Throws:
java.lang.Exception

loadTotalMessage

public Message loadTotalMessage(java.lang.String username,
                                java.lang.String accountId,
                                Message msg)
                         throws java.lang.Exception
Description copied from interface: MailService
If the message object didn't load attachment yet, then this method will load it's attachment from JCR and return it's message

Specified by:
loadTotalMessage in interface MailService
Returns:
Message
Throws:
java.lang.Exception

start

public void start()
Specified by:
start in interface org.picocontainer.Startable

stop

public void stop()
Specified by:
stop in interface org.picocontainer.Startable

addListenerPlugin

public void addListenerPlugin(org.exoplatform.container.component.ComponentPlugin listener)
                       throws java.lang.Exception
Specified by:
addListenerPlugin in interface MailService
Throws:
java.lang.Exception

sendReturnReceipt

public boolean sendReturnReceipt(java.lang.String username,
                                 java.lang.String accId,
                                 java.lang.String msgId,
                                 java.util.ResourceBundle res)
                          throws java.lang.Exception
Specified by:
sendReturnReceipt in interface MailService
Throws:
java.lang.Exception


Copyright © 2011 eXo Platform SAS. All Rights Reserved.