ConfigInfoImpl: Factor out initialization of MaxObjectSizeLimitInfo to a method

Change-Id: I6803c76c23532671c8794267b69f1aaec206d696
This commit is contained in:
David Pursehouse
2018-08-03 16:26:24 +01:00
parent 7b0bb0f103
commit ad87670f59

View File

@@ -98,15 +98,7 @@ public class ConfigInfoImpl extends ConfigInfo {
this.requireSignedPush = requireSignedPush;
}
MaxObjectSizeLimitInfo maxObjectSizeLimit = new MaxObjectSizeLimitInfo();
maxObjectSizeLimit.value =
transferConfig.getEffectiveMaxObjectSizeLimit(projectState)
== transferConfig.getMaxObjectSizeLimit()
? transferConfig.getFormattedMaxObjectSizeLimit()
: p.getMaxObjectSizeLimit();
maxObjectSizeLimit.configuredValue = p.getMaxObjectSizeLimit();
maxObjectSizeLimit.inheritedValue = transferConfig.getFormattedMaxObjectSizeLimit();
this.maxObjectSizeLimit = maxObjectSizeLimit;
this.maxObjectSizeLimit = getMaxObjectSizeLimit(projectState, transferConfig, p);
this.submitType = p.getSubmitType();
this.state =
@@ -130,6 +122,19 @@ public class ConfigInfoImpl extends ConfigInfo {
this.theme = projectState.getTheme();
}
private MaxObjectSizeLimitInfo getMaxObjectSizeLimit(
ProjectState projectState, TransferConfig transferConfig, Project p) {
MaxObjectSizeLimitInfo info = new MaxObjectSizeLimitInfo();
info.value =
transferConfig.getEffectiveMaxObjectSizeLimit(projectState)
== transferConfig.getMaxObjectSizeLimit()
? transferConfig.getFormattedMaxObjectSizeLimit()
: p.getMaxObjectSizeLimit();
info.configuredValue = p.getMaxObjectSizeLimit();
info.inheritedValue = transferConfig.getFormattedMaxObjectSizeLimit();
return info;
}
private Map<String, Map<String, ConfigParameterInfo>> getPluginConfig(
ProjectState project,
DynamicMap<ProjectConfigEntry> pluginConfigEntries,