public abstract class OutgoingEmail extends Object
Modifier and Type | Field and Description |
---|---|
protected EmailArguments |
args |
protected List<String> |
footers |
protected Account.Id |
fromId |
protected String |
messageClass |
protected NotifyHandling |
notify |
protected Map<String,Object> |
soyContext |
protected Map<String,Object> |
soyContextEmailData |
protected org.apache.velocity.VelocityContext |
velocityContext |
Modifier | Constructor and Description |
---|---|
protected |
OutgoingEmail(EmailArguments ea,
String mc) |
Modifier and Type | Method and Description |
---|---|
protected void |
add(RecipientType rt,
Account.Id to)
Schedule delivery of this message to the given account.
|
protected void |
add(RecipientType rt,
Address addr)
Schedule delivery of this message to the given account.
|
protected void |
add(RecipientType rt,
Collection<Account.Id> list)
Schedule this message for delivery to the listed accounts.
|
protected void |
add(RecipientType rt,
UserIdentity who) |
protected void |
appendHtml(String html)
Append html to the outgoing email body.
|
protected void |
appendText(String text)
Append text to the outgoing email body.
|
protected abstract void |
format()
Format the message body by calling
appendText(String) . |
protected String |
getFromLine() |
String |
getGerritHost() |
String |
getGerritUrl() |
String |
getNameEmailFor(Account.Id accountId)
Gets the human readable name and email for an account; if neither are available, returns the
Anonymous Coward name.
|
protected String |
getNameFor(Account.Id accountId)
Lookup a human readable name for an account, usually the "full name".
|
String |
getSettingsUrl() |
String |
getUserNameEmailFor(Account.Id accountId)
Gets the human readable name and email for an account; if both are unavailable, returns the
username.
|
protected void |
init()
Setup the message headers and envelope (TO, CC, BCC).
|
protected boolean |
isVisibleTo(Account.Id to) |
String |
joinStrings(Iterable<Object> in,
String joiner) |
String |
joinStrings(Iterator<Object> in,
String joiner) |
protected void |
removeHeader(String name)
Remove a header from the outgoing message.
|
protected void |
removeUser(Account user) |
void |
send()
Format and enqueue the message for delivery.
|
void |
setAccountsToNotify(com.google.common.collect.ListMultimap<RecipientType,Account.Id> accountsToNotify) |
void |
setFrom(Account.Id id) |
protected void |
setHeader(String name,
Date date) |
protected void |
setHeader(String name,
String value)
Set a header in the outgoing message.
|
void |
setNotify(NotifyHandling notify) |
protected void |
setupSoyContext() |
protected void |
setupVelocityContext() |
protected void |
setVHeader(String name,
String value)
Set a header in the outgoing message using a template.
|
protected boolean |
shouldSendMessage() |
protected String |
soyHtmlTemplate(String name) |
protected String |
soyTextTemplate(String name) |
protected boolean |
supportsHtml()
Override this method to enable HTML in a subclass.
|
protected String |
textTemplate(String name)
Evaluate the named template according to the following priority: 1) Velocity file override,
OR...
|
protected boolean |
useHtml() |
protected String |
velocify(String template) |
protected String |
velocifyFile(String name) |
protected String messageClass
protected org.apache.velocity.VelocityContext velocityContext
protected final EmailArguments args
protected Account.Id fromId
protected NotifyHandling notify
protected OutgoingEmail(EmailArguments ea, String mc)
public void setFrom(Account.Id id)
public void setNotify(NotifyHandling notify)
public void setAccountsToNotify(com.google.common.collect.ListMultimap<RecipientType,Account.Id> accountsToNotify)
public void send() throws EmailException
EmailException
protected abstract void format() throws EmailException
appendText(String)
.EmailException
protected void init() throws EmailException
EmailException
- if an error occurred.protected String getFromLine()
public String getGerritHost()
public String getSettingsUrl()
public String getGerritUrl()
protected void setVHeader(String name, String value) throws EmailException
EmailException
protected void removeHeader(String name)
protected void appendText(String text)
protected void appendHtml(String html)
protected String getNameFor(Account.Id accountId)
public String getNameEmailFor(Account.Id accountId)
accountId
- user to fetch.public String getUserNameEmailFor(Account.Id accountId)
accountId
- user to fetch.protected boolean shouldSendMessage()
protected void add(RecipientType rt, Collection<Account.Id> list)
protected void add(RecipientType rt, UserIdentity who)
protected void add(RecipientType rt, Account.Id to)
protected boolean isVisibleTo(Account.Id to) throws com.google.gwtorm.server.OrmException
to
- account.com.google.gwtorm.server.OrmException
protected void add(RecipientType rt, Address addr)
protected void setupVelocityContext()
protected void setupSoyContext()
protected String velocify(String template) throws EmailException
EmailException
protected String velocifyFile(String name) throws EmailException
EmailException
protected String textTemplate(String name) throws EmailException
EmailException
protected void removeUser(Account user)
protected final boolean useHtml()
protected boolean supportsHtml()