lumis.portal.sendmail.dao
Interface ISendMailDao

Package class diagram package ISendMailDao
All Known Implementing Classes:
SendMailDaoHib

public interface ISendMailDao

The DAO for sendmail persistence information.

Since:
4.0.4

Method Summary
 void addMailToSendQueue(IMultipleMail mail, String queueId, ITransaction transaction)
          Adds an mail to the send queue.
 void addMailToSendQueue(ISingleMail mail, String queueId, ITransaction transaction)
          Adds an mail to the send queue.
 IMailAttachment createMailAttachment()
          Factory method for creating a new mail attachment instance.
 IMailDestination createMailDestination()
          Factory method for creating a new mail destination instance.
 IMultipleMail createMultipleMail()
          Factory method for creating a new blank mail instance.
 ISingleMail createSingleMail()
          Factory method for creating a new blank mail instance.
 ISingleMail createSingleMail(IMultipleMail mail, IMailDestination destination)
          Returns a ISingleMail instance as the given mail addressed to the given destination.
 void deleteMail(String mailId, ITransaction transaction)
          Deletes the whole mail structure, including the body, attachments, destinations.
 void deleteMailBody(String mailId, ITransaction transaction)
          Deletes the whole mail's body, including the body message and the attachments.
 IMailDestination fetchNextPendingDestination(IMultipleMail multipleMail)
          Returns for the next destination pending for sending for the given mail, and marks its status as sending.
 IBaseMail fetchNextQueuedMail(String queueId)
          Returns the next queued mail pending for sending, and marks its status as sending.
 String generateNewQueueId()
          Returns a new generated queue id.
 IMailConfig getMailConfig(ITransaction transaction)
          Returns the IMailConfig containing the configurations for sending e-mails.
 String lockNextQueue()
          Locks the next queue mail available and returns its id.
 void setMailConfig(IMailConfig mailConfig, ITransaction transaction)
          Sets the IMailConfig containing the configurations for sending e-mails.
 void unfetchMail(String mailId)
          Puts a mail back on its place in the queue to be available to another queue processing.
 void unlockQueue(String queueId)
          Unlocks a mail queue.
 void updateMailSendStatus(IMailSendStatus mailSendStatus)
          Updates the mail send status as set in the given instance.
 

Method Detail

createSingleMail

ISingleMail createSingleMail()
                             throws PortalException
Factory method for creating a new blank mail instance. Use this method to obtain an instance of ISingleMail, to fill it with the required data and use it in the other methods in this interface.

Returns:
a new blank mail instance.
Throws:
PortalException
Since:
4.0.4
See Also:
createMultipleMail(), createMailAttachment()

createSingleMail

ISingleMail createSingleMail(IMultipleMail mail,
                             IMailDestination destination)
Returns a ISingleMail instance as the given mail addressed to the given destination.

Parameters:
mail - the mail.
destination - the destination.
Returns:
the corresponding ISingleMail instance.
Since:
4.0.4

createMultipleMail

IMultipleMail createMultipleMail()
                                 throws PortalException
Factory method for creating a new blank mail instance. Use this method to obtain an instance of IMultipleMail, to fill it with the required data and use it in the other methods in this interface.

Returns:
a new blank mail instance.
Throws:
PortalException
Since:
4.0.4
See Also:
createSingleMail(), createMailAttachment(), createMailDestination()

createMailDestination

IMailDestination createMailDestination()
Factory method for creating a new mail destination instance. Use this method to obtain an instance of IMailDestination, to fill it with the required data and use it in the other methods in this interface.

Returns:
a new mail destination instance.
Since:
4.0.4
See Also:
createMultipleMail(), IMultipleMail.getDestinations()

createMailAttachment

IMailAttachment createMailAttachment()
Factory method for creating a new mail attachment instance. Use this method to obtain an instance of IMailAttachment, to fill it with the required data and use it in the other methods in this interface.

Returns:
a new mail attachment instance.
Since:
4.0.4
See Also:
createSingleMail(), createMultipleMail(), IMailBody.getAttachments()

getMailConfig

IMailConfig getMailConfig(ITransaction transaction)
                          throws DaoException
Returns the IMailConfig containing the configurations for sending e-mails.

Parameters:
transaction - the transaction for persistence access.
Returns:
the IMailConfig, never null.
Throws:
DaoException - if it was not possible to obtain the IMailConfig.
Since:
4.0.4
See Also:
setMailConfig(IMailConfig, ITransaction)

setMailConfig

void setMailConfig(IMailConfig mailConfig,
                   ITransaction transaction)
                   throws DaoException
Sets the IMailConfig containing the configurations for sending e-mails.

Parameters:
mailConfig - the IMailConfig.
transaction - the transaction for persistence access.
Throws:
DaoException - if it was not possible to set the IMailConfig.
Since:
4.0.4
See Also:
getMailConfig(ITransaction)

addMailToSendQueue

void addMailToSendQueue(ISingleMail mail,
                        String queueId,
                        ITransaction transaction)
                        throws DaoException
Adds an mail to the send queue.

Parameters:
mail - the mail. This instance must have been created by createSingleMail().
queueId - the id of the queue where the mail will be added to. If null a new queue will be generated.
transaction - the transaction for persistence access.
Throws:
DaoException - if it was not possible to add the mail to the send queue.
Since:
4.0.4
See Also:
addMailToSendQueue(IMultipleMail, String, ITransaction), #createMail(), createMailAttachment()

addMailToSendQueue

void addMailToSendQueue(IMultipleMail mail,
                        String queueId,
                        ITransaction transaction)
                        throws DaoException
Adds an mail to the send queue.

Parameters:
mail - the mail. This instance must have been created by createMultipleMail().
queueId - the id of the queue where the mail will be added to. If null a new queue will be generated.
transaction - the transaction for persistence access.
Throws:
DaoException - if it was not possible to add the mail to the send queue.
Since:
4.0.4
See Also:
addMailToSendQueue(ISingleMail, String, ITransaction), #createMail(), createMailAttachment(), createMailDestination()

updateMailSendStatus

void updateMailSendStatus(IMailSendStatus mailSendStatus)
                          throws DaoException
Updates the mail send status as set in the given instance. The update is committed immediatelly.

Parameters:
mailSendStatus - the mail send status information.
Throws:
DaoException
Since:
4.0.4

fetchNextQueuedMail

IBaseMail fetchNextQueuedMail(String queueId)
                              throws DaoException
Returns the next queued mail pending for sending, and marks its status as sending. Must also update the queue lock expiration date time.

This operation must be atomic and garantee that the same mail will not be returned many times, even if this method is called simultaneously by many threads in many servers in the cluster.

Parameters:
queueId - the id of the queue from where the mail will be taken.
Returns:
the mail or null if none was found.
Throws:
DaoException
Since:
4.0.4

unfetchMail

void unfetchMail(String mailId)
                 throws DaoException
Puts a mail back on its place in the queue to be available to another queue processing. It status will be changed to IMailSendStatus.STATUS_SEND_PENDING.

Parameters:
mailId - the mail id.
Throws:
DaoException
Since:
4.0.4

fetchNextPendingDestination

IMailDestination fetchNextPendingDestination(IMultipleMail multipleMail)
                                             throws DaoException
Returns for the next destination pending for sending for the given mail, and marks its status as sending. Must also update the corresponding queue lock expiration date time.

This operation must be atomic and garantee that the same destination will not be returned many times, even if this method is called simultaneously by many threads in many servers in the cluster.

Parameters:
multipleMail - the mail.
Returns:
the destination or null if none was found.
Throws:
DaoException
Since:
4.0.4

lockNextQueue

String lockNextQueue()
                     throws DaoException
Locks the next queue mail available and returns its id.

This operation must be atomic and garantee that a locked queue will not be returned, even if this method is called simultaneously by many threads in many servers in the cluster.

Returns:
the id of the locked queue, or null if there was no queue pending.
Throws:
DaoException
Since:
4.0.4

generateNewQueueId

String generateNewQueueId()
                          throws DaoException
Returns a new generated queue id.

Returns:
a new generated queue id.
Throws:
DaoException - if the queue id could not be generated.
Since:
4.0.4

unlockQueue

void unlockQueue(String queueId)
                 throws DaoException
Unlocks a mail queue.

Parameters:
queueId - the queue's id.
Throws:
DaoException
Since:
4.0.4

deleteMail

void deleteMail(String mailId,
                ITransaction transaction)
                throws DaoException
Deletes the whole mail structure, including the body, attachments, destinations.

Parameters:
mailId - the id of the mail to be deleted.
transaction - the transaction for persistence access.
Throws:
DaoException - if it was not possible to delete the mail.
Since:
4.0.4

deleteMailBody

void deleteMailBody(String mailId,
                    ITransaction transaction)
                    throws DaoException
Deletes the whole mail's body, including the body message and the attachments.

Parameters:
mailId - the id of the mail whose body is to be deleted.
transaction - the transaction for persistence access.
Throws:
DaoException - if it was not possible to delete the mail.
Since:
4.0.4


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.