Package org.openbravo.email
Interface EmailEventContentGenerator
-
- All Known Implementing Classes:
AccountCancelledEmailGenerator
,NewUserEmailGenerator
public interface EmailEventContentGenerator
Classes implementing this interface will be listening to email events. In case the event is valid for them (isValidEvent(String, Object)
returnstrue
) they are in charge of generating the content for the email.event
in all methods is aString
that identifies the event.- Author:
- alostale
- See Also:
EmailEventManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<File>
getAttachments(Object data, String event)
Returns the list of files to be attached to the email.String
getBody(Object data, String event)
Returns the email body for the event and data.String
getContentType()
Returns the type of content of the email.int
getPriority()
When there are several classes listening to the same event, the order the emails are sent is based on this value.String
getSubject(Object data, String event)
Returns the email subject for the event and data.boolean
isAsynchronous()
Asynchronous emails are sent in a separate thread not waiting them to finish to continue the rest of the execution flow.boolean
isValidEvent(String event, Object data)
Checks if an email should be generated for theevent
.boolean
preventsOthersExecution()
In case there are several classes listening to the same event, when this method returnstrue
, other emails with lower priority that might exist, will not be sent.
-
-
-
Method Detail
-
isValidEvent
boolean isValidEvent(String event, Object data)
Checks if an email should be generated for theevent
. Same class can be listening to several events.- Parameters:
event
- Event to checkdata
- Data the email will be generated for (this can also determine whether the email must be sent)- Returns:
true
if the email must be sent,false
if not.
-
getSubject
String getSubject(Object data, String event)
Returns the email subject for the event and data.
-
getContentType
String getContentType()
Returns the type of content of the email. Tipically"text/html; charset=utf-8"
or"text/plain; charset=utf-8"
-
getPriority
int getPriority()
When there are several classes listening to the same event, the order the emails are sent is based on this value.- See Also:
preventsOthersExecution()
-
preventsOthersExecution
boolean preventsOthersExecution()
In case there are several classes listening to the same event, when this method returnstrue
, other emails with lower priority that might exist, will not be sent.
-
isAsynchronous
boolean isAsynchronous()
Asynchronous emails are sent in a separate thread not waiting them to finish to continue the rest of the execution flow.
-
-