Line data Source code
1 : // Copyright (C) 2010 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.events; 16 : 17 : import com.google.common.base.Supplier; 18 : import com.google.gerrit.entities.Change; 19 : import com.google.gerrit.entities.Project; 20 : import com.google.gerrit.entities.RefNames; 21 : import com.google.gerrit.server.data.ChangeAttribute; 22 : 23 : public abstract class ChangeEvent extends RefEvent { 24 : public Supplier<ChangeAttribute> change; 25 : public Project.NameKey project; 26 : public String refName; 27 : public Change.Key changeKey; 28 : 29 : protected ChangeEvent(String type, Change change) { 30 96 : super(type); 31 96 : this.project = change.getProject(); 32 96 : this.refName = RefNames.fullName(change.getDest().branch()); 33 96 : this.changeKey = change.getKey(); 34 96 : } 35 : 36 : @Override 37 : public Project.NameKey getProjectNameKey() { 38 92 : return project; 39 : } 40 : 41 : @Override 42 : public String getRefName() { 43 92 : return refName; 44 : } 45 : 46 : public Change.Key getChangeKey() { 47 0 : return changeKey; 48 : } 49 : }