Line data Source code
1 : // Copyright (C) 2009 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.Change; 18 : import com.google.gerrit.entities.NotifyConfig.NotifyType; 19 : import com.google.gerrit.entities.Project; 20 : import com.google.gerrit.exceptions.EmailException; 21 : import com.google.inject.Inject; 22 : import com.google.inject.assistedinject.Assisted; 23 : 24 : /** Send notice about a change being abandoned by its owner. */ 25 : public class AbandonedSender extends ReplyToChangeSender { 26 : public interface Factory extends ReplyToChangeSender.Factory<AbandonedSender> { 27 : @Override 28 : AbandonedSender create(Project.NameKey project, Change.Id changeId); 29 : } 30 : 31 : @Inject 32 : public AbandonedSender( 33 : EmailArguments args, @Assisted Project.NameKey project, @Assisted Change.Id changeId) { 34 20 : super(args, "abandon", ChangeEmail.newChangeData(args, project, changeId)); 35 20 : } 36 : 37 : @Override 38 : protected void init() throws EmailException { 39 20 : super.init(); 40 : 41 20 : ccAllApprovals(); 42 20 : bccStarredBy(); 43 20 : includeWatchers(NotifyType.ABANDONED_CHANGES); 44 20 : } 45 : 46 : @Override 47 : protected void formatChange() throws EmailException { 48 20 : appendText(textTemplate("Abandoned")); 49 20 : if (useHtml()) { 50 20 : appendHtml(soyHtmlTemplate("AbandonedHtml")); 51 : } 52 20 : } 53 : }