diff options
author | Godin <mandrikov@gmail.com> | 2010-12-21 22:45:14 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-12-21 22:45:14 +0000 |
commit | 2398469a24eb259e8b8de911a373bb49615d761c (patch) | |
tree | 8006be4514c54495b66cdb7adf9fafdeedc27133 /sonar-plugin-api/src | |
parent | 4d2ccd83150e1e769e67fb71bd4d519c6913cd6e (diff) | |
download | sonarqube-2398469a24eb259e8b8de911a373bb49615d761c.tar.gz sonarqube-2398469a24eb259e8b8de911a373bb49615d761c.zip |
SONAR-1722: Merge two fields ActiveRule.inherited and ActiveRule.overridden into one with enum type
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java | 35 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleInheritanceStatus.java | 14 |
2 files changed, 21 insertions, 28 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java index badb3bb2492..1ebab335157 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java @@ -58,10 +58,8 @@ public class ActiveRule implements Cloneable { private List<ActiveRuleParam> activeRuleParams = new ArrayList<ActiveRuleParam>(); @Column(name = "inherited", updatable = true, nullable = true) - private Boolean inherited; - - @Column(name = "overridden", updatable = true, nullable = true) - private Boolean overridden; + @Enumerated(EnumType.ORDINAL) + private ActiveRuleInheritanceStatus inherited = ActiveRuleInheritanceStatus.NO; /** * @deprecated visibility should be reduced to protected or package @@ -94,26 +92,8 @@ public class ActiveRule implements Cloneable { * * @since 2.5 */ - public boolean isInherited() { - return inherited == null ? false : inherited; - } - - /** - * For internal use only. - * - * @since 2.5 - */ - public void setInherited(boolean inherited) { - this.inherited = inherited; - } - - /** - * For internal use only. - * - * @since 2.5 - */ - public boolean isOverridden() { - return overridden == null ? false : overridden; + public ActiveRuleInheritanceStatus getInheritanceStatus() { + return inherited == null ? ActiveRuleInheritanceStatus.NO : inherited; } /** @@ -121,8 +101,8 @@ public class ActiveRule implements Cloneable { * * @since 2.5 */ - public void setOverridden(Boolean overridden) { - this.overridden = overridden; + public void setInheritanceStatus(ActiveRuleInheritanceStatus status) { + this.inherited = status; } /** @@ -279,8 +259,7 @@ public class ActiveRule implements Cloneable { @Override public Object clone() { final ActiveRule clone = new ActiveRule(getRulesProfile(), getRule(), getSeverity()); - clone.setInherited(isInherited()); - clone.setOverridden(isOverridden()); + clone.setInheritanceStatus(getInheritanceStatus()); if (CollectionUtils.isNotEmpty(getActiveRuleParams())) { clone.setActiveRuleParams(new ArrayList<ActiveRuleParam>(CollectionUtils.collect(getActiveRuleParams(), new Transformer() { public Object transform(Object input) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleInheritanceStatus.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleInheritanceStatus.java new file mode 100644 index 00000000000..713c72ea554 --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleInheritanceStatus.java @@ -0,0 +1,14 @@ +package org.sonar.api.rules; + +/** + * For internal use only. + * + * @since 2.5 + */ +public enum ActiveRuleInheritanceStatus { + /** + * WARNING : DO NOT CHANGE THE ENUMERATION ORDER + * the enum ordinal is used for db persistence + */ + NO, INHERITED, OVERRIDDEN +} |