public abstract class OutgoingEmail extends Object
Modifier and Type | Field and Description |
---|---|
protected EmailArguments |
args |
protected com.google.gerrit.reviewdb.client.Account.Id |
fromId |
protected String |
messageClass |
protected com.google.gerrit.extensions.api.changes.NotifyHandling |
notify |
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,
com.google.gerrit.reviewdb.client.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<com.google.gerrit.reviewdb.client.Account.Id> list)
Schedule this message for delivery to the listed accounts.
|
protected void |
add(RecipientType rt,
com.google.gerrit.reviewdb.client.UserIdentity who) |
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(com.google.gerrit.reviewdb.client.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(com.google.gerrit.reviewdb.client.Account.Id accountId)
Lookup a human readable name for an account, usually the "full name".
|
String |
getSettingsUrl() |
String |
getUserNameEmailFor(com.google.gerrit.reviewdb.client.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(com.google.gerrit.reviewdb.client.Account.Id to) |
String |
joinStrings(Iterable<Object> in,
String joiner) |
String |
joinStrings(Iterator<Object> in,
String joiner) |
protected void |
removeUser(com.google.gerrit.reviewdb.client.Account user) |
void |
send()
Format and enqueue the message for delivery.
|
void |
setFrom(com.google.gerrit.reviewdb.client.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(com.google.gerrit.extensions.api.changes.NotifyHandling notify) |
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 |
velocify(String template) |
protected String |
velocifyFile(String name) |
protected String messageClass
protected org.apache.velocity.VelocityContext velocityContext
protected final EmailArguments args
protected com.google.gerrit.reviewdb.client.Account.Id fromId
protected com.google.gerrit.extensions.api.changes.NotifyHandling notify
protected OutgoingEmail(EmailArguments ea, String mc)
public void setFrom(com.google.gerrit.reviewdb.client.Account.Id id)
public void setNotify(com.google.gerrit.extensions.api.changes.NotifyHandling notify)
public void send() throws com.google.gerrit.common.errors.EmailException
com.google.gerrit.common.errors.EmailException
protected abstract void format() throws com.google.gerrit.common.errors.EmailException
appendText(String)
.com.google.gerrit.common.errors.EmailException
protected void init() throws com.google.gerrit.common.errors.EmailException
com.google.gerrit.common.errors.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 com.google.gerrit.common.errors.EmailException
com.google.gerrit.common.errors.EmailException
protected void appendText(String text)
protected String getNameFor(com.google.gerrit.reviewdb.client.Account.Id accountId)
public String getNameEmailFor(com.google.gerrit.reviewdb.client.Account.Id accountId)
accountId
- user to fetch.public String getUserNameEmailFor(com.google.gerrit.reviewdb.client.Account.Id accountId)
accountId
- user to fetch.protected boolean shouldSendMessage()
protected void add(RecipientType rt, Collection<com.google.gerrit.reviewdb.client.Account.Id> list)
protected void add(RecipientType rt, com.google.gerrit.reviewdb.client.UserIdentity who)
protected void add(RecipientType rt, com.google.gerrit.reviewdb.client.Account.Id to)
protected boolean isVisibleTo(com.google.gerrit.reviewdb.client.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 String velocify(String template) throws com.google.gerrit.common.errors.EmailException
com.google.gerrit.common.errors.EmailException
protected String velocifyFile(String name) throws com.google.gerrit.common.errors.EmailException
com.google.gerrit.common.errors.EmailException
protected void removeUser(com.google.gerrit.reviewdb.client.Account user)