// 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.common;

import com.google.gerrit.common.ChangeHookRunner.HookResult;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.events.ChangeEvent;
import com.google.gerrit.server.events.Event;
import com.google.gerrit.server.events.ProjectEvent;
import com.google.gerrit.server.events.RefEvent;

import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.RefUpdate;

import java.util.Map;
import java.util.Set;

/** Does not invoke hooks. */
public final class DisabledChangeHooks implements ChangeHooks, EventDispatcher {
  @Override
  public void doChangeAbandonedHook(Change change, Account account,
      PatchSet patchSet, String reason, ReviewDb db) {
  }

  @Override
  public void doChangeMergedHook(Change change, Account account,
      PatchSet patchSet, ReviewDb db, String mergeResultRev) {
  }

  @Override
  public void doChangeRestoredHook(Change change, Account account,
      PatchSet patchSet, String reason, ReviewDb db) {
  }

  @Override
  public void doClaSignupHook(Account account, String claName) {
  }

  @Override
  public void doCommentAddedHook(Change change, Account account,
      PatchSet patchSet, String comment,
      Map<String, Short> approvals, Map<String, Short> oldApprovals,
      ReviewDb db) {
  }

  @Override
  public void doPatchsetCreatedHook(Change change, PatchSet patchSet,
      ReviewDb db) {
  }

  @Override
  public void doDraftPublishedHook(Change change, PatchSet patchSet,
      ReviewDb db) {
  }

  @Override
  public void doRefUpdatedHook(Branch.NameKey refName, RefUpdate refUpdate,
      Account account) {
  }

  @Override
  public void doRefUpdatedHook(Branch.NameKey refName, ObjectId oldId,
      ObjectId newId, Account account) {
  }

  @Override
  public void doReviewerAddedHook(Change change, Account account, PatchSet patchSet,
      ReviewDb db) {
  }

  @Override
  public void doReviewerDeletedHook(Change change, Account account,
      PatchSet patchSet, String comment, Map<String, Short> approvals,
      Map<String, Short> oldApprovals, ReviewDb db) {
  }

  @Override
  public void doTopicChangedHook(Change change, Account account, String oldTopic,
      ReviewDb db) {
  }

  @Override
  public void doHashtagsChangedHook(Change change, Account account, Set<String> added,
      Set<String> removed, Set<String> hashtags, ReviewDb db) {
  }

  @Override
  public HookResult doRefUpdateHook(Project project, String refName,
      Account uploader, ObjectId oldId, ObjectId newId) {
    return null;
  }

  @Override
  public void doProjectCreatedHook(Project.NameKey project, String headName) {
  }

  @Override
  public void postEvent(Change change, ChangeEvent event, ReviewDb db) {
  }

  @Override
  public void postEvent(Branch.NameKey branchName, RefEvent event) {
  }

  @Override
  public void postEvent(Project.NameKey projectName, ProjectEvent event) {
  }

  @Override
  public void postEvent(Event event, ReviewDb db) {
  }
}

@@ -1001,208 +1001,8 @@
 wDb;
-%0Aimport com.google.gerrit.server.events.ChangeEvent;%0Aimport com.google.gerrit.server.events.Event;%0Aimport com.google.gerrit.server.events.ProjectEvent;%0Aimport com.google.gerrit.server.events.RefEvent;
 %0A%0Aim
@@ -1217,25 +1217,8 @@
 ooks
-, EventDispatcher
  %7B%0A 
@@ -3277,344 +3277,7 @@
 %0A  %7D
-%0A%0A  @Override%0A  public void postEvent(Change change, ChangeEvent event, ReviewDb db) %7B%0A  %7D%0A%0A  @Override%0A  public void postEvent(Branch.NameKey branchName, RefEvent event) %7B%0A  %7D%0A%0A  @Override%0A  public void postEvent(Project.NameKey projectName, ProjectEvent event) %7B%0A  %7D%0A%0A  @Override%0A  public void postEvent(Event event, ReviewDb db) %7B%0A  %7D
 %0A%7D%0A

Remove unused implementation of EventDispatcher interface