Remove old RPC to create groups

The RPC for deleting groups is not used anymore. This functionality is
now covered by the REST API.

Change-Id: I8c796aa5c8afdd7cbf045d32dff2adc6579fd330
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupAdminService.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupAdminService.java
index 5adc6a5..ae237e4 100644
--- a/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupAdminService.java
+++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupAdminService.java
@@ -30,10 +30,6 @@
 public interface GroupAdminService extends RemoteJsonService {
   @Audit
   @SignInRequired
-  void createGroup(String newName, AsyncCallback<AccountGroup.Id> callback);
-
-  @Audit
-  @SignInRequired
   void groupDetail(AccountGroup.Id groupId, AccountGroup.UUID uuid,
       AsyncCallback<GroupDetail> callback);
 
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountModule.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountModule.java
index 745c7ba..ff949da 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountModule.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountModule.java
@@ -30,7 +30,6 @@
       @Override
       protected void configure() {
         factory(AgreementInfoFactory.Factory.class);
-        factory(CreateGroup.Factory.class);
         factory(DeleteExternalIds.Factory.class);
         factory(ExternalIdDetailFactory.Factory.class);
         factory(GroupDetailHandler.Factory.class);
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/CreateGroup.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/CreateGroup.java
deleted file mode 100644
index 83b23ee..0000000
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/CreateGroup.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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.account;
-
-import com.google.gerrit.common.errors.NameAlreadyUsedException;
-import com.google.gerrit.common.errors.PermissionDeniedException;
-import com.google.gerrit.httpd.rpc.Handler;
-import com.google.gerrit.reviewdb.client.Account;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gerrit.server.IdentifiedUser;
-import com.google.gerrit.server.account.PerformCreateGroup;
-import com.google.gerrit.server.config.GerritServerConfig;
-import com.google.gwtorm.server.OrmException;
-import com.google.inject.Inject;
-import com.google.inject.assistedinject.Assisted;
-
-import org.eclipse.jgit.lib.Config;
-
-import java.util.Collections;
-
-class CreateGroup extends Handler<AccountGroup.Id> {
-  interface Factory {
-    CreateGroup create(String groupName);
-  }
-
-  private final PerformCreateGroup.Factory performCreateGroupFactory;
-  private final IdentifiedUser user;
-  private final boolean visibleToAll;
-  private final String groupName;
-
-  @Inject
-  CreateGroup(final PerformCreateGroup.Factory performCreateGroupFactory,
-      final IdentifiedUser user, @GerritServerConfig final Config cfg,
-      @Assisted final String groupName) {
-    this.performCreateGroupFactory = performCreateGroupFactory;
-    this.user = user;
-    this.visibleToAll = cfg.getBoolean("groups", "newGroupsVisibleToAll", false);
-    this.groupName = groupName;
-  }
-
-  @Override
-  public AccountGroup.Id call() throws OrmException, NameAlreadyUsedException,
-      PermissionDeniedException {
-    final PerformCreateGroup performCreateGroup = performCreateGroupFactory.create();
-    final Account.Id me = user.getAccountId();
-    return performCreateGroup.createGroup(groupName, null, visibleToAll, null,
-        Collections.singleton(me), null).getId();
-  }
-}
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/GroupAdminServiceImpl.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/GroupAdminServiceImpl.java
index 0c20bb4..0ddace2 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/GroupAdminServiceImpl.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/GroupAdminServiceImpl.java
@@ -50,7 +50,6 @@
   private final GroupIncludeCache groupIncludeCache;
   private final GroupControl.Factory groupControlFactory;
 
-  private final CreateGroup.Factory createGroupFactory;
   private final RenameGroup.Factory renameGroupFactory;
   private final GroupDetailHandler.Factory groupDetailFactory;
 
@@ -61,7 +60,6 @@
       final GroupCache groupCache,
       final GroupBackend groupBackend,
       final GroupControl.Factory groupControlFactory,
-      final CreateGroup.Factory createGroupFactory,
       final RenameGroup.Factory renameGroupFactory,
       final GroupDetailHandler.Factory groupDetailFactory) {
     super(schema, currentUser);
@@ -69,16 +67,10 @@
     this.groupCache = groupCache;
     this.groupBackend = groupBackend;
     this.groupControlFactory = groupControlFactory;
-    this.createGroupFactory = createGroupFactory;
     this.renameGroupFactory = renameGroupFactory;
     this.groupDetailFactory = groupDetailFactory;
   }
 
-  public void createGroup(final String newName,
-      final AsyncCallback<AccountGroup.Id> callback) {
-    createGroupFactory.create(newName).to(callback);
-  }
-
   public void groupDetail(AccountGroup.Id groupId, AccountGroup.UUID groupUUID,
       AsyncCallback<GroupDetail> callback) {
     if (groupId == null && groupUUID != null) {