Allow throwing RestApiException from all create methods in REST root collections
Internally at Google we need to subclass the REST root collections and we want to be able to reject the creation of new resources in the root collections with any REST exception. Change-Id: I30688e5ae11f0631d61a875ab03afddce42de67b Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import com.google.gerrit.extensions.restapi.AcceptsCreate;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.restapi.RestCollection;
|
||||
import com.google.gerrit.extensions.restapi.RestView;
|
||||
import com.google.gerrit.extensions.restapi.TopLevelResource;
|
||||
@@ -160,7 +161,7 @@ public class AccountsCollection
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateAccount create(TopLevelResource parent, IdString username) {
|
||||
public CreateAccount create(TopLevelResource parent, IdString username) throws RestApiException {
|
||||
return createAccountFactory.create(username.get());
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
import com.google.gerrit.extensions.restapi.NeedsParams;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.restapi.RestCollection;
|
||||
import com.google.gerrit.extensions.restapi.RestView;
|
||||
import com.google.gerrit.extensions.restapi.TopLevelResource;
|
||||
@@ -199,7 +200,7 @@ public class GroupsCollection
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateGroup create(TopLevelResource root, IdString name) {
|
||||
public CreateGroup create(TopLevelResource root, IdString name) throws RestApiException {
|
||||
return createGroup.create(name.get());
|
||||
}
|
||||
|
||||
|
@@ -181,7 +181,7 @@ public class ProjectsCollection
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateProject create(TopLevelResource parent, IdString name) {
|
||||
public CreateProject create(TopLevelResource parent, IdString name) throws RestApiException {
|
||||
return createProjectFactory.create(name.get());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user