diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-22 15:02:41 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-22 15:02:41 +0000 |
commit | 80554ac4be046afaac167a309e94c7c5f3cf3405 (patch) | |
tree | 3616c75a11a28d3cb7b677e24eb2885d618f3914 /sonar-plugin-api | |
parent | 7193aef67d64d8a58d62048745195ee12326c28a (diff) | |
download | sonarqube-80554ac4be046afaac167a309e94c7c5f3cf3405.tar.gz sonarqube-80554ac4be046afaac167a309e94c7c5f3cf3405.zip |
SONAR-1722 increase the size of RULES_PROFILES.PARENT_NAME (same as NAME) + change the type of ACTIVE_RULES.INHERITANCE
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java | 26 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleInheritanceStatus.java | 33 |
2 files changed, 18 insertions, 41 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 1ebab335157..c2d33ec2eb5 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 @@ -37,6 +37,9 @@ import javax.persistence.*; @Table(name = "active_rules") public class ActiveRule implements Cloneable { + public static final String INHERITED = "INHERITED"; + public static final String OVERRIDES = "OVERRIDES"; + @Id @Column(name = "id") @GeneratedValue @@ -57,9 +60,8 @@ public class ActiveRule implements Cloneable { @OneToMany(mappedBy = "activeRule", fetch = FetchType.LAZY, cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE }) private List<ActiveRuleParam> activeRuleParams = new ArrayList<ActiveRuleParam>(); - @Column(name = "inherited", updatable = true, nullable = true) - @Enumerated(EnumType.ORDINAL) - private ActiveRuleInheritanceStatus inherited = ActiveRuleInheritanceStatus.NO; + @Column(name = "inheritance", updatable = true, nullable = true) + private String inheritance; /** * @deprecated visibility should be reduced to protected or package @@ -92,8 +94,8 @@ public class ActiveRule implements Cloneable { * * @since 2.5 */ - public ActiveRuleInheritanceStatus getInheritanceStatus() { - return inherited == null ? ActiveRuleInheritanceStatus.NO : inherited; + public String getInheritance() { + return inheritance; } /** @@ -101,8 +103,16 @@ public class ActiveRule implements Cloneable { * * @since 2.5 */ - public void setInheritanceStatus(ActiveRuleInheritanceStatus status) { - this.inherited = status; + public void setInheritance(String s) { + this.inheritance = s; + } + + public boolean isInherited() { + return StringUtils.equals(INHERITED, inheritance); + } + + public boolean doesOverride() { + return StringUtils.equals(OVERRIDES, inheritance); } /** @@ -259,7 +269,7 @@ public class ActiveRule implements Cloneable { @Override public Object clone() { final ActiveRule clone = new ActiveRule(getRulesProfile(), getRule(), getSeverity()); - clone.setInheritanceStatus(getInheritanceStatus()); + clone.setInheritance(getInheritance()); 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 deleted file mode 100644 index 27c7e413bc0..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleInheritanceStatus.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -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 -} |