ListChildProjects: Make settting recursive option chainable
Change-Id: I4ffa174cd8ba2b062cd230a8e116f45c65f58693
This commit is contained in:
committed by
David Pursehouse
parent
d3039e7143
commit
712f699db9
@@ -70,7 +70,6 @@ import com.google.gerrit.server.restapi.project.GetHead;
|
||||
import com.google.gerrit.server.restapi.project.GetParent;
|
||||
import com.google.gerrit.server.restapi.project.Index;
|
||||
import com.google.gerrit.server.restapi.project.ListBranches;
|
||||
import com.google.gerrit.server.restapi.project.ListChildProjects;
|
||||
import com.google.gerrit.server.restapi.project.ListDashboards;
|
||||
import com.google.gerrit.server.restapi.project.ListTags;
|
||||
import com.google.gerrit.server.restapi.project.ProjectsCollection;
|
||||
@@ -475,10 +474,8 @@ public class ProjectApiImpl implements ProjectApi {
|
||||
|
||||
@Override
|
||||
public List<ProjectInfo> children(boolean recursive) throws RestApiException {
|
||||
ListChildProjects list = children.list();
|
||||
list.setRecursive(recursive);
|
||||
try {
|
||||
return list.apply(checkExists());
|
||||
return children.list().withRecursive(recursive).apply(checkExists());
|
||||
} catch (Exception e) {
|
||||
throw asRestApiException("Cannot list children", e);
|
||||
}
|
||||
|
||||
@@ -63,9 +63,7 @@ public class Index implements RestModifyView<ProjectResource, IndexProjectInput>
|
||||
|
||||
reindex(rsrc.getNameKey(), input.async);
|
||||
if (Boolean.TRUE.equals(input.indexChildren)) {
|
||||
ListChildProjects listChildProjects = listChildProjectsProvider.get();
|
||||
listChildProjects.setRecursive(true);
|
||||
for (ProjectInfo child : listChildProjects.apply(rsrc)) {
|
||||
for (ProjectInfo child : listChildProjectsProvider.get().withRecursive(true).apply(rsrc)) {
|
||||
reindex(new Project.NameKey(child.name), input.async);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,9 @@ public class ListChildProjects implements RestReadView<ProjectResource> {
|
||||
this.queryProvider = queryProvider;
|
||||
}
|
||||
|
||||
public void setRecursive(boolean recursive) {
|
||||
public ListChildProjects withRecursive(boolean recursive) {
|
||||
this.recursive = recursive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ListChildProjects withLimit(int limit) {
|
||||
|
||||
Reference in New Issue
Block a user