diff options
author | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-06-23 09:35:55 +0200 |
---|---|---|
committer | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-06-23 09:35:55 +0200 |
commit | b005183fd67521cbb16182fbe4ef9094f92a3c83 (patch) | |
tree | a7a946c02a7fbed277d1914fdd877d0fb87ee48a /sonar-server/src/main | |
parent | be76801c0871d1f7c826461d99aa5f4068811dc9 (diff) | |
download | sonarqube-b005183fd67521cbb16182fbe4ef9094f92a3c83.tar.gz sonarqube-b005183fd67521cbb16182fbe4ef9094f92a3c83.zip |
SONAR-5406 - Added effortToFix to Rule domain object and WS Json response.
Diffstat (limited to 'sonar-server/src/main')
4 files changed, 11 insertions, 2 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/Rule.java b/sonar-server/src/main/java/org/sonar/server/rule/Rule.java index 74b785903ad..93a238bc12c 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/Rule.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/Rule.java @@ -24,7 +24,6 @@ import org.sonar.api.rule.RuleStatus; import org.sonar.api.server.debt.DebtRemediationFunction; import javax.annotation.CheckForNull; - import java.util.Date; import java.util.List; @@ -41,6 +40,8 @@ public interface Rule { String htmlDescription(); + String effortToFixDescription(); + /** * Default severity when activated on a Quality profile * diff --git a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java index 3d3d7b30186..d5f88efdc78 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java @@ -33,7 +33,6 @@ import org.sonar.server.search.IndexUtils; import javax.annotation.CheckForNull; import javax.annotation.Nullable; - import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -94,6 +93,12 @@ public class RuleDoc extends BaseDoc implements Rule { @Override @CheckForNull + public String effortToFixDescription() { + return getNullableField(RuleNormalizer.RuleField.FIX_DESCRIPTION.field()); + } + + @Override + @CheckForNull public String severity() { return (String) getNullableField(RuleNormalizer.RuleField.SEVERITY.field()); } diff --git a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java index 07d3a37c669..d1a3b6fd525 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java @@ -89,6 +89,7 @@ public class RuleNormalizer extends BaseNormalizer<RuleDto, RuleKey> { public static final IndexField HTML_DESCRIPTION = addSearchable(IndexField.Type.TEXT, "htmlDesc"); public static final IndexField SEVERITY = add(IndexField.Type.STRING, "severity"); public static final IndexField STATUS = add(IndexField.Type.STRING, "status"); + public static final IndexField FIX_DESCRIPTION = add(IndexField.Type.STRING, "effortToFix"); public static final IndexField LANGUAGE = add(IndexField.Type.STRING, "lang"); public static final IndexField TAGS = add(IndexField.Type.STRING, "tags"); public static final IndexField SYSTEM_TAGS = add(IndexField.Type.STRING, "sysTags"); @@ -174,6 +175,7 @@ public class RuleNormalizer extends BaseNormalizer<RuleDto, RuleKey> { update.put(RuleField.CREATED_AT.field(), rule.getCreatedAt()); update.put(RuleField.UPDATED_AT.field(), rule.getUpdatedAt()); update.put(RuleField.HTML_DESCRIPTION.field(), rule.getDescription()); + update.put(RuleField.FIX_DESCRIPTION.field(), rule.getEffortToFixDescription()); update.put(RuleField.SEVERITY.field(), rule.getSeverityString()); update.put(RuleField.STATUS.field(), rule.getStatus().name()); update.put(RuleField.LANGUAGE.field(), rule.getLanguage()); diff --git a/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleMapping.java b/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleMapping.java index 265730b321c..4c7585a6d4b 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleMapping.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleMapping.java @@ -53,6 +53,7 @@ public class RuleMapping extends BaseMapping { addField("debtRemFn", new IndexStringField("debtRemFnType", RuleNormalizer.RuleField.DEBT_FUNCTION_TYPE.field())); addField("debtRemFn", new IndexStringField("debtRemFnCoeff", RuleNormalizer.RuleField.DEBT_FUNCTION_COEFFICIENT.field())); addField("debtRemFn", new IndexStringField("debtRemFnOffset", RuleNormalizer.RuleField.DEBT_FUNCTION_OFFSET.field())); + addIndexStringField("effortToFixDescription", RuleNormalizer.RuleField.FIX_DESCRIPTION.field()); addIndexStringField("mdNote", RuleNormalizer.RuleField.NOTE.field()); addField("htmlNote", new HtmlNoteField(macroInterpreter)); addIndexStringField("noteLogin", RuleNormalizer.RuleField.NOTE_LOGIN.field()); |