Package lumis.portal.sendmail.dao
Interface ISendMailDao
-
- All Known Implementing Classes:
SendMailDaoHib
public interface ISendMailDao
The DAO for sendmail persistence information.- Since:
- 4.0.4
- Version:
- $Revision: 17593 $ $Date: 2015-07-17 11:21:36 -0300 (Fri, 17 Jul 2015) $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 aISingleMail
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.void
deleteMailDestination(String mailDestinationId, ITransaction transaction)
Deletes the mail destination.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 ofISingleMail
, 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 aISingleMail
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 ofIMultipleMail
, 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 ofIMailDestination
, 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 ofIMailAttachment
, 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 bycreateSingleMail()
.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 bycreateMultipleMail()
.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 toIMailSendStatus.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
-
deleteMailDestination
void deleteMailDestination(String mailDestinationId, ITransaction transaction) throws DaoException
Deletes the mail destination.- Parameters:
mailDestinationId
- the id of the mail destination to be deleted.transaction
- the transaction for persistence access.- Throws:
DaoException
- if it was not possible to delete the mail destination.- Since:
- 8.1.0
-
-