Class ChangeEmail
- java.lang.Object
-
- com.google.gerrit.server.mail.send.OutgoingEmail
-
- com.google.gerrit.server.mail.send.NotificationEmail
-
- com.google.gerrit.server.mail.send.ChangeEmail
-
- Direct Known Subclasses:
NewChangeSender
,ReplyToChangeSender
,SetAssigneeSender
public abstract class ChangeEmail extends NotificationEmail
Sends an email to one or more interested parties.
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<Account.Id>
authors
protected Change
change
protected ChangeData
changeData
protected String
changeMessage
protected boolean
emailOnlyAuthors
protected PatchSet
patchSet
protected PatchSetInfo
patchSetInfo
protected ProjectState
projectState
protected com.google.common.collect.ListMultimap<Account.Id,String>
stars
protected Timestamp
timestamp
-
Fields inherited from class com.google.gerrit.server.mail.send.NotificationEmail
branch
-
Fields inherited from class com.google.gerrit.server.mail.send.OutgoingEmail
args, footers, fromId, messageClass, notify, soyContext, soyContextEmailData
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ChangeEmail(EmailArguments args, String messageClass, ChangeData changeData)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
add(RecipientType rt, Account.Id to)
Schedule delivery of this message to the given account.protected void
bccStarredBy()
BCC any user who has starred this change.protected void
ccAllApprovals()
Any user who has published comments on this change.protected void
ccExistingReviewers()
Users who were added as reviewers to this change.protected void
format()
Format the message body by callingOutgoingEmail.appendText(String)
.protected abstract void
formatChange()
Format the message body by callingOutgoingEmail.appendText(String)
.protected void
formatFooter()
Format the message footer by callingOutgoingEmail.appendText(String)
.protected Set<Account.Id>
getAuthors()
Find all users who are authors of any part of this change.String
getChangeDetail()
Create the change message and the affected file list.String
getChangeMessageThreadId()
String
getChangeUrl()
Get a link to the change; null if the server doesn't know its own address.String
getCoverLetter()
Get the text of the "cover letter".boolean
getIncludeDiff()
protected PatchList
getPatchList()
Get the patch list corresponding to this patch set.protected PatchList
getPatchList(int patchSetId)
Get the patch list corresponding to patch set patchSetId of this change.protected ProjectState
getProjectState()
Get the project entity the change is in; null if its been deleted.String
getUnifiedDiff()
Show patch set as unified difference.protected ProjectWatch.Watchers
getWatchers(ProjectWatches.NotifyType type, boolean includeWatchersFromNotifyConfig)
Returns all watchers that are relevantprotected void
init()
Setup the message headers and envelope (TO, CC, BCC).protected boolean
isVisibleTo(Account.Id to)
protected static ChangeData
newChangeData(EmailArguments ea, Project.NameKey project, Change.Id id)
protected void
rcptToAuthors(RecipientType rt)
TO or CC all vested parties (change owner, patch set uploader, author).protected void
removeUsersThatIgnoredTheChange()
void
setChangeMessage(String cm, Timestamp t)
void
setFrom(Account.Id id)
void
setPatchSet(PatchSet ps)
void
setPatchSet(PatchSet ps, PatchSetInfo psi)
protected void
setupSoyContext()
-
Methods inherited from class com.google.gerrit.server.mail.send.NotificationEmail
add, getInstanceAndProjectName, getShortProjectName, getSshHost, includeWatchers, includeWatchers
-
Methods inherited from class com.google.gerrit.server.mail.send.OutgoingEmail
add, add, add, add, add, add, add, addByEmail, addByEmail, appendHtml, appendText, getFromLine, getGerritHost, getNameEmailFor, getNameFor, getSettingsUrl, getUserNameEmailFor, removeHeader, removeUser, send, setHeader, setHeader, setNotify, shouldSendMessage, soyHtmlTemplate, supportsHtml, textTemplate, useHtml
-
-
-
-
Field Detail
-
change
protected final Change change
-
changeData
protected final ChangeData changeData
-
stars
protected com.google.common.collect.ListMultimap<Account.Id,String> stars
-
patchSet
protected PatchSet patchSet
-
patchSetInfo
protected PatchSetInfo patchSetInfo
-
changeMessage
protected String changeMessage
-
timestamp
protected Timestamp timestamp
-
projectState
protected ProjectState projectState
-
authors
protected Set<Account.Id> authors
-
emailOnlyAuthors
protected boolean emailOnlyAuthors
-
-
Constructor Detail
-
ChangeEmail
protected ChangeEmail(EmailArguments args, String messageClass, ChangeData changeData)
-
-
Method Detail
-
newChangeData
protected static ChangeData newChangeData(EmailArguments ea, Project.NameKey project, Change.Id id)
-
setFrom
public void setFrom(Account.Id id)
- Overrides:
setFrom
in classOutgoingEmail
-
setPatchSet
public void setPatchSet(PatchSet ps)
-
setPatchSet
public void setPatchSet(PatchSet ps, PatchSetInfo psi)
-
format
protected void format() throws com.google.gerrit.exceptions.EmailException
Format the message body by callingOutgoingEmail.appendText(String)
.- Specified by:
format
in classOutgoingEmail
- Throws:
com.google.gerrit.exceptions.EmailException
-
formatChange
protected abstract void formatChange() throws com.google.gerrit.exceptions.EmailException
Format the message body by callingOutgoingEmail.appendText(String)
.- Throws:
com.google.gerrit.exceptions.EmailException
-
formatFooter
protected void formatFooter() throws com.google.gerrit.exceptions.EmailException
Format the message footer by callingOutgoingEmail.appendText(String)
.- Throws:
com.google.gerrit.exceptions.EmailException
- if an error occurred.
-
init
protected void init() throws com.google.gerrit.exceptions.EmailException
Setup the message headers and envelope (TO, CC, BCC).- Overrides:
init
in classNotificationEmail
- Throws:
com.google.gerrit.exceptions.EmailException
- if an error occurred.
-
getChangeUrl
public String getChangeUrl()
Get a link to the change; null if the server doesn't know its own address.
-
getChangeMessageThreadId
public String getChangeMessageThreadId()
-
getCoverLetter
public String getCoverLetter()
Get the text of the "cover letter".
-
getChangeDetail
public String getChangeDetail()
Create the change message and the affected file list.
-
getPatchList
protected PatchList getPatchList(int patchSetId) throws PatchListNotAvailableException
Get the patch list corresponding to patch set patchSetId of this change.- Throws:
PatchListNotAvailableException
-
getPatchList
protected PatchList getPatchList() throws PatchListNotAvailableException
Get the patch list corresponding to this patch set.- Throws:
PatchListNotAvailableException
-
getProjectState
protected ProjectState getProjectState()
Get the project entity the change is in; null if its been deleted.
-
rcptToAuthors
protected void rcptToAuthors(RecipientType rt)
TO or CC all vested parties (change owner, patch set uploader, author).
-
bccStarredBy
protected void bccStarredBy()
BCC any user who has starred this change.
-
removeUsersThatIgnoredTheChange
protected void removeUsersThatIgnoredTheChange()
-
getWatchers
protected final ProjectWatch.Watchers getWatchers(ProjectWatches.NotifyType type, boolean includeWatchersFromNotifyConfig)
Description copied from class:NotificationEmail
Returns all watchers that are relevant- Specified by:
getWatchers
in classNotificationEmail
-
ccAllApprovals
protected void ccAllApprovals()
Any user who has published comments on this change.
-
ccExistingReviewers
protected void ccExistingReviewers()
Users who were added as reviewers to this change.
-
add
protected void add(RecipientType rt, Account.Id to)
Description copied from class:OutgoingEmail
Schedule delivery of this message to the given account.- Overrides:
add
in classOutgoingEmail
-
isVisibleTo
protected boolean isVisibleTo(Account.Id to) throws PermissionBackendException
- Overrides:
isVisibleTo
in classOutgoingEmail
- Parameters:
to
- account.- Returns:
- whether this email is visible to the given account.
- Throws:
PermissionBackendException
-
getAuthors
protected Set<Account.Id> getAuthors()
Find all users who are authors of any part of this change.
-
setupSoyContext
protected void setupSoyContext()
- Overrides:
setupSoyContext
in classNotificationEmail
-
getIncludeDiff
public boolean getIncludeDiff()
-
getUnifiedDiff
public String getUnifiedDiff()
Show patch set as unified difference.
-
-