Restore enforcement constraint by parent projects

The fix on boolean to string (I86689fc803f62cce54201a720c80d0f6267fd4b2)
has broken the enforcement of the policy on parent projects.
Refactor the code to make the intention more explicit and restore
the parent project enforcement.

Change-Id: Ia330e9a4f095368a0734cb54b95e4537d94e3598
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
index 581ef99..06b2b77 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
@@ -97,13 +97,8 @@
       return false;
     }
 
-    for (ProjectState parentState : projectState.treeInOrder()) {
-      PluginConfig parentCfg =
-          pluginCfgFactory.getFromProjectConfig(parentState, pluginName);
-      if (!"false".equals(parentCfg.getString("enabled"))
-          && isEnabledForBranch(parentState, refName)) {
-        return true;
-      }
+    if(isEnforcedByAnyParentProject(refName, projectState)) {
+      return true;
     }
 
     return !"false".equals(pluginCfgFactory.getFromProjectConfigWithInheritance(
@@ -111,6 +106,19 @@
         && isEnabledForBranch(projectState, refName);
   }
 
+  private boolean isEnforcedByAnyParentProject(String refName,
+      ProjectState projectState) {
+    for (ProjectState parentState : projectState.treeInOrder()) {
+      PluginConfig parentCfg =
+          pluginCfgFactory.getFromProjectConfig(parentState, pluginName);
+      if ("enforced".equals(parentCfg.getString("enabled", "false"))
+          && isEnabledForBranch(parentState, refName)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   private boolean isEnabledForBranch(ProjectState project, String refName) {
     String[] refPatterns =
         pluginCfgFactory.getFromProjectConfigWithInheritance(project,