// Copyright (C) 2009 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.httpd.rpc.patch;

import com.google.gerrit.common.data.ReviewerResult;
import com.google.gerrit.httpd.rpc.Handler;
import com.google.gerrit.httpd.rpc.changedetail.ChangeDetailFactory;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.patch.AddReviewer;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;

import java.util.Collection;

class AddReviewerHandler extends Handler<ReviewerResult> {
  interface Factory {
    AddReviewerHandler create(Change.Id changeId, Collection<String> nameOrEmails);
  }

  private final AddReviewer.Factory addReviewerFactory;
  private final ChangeDetailFactory.Factory changeDetailFactory;
  private final IdentifiedUser currentUser;
  private final IdentifiedUser.GenericFactory identifiedUserFactory;

  private final Change.Id changeId;
  private final Collection<String> reviewers;

  @Inject
  AddReviewerHandler(final AddReviewer.Factory addReviewerFactory,
      final IdentifiedUser.GenericFactory identifiedUserFactory,
      final IdentifiedUser currentUser,
      final ChangeDetailFactory.Factory changeDetailFactory,
      @Assisted final Change.Id changeId,
      @Assisted final Collection<String> nameOrEmails) {

    this.addReviewerFactory = addReviewerFactory;
    this.identifiedUserFactory = identifiedUserFactory;
    this.currentUser = currentUser;
    this.changeDetailFactory = changeDetailFactory;

    this.changeId = changeId;
    this.reviewers = nameOrEmails;
  }

  @Override
  public ReviewerResult call() throws Exception {
    ReviewerResult result = addReviewerFactory.create(changeId, reviewers).call();
    result.setChange(changeDetailFactory.create(changeId).call());
    return result;
  }
}

@@ -858,56 +858,8 @@
 ge;%0A
-import com.google.gerrit.server.IdentifiedUser;%0A
 impo
@@ -901,24 +901,24 @@
 ddReviewer;%0A
+
 import com.g
@@ -1313,121 +1313,8 @@
 ory;
-%0A  private final IdentifiedUser currentUser;%0A  private final IdentifiedUser.GenericFactory identifiedUserFactory;
 %0A%0A  
@@ -1475,113 +1475,8 @@
 ry,%0A
-      final IdentifiedUser.GenericFactory identifiedUserFactory,%0A      final IdentifiedUser currentUser,%0A
     
@@ -1632,16 +1632,16 @@
 ils) %7B%0A%0A
+
     this
@@ -1686,100 +1686,8 @@
 ry;%0A
-    this.identifiedUserFactory = identifiedUserFactory;%0A    this.currentUser = currentUser;%0A
     

Remove unused code from AddReviewerHandler