Class MailEventImpl
- java.lang.Object
-
- de.aristaflow.adept2.core.eventmanager.common.AbstractEvent
-
- de.aristaflow.adept2.core.eventmanager.mailevents.MailEventImpl
-
public class MailEventImpl extends AbstractEvent implements MailEvent
An event for mails, that is, an event is produced and sent as soon as a mail is stored to a specific folder.
This event source terminates as soon as an event has been handled. However, since it polls, one has to ensure that a handled message is deleted or moved to another folder. Otherwise the source will create another event for the message.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringcontentThe string content of the message if the content is a string.protected javax.mail.MessagemessageThe message for which the event has been created.protected DatereceivedDateThe date the message has been received (if it has been received and not been sent or stored as draft).protected String[]recipientsAll the recipients of the message.protected String[]sendersThe senders of the message.protected DatesentDateThe date the message has been sent (if it has been sent and not been received or stored as draft).protected StringsubjectThe subject of the message.-
Fields inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEvent
creationTime, eventType, id, ID_COUNT, managerURI, sourceID, sourceType
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]getAllRecipients()Gets the recipients (mail addresses) of the mail that caused this event.javax.mail.MessagegetMessage()Gets the message (mail) that caused this event.DategetReceivedDate()Gets the date the mail that caused this event has been received.String[]getSenders()Gets the senders (mail addresses) of the mail that caused this event.DategetSentDate()Gets the date the mail that caused this event has been sent.StringgetStringContent()Gets the string content of the mail that caused this event.StringgetSubject()Gets the subject of the mail that caused this event.-
Methods inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEvent
getCreationTime, getEventManager, getEventType, getID, getSourceID, getSourceType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.model.events.Event
getCreationTime, getEventManager, getEventType, getID, getSourceID, getSourceType
-
-
-
-
Field Detail
-
message
protected final javax.mail.Message message
The message for which the event has been created.
-
recipients
protected final String[] recipients
All the recipients of the message.
-
senders
protected final String[] senders
The senders of the message.
-
subject
protected final String subject
The subject of the message.
-
receivedDate
protected final Date receivedDate
The date the message has been received (if it has been received and not been sent or stored as draft).
-
sentDate
protected final Date sentDate
The date the message has been sent (if it has been sent and not been received or stored as draft).
-
content
protected final String content
The string content of the message if the content is a string. Otherwise this will benull.
-
-
Constructor Detail
-
MailEventImpl
public MailEventImpl(URI[] managerURI, String eventType, String sourceType, String sourceID, javax.mail.Message message, Logger logger) throws javax.mail.MessagingException, IOException
Creates a new event for the designated message.- Parameters:
managerURI- The URIs of the service (event manager) creating the event.eventType- The type of the event.sourceType- The type of the source of this event.sourceID- The ID of the source of this event.message- The message of the event.logger- The logger in case an encoding of an addresses is not supported.- Throws:
javax.mail.MessagingException- If retrieving the required data from the message fails, aMessagingExceptionwill be thrown.IOException- Retrieving the (complex) content of the message may thrown anIOException.
-
-
Method Detail
-
getAllRecipients
public String[] getAllRecipients()
Gets the recipients (mail addresses) of the mail that caused this event. In case there are no recipients (yet), an emtpy array will be returned.- Specified by:
getAllRecipientsin interfaceMailEvent- Returns:
- The recipients (mail addresses) of the mail that caused this event.
-
getSenders
public String[] getSenders()
Description copied from interface:MailEventGets the senders (mail addresses) of the mail that caused this event. In case there are no senders (yet), an emtpy array will be returned.- Specified by:
getSendersin interfaceMailEvent- Returns:
- The senders (mail addresses) of the mail that caused this event.
-
getSubject
public String getSubject()
Description copied from interface:MailEventGets the subject of the mail that caused this event. In case there is no subject (yet),nullwill be returned.- Specified by:
getSubjectin interfaceMailEvent- Returns:
- The subject of the mail that caused this event.
-
getReceivedDate
public Date getReceivedDate()
Description copied from interface:MailEventGets the date the mail that caused this event has been received. In case this mail has not been received (for instance it is a draft),nullwill be returned.- Specified by:
getReceivedDatein interfaceMailEvent- Returns:
- The date the mail that caused this event has been received.
-
getSentDate
public Date getSentDate()
Description copied from interface:MailEventGets the date the mail that caused this event has been sent. In case this mail has not been sent (for instance it is a draft),nullwill be returned.- Specified by:
getSentDatein interfaceMailEvent- Returns:
- The date the mail that caused this event has been sent.
-
getStringContent
public String getStringContent()
Description copied from interface:MailEventGets the string content of the mail that caused this event. In case there is no string content (yet),nullwill be returned.- Specified by:
getStringContentin interfaceMailEvent- Returns:
- The string content of the mail that caused this event.
-
getMessage
public javax.mail.Message getMessage()
Description copied from interface:MailEventGets the message (mail) that caused this event.
Important: Only change this message if you consume this event!- Specified by:
getMessagein interfaceMailEvent- Returns:
- The message (mail) that caused this event.
-
-