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 String
content
The string content of the message if the content is a string.protected javax.mail.Message
message
The message for which the event has been created.protected Date
receivedDate
The date the message has been received (if it has been received and not been sent or stored as draft).protected String[]
recipients
All the recipients of the message.protected String[]
senders
The senders of the message.protected Date
sentDate
The date the message has been sent (if it has been sent and not been received or stored as draft).protected String
subject
The 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.Message
getMessage()
Gets the message (mail) that caused this event.Date
getReceivedDate()
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.Date
getSentDate()
Gets the date the mail that caused this event has been sent.String
getStringContent()
Gets the string content of the mail that caused this event.String
getSubject()
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, aMessagingException
will 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:
getAllRecipients
in interfaceMailEvent
- Returns:
- The recipients (mail addresses) of the mail that caused this event.
-
getSenders
public String[] getSenders()
Description copied from interface:MailEvent
Gets 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:
getSenders
in interfaceMailEvent
- Returns:
- The senders (mail addresses) of the mail that caused this event.
-
getSubject
public String getSubject()
Description copied from interface:MailEvent
Gets the subject of the mail that caused this event. In case there is no subject (yet),null
will be returned.- Specified by:
getSubject
in interfaceMailEvent
- Returns:
- The subject of the mail that caused this event.
-
getReceivedDate
public Date getReceivedDate()
Description copied from interface:MailEvent
Gets 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),null
will be returned.- Specified by:
getReceivedDate
in interfaceMailEvent
- Returns:
- The date the mail that caused this event has been received.
-
getSentDate
public Date getSentDate()
Description copied from interface:MailEvent
Gets 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),null
will be returned.- Specified by:
getSentDate
in interfaceMailEvent
- Returns:
- The date the mail that caused this event has been sent.
-
getStringContent
public String getStringContent()
Description copied from interface:MailEvent
Gets the string content of the mail that caused this event. In case there is no string content (yet),null
will be returned.- Specified by:
getStringContent
in interfaceMailEvent
- Returns:
- The string content of the mail that caused this event.
-
getMessage
public javax.mail.Message getMessage()
Description copied from interface:MailEvent
Gets the message (mail) that caused this event.
Important: Only change this message if you consume this event!- Specified by:
getMessage
in interfaceMailEvent
- Returns:
- The message (mail) that caused this event.
-
-