diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/ProjectAdminService.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/ProjectAdminService.java index 1b504b07bc..df6728e483 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/ProjectAdminService.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/ProjectAdminService.java @@ -28,10 +28,7 @@ import java.util.Set; @RpcImpl(version = Version.V2_0) public interface ProjectAdminService extends RemoteJsonService { - void visibleProjects(AsyncCallback callback); - void visibleProjectDetails(AsyncCallback> callback); - void suggestParentCandidates(AsyncCallback> callback); void projectDetail(Project.NameKey projectName, AsyncCallback callback); diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/ProjectList.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/ProjectList.java deleted file mode 100644 index 8511460f65..0000000000 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/ProjectList.java +++ /dev/null @@ -1,43 +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.common.data; - -import com.google.gerrit.reviewdb.client.Project; - -import java.util.List; - -public class ProjectList { - protected List projects; - protected boolean canCreateProject; - - public ProjectList() { - } - - public List getProjects() { - return projects; - } - - public void setProjects(List projects) { - this.projects = projects; - } - - public boolean canCreateProject() { - return canCreateProject; - } - - public void setCanCreateProject(boolean canCreateProject) { - this.canCreateProject = canCreateProject; - } -} diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectAdminServiceImpl.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectAdminServiceImpl.java index a6bb74fb62..ca7f448586 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectAdminServiceImpl.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectAdminServiceImpl.java @@ -19,7 +19,6 @@ import com.google.gerrit.common.data.ListBranchesResult; import com.google.gerrit.common.data.ProjectAccess; import com.google.gerrit.common.data.ProjectAdminService; import com.google.gerrit.common.data.ProjectDetail; -import com.google.gerrit.common.data.ProjectList; import com.google.gerrit.reviewdb.client.Branch; import com.google.gerrit.reviewdb.client.Project; import com.google.gwtjsonrpc.common.AsyncCallback; @@ -37,12 +36,10 @@ class ProjectAdminServiceImpl implements ProjectAdminService { private final ChangeProjectSettings.Factory changeProjectSettingsFactory; private final DeleteBranches.Factory deleteBranchesFactory; private final ListBranches.Factory listBranchesFactory; - private final VisibleProjects.Factory visibleProjectsFactory; private final VisibleProjectDetails.Factory visibleProjectDetailsFactory; private final ProjectAccessFactory.Factory projectAccessFactory; private final CreateProjectHandler.Factory createProjectHandlerFactory; private final ProjectDetailFactory.Factory projectDetailFactory; - private final SuggestParentCandidatesHandler.Factory suggestParentCandidatesHandlerFactory; @Inject ProjectAdminServiceImpl(final AddBranch.Factory addBranchFactory, @@ -50,28 +47,19 @@ class ProjectAdminServiceImpl implements ProjectAdminService { final ChangeProjectSettings.Factory changeProjectSettingsFactory, final DeleteBranches.Factory deleteBranchesFactory, final ListBranches.Factory listBranchesFactory, - final VisibleProjects.Factory visibleProjectsFactory, final VisibleProjectDetails.Factory visibleProjectDetailsFactory, final ProjectAccessFactory.Factory projectAccessFactory, final ProjectDetailFactory.Factory projectDetailFactory, - final SuggestParentCandidatesHandler.Factory parentCandidatesFactory, final CreateProjectHandler.Factory createNewProjectFactory) { this.addBranchFactory = addBranchFactory; this.changeProjectAccessFactory = changeProjectAccessFactory; this.changeProjectSettingsFactory = changeProjectSettingsFactory; this.deleteBranchesFactory = deleteBranchesFactory; this.listBranchesFactory = listBranchesFactory; - this.visibleProjectsFactory = visibleProjectsFactory; this.visibleProjectDetailsFactory = visibleProjectDetailsFactory; this.projectAccessFactory = projectAccessFactory; this.projectDetailFactory = projectDetailFactory; this.createProjectHandlerFactory = createNewProjectFactory; - this.suggestParentCandidatesHandlerFactory = parentCandidatesFactory; - } - - @Override - public void visibleProjects(final AsyncCallback callback) { - visibleProjectsFactory.create().to(callback); } @Override @@ -79,11 +67,6 @@ class ProjectAdminServiceImpl implements ProjectAdminService { visibleProjectDetailsFactory.create().to(callback); } - @Override - public void suggestParentCandidates(AsyncCallback> callback) { - suggestParentCandidatesHandlerFactory.create().to(callback); - } - @Override public void projectDetail(final Project.NameKey projectName, final AsyncCallback callback) { diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectModule.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectModule.java index 2eb55b3d81..efcc22fd86 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectModule.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectModule.java @@ -34,11 +34,9 @@ public class ProjectModule extends RpcServletModule { factory(ChangeProjectSettings.Factory.class); factory(DeleteBranches.Factory.class); factory(ListBranches.Factory.class); - factory(VisibleProjects.Factory.class); factory(VisibleProjectDetails.Factory.class); factory(ProjectAccessFactory.Factory.class); factory(ProjectDetailFactory.Factory.class); - factory(SuggestParentCandidatesHandler.Factory.class); } }); rpc(ProjectAdminServiceImpl.class); diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/SuggestParentCandidatesHandler.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/SuggestParentCandidatesHandler.java deleted file mode 100644 index ba0e4cd334..0000000000 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/SuggestParentCandidatesHandler.java +++ /dev/null @@ -1,40 +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.project; - -import com.google.gerrit.httpd.rpc.Handler; -import com.google.gerrit.reviewdb.client.Project; -import com.google.gerrit.server.project.SuggestParentCandidates; -import com.google.inject.Inject; - -import java.util.List; - -public class SuggestParentCandidatesHandler extends Handler> { - interface Factory { - SuggestParentCandidatesHandler create(); - } - - private final SuggestParentCandidates suggestParentCandidates; - - @Inject - SuggestParentCandidatesHandler(final SuggestParentCandidates suggestParentCandidates) { - this.suggestParentCandidates = suggestParentCandidates; - } - - @Override - public List call() throws Exception { - return suggestParentCandidates.getProjects(); - } -} diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/VisibleProjects.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/VisibleProjects.java deleted file mode 100644 index ba65617aa7..0000000000 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/VisibleProjects.java +++ /dev/null @@ -1,75 +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.project; - -import com.google.gerrit.common.data.ProjectList; -import com.google.gerrit.httpd.rpc.Handler; -import com.google.gerrit.reviewdb.client.Project; -import com.google.gerrit.server.CurrentUser; -import com.google.gerrit.server.project.NoSuchProjectException; -import com.google.gerrit.server.project.ProjectCache; -import com.google.gerrit.server.project.ProjectControl; -import com.google.inject.Inject; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -class VisibleProjects extends Handler { - interface Factory { - VisibleProjects create(); - } - - private final ProjectControl.Factory projectControlFactory; - private final ProjectCache projectCache; - private final CurrentUser user; - - @Inject - VisibleProjects(final ProjectControl.Factory projectControlFactory, - final ProjectCache projectCache, final CurrentUser user) { - this.projectControlFactory = projectControlFactory; - this.projectCache = projectCache; - this.user = user; - } - - @Override - public ProjectList call() { - ProjectList result = new ProjectList(); - result.setProjects(getProjects()); - result.setCanCreateProject(user.getCapabilities().canCreateProject()); - return result; - } - - private List getProjects() { - List result = new ArrayList(); - for (Project.NameKey p : projectCache.all()) { - try { - ProjectControl c = projectControlFactory.controlFor(p); - if (c.isVisible() || c.isOwner()) { - result.add(c.getProject()); - } - } catch (NoSuchProjectException e) { - continue; - } - } - Collections.sort(result, new Comparator() { - public int compare(final Project a, final Project b) { - return a.getName().compareTo(b.getName()); - } - }); - return result; - } -}