Line data Source code
1 : // Copyright (C) 2020 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.mail.send; 16 : 17 : import com.google.gerrit.entities.Account; 18 : import com.google.gerrit.entities.Change; 19 : import com.google.gerrit.entities.Project; 20 : import com.google.gerrit.exceptions.EmailException; 21 : 22 : /** Base class for Attention Set email senders */ 23 : public abstract class AttentionSetSender extends ReplyToChangeSender { 24 : private Account.Id attentionSetUser; 25 : private String reason; 26 : 27 : public AttentionSetSender( 28 : EmailArguments args, String messageClass, Project.NameKey project, Change.Id changeId) { 29 13 : super(args, messageClass, ChangeEmail.newChangeData(args, project, changeId)); 30 13 : } 31 : 32 : @Override 33 : protected void init() throws EmailException { 34 13 : super.init(); 35 : 36 13 : ccAllApprovals(); 37 13 : bccStarredBy(); 38 13 : ccExistingReviewers(); 39 13 : } 40 : 41 : public void setAttentionSetUser(Account.Id attentionSetUser) { 42 13 : this.attentionSetUser = attentionSetUser; 43 13 : } 44 : 45 : public void setReason(String reason) { 46 13 : this.reason = reason; 47 13 : } 48 : 49 : @Override 50 : protected void setupSoyContext() { 51 13 : super.setupSoyContext(); 52 13 : soyContext.put("attentionSetUser", getNameFor(attentionSetUser)); 53 13 : soyContext.put("reason", reason); 54 13 : } 55 : }