Class ChangeEmail

    • Field Detail

      • change

        protected final Change change
      • changeData

        protected final ChangeData changeData
      • stars

        protected com.google.common.collect.ListMultimap<Account.Id,​String> stars
      • changeMessage

        protected String changeMessage
      • timestamp

        protected Instant timestamp
      • emailOnlyAttentionSetIfEnabled

        protected boolean emailOnlyAttentionSetIfEnabled
      • watcherEmails

        protected Set<Address> watcherEmails
    • Method Detail

      • setPatchSet

        public void setPatchSet​(PatchSet ps)
      • setChangeMessage

        public void setChangeMessage​(String cm,
                                     Instant t)
      • formatChange

        protected abstract void formatChange()
                                      throws com.google.gerrit.exceptions.EmailException
        Format the message body by calling OutgoingEmail.appendText(String).
        Throws:
        com.google.gerrit.exceptions.EmailException
      • formatFooter

        protected void formatFooter()
                             throws com.google.gerrit.exceptions.EmailException
        Format the message footer by calling OutgoingEmail.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 class OutgoingEmail
        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 or if the address is malformed. The link will contain a usp parameter set to "email" to inform the frontend on clickthroughs where the link came from.
      • 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.
      • listModifiedFiles

        protected Map<String,​FileDiffOutput> listModifiedFiles​(int patchSetId)
        Get the patch list corresponding to patch set patchSetId of this change.
      • listModifiedFiles

        protected Map<String,​FileDiffOutput> listModifiedFiles()
        Get the patch list corresponding to this patch set.
      • getProjectState

        protected ProjectState getProjectState()
        Get the project entity the change is in; null if its been deleted.
      • addAuthors

        protected void addAuthors​(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.
      • includeWatchers

        protected void includeWatchers​(NotifyConfig.NotifyType type)
        Include users and groups that want notification of events.
      • includeWatchers

        protected void includeWatchers​(NotifyConfig.NotifyType type,
                                       boolean includeWatchersFromNotifyConfig)
        Include users and groups that want notification of events.
      • 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.
      • getAuthors

        protected Set<Account.Id> getAuthors()
        Lazily finds all users who are authors of any part of this change.
      • getIncludeDiff

        public boolean getIncludeDiff()
      • getUnifiedDiff

        public String getUnifiedDiff()
        Show patch set as unified difference.
      • getDiffTemplateData

        protected static com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableMap<String,​String>> getDiffTemplateData​(String sourceDiff)
        Generate a list of maps representing each line of the unified diff. The line maps will have a 'type' key which maps to one of 'common', 'add' or 'remove' and a 'text' key which maps to the line's content.
        Parameters:
        sourceDiff - the unified diff that we're converting to the map.
        Returns:
        map of 'type' to a line's content.