ConfigInfo: Move to extension API
Change-Id: I165b1afbae4acb027b08c590256515f863478d7b
diff --git a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/CommentLinkInfo.java b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/CommentLinkInfo.java
new file mode 100644
index 0000000..64ad6086
--- /dev/null
+++ b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/CommentLinkInfo.java
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.extensions.api.projects;
+
+public class CommentLinkInfo {
+ public String match;
+ public String link;
+ public String html;
+ public Boolean enabled; // null means true
+
+ public transient String name;
+}
diff --git a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ConfigInfo.java b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ConfigInfo.java
new file mode 100644
index 0000000..d42bf7b
--- /dev/null
+++ b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ConfigInfo.java
@@ -0,0 +1,68 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.extensions.api.projects;
+
+import com.google.gerrit.extensions.client.InheritableBoolean;
+import com.google.gerrit.extensions.client.ProjectState;
+import com.google.gerrit.extensions.client.SubmitType;
+import com.google.gerrit.extensions.common.ActionInfo;
+
+import java.util.List;
+import java.util.Map;
+
+public class ConfigInfo {
+ public String description;
+ public InheritedBooleanInfo useContributorAgreements;
+ public InheritedBooleanInfo useContentMerge;
+ public InheritedBooleanInfo useSignedOffBy;
+ public InheritedBooleanInfo createNewChangeForAllNotInTarget;
+ public InheritedBooleanInfo requireChangeId;
+ public InheritedBooleanInfo enableSignedPush;
+ public InheritedBooleanInfo requireSignedPush;
+ public MaxObjectSizeLimitInfo maxObjectSizeLimit;
+ public SubmitType submitType;
+ public ProjectState state;
+ public Map<String, Map<String, ConfigParameterInfo>> pluginConfig;
+ public Map<String, ActionInfo> actions;
+
+ public Map<String, CommentLinkInfo> commentlinks;
+ public ThemeInfo theme;
+
+ public static class InheritedBooleanInfo {
+ public Boolean value;
+ public InheritableBoolean configuredValue;
+ public Boolean inheritedValue;
+ }
+
+ public static class MaxObjectSizeLimitInfo {
+ public String value;
+ public String configuredValue;
+ public String inheritedValue;
+ }
+
+ public static class ConfigParameterInfo {
+ public String displayName;
+ public String description;
+ public String warning;
+ public ProjectConfigEntryType type;
+ public String value;
+ public Boolean editable;
+ public Boolean inheritable;
+ public String configuredValue;
+ public String inheritedValue;
+ public List<String> permittedValues;
+ public List<String> values;
+ }
+}
diff --git a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ProjectConfigEntryType.java b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ProjectConfigEntryType.java
new file mode 100644
index 0000000..bc4674f
--- /dev/null
+++ b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ProjectConfigEntryType.java
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.extensions.api.projects;
+
+public enum ProjectConfigEntryType {
+ STRING, INT, LONG, BOOLEAN, LIST, ARRAY
+}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ThemeInfo.java b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ThemeInfo.java
similarity index 80%
rename from gerrit-server/src/main/java/com/google/gerrit/server/project/ThemeInfo.java
rename to gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ThemeInfo.java
index 4fcc4a6..d5d520f 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ThemeInfo.java
+++ b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ThemeInfo.java
@@ -12,16 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package com.google.gerrit.server.project;
+package com.google.gerrit.extensions.api.projects;
public class ThemeInfo {
- static final ThemeInfo INHERIT = new ThemeInfo(null, null, null);
+ public static final ThemeInfo INHERIT = new ThemeInfo(null, null, null);
public final String css;
public final String header;
public final String footer;
- ThemeInfo(String css, String header, String footer) {
+ public ThemeInfo(String css, String header, String footer) {
this.css = css;
this.header = header;
this.footer = footer;
diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/BatchProgramModule.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/BatchProgramModule.java
index e59a03f..a573625 100644
--- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/BatchProgramModule.java
+++ b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/BatchProgramModule.java
@@ -17,6 +17,7 @@
import static com.google.inject.Scopes.SINGLETON;
import com.google.common.cache.Cache;
+import com.google.gerrit.extensions.api.projects.CommentLinkInfo;
import com.google.gerrit.extensions.config.FactoryModule;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.registration.DynamicSet;
@@ -56,7 +57,6 @@
import com.google.gerrit.server.patch.DiffExecutorModule;
import com.google.gerrit.server.patch.PatchListCacheImpl;
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.ProjectCacheImpl;
import com.google.gerrit.server.project.ProjectControl;
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java
index 9d99703..e22e61d 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java
@@ -20,6 +20,7 @@
import com.google.gerrit.audit.AuditModule;
import com.google.gerrit.common.EventListener;
import com.google.gerrit.common.UserScopedEventListener;
+import com.google.gerrit.extensions.api.projects.CommentLinkInfo;
import com.google.gerrit.extensions.auth.oauth.OAuthLoginProvider;
import com.google.gerrit.extensions.auth.oauth.OAuthTokenEncrypter;
import com.google.gerrit.extensions.config.CapabilityDefinition;
@@ -130,7 +131,6 @@
import com.google.gerrit.server.plugins.ReloadPluginListener;
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.PermissionCollection;
import com.google.gerrit.server.project.ProjectCacheImpl;
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/ProjectConfigEntry.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/ProjectConfigEntry.java
index b875f2d..cbad98c 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/config/ProjectConfigEntry.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/ProjectConfigEntry.java
@@ -18,6 +18,7 @@
import com.google.common.collect.Lists;
import com.google.gerrit.extensions.annotations.ExtensionPoint;
import com.google.gerrit.extensions.api.projects.ConfigValue;
+import com.google.gerrit.extensions.api.projects.ProjectConfigEntryType;
import com.google.gerrit.extensions.events.GitReferenceUpdatedListener;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.registration.DynamicMap.Entry;
@@ -41,15 +42,11 @@
@ExtensionPoint
public class ProjectConfigEntry {
- public enum Type {
- STRING, INT, LONG, BOOLEAN, LIST, ARRAY
- }
-
private final String displayName;
private final String description;
private final boolean inheritable;
private final String defaultValue;
- private final Type type;
+ private final ProjectConfigEntryType type;
private final List<String> permittedValues;
public ProjectConfigEntry(String displayName, String defaultValue) {
@@ -63,7 +60,8 @@
public ProjectConfigEntry(String displayName, String defaultValue,
boolean inheritable, String description) {
- this(displayName, defaultValue, Type.STRING, null, inheritable, description);
+ this(displayName, defaultValue, ProjectConfigEntryType.STRING, null,
+ inheritable, description);
}
public ProjectConfigEntry(String displayName, int defaultValue) {
@@ -77,8 +75,8 @@
public ProjectConfigEntry(String displayName, int defaultValue,
boolean inheritable, String description) {
- this(displayName, Integer.toString(defaultValue), Type.INT, null,
- inheritable, description);
+ this(displayName, Integer.toString(defaultValue),
+ ProjectConfigEntryType.INT, null, inheritable, description);
}
public ProjectConfigEntry(String displayName, long defaultValue) {
@@ -92,8 +90,8 @@
public ProjectConfigEntry(String displayName, long defaultValue,
boolean inheritable, String description) {
- this(displayName, Long.toString(defaultValue), Type.LONG, null,
- inheritable, description);
+ this(displayName, Long.toString(defaultValue),
+ ProjectConfigEntryType.LONG, null, inheritable, description);
}
// For inheritable boolean use 'LIST' type with InheritableBoolean
@@ -104,8 +102,8 @@
//For inheritable boolean use 'LIST' type with InheritableBoolean
public ProjectConfigEntry(String displayName, boolean defaultValue,
String description) {
- this(displayName, Boolean.toString(defaultValue), Type.BOOLEAN, null,
- false, description);
+ this(displayName, Boolean.toString(defaultValue),
+ ProjectConfigEntryType.BOOLEAN, null, false, description);
}
public ProjectConfigEntry(String displayName, String defaultValue,
@@ -120,8 +118,8 @@
public ProjectConfigEntry(String displayName, String defaultValue,
List<String> permittedValues, boolean inheritable, String description) {
- this(displayName, defaultValue, Type.LIST, permittedValues, inheritable,
- description);
+ this(displayName, defaultValue, ProjectConfigEntryType.LIST,
+ permittedValues, inheritable, description);
}
public <T extends Enum<?>> ProjectConfigEntry(String displayName,
@@ -137,26 +135,27 @@
public <T extends Enum<?>> ProjectConfigEntry(String displayName,
T defaultValue, Class<T> permittedValues, boolean inheritable,
String description) {
- this(displayName, defaultValue.name(), Type.LIST, Lists.transform(
- Arrays.asList(permittedValues.getEnumConstants()),
- new Function<Enum<?>, String>() {
- @Override
- public String apply(Enum<?> e) {
- return e.name();
- }
- }), inheritable, description);
+ this(displayName, defaultValue.name(), ProjectConfigEntryType.LIST,
+ Lists.transform(
+ Arrays.asList(permittedValues.getEnumConstants()),
+ new Function<Enum<?>, String>() {
+ @Override
+ public String apply(Enum<?> e) {
+ return e.name();
+ }
+ }), inheritable, description);
}
public ProjectConfigEntry(String displayName, String defaultValue,
- Type type, List<String> permittedValues, boolean inheritable,
- String description) {
+ ProjectConfigEntryType type, List<String> permittedValues,
+ boolean inheritable, String description) {
this.displayName = displayName;
this.defaultValue = defaultValue;
this.type = type;
this.permittedValues = permittedValues;
this.inheritable = inheritable;
this.description = description;
- if (type == Type.ARRAY && inheritable) {
+ if (type == ProjectConfigEntryType.ARRAY && inheritable) {
throw new ProvisionException(
"ARRAY doesn't support inheritable values");
}
@@ -178,7 +177,7 @@
return defaultValue;
}
- public Type getType() {
+ public ProjectConfigEntryType getType() {
return type;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java
index 65e0387..b94efce 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java
@@ -53,7 +53,7 @@
import com.google.gerrit.server.config.ConfigUtil;
import com.google.gerrit.server.config.PluginConfig;
import com.google.gerrit.server.mail.Address;
-import com.google.gerrit.server.project.CommentLinkInfo;
+import com.google.gerrit.server.project.CommentLinkInfoImpl;
import com.google.gerrit.server.project.RefPattern;
import org.eclipse.jgit.errors.ConfigInvalidException;
@@ -171,7 +171,7 @@
private Map<String, LabelType> labelSections;
private ConfiguredMimeTypes mimeTypes;
private Map<Project.NameKey, SubscribeSection> subscribeSections;
- private List<CommentLinkInfo> commentLinkSections;
+ private List<CommentLinkInfoImpl> commentLinkSections;
private List<ValidationError> validationErrors;
private ObjectId rulesId;
private long maxObjectSizeLimit;
@@ -192,7 +192,7 @@
return r;
}
- public static CommentLinkInfo buildCommentLink(Config cfg, String name,
+ public static CommentLinkInfoImpl buildCommentLink(Config cfg, String name,
boolean allowRaw) throws IllegalArgumentException {
String match = cfg.getString(COMMENTLINK, name, KEY_MATCH);
if (match != null) {
@@ -220,11 +220,11 @@
if (Strings.isNullOrEmpty(match) && Strings.isNullOrEmpty(link) && !hasHtml
&& enabled != null) {
if (enabled) {
- return new CommentLinkInfo.Enabled(name);
+ return new CommentLinkInfoImpl.Enabled(name);
}
- return new CommentLinkInfo.Disabled(name);
+ return new CommentLinkInfoImpl.Disabled(name);
}
- return new CommentLinkInfo(name, match, link, html, enabled);
+ return new CommentLinkInfoImpl(name, match, link, html, enabled);
}
public ProjectConfig(Project.NameKey projectName) {
@@ -374,7 +374,7 @@
return labelSections;
}
- public Collection<CommentLinkInfo> getCommentLinkSections() {
+ public Collection<CommentLinkInfoImpl> getCommentLinkSections() {
return commentLinkSections;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
index 131b8a3..7e4b470 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
@@ -63,6 +63,7 @@
import com.google.gerrit.extensions.api.changes.HashtagsInput;
import com.google.gerrit.extensions.api.changes.ReviewInput.NotifyHandling;
import com.google.gerrit.extensions.api.changes.SubmitInput;
+import com.google.gerrit.extensions.api.projects.ProjectConfigEntryType;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.registration.DynamicMap.Entry;
import com.google.gerrit.extensions.registration.DynamicSet;
@@ -995,7 +996,7 @@
projectControl.getProjectState().getConfig()
.getPluginConfig(e.getPluginName())
.getString(e.getExportName());
- if (configEntry.getType() == ProjectConfigEntry.Type.ARRAY) {
+ if (configEntry.getType() == ProjectConfigEntryType.ARRAY) {
List<String> l =
Arrays.asList(projectControl.getProjectState()
.getConfig().getPluginConfig(e.getPluginName())
@@ -1012,7 +1013,7 @@
continue;
}
- if (ProjectConfigEntry.Type.LIST.equals(configEntry.getType())
+ if (ProjectConfigEntryType.LIST.equals(configEntry.getType())
&& value != null && !configEntry.getPermittedValues().contains(value)) {
reject(cmd, String.format(
"invalid project configuration: The value '%s' is "
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/MergeValidators.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/MergeValidators.java
index 4bf3076..4bf1deb 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/MergeValidators.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/MergeValidators.java
@@ -14,6 +14,7 @@
package com.google.gerrit.server.git.validators;
+import com.google.gerrit.extensions.api.projects.ProjectConfigEntryType;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.registration.DynamicMap.Entry;
import com.google.gerrit.extensions.registration.DynamicSet;
@@ -158,7 +159,7 @@
throw new MergeValidationException(PLUGIN_VALUE_NOT_EDITABLE);
}
- if (ProjectConfigEntry.Type.LIST.equals(configEntry.getType())
+ if (ProjectConfigEntryType.LIST.equals(configEntry.getType())
&& value != null && !configEntry.getPermittedValues().contains(value)) {
throw new MergeValidationException(PLUGIN_VALUE_NOT_PERMITTED);
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/CommentLinkInfo.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/CommentLinkInfoImpl.java
similarity index 77%
rename from gerrit-server/src/main/java/com/google/gerrit/server/project/CommentLinkInfo.java
rename to gerrit-server/src/main/java/com/google/gerrit/server/project/CommentLinkInfoImpl.java
index a91e745..ef5af20 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/CommentLinkInfo.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/CommentLinkInfoImpl.java
@@ -17,10 +17,11 @@
import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.base.Strings;
+import com.google.gerrit.extensions.api.projects.CommentLinkInfo;
/** Info about a single commentlink section in a config. */
-public class CommentLinkInfo {
- public static class Enabled extends CommentLinkInfo {
+public class CommentLinkInfoImpl extends CommentLinkInfo {
+ public static class Enabled extends CommentLinkInfoImpl {
public Enabled(String name) {
super(name, true);
}
@@ -31,7 +32,7 @@
}
}
- public static class Disabled extends CommentLinkInfo {
+ public static class Disabled extends CommentLinkInfoImpl {
public Disabled(String name) {
super(name, false);
}
@@ -42,14 +43,7 @@
}
}
- public final String match;
- public final String link;
- public final String html;
- public final Boolean enabled; // null means true
-
- public final transient String name;
-
- public CommentLinkInfo(String name, String match, String link, String html,
+ public CommentLinkInfoImpl(String name, String match, String link, String html,
Boolean enabled) {
checkArgument(name != null, "invalid commentlink.name");
checkArgument(!Strings.isNullOrEmpty(match),
@@ -66,7 +60,7 @@
this.enabled = enabled;
}
- private CommentLinkInfo(CommentLinkInfo src, boolean enabled) {
+ private CommentLinkInfoImpl(CommentLinkInfo src, boolean enabled) {
this.name = src.name;
this.match = src.match;
this.link = src.link;
@@ -74,7 +68,7 @@
this.enabled = enabled;
}
- private CommentLinkInfo(String name, boolean enabled) {
+ private CommentLinkInfoImpl(String name, boolean enabled) {
this.name = name;
this.match = null;
this.link = null;
@@ -87,6 +81,6 @@
}
CommentLinkInfo inherit(CommentLinkInfo src) {
- return new CommentLinkInfo(src, enabled);
+ return new CommentLinkInfoImpl(src, enabled);
}
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/CommentLinkProvider.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/CommentLinkProvider.java
index 114ab90..2a29995 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/CommentLinkProvider.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/CommentLinkProvider.java
@@ -16,6 +16,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
+import com.google.gerrit.extensions.api.projects.CommentLinkInfo;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.git.ProjectConfig;
import com.google.inject.Inject;
@@ -41,7 +42,7 @@
List<CommentLinkInfo> cls =
Lists.newArrayListWithCapacity(subsections.size());
for (String name : subsections) {
- CommentLinkInfo cl = ProjectConfig.buildCommentLink(cfg, name, true);
+ CommentLinkInfoImpl cl = ProjectConfig.buildCommentLink(cfg, name, true);
if (cl.isOverrideOnly()) {
throw new ProvisionException(
"commentlink " + name + " empty except for \"enabled\"");
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ConfigInfo.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ConfigInfoImpl.java
similarity index 82%
rename from gerrit-server/src/main/java/com/google/gerrit/server/project/ConfigInfo.java
rename to gerrit-server/src/main/java/com/google/gerrit/server/project/ConfigInfoImpl.java
index d24a7e5..570c2d2 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ConfigInfo.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ConfigInfoImpl.java
@@ -16,8 +16,9 @@
import com.google.common.base.Strings;
import com.google.common.collect.Iterables;
-import com.google.gerrit.extensions.client.InheritableBoolean;
-import com.google.gerrit.extensions.client.SubmitType;
+import com.google.gerrit.extensions.api.projects.CommentLinkInfo;
+import com.google.gerrit.extensions.api.projects.ConfigInfo;
+import com.google.gerrit.extensions.api.projects.ProjectConfigEntryType;
import com.google.gerrit.extensions.common.ActionInfo;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.registration.DynamicMap.Entry;
@@ -34,29 +35,12 @@
import java.util.Arrays;
import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
import java.util.TreeMap;
-public class ConfigInfo {
- public String description;
- public InheritedBooleanInfo useContributorAgreements;
- public InheritedBooleanInfo useContentMerge;
- public InheritedBooleanInfo useSignedOffBy;
- public InheritedBooleanInfo createNewChangeForAllNotInTarget;
- public InheritedBooleanInfo requireChangeId;
- public InheritedBooleanInfo enableSignedPush;
- public InheritedBooleanInfo requireSignedPush;
- public MaxObjectSizeLimitInfo maxObjectSizeLimit;
- public SubmitType submitType;
- public com.google.gerrit.extensions.client.ProjectState state;
- public Map<String, Map<String, ConfigParameterInfo>> pluginConfig;
- public Map<String, ActionInfo> actions;
+public class ConfigInfoImpl extends ConfigInfo {
- public Map<String, CommentLinkInfo> commentlinks;
- public ThemeInfo theme;
-
- public ConfigInfo(boolean serverEnableSignedPush,
+ public ConfigInfoImpl(boolean serverEnableSignedPush,
ProjectControl control,
TransferConfig config,
DynamicMap<ProjectConfigEntry> pluginConfigEntries,
@@ -177,7 +161,7 @@
p.configuredValue = configuredValue;
p.inheritedValue = getInheritedValue(project, cfgFactory, e);
} else {
- if (configEntry.getType() == ProjectConfigEntry.Type.ARRAY) {
+ if (configEntry.getType() == ProjectConfigEntryType.ARRAY) {
p.values = configEntry.onRead(project,
Arrays.asList(cfg.getStringList(e.getExportName())));
} else {
@@ -211,30 +195,4 @@
}
return inheritedValue;
}
-
- public static class InheritedBooleanInfo {
- public Boolean value;
- public InheritableBoolean configuredValue;
- public Boolean inheritedValue;
- }
-
- public static class MaxObjectSizeLimitInfo {
- public String value;
- public String configuredValue;
- public String inheritedValue;
- }
-
- public static class ConfigParameterInfo {
- public String displayName;
- public String description;
- public String warning;
- public ProjectConfigEntry.Type type;
- public String value;
- public Boolean editable;
- public Boolean inheritable;
- public String configuredValue;
- public String inheritedValue;
- public List<String> permittedValues;
- public List<String> values;
- }
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/GetConfig.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/GetConfig.java
index e916162..c999119 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/GetConfig.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/GetConfig.java
@@ -14,6 +14,7 @@
package com.google.gerrit.server.project;
+import com.google.gerrit.extensions.api.projects.ConfigInfo;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.restapi.RestReadView;
import com.google.gerrit.extensions.restapi.RestView;
@@ -51,7 +52,7 @@
@Override
public ConfigInfo apply(ProjectResource resource) {
- return new ConfigInfo(serverEnableSignedPush, resource.getControl(), config,
- pluginConfigEntries, cfgFactory, allProjects, views);
+ return new ConfigInfoImpl(serverEnableSignedPush, resource.getControl(),
+ config, pluginConfigEntries, cfgFactory, allProjects, views);
}
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java
index 1f52b77..b391da7 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java
@@ -28,6 +28,8 @@
import com.google.gerrit.common.data.Permission;
import com.google.gerrit.common.data.PermissionRule;
import com.google.gerrit.common.data.SubscribeSection;
+import com.google.gerrit.extensions.api.projects.CommentLinkInfo;
+import com.google.gerrit.extensions.api.projects.ThemeInfo;
import com.google.gerrit.extensions.client.InheritableBoolean;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.Branch;
@@ -463,7 +465,7 @@
cls.put(cl.name.toLowerCase(), cl);
}
for (ProjectState s : treeInOrder()) {
- for (CommentLinkInfo cl : s.getConfig().getCommentLinkSections()) {
+ for (CommentLinkInfoImpl cl : s.getConfig().getCommentLinkSections()) {
String name = cl.name.toLowerCase();
if (cl.isOverrideOnly()) {
CommentLinkInfo parent = cls.get(name);
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/PutConfig.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/PutConfig.java
index 805e71a..0a7536d 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/PutConfig.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/PutConfig.java
@@ -18,8 +18,10 @@
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.ConfigInfo;
import com.google.gerrit.extensions.api.projects.ConfigInput;
import com.google.gerrit.extensions.api.projects.ConfigValue;
+import com.google.gerrit.extensions.api.projects.ProjectConfigEntryType;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.restapi.BadRequestException;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
@@ -197,7 +199,7 @@
}
ProjectState state = projectStateFactory.create(projectConfig);
- return new ConfigInfo(serverEnableSignedPush,
+ return new ConfigInfoImpl(serverEnableSignedPush,
state.controlFor(user.get()), config, pluginConfigEntries,
cfgFactory, allProjects, views);
} catch (RepositoryNotFoundException notFound) {
@@ -226,7 +228,7 @@
}
String oldValue = cfg.getString(v.getKey());
String value = v.getValue().value;
- if (projectConfigEntry.getType() == ProjectConfigEntry.Type.ARRAY) {
+ if (projectConfigEntry.getType() == ProjectConfigEntryType.ARRAY) {
List<String> l = Arrays.asList(cfg.getStringList(v.getKey()));
oldValue = Joiner.on("\n").join(l);
value = Joiner.on("\n").join(v.getValue().values);
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java
index a3547bb..e6d488d 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java
@@ -40,6 +40,7 @@
import com.google.gerrit.common.data.PermissionRange;
import com.google.gerrit.common.data.PermissionRule;
import com.google.gerrit.common.errors.InvalidNameException;
+import com.google.gerrit.extensions.api.projects.CommentLinkInfo;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.server.ReviewDb;
diff --git a/plugins/cookbook-plugin b/plugins/cookbook-plugin
index 3e801bd..6eecd42 160000
--- a/plugins/cookbook-plugin
+++ b/plugins/cookbook-plugin
@@ -1 +1 @@
-Subproject commit 3e801bd7d488c0b750422b32e4d4729beafcc00c
+Subproject commit 6eecd42fd629c700409826273d9ed02499a1d12c