public abstract class OutgoingEmail
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected EmailArguments |
args |
protected java.util.List<java.lang.String> |
footers |
protected Account.Id |
fromId |
protected java.lang.String |
messageClass |
protected NotifyHandling |
notify |
protected java.util.Map<java.lang.String,java.lang.Object> |
soyContext |
protected java.util.Map<java.lang.String,java.lang.Object> |
soyContextEmailData |
Modifier | Constructor and Description |
---|---|
protected |
OutgoingEmail(EmailArguments ea,
java.lang.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,
Account.Id to,
boolean override) |
protected void |
add(RecipientType rt,
com.google.gerrit.mail.Address addr)
Schedule delivery of this message to the given account.
|
protected void |
add(RecipientType rt,
com.google.gerrit.mail.Address addr,
boolean override) |
protected void |
add(RecipientType rt,
java.util.Collection<Account.Id> list)
Schedule this message for delivery to the listed accounts.
|
protected void |
add(RecipientType rt,
java.util.Collection<Account.Id> list,
boolean override)
Schedule this message for delivery to the listed accounts.
|
protected void |
add(RecipientType rt,
UserIdentity who) |
protected void |
add(RecipientType rt,
UserIdentity who,
boolean override) |
protected void |
addByEmail(RecipientType rt,
java.util.Collection<com.google.gerrit.mail.Address> list)
Schedule this message for delivery to the listed address.
|
protected void |
addByEmail(RecipientType rt,
java.util.Collection<com.google.gerrit.mail.Address> list,
boolean override)
Schedule this message for delivery to the listed address.
|
protected void |
appendHtml(java.lang.String html)
Append html to the outgoing email body.
|
protected void |
appendText(java.lang.String text)
Append text to the outgoing email body.
|
protected abstract void |
format()
Format the message body by calling
appendText(String) . |
protected java.lang.String |
getFromLine() |
java.lang.String |
getGerritHost() |
protected java.lang.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 java.lang.String |
getNameFor(Account.Id accountId)
Lookup a human readable name for an account, usually the "full name".
|
java.lang.String |
getSettingsUrl() |
protected java.lang.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) |
protected void |
removeHeader(java.lang.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(java.lang.String name,
java.util.Date date) |
protected void |
setHeader(java.lang.String name,
java.lang.String value)
Set a header in the outgoing message.
|
void |
setNotify(NotifyHandling notify) |
protected void |
setupSoyContext() |
protected boolean |
shouldSendMessage() |
protected java.lang.String |
soyHtmlTemplate(java.lang.String name) |
protected boolean |
supportsHtml()
Override this method to enable HTML in a subclass.
|
protected java.lang.String |
textTemplate(java.lang.String name) |
protected boolean |
useHtml() |
protected java.lang.String messageClass
protected java.util.Map<java.lang.String,java.lang.Object> soyContext
protected java.util.Map<java.lang.String,java.lang.Object> soyContextEmailData
protected java.util.List<java.lang.String> footers
protected final EmailArguments args
protected Account.Id fromId
protected NotifyHandling notify
protected OutgoingEmail(EmailArguments ea, java.lang.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 java.lang.String getFromLine()
public java.lang.String getGerritHost()
public java.lang.String getSettingsUrl()
protected void setHeader(java.lang.String name, java.lang.String value)
protected void removeHeader(java.lang.String name)
protected void setHeader(java.lang.String name, java.util.Date date)
protected void appendText(java.lang.String text)
protected void appendHtml(java.lang.String html)
protected java.lang.String getNameFor(Account.Id accountId)
protected java.lang.String getNameEmailFor(Account.Id accountId)
accountId
- user to fetch.protected java.lang.String getUserNameEmailFor(Account.Id accountId)
accountId
- user to fetch.protected boolean shouldSendMessage()
protected void add(RecipientType rt, java.util.Collection<Account.Id> list)
protected void add(RecipientType rt, java.util.Collection<Account.Id> list, boolean override)
protected void addByEmail(RecipientType rt, java.util.Collection<com.google.gerrit.mail.Address> list)
protected void addByEmail(RecipientType rt, java.util.Collection<com.google.gerrit.mail.Address> list, boolean override)
protected void add(RecipientType rt, UserIdentity who)
protected void add(RecipientType rt, UserIdentity who, boolean override)
protected void add(RecipientType rt, Account.Id to)
protected void add(RecipientType rt, Account.Id to, boolean override)
protected boolean isVisibleTo(Account.Id to) throws PermissionBackendException
to
- account.PermissionBackendException
protected void add(RecipientType rt, com.google.gerrit.mail.Address addr)
protected void add(RecipientType rt, com.google.gerrit.mail.Address addr, boolean override)
protected void setupSoyContext()
protected java.lang.String textTemplate(java.lang.String name)
protected java.lang.String soyHtmlTemplate(java.lang.String name)
protected void removeUser(Account user)
protected final boolean useHtml()
protected boolean supportsHtml()