For inherited boolean values display the actual value that is inherited

The values for useContributorAgreements, useSignedOffBy,
useContentMerge and requireChangeID can be either directly set on a
project or be inherited from the parent project. In case that the value
is inherited from the parent project display the actual value that is
inherited on the ProjectInfoScreen.

Change-Id: If4f484ceb5287326d7e9961733cdbf86a6e58827
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2012-11-24 22:44:36 +01:00
committed by Shawn O. Pearce
parent 69b3336684
commit 8fb080a4a3
12 changed files with 180 additions and 92 deletions

View File

@@ -23,7 +23,7 @@ import com.google.gerrit.common.data.Permission;
import com.google.gerrit.common.data.PermissionRule;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.Project.InheritedBoolean;
import com.google.gerrit.reviewdb.client.Project.InheritableBoolean;
import com.google.gerrit.rules.PrologEnvironment;
import com.google.gerrit.rules.RulesCache;
import com.google.gerrit.server.CurrentUser;
@@ -315,42 +315,42 @@ public class ProjectState {
}
public boolean isUseContributorAgreements() {
return getInheritedBoolean(new Function<Project, InheritedBoolean>() {
return getInheritableBoolean(new Function<Project, InheritableBoolean>() {
@Override
public InheritedBoolean apply(Project input) {
public InheritableBoolean apply(Project input) {
return input.getUseContributorAgreements();
}
});
}
public boolean isUseContentMerge() {
return getInheritedBoolean(new Function<Project, InheritedBoolean>() {
return getInheritableBoolean(new Function<Project, InheritableBoolean>() {
@Override
public InheritedBoolean apply(Project input) {
public InheritableBoolean apply(Project input) {
return input.getUseContentMerge();
}
});
}
public boolean isUseSignedOffBy() {
return getInheritedBoolean(new Function<Project, InheritedBoolean>() {
return getInheritableBoolean(new Function<Project, InheritableBoolean>() {
@Override
public InheritedBoolean apply(Project input) {
public InheritableBoolean apply(Project input) {
return input.getUseSignedOffBy();
}
});
}
public boolean isRequireChangeID() {
return getInheritedBoolean(new Function<Project, InheritedBoolean>() {
return getInheritableBoolean(new Function<Project, InheritableBoolean>() {
@Override
public InheritedBoolean apply(Project input) {
public InheritableBoolean apply(Project input) {
return input.getRequireChangeID();
}
});
}
private boolean getInheritedBoolean(Function<Project, InheritedBoolean> func) {
private boolean getInheritableBoolean(Function<Project, InheritableBoolean> func) {
Set<Project.NameKey> seen = Sets.newHashSet();
seen.add(getProject().getNameKey());
ProjectState s = this;