use of com.google.gerrit.server.project.ListChildProjects in project gerrit by GerritCodeReview.
the class ProjectApiImpl method children.
@Override
public List<ProjectInfo> children(boolean recursive) throws RestApiException {
ListChildProjects list = children.list();
list.setRecursive(recursive);
try {
return list.apply(checkExists());
} catch (Exception e) {
throw asRestApiException("Cannot list children", e);
}
}
use of com.google.gerrit.server.project.ListChildProjects in project gerrit by GerritCodeReview.
the class ParentProjectPredicate method predicates.
protected static List<Predicate<ChangeData>> predicates(ProjectCache projectCache, Provider<ListChildProjects> listChildProjects, Provider<CurrentUser> self, String value) {
ProjectState projectState = projectCache.get(new Project.NameKey(value));
if (projectState == null) {
return Collections.emptyList();
}
List<Predicate<ChangeData>> r = new ArrayList<>();
r.add(new ProjectPredicate(projectState.getProject().getName()));
try {
ProjectResource proj = new ProjectResource(projectState.controlFor(self.get()));
ListChildProjects children = listChildProjects.get();
children.setRecursive(true);
for (ProjectInfo p : children.apply(proj)) {
r.add(new ProjectPredicate(p.name));
}
} catch (PermissionBackendException e) {
log.warn("cannot check permissions to expand child projects", e);
}
return r;
}
Aggregations