Move project and branch info to new base class NotificationEmail

Class NotificationEmail holds data about project and branch, and let
the class ChangeEmail only hold change and patchset info, then for
emails that are not related to change and patchset, such as direct
pushed email, they can use class NotificationEmail as base class.

Change-Id: I57c71c8a10857f7c03c6ed476c79401018e6d343
This commit is contained in:
Yang Zhenhui
2012-12-21 14:06:09 +08:00
committed by David Pursehouse
parent a7ee130b7d
commit 0ff7fd2338
2 changed files with 43 additions and 5 deletions

View File

@@ -0,0 +1,41 @@
// Copyright (C) 2012 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.mail;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Project;
/**
* Common class for notifications that are related to a project and branch
*/
public abstract class NotificationEmail extends OutgoingEmail {
protected Project.NameKey project;
protected Branch.NameKey branch;
protected NotificationEmail(EmailArguments ea, String anonymousCowardName,
String mc, Project.NameKey project, Branch.NameKey branch) {
super(ea, anonymousCowardName, mc);
this.project = project;
this.branch = branch;
}
@Override
protected void setupVelocityContext() {
super.setupVelocityContext();
velocityContext.put("projectName", project.get());
velocityContext.put("branch", branch);
}
}