Search in sources :

Example 1 with ChildProjectResource

use of com.google.gerrit.server.project.ChildProjectResource in project gerrit by GerritCodeReview.

the class ChildProjectsCollection method parse.

@Override
public ChildProjectResource parse(ProjectResource parent, IdString id) throws RestApiException, IOException, PermissionBackendException {
    parent.getProjectState().checkStatePermitsRead();
    ProjectResource p = projectsCollection.parse(TopLevelResource.INSTANCE, id);
    for (ProjectState pp : p.getProjectState().parents()) {
        if (parent.getNameKey().equals(pp.getProject().getNameKey())) {
            return new ChildProjectResource(parent, p.getProjectState());
        }
    }
    throw new ResourceNotFoundException(id);
}
Also used : ChildProjectResource(com.google.gerrit.server.project.ChildProjectResource) ChildProjectResource(com.google.gerrit.server.project.ChildProjectResource) ProjectResource(com.google.gerrit.server.project.ProjectResource) ProjectState(com.google.gerrit.server.project.ProjectState) ResourceNotFoundException(com.google.gerrit.extensions.restapi.ResourceNotFoundException)

Aggregations

ResourceNotFoundException (com.google.gerrit.extensions.restapi.ResourceNotFoundException)1 ChildProjectResource (com.google.gerrit.server.project.ChildProjectResource)1 ProjectResource (com.google.gerrit.server.project.ProjectResource)1 ProjectState (com.google.gerrit.server.project.ProjectState)1