public class SendMailManager extends Object implements ISendMailManager
ISendMailManager
interface.Constructor and Description |
---|
SendMailManager() |
Modifier and Type | Method and Description |
---|---|
void |
addMailToSendQueue(SessionConfig sessionConfig,
IMultipleMail mail,
String queueId,
ITransaction transaction)
Adds an e-mail to the send queue.
|
void |
addMailToSendQueue(SessionConfig sessionConfig,
ISingleMail mail,
String queueId,
ITransaction transaction)
Adds an e-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.
|
void |
deleteMail(SessionConfig sessionConfig,
String mailId,
ITransaction transaction)
Deletes a mail and all its internal components (body, attachments,
destinations).
|
void |
deleteMailDestination(SessionConfig sessionConfig,
String mailDestinationId,
ITransaction transaction)
Deletes a mail destination.
|
String |
generateNewQueueId()
Returns a new generated queue id.
|
IMailConfig |
getMailConfig(SessionConfig sessionConfig,
ITransaction transaction)
Returns the IMailConfig containing the configurations for sending
e-mails.
|
protected IMailSender |
getMailSender(SessionConfig sessionConfig,
ITransaction transaction)
Returns a new instance of the
IMailSender to be used by this manager for sending e-mails. |
void |
pollMailQueueProcessing()
Verifies the need to create another mail queue process thread, and create
it if necessary.
|
boolean |
processNextQueuedMail(String queueId)
Gets the next queued mail and process it.
|
void |
sendMail(SessionConfig sessionConfig,
ISingleMail mail,
ITransaction transaction)
Sends an e-mail immediately.
|
void |
setMailConfig(SessionConfig sessionConfig,
IMailConfig mailConfig,
ITransaction transaction)
Sets the IMailConfig containing the configurations for sending e-mails.
|
void |
threadTerminated(String queueId)
Method called by the
MailQueueProcessThread to indicate that it has
terminated its processing. |
public IMultipleMail createMultipleMail() throws PortalException
ISendMailManager
IMultipleMail
, to fill it with the
required data and use it in the other methods in this manager.createMultipleMail
in interface ISendMailManager
PortalException
ISendMailManager.createSingleMail()
,
ISendMailManager.createMailAttachment()
,
ISendMailManager.createMailDestination()
public ISingleMail createSingleMail() throws PortalException
ISendMailManager
ISingleMail
, to fill it with the required
data and use it in the other methods in this manager.createSingleMail
in interface ISendMailManager
PortalException
ISendMailManager.createMultipleMail()
,
ISendMailManager.createMailAttachment()
public IMailAttachment createMailAttachment() throws PortalException
ISendMailManager
IMailAttachment
, to fill it with
the required data and use it in the other methods in this manager.createMailAttachment
in interface ISendMailManager
PortalException
ISendMailManager.createSingleMail()
,
ISendMailManager.createMultipleMail()
,
IMailBody.getAttachments()
public IMailDestination createMailDestination() throws PortalException
ISendMailManager
IMailDestination
, to fill it
with the required data and use it in the other methods in this manager.createMailDestination
in interface ISendMailManager
PortalException
ISendMailManager.createMultipleMail()
,
IMultipleMail.getDestinations()
public String generateNewQueueId() throws PortalException
ISendMailManager
generateNewQueueId
in interface ISendMailManager
PortalException
- if the queue id could not be generated.public IMailConfig getMailConfig(SessionConfig sessionConfig, ITransaction transaction) throws PortalException
ISendMailManager
getMailConfig
in interface ISendMailManager
sessionConfig
- the user session information.transaction
- the transaction for persistence access.PortalException
- if it was not possible to obtain the IMailConfig.public void setMailConfig(SessionConfig sessionConfig, IMailConfig mailConfig, ITransaction transaction) throws PortalException
ISendMailManager
setMailConfig
in interface ISendMailManager
sessionConfig
- the user session information.mailConfig
- the IMailConfig.transaction
- the transaction for persistence access.PortalException
- if it was not possible to set the IMailConfig.#getMailConfig(ITransaction)
protected IMailSender getMailSender(SessionConfig sessionConfig, ITransaction transaction) throws PortalException
IMailSender
to be used by this manager for sending e-mails.sessionConfig
- user session information.transaction
- transaction for persistence access.PortalException
public void sendMail(SessionConfig sessionConfig, ISingleMail mail, ITransaction transaction) throws PortalException
ISendMailManager
sendMail
in interface ISendMailManager
sessionConfig
- the user session information.mail
- information about the e-mail to be sent.transaction
- the transaction for persistence access.PortalException
- if it was not possible to send the e-mail.ISendMailManager.createSingleMail()
public void addMailToSendQueue(SessionConfig sessionConfig, ISingleMail mail, String queueId, ITransaction transaction) throws PortalException
ISendMailManager
addMailToSendQueue
in interface ISendMailManager
sessionConfig
- the user session information.mail
- information about the e-mail to be sent.queueId
- the id of the queue where the mail will be added to. If null a
new queue will be generated. To generate a new queueId use
ISendMailManager.generateNewQueueId()
.transaction
- the transaction for persistence access. If the transaction
rollbacks the e-mail will not be added to the queue and not
sent.PortalException
- if it was not possible to queue the the e-mail.ISendMailManager.createSingleMail()
public void addMailToSendQueue(SessionConfig sessionConfig, IMultipleMail mail, String queueId, ITransaction transaction) throws PortalException
ISendMailManager
addMailToSendQueue
in interface ISendMailManager
sessionConfig
- the user session information.mail
- information about the e-mail to be sent.queueId
- the id of the queue where the mail will be added to. If null a
new queue will be generated. To generate a new queueId use
ISendMailManager.generateNewQueueId()
.transaction
- the transaction for persistence access. If the transaction
rollbacks the e-mail will not be added to the queue and not
sent.PortalException
- if it was not possible to queue the e-mail.ISendMailManager.createMultipleMail()
public boolean processNextQueuedMail(String queueId) throws PortalException
queueId
- the id of the mail queue to be processed.PortalException
- if it was not possible to process the mail queue.public void threadTerminated(String queueId)
MailQueueProcessThread
to indicate that it has
terminated its processing.queueId
- the id of the mail queue the thread was responsible to process.public void pollMailQueueProcessing() throws PortalException
ISendMailManager
pollMailQueueProcessing
in interface ISendMailManager
PortalException
- if it was not possible to complete the operation.public void deleteMail(SessionConfig sessionConfig, String mailId, ITransaction transaction) throws PortalException
ISendMailManager
deleteMail
in interface ISendMailManager
sessionConfig
- the user session information.mailId
- the mail's id.transaction
- the transaction for persistence access.PortalException
- if it was not possible to delete the mail.public void deleteMailDestination(SessionConfig sessionConfig, String mailDestinationId, ITransaction transaction) throws PortalException
ISendMailManager
deleteMailDestination
in interface ISendMailManager
sessionConfig
- the user session information.mailDestinationId
- the mail destination's id.transaction
- the transaction for persistence access.PortalException
- if it was not possible to delete the mail destination.LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.