Merge PerformCreateProject into CreateProject

The CreateProject class is the only user of the PerformCreateProject
class. This additional indirection is not needed and the pattern of
having a Perform* class to encapsule common logic between SSH and UI
was given up in favor of having this common code in the REST API
implementation classes.

Having all the functionality in CreateProject allows us in a next step
to do better handling of exceptions. At the moment all exceptions are
wrapped as ProjectCreationFailedException which result in 500 Internal
Server Error, but we should rather map them to the proper HTTP status
codes. Having all code in CreateProject allows us to throw REST
exceptions in the place where the errors occur.

Some of the validation checks that were done in PerformCreateProject
are now not needed anymore since CreateProject already did the same
checks (e.g. if that the calling user has the 'Create Project'
capability). All checks have been moved to the place where
CreateProjectArgs are created.

We cannot get rid of CreateProjectArgs easily since this would break
ProjectCreationValidationListeners implemented by plugins.

Change-Id: I2a7922814a96041b4fa725a4ae56a6623526f666
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2015-04-07 16:04:27 +02:00
parent c14231bf91
commit 3c6960b699
3 changed files with 252 additions and 320 deletions

View File

@@ -115,7 +115,6 @@ import com.google.gerrit.server.project.AccessControlModule;
import com.google.gerrit.server.project.ChangeControl;
import com.google.gerrit.server.project.CommentLinkInfo;
import com.google.gerrit.server.project.CommentLinkProvider;
import com.google.gerrit.server.project.PerformCreateProject;
import com.google.gerrit.server.project.PermissionCollection;
import com.google.gerrit.server.project.ProjectCacheImpl;
import com.google.gerrit.server.project.ProjectControl;
@@ -205,7 +204,6 @@ public class GerritGlobalModule extends FactoryModule {
factory(ProjectState.Factory.class);
factory(RegisterNewEmailSender.Factory.class);
factory(ReplacePatchSetSender.Factory.class);
factory(PerformCreateProject.Factory.class);
factory(GarbageCollection.Factory.class);
bind(PermissionCollection.Factory.class);
bind(AccountVisibility.class)