com.hs.mail.imap.dao
Class MySqlMailboxDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.jdbc.core.support.JdbcDaoSupport
          extended by com.hs.mail.imap.dao.AbstractDao
              extended by com.hs.mail.imap.dao.MySqlMailboxDao
All Implemented Interfaces:
MailboxDao, org.springframework.beans.factory.InitializingBean

public class MySqlMailboxDao
extends AbstractDao
implements MailboxDao

Since:
Mar 23, 2010
Author:
Won Chul Doh

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
MySqlMailboxDao()
           
 
Method Summary
 void addSubscription(long userID, long mailboxID, String mailboxName)
          Subscribe the mailbox.
 Mailbox createMailbox(long ownerID, String mailboxName)
          Create a mailbox with given name.
 void deleteMailbox(long ownerID, long mailboxID)
          Delete the mailbox.
 void deleteMailboxes(long ownerID)
          Delete all the mailboxes owned by the user.
 void deleteMessages(long ownerID)
          Delete all the messages owned by the user.
 void deleteMessages(long ownerID, long mailboxID)
          Delete all the messages in the mailbox.
 void deleteSubscription(long userID, String mailboxName)
          Unsubscribe the mailbox.
 void forbidSelectMailbox(long ownerID, long mailboxID)
          Set \Noselect mailbox name attribute.
 int getChildCount(long ownerID, String mailboxName)
          Get the child mailboxes count.
 List<Mailbox> getChildren(long userID, long ownerID, String mailboxName, boolean subscribed)
          Get all child mailboxes of named mailbox.
 List<PhysMessage> getDanglingMessageIDList(long ownerID)
          Get the list of physical message identifiers which will be dangling pointers (pointing messages which are already deleted) after deleting all the messages owned by the user.
 List<PhysMessage> getDanglingMessageIDList(long ownerID, long mailboxID)
          Get the list of physical message identifiers which will be dangling pointers (pointing messages which are already deleted) after expunging the mailbox.
 List<Long> getDeletedMessageIDList(long mailboxID)
          Get the deleted message's identifiers.
 long getFirstUnseenMessageID(long mailboxID)
          Get the message identifier of the first unseen message.
 List<Long> getGarbageMailboxList()
           
 Mailbox getMailbox(long ownerID, String mailboxName)
          Get the named mailbox.
 List<Long> getMailboxIDList(String mailboxName)
          Get the identifiers of mailboxes whose name match the given name.
 int getMessageCount(long mailboxID)
          Get the total message count.
 int getRecentMessageCount(long mailboxID)
          Get the recent message count.
 int getUnseenMessageCount(long mailboxID)
          Get the unseen message count.
 boolean isSubscribed(long userID, String mailboxName)
          Check whether the mailbox is subscribed.
 boolean mailboxExists(long ownerID, String mailboxName)
          Check whether the mailbox really exists.
 void renameMailbox(Mailbox source, String dest)
          Rename the mailbox.
 
Methods inherited from class com.hs.mail.imap.dao.AbstractDao
duplicate, escape, queryForInt, queryForLong, queryForObject
 
Methods inherited from class org.springframework.jdbc.core.support.JdbcDaoSupport
checkDaoConfig, createJdbcTemplate, getConnection, getDataSource, getExceptionTranslator, getJdbcTemplate, initTemplateConfig, releaseConnection, setDataSource, setJdbcTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MySqlMailboxDao

public MySqlMailboxDao()
Method Detail

getMailbox

public Mailbox getMailbox(long ownerID,
                          String mailboxName)
Description copied from interface: MailboxDao
Get the named mailbox.

Specified by:
getMailbox in interface MailboxDao
Parameters:
ownerID - the id of the user who owns the mailbox
mailboxName - fullname of the mailbox
Returns:
Mailbox object

mailboxExists

public boolean mailboxExists(long ownerID,
                             String mailboxName)
Description copied from interface: MailboxDao
Check whether the mailbox really exists.

Specified by:
mailboxExists in interface MailboxDao
Parameters:
ownerID - ID of the user who owns the mailbox
mailboxName - fullname of the parent mailbox
Returns:
true if the mailbox exists, otherwise false

createMailbox

public Mailbox createMailbox(long ownerID,
                             String mailboxName)
Description copied from interface: MailboxDao
Create a mailbox with given name.

Specified by:
createMailbox in interface MailboxDao
Parameters:
ownerID - ID of the user who owns the mailbox
mailboxName - fullname of the mailbox to create
Returns:
Mailbox object created

renameMailbox

public void renameMailbox(Mailbox source,
                          String dest)
Description copied from interface: MailboxDao
Rename the mailbox.

Specified by:
renameMailbox in interface MailboxDao
Parameters:
source - fullname of the mailbox to rename
dest - new name for the mailbox

getChildren

public List<Mailbox> getChildren(long userID,
                                 long ownerID,
                                 String mailboxName,
                                 boolean subscribed)
Description copied from interface: MailboxDao
Get all child mailboxes of named mailbox.

Specified by:
getChildren in interface MailboxDao
Parameters:
userID - ID of user who called this method
ownerID - ID of user who owns the mailbox
mailboxName - fullname of the parent mailbox
subscribed - If true, only subscribed mailboxes are returned
Returns:
list of child Mailbox objects

getChildCount

public int getChildCount(long ownerID,
                         String mailboxName)
Description copied from interface: MailboxDao
Get the child mailboxes count.

Specified by:
getChildCount in interface MailboxDao
Parameters:
ownerID - ID of the user who owns the mailbox
mailboxName - fullname of the parent mailbox
Returns:
total number of child mailboxes

getMailboxIDList

public List<Long> getMailboxIDList(String mailboxName)
Description copied from interface: MailboxDao
Get the identifiers of mailboxes whose name match the given name.

Specified by:
getMailboxIDList in interface MailboxDao
Parameters:
mailboxName - fullname of the mailboxes to find
Returns:
list of mailbox identifiers

isSubscribed

public boolean isSubscribed(long userID,
                            String mailboxName)
Description copied from interface: MailboxDao
Check whether the mailbox is subscribed.

Specified by:
isSubscribed in interface MailboxDao
Parameters:
userID - ID of the user
Returns:
true if the mailbox is subscribed, otherwise false

addSubscription

public void addSubscription(long userID,
                            long mailboxID,
                            String mailboxName)
Description copied from interface: MailboxDao
Subscribe the mailbox.

Specified by:
addSubscription in interface MailboxDao
Parameters:
userID - ID of the user
mailboxID - ID of the mailbox to subscribe

deleteSubscription

public void deleteSubscription(long userID,
                               String mailboxName)
Description copied from interface: MailboxDao
Unsubscribe the mailbox.

Specified by:
deleteSubscription in interface MailboxDao
Parameters:
userID - ID of the user
mailboxName - name of the mailbox to unsubscribe

getDeletedMessageIDList

public List<Long> getDeletedMessageIDList(long mailboxID)
Description copied from interface: MailboxDao
Get the deleted message's identifiers.

Specified by:
getDeletedMessageIDList in interface MailboxDao
Parameters:
mailboxID - id of the mailbox
Returns:
list of message identifies which has \Delete message flag

deleteMailboxes

public void deleteMailboxes(long ownerID)
Description copied from interface: MailboxDao
Delete all the mailboxes owned by the user.

Specified by:
deleteMailboxes in interface MailboxDao
Parameters:
ownerID - ID of the user

deleteMailbox

public void deleteMailbox(long ownerID,
                          long mailboxID)
Description copied from interface: MailboxDao
Delete the mailbox.

Specified by:
deleteMailbox in interface MailboxDao
Parameters:
ownerID - ID of the user
mailboxID - ID of the mailbox

forbidSelectMailbox

public void forbidSelectMailbox(long ownerID,
                                long mailboxID)
Description copied from interface: MailboxDao
Set \Noselect mailbox name attribute.

Specified by:
forbidSelectMailbox in interface MailboxDao
Parameters:
ownerID - ID of the user
mailboxID - ID of the mailbox

getDanglingMessageIDList

public List<PhysMessage> getDanglingMessageIDList(long ownerID)
Description copied from interface: MailboxDao
Get the list of physical message identifiers which will be dangling pointers (pointing messages which are already deleted) after deleting all the messages owned by the user.

Specified by:
getDanglingMessageIDList in interface MailboxDao
Parameters:
ownerID - ID of the user
Returns:
list of PhysMessage objects

getDanglingMessageIDList

public List<PhysMessage> getDanglingMessageIDList(long ownerID,
                                                  long mailboxID)
Description copied from interface: MailboxDao
Get the list of physical message identifiers which will be dangling pointers (pointing messages which are already deleted) after expunging the mailbox.

Specified by:
getDanglingMessageIDList in interface MailboxDao
Parameters:
ownerID - ID of the user who owns the mailbox
mailboxID - ID of the mailbox
Returns:
list of PhysMessage objects

deleteMessages

public void deleteMessages(long ownerID)
Description copied from interface: MailboxDao
Delete all the messages owned by the user.

Specified by:
deleteMessages in interface MailboxDao
Parameters:
ownerID - ID of the user

deleteMessages

public void deleteMessages(long ownerID,
                           long mailboxID)
Description copied from interface: MailboxDao
Delete all the messages in the mailbox.

Specified by:
deleteMessages in interface MailboxDao
Parameters:
ownerID - ID of the user
mailboxID - ID of the mailbox

getMessageCount

public int getMessageCount(long mailboxID)
Description copied from interface: MailboxDao
Get the total message count.

Specified by:
getMessageCount in interface MailboxDao
Parameters:
mailboxID - ID of the mailbox
Returns:
total number of messages

getRecentMessageCount

public int getRecentMessageCount(long mailboxID)
Description copied from interface: MailboxDao
Get the recent message count.

Specified by:
getRecentMessageCount in interface MailboxDao
Parameters:
mailboxID - ID of the mailbox
Returns:
number of recent messages

getUnseenMessageCount

public int getUnseenMessageCount(long mailboxID)
Description copied from interface: MailboxDao
Get the unseen message count.

Specified by:
getUnseenMessageCount in interface MailboxDao
Parameters:
mailboxID - ID of the mailbox
Returns:
total number of unseen messages

getFirstUnseenMessageID

public long getFirstUnseenMessageID(long mailboxID)
Description copied from interface: MailboxDao
Get the message identifier of the first unseen message.

Specified by:
getFirstUnseenMessageID in interface MailboxDao
Parameters:
mailboxID - ID of the mailbox.
Returns:
ID of the first unseen message

getGarbageMailboxList

public List<Long> getGarbageMailboxList()


Copyright © 2011. All Rights Reserved.