use of com.google.gerrit.extensions.api.projects.ConfigInfo.InheritedBooleanInfo in project gerrit by GerritCodeReview.
the class ConfigInfoCreator method constructInfo.
@SuppressWarnings("deprecation")
public static ConfigInfo constructInfo(boolean serverEnableSignedPush, ProjectState projectState, CurrentUser user, DynamicMap<ProjectConfigEntry> pluginConfigEntries, PluginConfigFactory cfgFactory, AllProjectsName allProjects, UiActions uiActions, DynamicMap<RestView<ProjectResource>> views) {
ConfigInfo configInfo = new ConfigInfo();
Project p = projectState.getProject();
configInfo.description = Strings.emptyToNull(p.getDescription());
ProjectState parentState = Iterables.getFirst(projectState.parents(), null);
for (BooleanProjectConfig cfg : BooleanProjectConfig.values()) {
InheritedBooleanInfo info = new InheritedBooleanInfo();
info.configuredValue = p.getBooleanConfig(cfg);
if (parentState != null) {
info.inheritedValue = parentState.is(cfg);
}
BooleanProjectConfigTransformations.set(cfg, configInfo, info);
}
if (!serverEnableSignedPush) {
configInfo.enableSignedPush = null;
configInfo.requireSignedPush = null;
}
configInfo.maxObjectSizeLimit = getMaxObjectSizeLimit(projectState, p);
configInfo.defaultSubmitType = new SubmitTypeInfo();
configInfo.defaultSubmitType.value = projectState.getSubmitType();
configInfo.defaultSubmitType.configuredValue = MoreObjects.firstNonNull(projectState.getConfig().getProject().getSubmitType(), Project.DEFAULT_SUBMIT_TYPE);
ProjectState parent = projectState.isAllProjects() ? projectState : projectState.parents().get(0);
configInfo.defaultSubmitType.inheritedValue = parent.getSubmitType();
configInfo.submitType = configInfo.defaultSubmitType.value;
configInfo.state = p.getState() != com.google.gerrit.extensions.client.ProjectState.ACTIVE ? p.getState() : null;
configInfo.commentlinks = new LinkedHashMap<>();
for (CommentLinkInfo cl : projectState.getCommentLinks()) {
configInfo.commentlinks.put(cl.name, cl);
}
configInfo.pluginConfig = getPluginConfig(projectState, pluginConfigEntries, cfgFactory, allProjects);
configInfo.actions = new TreeMap<>();
for (UiAction.Description d : uiActions.from(views, new ProjectResource(projectState, user))) {
configInfo.actions.put(d.getId(), new ActionInfo(d));
}
configInfo.extensionPanelNames = projectState.getConfig().getExtensionPanelSections();
return configInfo;
}
Aggregations