PutConfig: move static inner Input class to extension API
Also rename the existing PutDescriptionInput to DescriptionInput. Change-Id: I8291e970353b8ae6ed4f0cbe5dce746007e25291
This commit is contained in:
@@ -21,9 +21,9 @@ import com.google.gerrit.extensions.api.access.ProjectAccessInput;
|
||||
import com.google.gerrit.extensions.api.projects.BranchApi;
|
||||
import com.google.gerrit.extensions.api.projects.BranchInfo;
|
||||
import com.google.gerrit.extensions.api.projects.ChildProjectApi;
|
||||
import com.google.gerrit.extensions.api.projects.DescriptionInput;
|
||||
import com.google.gerrit.extensions.api.projects.ProjectApi;
|
||||
import com.google.gerrit.extensions.api.projects.ProjectInput;
|
||||
import com.google.gerrit.extensions.api.projects.PutDescriptionInput;
|
||||
import com.google.gerrit.extensions.api.projects.TagApi;
|
||||
import com.google.gerrit.extensions.api.projects.TagInfo;
|
||||
import com.google.gerrit.extensions.common.ProjectInfo;
|
||||
@@ -216,7 +216,7 @@ public class ProjectApiImpl implements ProjectApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void description(PutDescriptionInput in)
|
||||
public void description(DescriptionInput in)
|
||||
throws RestApiException {
|
||||
try {
|
||||
putDescription.apply(checkExists(), in);
|
||||
|
||||
@@ -17,7 +17,7 @@ package com.google.gerrit.server.config;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.extensions.api.projects.ProjectInput.ConfigValue;
|
||||
import com.google.gerrit.extensions.api.projects.ConfigValue;
|
||||
import com.google.gerrit.extensions.events.GitReferenceUpdatedListener;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap.Entry;
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.google.gerrit.common.data.GroupReference;
|
||||
import com.google.gerrit.common.data.Permission;
|
||||
import com.google.gerrit.common.data.PermissionRule;
|
||||
import com.google.gerrit.extensions.annotations.RequiresCapability;
|
||||
import com.google.gerrit.extensions.api.projects.ConfigInput;
|
||||
import com.google.gerrit.extensions.api.projects.ProjectInput;
|
||||
import com.google.gerrit.extensions.client.InheritableBoolean;
|
||||
import com.google.gerrit.extensions.client.SubmitType;
|
||||
@@ -214,7 +215,7 @@ public class CreateProject implements RestModifyView<TopLevelResource, ProjectIn
|
||||
try {
|
||||
ProjectControl projectControl =
|
||||
projectControlFactory.controlFor(p.getNameKey(), currentUser.get());
|
||||
PutConfig.Input in = new PutConfig.Input();
|
||||
ConfigInput in = new ConfigInput();
|
||||
in.pluginConfigValues = input.pluginConfigValues;
|
||||
putConfig.get().apply(projectControl, in);
|
||||
} catch (NoSuchProjectException e) {
|
||||
|
||||
@@ -18,9 +18,8 @@ import com.google.common.base.CharMatcher;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.common.ChangeHooks;
|
||||
import com.google.gerrit.extensions.api.projects.ProjectInput.ConfigValue;
|
||||
import com.google.gerrit.extensions.client.InheritableBoolean;
|
||||
import com.google.gerrit.extensions.client.SubmitType;
|
||||
import com.google.gerrit.extensions.api.projects.ConfigInput;
|
||||
import com.google.gerrit.extensions.api.projects.ConfigValue;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
@@ -41,7 +40,6 @@ import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.git.MetaDataUpdate;
|
||||
import com.google.gerrit.server.git.ProjectConfig;
|
||||
import com.google.gerrit.server.git.TransferConfig;
|
||||
import com.google.gerrit.server.project.PutConfig.Input;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
@@ -60,24 +58,9 @@ import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
|
||||
@Singleton
|
||||
public class PutConfig implements RestModifyView<ProjectResource, Input> {
|
||||
public class PutConfig implements RestModifyView<ProjectResource, ConfigInput> {
|
||||
private static final Logger log = LoggerFactory.getLogger(PutConfig.class);
|
||||
|
||||
public static class Input {
|
||||
public String description;
|
||||
public InheritableBoolean useContributorAgreements;
|
||||
public InheritableBoolean useContentMerge;
|
||||
public InheritableBoolean useSignedOffBy;
|
||||
public InheritableBoolean createNewChangeForAllNotInTarget;
|
||||
public InheritableBoolean requireChangeId;
|
||||
public InheritableBoolean enableSignedPush;
|
||||
public InheritableBoolean requireSignedPush;
|
||||
public String maxObjectSizeLimit;
|
||||
public SubmitType submitType;
|
||||
public com.google.gerrit.extensions.client.ProjectState state;
|
||||
public Map<String, Map<String, ConfigValue>> pluginConfigValues;
|
||||
}
|
||||
|
||||
private final boolean serverEnableSignedPush;
|
||||
private final Provider<MetaDataUpdate.User> metaDataUpdateFactory;
|
||||
private final ProjectCache projectCache;
|
||||
@@ -122,7 +105,7 @@ public class PutConfig implements RestModifyView<ProjectResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigInfo apply(ProjectResource rsrc, Input input)
|
||||
public ConfigInfo apply(ProjectResource rsrc, ConfigInput input)
|
||||
throws ResourceNotFoundException, BadRequestException,
|
||||
ResourceConflictException {
|
||||
if (!rsrc.getControl().isOwner()) {
|
||||
@@ -131,7 +114,7 @@ public class PutConfig implements RestModifyView<ProjectResource, Input> {
|
||||
return apply(rsrc.getControl(), input);
|
||||
}
|
||||
|
||||
public ConfigInfo apply(ProjectControl ctrl, Input input)
|
||||
public ConfigInfo apply(ProjectControl ctrl, ConfigInput input)
|
||||
throws ResourceNotFoundException, BadRequestException,
|
||||
ResourceConflictException {
|
||||
Project.NameKey projectName = ctrl.getProject().getNameKey();
|
||||
|
||||
@@ -17,7 +17,7 @@ package com.google.gerrit.server.project;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.common.ChangeHooks;
|
||||
import com.google.gerrit.extensions.api.projects.PutDescriptionInput;
|
||||
import com.google.gerrit.extensions.api.projects.DescriptionInput;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
@@ -42,7 +42,7 @@ import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
@Singleton
|
||||
public class PutDescription implements RestModifyView<ProjectResource, PutDescriptionInput> {
|
||||
public class PutDescription implements RestModifyView<ProjectResource, DescriptionInput> {
|
||||
private final ProjectCache cache;
|
||||
private final MetaDataUpdate.Server updateFactory;
|
||||
private final GitRepositoryManager gitMgr;
|
||||
@@ -64,10 +64,10 @@ public class PutDescription implements RestModifyView<ProjectResource, PutDescri
|
||||
|
||||
@Override
|
||||
public Response<String> apply(ProjectResource resource,
|
||||
PutDescriptionInput input) throws AuthException,
|
||||
DescriptionInput input) throws AuthException,
|
||||
ResourceConflictException, ResourceNotFoundException, IOException {
|
||||
if (input == null) {
|
||||
input = new PutDescriptionInput(); // Delete would set description to null.
|
||||
input = new DescriptionInput(); // Delete would set description to null.
|
||||
}
|
||||
|
||||
ProjectControl ctl = resource.getControl();
|
||||
|
||||
Reference in New Issue
Block a user