use of com.google.gerrit.entities.AccountsSection in project gerrit by GerritCodeReview.
the class ProjectConfig method getCacheable.
/**
* Returns an immutable, thread-safe representation of this object that can be cached.
*/
public CachedProjectConfig getCacheable() {
CachedProjectConfig.Builder builder = CachedProjectConfig.builder().setProject(project).setAccountsSection(accountsSection).setBranchOrderSection(Optional.ofNullable(branchOrderSection)).setMimeTypes(mimeTypes).setRulesId(Optional.ofNullable(rulesId)).setRevision(Optional.ofNullable(getRevision())).setMaxObjectSizeLimit(maxObjectSizeLimit).setCheckReceivedObjects(checkReceivedObjects).setExtensionPanelSections(extensionPanelSections);
groupList.byUUID().values().forEach(g -> builder.addGroup(g));
contributorAgreements.values().forEach(c -> builder.addContributorAgreement(c));
notifySections.values().forEach(n -> builder.addNotifySection(n));
subscribeSections.values().forEach(s -> builder.addSubscribeSection(s));
commentLinkSections.values().forEach(c -> builder.addCommentLinkSection(c));
labelSections.values().forEach(l -> builder.addLabelSection(l));
submitRequirementSections.values().forEach(sr -> builder.addSubmitRequirementSection(sr));
pluginConfigs.entrySet().forEach(c -> builder.addPluginConfig(c.getKey(), c.getValue().toText()));
projectLevelConfigs.entrySet().forEach(c -> builder.addProjectLevelConfig(c.getKey(), c.getValue().toText()));
if (projectName.equals(allProjectsName)) {
// Filter out permissions that aren't allowed to be set on All-Projects
accessSections.values().forEach(a -> {
List<Permission.Builder> copy = new ArrayList<>();
for (Permission p : a.getPermissions()) {
if (Permission.canBeOnAllProjects(a.getName(), p.getName())) {
copy.add(p.toBuilder());
}
}
AccessSection section = AccessSection.builder(a.getName()).modifyPermissions(permissions -> permissions.addAll(copy)).build();
builder.addAccessSection(section);
});
} else {
accessSections.values().forEach(a -> builder.addAccessSection(a));
}
return builder.build();
}
Aggregations