Search in sources :

Example 1 with CreateGroup

use of com.google.gerrit.server.group.CreateGroup in project gerrit by GerritCodeReview.

the class GroupsImpl method create.

@Override
public GroupApi create(GroupInput in) throws RestApiException {
    if (checkNotNull(in, "GroupInput").name == null) {
        throw new BadRequestException("GroupInput must specify name");
    }
    try {
        CreateGroup impl = createGroup.create(in.name);
        permissionBackend.user(user).checkAny(GlobalPermission.fromAnnotation(impl.getClass()));
        GroupInfo info = impl.apply(TopLevelResource.INSTANCE, in);
        return id(info.id);
    } catch (Exception e) {
        throw asRestApiException("Cannot create group " + in.name, e);
    }
}
Also used : GroupInfo(com.google.gerrit.extensions.common.GroupInfo) CreateGroup(com.google.gerrit.server.group.CreateGroup) BadRequestException(com.google.gerrit.extensions.restapi.BadRequestException) ApiUtil.asRestApiException(com.google.gerrit.server.api.ApiUtil.asRestApiException) BadRequestException(com.google.gerrit.extensions.restapi.BadRequestException) RestApiException(com.google.gerrit.extensions.restapi.RestApiException)

Aggregations

GroupInfo (com.google.gerrit.extensions.common.GroupInfo)1 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)1 RestApiException (com.google.gerrit.extensions.restapi.RestApiException)1 ApiUtil.asRestApiException (com.google.gerrit.server.api.ApiUtil.asRestApiException)1 CreateGroup (com.google.gerrit.server.group.CreateGroup)1