use of com.google.gerrit.server.project.CreateProject in project gerrit by GerritCodeReview.
the class ProjectApiImpl method create.
@Override
public ProjectApi create(ProjectInput in) throws RestApiException {
try {
if (name == null) {
throw new ResourceConflictException("Project already exists");
}
if (in.name != null && !name.equals(in.name)) {
throw new BadRequestException("name must match input.name");
}
CreateProject impl = createProjectFactory.create(name);
permissionBackend.user(user).checkAny(GlobalPermission.fromAnnotation(impl.getClass()));
impl.apply(TopLevelResource.INSTANCE, in);
return projectApi.create(projects.parse(name));
} catch (Exception e) {
throw asRestApiException("Cannot create project: " + e.getMessage(), e);
}
}
Aggregations