|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lumis.portal.sendmail.dao.hibernate.SendMailDaoHib
public class SendMailDaoHib
Hibernate based implementation of ISendMailDao
.
Constructor Summary | |
---|---|
SendMailDaoHib()
|
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)
This implementation actually uses the same mail instance, only sets the values in the to, cc and bcc fields. |
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 mail)
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SendMailDaoHib()
Method Detail |
---|
public IMultipleMail createMultipleMail() throws PortalException
ISendMailDao
IMultipleMail
,
to fill it with the required data and use it in the
other methods in this interface.
createMultipleMail
in interface ISendMailDao
PortalException
ISendMailDao.createSingleMail()
,
ISendMailDao.createMailAttachment()
,
ISendMailDao.createMailDestination()
public ISingleMail createSingleMail() throws PortalException
ISendMailDao
ISingleMail
,
to fill it with the required data and use it in the
other methods in this interface.
createSingleMail
in interface ISendMailDao
PortalException
ISendMailDao.createMultipleMail()
,
ISendMailDao.createMailAttachment()
public IMailAttachment createMailAttachment()
ISendMailDao
IMailAttachment
,
to fill it with the required data and use it in the
other methods in this interface.
createMailAttachment
in interface ISendMailDao
ISendMailDao.createSingleMail()
,
ISendMailDao.createMultipleMail()
,
IMailBody.getAttachments()
public IMailDestination createMailDestination()
ISendMailDao
IMailDestination
,
to fill it with the required data and use it in the
other methods in this interface.
createMailDestination
in interface ISendMailDao
ISendMailDao.createMultipleMail()
,
IMultipleMail.getDestinations()
public String generateNewQueueId() throws DaoException
ISendMailDao
generateNewQueueId
in interface ISendMailDao
DaoException
- if the queue id could not be generated.public IMailConfig getMailConfig(ITransaction transaction) throws DaoException
ISendMailDao
getMailConfig
in interface ISendMailDao
transaction
- the transaction for persistence access.
DaoException
- if it was not possible to obtain the IMailConfig.ISendMailDao.setMailConfig(IMailConfig, ITransaction)
public void setMailConfig(IMailConfig mailConfig, ITransaction transaction) throws DaoException
ISendMailDao
setMailConfig
in interface ISendMailDao
mailConfig
- the IMailConfig.transaction
- the transaction for persistence access.
DaoException
- if it was not possible to set the IMailConfig.ISendMailDao.getMailConfig(ITransaction)
public void addMailToSendQueue(ISingleMail mail, String queueId, ITransaction transaction) throws DaoException
ISendMailDao
addMailToSendQueue
in interface ISendMailDao
mail
- the mail. This instance must have been created by ISendMailDao.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.
DaoException
- if it was not possible to add the mail to the send queue.ISendMailDao.addMailToSendQueue(IMultipleMail, String, ITransaction)
,
#createMail()
,
ISendMailDao.createMailAttachment()
public void addMailToSendQueue(IMultipleMail mail, String queueId, ITransaction transaction) throws DaoException
ISendMailDao
addMailToSendQueue
in interface ISendMailDao
mail
- the mail. This instance must have been created by ISendMailDao.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.
DaoException
- if it was not possible to add the mail to the send queue.ISendMailDao.addMailToSendQueue(ISingleMail, String, ITransaction)
,
#createMail()
,
ISendMailDao.createMailAttachment()
,
ISendMailDao.createMailDestination()
public ISingleMail createSingleMail(IMultipleMail mail, IMailDestination destination)
This can be done because both IMultipleMail
and ISingleMail
are implemented
by the Mail
class, but the ISingleMail
destination fields are ignored when
used as a IMultipleMail
in this Dao.
createSingleMail
in interface ISendMailDao
mail
- the mail.destination
- the destination
ISingleMail
instance.public IBaseMail fetchNextQueuedMail(String queueId) throws DaoException
ISendMailDao
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.
fetchNextQueuedMail
in interface ISendMailDao
queueId
- the id of the queue from where the mail will be taken.
DaoException
public void unfetchMail(String mailId) throws DaoException
ISendMailDao
IMailSendStatus.STATUS_SEND_PENDING
.
unfetchMail
in interface ISendMailDao
mailId
- the mail id.
DaoException
public IMailDestination fetchNextPendingDestination(IMultipleMail mail) throws DaoException
ISendMailDao
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.
fetchNextPendingDestination
in interface ISendMailDao
mail
- the mail.
DaoException
public void updateMailSendStatus(IMailSendStatus mailSendStatus) throws DaoException
ISendMailDao
updateMailSendStatus
in interface ISendMailDao
mailSendStatus
- the mail send status information.
DaoException
public String lockNextQueue() throws DaoException
ISendMailDao
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.
lockNextQueue
in interface ISendMailDao
DaoException
public void unlockQueue(String queueId) throws DaoException
ISendMailDao
unlockQueue
in interface ISendMailDao
queueId
- the queue's id.
DaoException
public void deleteMail(String mailId, ITransaction transaction) throws DaoException
ISendMailDao
deleteMail
in interface ISendMailDao
mailId
- the id of the mail to be deleted.transaction
- the transaction for persistence access.
DaoException
- if it was not possible to delete the mail.public void deleteMailBody(String mailId, ITransaction transaction) throws DaoException
ISendMailDao
deleteMailBody
in interface ISendMailDao
mailId
- the id of the mail whose body is to be deleted.transaction
- the transaction for persistence access.
DaoException
- if it was not possible to delete the mail.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |