aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-07-01 10:09:26 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-07-01 10:11:21 +0200
commit486169ddd0dba69431c6e85c1be073bdaf1b795b (patch)
tree41189d047f541abfae4e96013552e136b67f5f1a
parentb4ee43b4e63c79919b18d7fa5e62b1ccec7e1a0f (diff)
downloadsonarqube-486169ddd0dba69431c6e85c1be073bdaf1b795b.tar.gz
sonarqube-486169ddd0dba69431c6e85c1be073bdaf1b795b.zip
SONAR-5007 - Added legacy ID field to Rule for RuleFinder
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java3
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java7
2 files changed, 7 insertions, 3 deletions
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 0b7ac65d5c7..45328b52e49 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
@@ -511,8 +511,9 @@ public class Rule {
/**
* For definition of rule only
*/
- public void setTags(String[] tags) {
+ public Rule setTags(String[] tags) {
this.tags = tags;
+ return this;
}
/**
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java b/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java
index 395822f832d..be224ea5b0f 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java
@@ -25,6 +25,7 @@ import org.sonar.api.rule.RuleKey;
import org.sonar.api.rule.RuleStatus;
import org.sonar.api.rules.RuleFinder;
import org.sonar.api.rules.RulePriority;
+import org.sonar.server.rule.index.RuleDoc;
import org.sonar.server.rule.index.RuleIndex;
import org.sonar.server.rule.index.RuleQuery;
import org.sonar.server.search.IndexClient;
@@ -107,7 +108,8 @@ public class DefaultRuleFinder implements RuleFinder {
private org.sonar.api.rules.Rule toRule(Rule rule) {
org.sonar.api.rules.Rule apiRule = new org.sonar.api.rules.Rule();
- apiRule.setName(rule.name())
+ apiRule
+ .setName(rule.name())
.setLanguage(rule.language())
.setKey(rule.key().rule())
.setConfigKey(rule.internalKey())
@@ -122,7 +124,8 @@ public class DefaultRuleFinder implements RuleFinder {
.setDefaultSubCharacteristicKey(rule.defaultDebtSubCharacteristicKey())
.setCharacteristicKey(rule.debtCharacteristicKey())
.setSubCharacteristicKey(rule.debtSubCharacteristicKey())
- .setTags(rule.tags().toArray(new String[rule.tags().size()]));
+ .setTags(rule.tags().toArray(new String[rule.tags().size()]))
+ .setId(((RuleDoc) rule).id());
List<org.sonar.api.rules.RuleParam> apiParams = newArrayList();
for (RuleParam param : rule.params()) {