Add BooleanProjectConfig to reduce boiler plate

Adding a new inheritable boolean project configuration required adding
it in many places so that it can be set and retrieved from the API and
is persisted in Git. Also making sure that it has the required
inheritance behavior was cumbersome.

This commit refactors the code and introdcues BooleanProjectConfig. This
makes it very easy to add new boolean configs server-side by adding them
to BooleanProjectConfig, ConfigInfo, ConfigInput and
BooleanProjectConfigTransformations.

Change-Id: Ie5b3678bbc8db44cb7ccefe5c59dd68918aba045
This commit is contained in:
Patrick Hiesel
2017-11-27 16:10:11 +01:00
parent d96ef40576
commit cb904b41ac
26 changed files with 355 additions and 433 deletions

View File

@@ -22,6 +22,7 @@ import com.google.gerrit.common.data.PermissionRule.Action;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.AccountGroup.UUID;
import com.google.gerrit.reviewdb.client.BooleanProjectConfig;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.IdentifiedUser;
@@ -65,7 +66,7 @@ public class ContributorAgreementsChecker {
throw new IOException("Can't load All-Projects");
}
if (!projectState.isUseContributorAgreements()) {
if (!projectState.is(BooleanProjectConfig.USE_CONTRIBUTOR_AGREEMENTS)) {
return;
}