From 2d7561ddab17a13d5a539462353e2b35f2e29e62 Mon Sep 17 00:00:00 2001 From: Edwin Kempin Date: Mon, 7 Jan 2013 14:26:05 +0100 Subject: [PATCH] Remove RPC's for listing all groups and my groups These RPC's are not needed anymore since there is now a REST API to retrieve the groups. Change-Id: I92603f4fdc74da1bd7bcf3e55917bb38264f060a Signed-off-by: Edwin Kempin --- .../gerrit/common/data/AccountSecurity.java | 4 -- .../gerrit/common/data/GroupAdminService.java | 4 -- .../httpd/rpc/account/AccountModule.java | 2 - .../rpc/account/AccountSecurityImpl.java | 14 ------ .../rpc/account/GroupAdminServiceImpl.java | 10 +--- .../httpd/rpc/account/MyGroupsFactory.java | 46 ------------------- .../rpc/account/VisibleGroupsHandler.java | 39 ---------------- 7 files changed, 1 insertion(+), 118 deletions(-) delete mode 100644 gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/MyGroupsFactory.java delete mode 100644 gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/VisibleGroupsHandler.java diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountSecurity.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountSecurity.java index aa212f9bb1..c2d03ab601 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountSecurity.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountSecurity.java @@ -18,7 +18,6 @@ import com.google.gerrit.common.audit.Audit; import com.google.gerrit.common.auth.SignInRequired; import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.AccountExternalId; -import com.google.gerrit.reviewdb.client.AccountGroup; import com.google.gerrit.reviewdb.client.AccountSshKey; import com.google.gerrit.reviewdb.client.ContactInformation; import com.google.gwtjsonrpc.common.AsyncCallback; @@ -61,9 +60,6 @@ public interface AccountSecurity extends RemoteJsonService { @SignInRequired void myExternalIds(AsyncCallback> callback); - @SignInRequired - void myGroups(AsyncCallback> callback); - @Audit @SignInRequired void deleteExternalIds(Set keys, 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 5cb7fa2f57..e00cd2316f 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 @@ -29,10 +29,6 @@ import java.util.Set; @RpcImpl(version = Version.V2_0) public interface GroupAdminService extends RemoteJsonService { - @Audit - @SignInRequired - void visibleGroups(AsyncCallback callback); - @Audit @SignInRequired void createGroup(String newName, AsyncCallback 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 957f33951a..745c7ba9e6 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 @@ -34,10 +34,8 @@ public class AccountModule extends RpcServletModule { factory(DeleteExternalIds.Factory.class); factory(ExternalIdDetailFactory.Factory.class); factory(GroupDetailHandler.Factory.class); - factory(MyGroupsFactory.Factory.class); factory(RegisterNewEmailSender.Factory.class); factory(RenameGroup.Factory.class); - factory(VisibleGroupsHandler.Factory.class); } }); rpc(AccountSecurityImpl.class); diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountSecurityImpl.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountSecurityImpl.java index 72ad252b59..07d769042c 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountSecurityImpl.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/AccountSecurityImpl.java @@ -22,7 +22,6 @@ import com.google.gerrit.common.errors.EmailException; import com.google.gerrit.common.errors.InvalidSshKeyException; import com.google.gerrit.common.errors.NameAlreadyUsedException; import com.google.gerrit.common.errors.NoSuchEntityException; -import com.google.gerrit.common.errors.NoSuchGroupException; import com.google.gerrit.httpd.rpc.BaseServiceImplementation; import com.google.gerrit.httpd.rpc.Handler; import com.google.gerrit.reviewdb.client.Account; @@ -86,7 +85,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements private final ChangeUserName.CurrentUser changeUserNameFactory; private final DeleteExternalIds.Factory deleteExternalIdsFactory; private final ExternalIdDetailFactory.Factory externalIdDetailFactory; - private final MyGroupsFactory.Factory myGroupsFactory; private final ChangeHooks hooks; private final GroupCache groupCache; @@ -104,7 +102,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements final ChangeUserName.CurrentUser changeUserNameFactory, final DeleteExternalIds.Factory deleteExternalIdsFactory, final ExternalIdDetailFactory.Factory externalIdDetailFactory, - final MyGroupsFactory.Factory myGroupsFactory, final ChangeHooks hooks, final GroupCache groupCache) { super(schema, currentUser); contactStore = cs; @@ -126,7 +123,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements this.changeUserNameFactory = changeUserNameFactory; this.deleteExternalIdsFactory = deleteExternalIdsFactory; this.externalIdDetailFactory = externalIdDetailFactory; - this.myGroupsFactory = myGroupsFactory; this.hooks = hooks; this.groupCache = groupCache; } @@ -211,16 +207,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements externalIdDetailFactory.create().to(callback); } - @Override - public void myGroups(final AsyncCallback> callback) { - run(callback, new Action>() { - public List run(final ReviewDb db) throws OrmException, - NoSuchGroupException, Failure { - return myGroupsFactory.create().call(); - } - }); - } - public void deleteExternalIds(final Set keys, final AsyncCallback> callback) { deleteExternalIdsFactory.create(keys).to(callback); 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 aca2e055dc..efc2b94a13 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 @@ -16,7 +16,6 @@ package com.google.gerrit.httpd.rpc.account; import com.google.gerrit.common.data.GroupAdminService; import com.google.gerrit.common.data.GroupDetail; -import com.google.gerrit.common.data.GroupList; import com.google.gerrit.common.data.GroupOptions; import com.google.gerrit.common.data.GroupReference; import com.google.gerrit.common.errors.InactiveAccountException; @@ -69,7 +68,6 @@ class GroupAdminServiceImpl extends BaseServiceImplementation implements private final CreateGroup.Factory createGroupFactory; private final RenameGroup.Factory renameGroupFactory; private final GroupDetailHandler.Factory groupDetailFactory; - private final VisibleGroupsHandler.Factory visibleGroupsFactory; @Inject GroupAdminServiceImpl(final Provider schema, @@ -84,8 +82,7 @@ class GroupAdminServiceImpl extends BaseServiceImplementation implements final GroupControl.Factory groupControlFactory, final CreateGroup.Factory createGroupFactory, final RenameGroup.Factory renameGroupFactory, - final GroupDetailHandler.Factory groupDetailFactory, - final VisibleGroupsHandler.Factory visibleGroupsFactory) { + final GroupDetailHandler.Factory groupDetailFactory) { super(schema, currentUser); this.accountCache = accountCache; this.groupIncludeCache = groupIncludeCache; @@ -98,11 +95,6 @@ class GroupAdminServiceImpl extends BaseServiceImplementation implements this.createGroupFactory = createGroupFactory; this.renameGroupFactory = renameGroupFactory; this.groupDetailFactory = groupDetailFactory; - this.visibleGroupsFactory = visibleGroupsFactory; - } - - public void visibleGroups(final AsyncCallback callback) { - visibleGroupsFactory.create().to(callback); } public void createGroup(final String newName, diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/MyGroupsFactory.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/MyGroupsFactory.java deleted file mode 100644 index 33ce371083..0000000000 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/MyGroupsFactory.java +++ /dev/null @@ -1,46 +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.NoSuchGroupException; -import com.google.gerrit.httpd.rpc.Handler; -import com.google.gerrit.reviewdb.client.AccountGroup; -import com.google.gerrit.server.IdentifiedUser; -import com.google.gerrit.server.account.VisibleGroups; -import com.google.gwtorm.server.OrmException; -import com.google.inject.Inject; - -import java.util.List; - -class MyGroupsFactory extends Handler> { - interface Factory { - MyGroupsFactory create(); - } - - private final VisibleGroups.Factory visibleGroupsFactory; - private final IdentifiedUser user; - - @Inject - MyGroupsFactory(final VisibleGroups.Factory visibleGroupsFactory, final IdentifiedUser user) { - this.visibleGroupsFactory = visibleGroupsFactory; - this.user = user; - } - - @Override - public List call() throws OrmException, NoSuchGroupException { - final VisibleGroups visibleGroups = visibleGroupsFactory.create(); - return visibleGroups.get(user).getGroups(); - } -} diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/VisibleGroupsHandler.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/VisibleGroupsHandler.java deleted file mode 100644 index 54f91f7c86..0000000000 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/VisibleGroupsHandler.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2011 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.data.GroupList; -import com.google.gerrit.httpd.rpc.Handler; -import com.google.gerrit.server.account.VisibleGroups; -import com.google.inject.Inject; - -public class VisibleGroupsHandler extends Handler { - - interface Factory { - VisibleGroupsHandler create(); - } - - private final VisibleGroups.Factory visibleGroupsFactory; - - @Inject - VisibleGroupsHandler(final VisibleGroups.Factory visibleGroupsFactory) { - this.visibleGroupsFactory = visibleGroupsFactory; - } - - @Override - public GroupList call() throws Exception { - return visibleGroupsFactory.create().get(); - } -}