aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-12-08 13:45:25 +0000
committerGodin <mandrikov@gmail.com>2010-12-08 13:45:25 +0000
commit74c4ac9a4a5c9df13116862dd5dca982cc3f84bd (patch)
treecb57a7450654f6b1ece1f7ecf2b1a49b307f559b /sonar-plugin-api
parent72d3b0a889574cea355b61f7395b38a55071da33 (diff)
downloadsonarqube-74c4ac9a4a5c9df13116862dd5dca982cc3f84bd.tar.gz
sonarqube-74c4ac9a4a5c9df13116862dd5dca982cc3f84bd.zip
Deprecate Rule.setPluginName() , Rule.getPluginName() and related stuff, because was replaced by repositoryKey
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java19
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java11
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java43
3 files changed, 39 insertions, 34 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
index 01d91243bbb..895bea88eba 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
@@ -29,14 +29,13 @@ import org.sonar.api.rules.ActiveRule;
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RulePriority;
-import javax.persistence.*;
-
import java.util.ArrayList;
import java.util.List;
+import javax.persistence.*;
+
/**
- * This class is badly named. It should be "QualityProfile". Indeed it does not relate only to rules but to metric
- * thresholds too.
+ * This class is badly named. It should be "QualityProfile". Indeed it does not relate only to rules but to metric thresholds too.
*/
@Entity
@Table(name = "rules_profiles")
@@ -153,16 +152,16 @@ public class RulesProfile implements Cloneable {
}
/**
- * Set whether this is the default profile for the language. The default profile is used when none is explicitly
- * defined when auditing a project.
+ * Set whether this is the default profile for the language. The default profile is used when none is explicitly defined when auditing a
+ * project.
*/
public void setDefaultProfile(Boolean b) {
this.defaultProfile = b;
}
/**
- * @return whether the profile is defined in a plugin. Provided profiles are automatically restored during
- * server startup and can not be updated by end users.
+ * @return whether the profile is defined in a plugin. Provided profiles are automatically restored during server startup and can not be
+ * updated by end users.
*/
public Boolean getProvided() {
return provided;
@@ -232,7 +231,7 @@ public class RulesProfile implements Cloneable {
}
/**
- * @deprecated since 2.3. Use getActiveRulesByRepository().
+ * @deprecated since 2.3 use {@link #getActiveRulesByRepository()} instead.
*/
@Deprecated
public List<ActiveRule> getActiveRulesByPlugin(String repositoryKey) {
@@ -242,7 +241,7 @@ public class RulesProfile implements Cloneable {
public List<ActiveRule> getActiveRulesByRepository(String repositoryKey) {
List<ActiveRule> result = new ArrayList<ActiveRule>();
for (ActiveRule activeRule : getActiveRules()) {
- if (repositoryKey.equals(activeRule.getPluginName())) {
+ if (repositoryKey.equals(activeRule.getRepositoryKey())) {
result.add(activeRule);
}
}
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 a57bc3c21bb..de5db8d61a8 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
@@ -25,11 +25,11 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.sonar.api.profiles.RulesProfile;
-import javax.persistence.*;
-
import java.util.ArrayList;
import java.util.List;
+import javax.persistence.*;
+
/**
* A class to map an ActiveRule to the hibernate model
*/
@@ -175,11 +175,11 @@ public class ActiveRule implements Cloneable {
}
/**
- * @deprecated use getRepositoryKey()
+ * @deprecated since 2.3 use {@link #getRepositoryKey()} instead
*/
@Deprecated
public String getPluginName() {
- return rule.getPluginName();
+ return rule.getRepositoryKey();
}
public String getRepositoryKey() {
@@ -230,7 +230,8 @@ public class ActiveRule implements Cloneable {
@Override
public String toString() {
- return new ToStringBuilder(this).append("id", getId()).append("rule", rule).append("priority", severity).append("params", activeRuleParams).toString();
+ return new ToStringBuilder(this).append("id", getId()).append("rule", rule).append("priority", severity)
+ .append("params", activeRuleParams).toString();
}
@Override
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java
index 618d0e6fb46..6a33cb6c5f6 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java
@@ -26,11 +26,11 @@ import org.apache.commons.lang.builder.ToStringBuilder;
import org.sonar.api.database.DatabaseProperties;
import org.sonar.check.Cardinality;
-import javax.persistence.*;
-
import java.util.ArrayList;
import java.util.List;
+import javax.persistence.*;
+
@Entity
@Table(name = "rules")
public final class Rule {
@@ -92,8 +92,8 @@ public final class Rule {
* Creates rule with minimum set of info
*
* @param pluginName the plugin name indicates which plugin the rule belongs to
- * @param key the key should be unique within a plugin, but it is even more careful for the time being that it is unique
- * across the application
+ * @param key the key should be unique within a plugin, but it is even more careful for the time being that it is unique across the
+ * application
* @deprecated since 2.3. Use the factory method {@link #create()}
*/
@Deprecated
@@ -107,8 +107,8 @@ public final class Rule {
* Creates a fully qualified rule
*
* @param pluginKey the plugin the rule belongs to
- * @param key the key should be unique within a plugin, but it is even more careful for the time being that it is unique
- * across the application
+ * @param key the key should be unique within a plugin, but it is even more careful for the time being that it is unique across the
+ * application
* @param name the name displayed in the UI
* @param rulesCategory the ISO category the rule belongs to
* @param severity this is the severity associated to the rule
@@ -201,13 +201,18 @@ public final class Rule {
return this;
}
+ /**
+ * @deprecated since 2.5 use {@link #getRepositoryKey()} instead
+ */
+ @Deprecated
public String getPluginName() {
return pluginName;
}
/**
- * Sets the plugin name the rule belongs to
+ * @deprecated since 2.5 use {@link #setRepositoryKey(String)} instead
*/
+ @Deprecated
public Rule setPluginName(String pluginName) {
this.pluginName = pluginName;
return this;
@@ -229,6 +234,14 @@ public final class Rule {
return description;
}
+ /**
+ * Sets the rule description
+ */
+ public Rule setDescription(String description) {
+ this.description = StringUtils.strip(description);
+ return this;
+ }
+
public Boolean isEnabled() {
return enabled;
}
@@ -241,14 +254,6 @@ public final class Rule {
return this;
}
- /**
- * Sets the rule description
- */
- public Rule setDescription(String description) {
- this.description = StringUtils.strip(description);
- return this;
- }
-
public List<RuleParam> getParams() {
return params;
}
@@ -276,15 +281,15 @@ public final class Rule {
public RuleParam createParameter() {
RuleParam parameter = new RuleParam()
- .setRule(this);
+ .setRule(this);
params.add(parameter);
return parameter;
}
public RuleParam createParameter(String key) {
RuleParam parameter = new RuleParam()
- .setKey(key)
- .setRule(this);
+ .setKey(key)
+ .setRule(this);
params.add(parameter);
return parameter;
}
@@ -376,7 +381,7 @@ public final class Rule {
}
Rule other = (Rule) obj;
return new EqualsBuilder()
- .append(pluginName, other.getPluginName())
+ .append(pluginName, other.getRepositoryKey())
.append(key, other.getKey())
.isEquals();
}