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 : /** Notify interested parties of a brand new change. */ 25 : public class CreateChangeSender extends NewChangeSender { 26 : public interface Factory { 27 : CreateChangeSender create(Project.NameKey project, Change.Id changeId); 28 : } 29 : 30 : @Inject 31 : public CreateChangeSender( 32 : EmailArguments args, @Assisted Project.NameKey project, @Assisted Change.Id changeId) { 33 103 : super(args, newChangeData(args, project, changeId)); 34 103 : } 35 : 36 : @Override 37 : protected void init() throws EmailException { 38 103 : super.init(); 39 : 40 103 : includeWatchers(NotifyType.NEW_CHANGES, !change.isWorkInProgress() && !change.isPrivate()); 41 103 : includeWatchers(NotifyType.NEW_PATCHSETS, !change.isWorkInProgress() && !change.isPrivate()); 42 103 : } 43 : }