diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-09-22 17:10:27 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-09-22 18:22:45 +0200 |
commit | 89d60bf5077d6732ec3259cb20d2b14e3e7b8631 (patch) | |
tree | 01a70dc0e936c0dd7159ee8c7bbac5f732f44e78 /sonar-core | |
parent | 205b4e422fa3ad3f6b65d4e07b0fe0757b88a874 (diff) | |
download | sonarqube-89d60bf5077d6732ec3259cb20d2b14e3e7b8631.tar.gz sonarqube-89d60bf5077d6732ec3259cb20d2b14e3e7b8631.zip |
SONAR-5531 Support paging, querying by rules and languages in Issues search WS
Diffstat (limited to 'sonar-core')
3 files changed, 20 insertions, 0 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDto.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDto.java index fa67f6872a9..15092940d68 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDto.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDto.java @@ -78,6 +78,7 @@ public final class IssueDto extends Dto<String> implements Serializable { // joins private String ruleKey; private String ruleRepo; + private String language; private String componentKey; private String rootComponentKey; @@ -153,6 +154,7 @@ public final class IssueDto extends Dto<String> implements Serializable { this.ruleId = rule.getId(); this.ruleKey = rule.getRuleKey(); this.ruleRepo = rule.getRepositoryKey(); + this.language = rule.getLanguage(); return this; } @@ -353,6 +355,10 @@ public final class IssueDto extends Dto<String> implements Serializable { return RuleKey.of(ruleRepo, ruleKey); } + public String getLanguage(){ + return language; + } + public String getComponentKey() { return componentKey; } @@ -385,6 +391,16 @@ public final class IssueDto extends Dto<String> implements Serializable { /** * Should only be used to persist in E/S * + * Please use {@link #setRule(org.sonar.core.rule.RuleDto)} instead + */ + public IssueDto setLanguage(String language) { + this.language = language; + return this; + } + + /** + * Should only be used to persist in E/S + * * Please use {@link #setComponent(org.sonar.core.component.ComponentDto)} instead */ public IssueDto setComponentKey(String componentKey) { @@ -485,6 +501,7 @@ public final class IssueDto extends Dto<String> implements Serializable { issue.setProjectKey(rootComponentKey); issue.setManualSeverity(manualSeverity); issue.setRuleKey(getRuleKey()); + issue.setLanguage(language); issue.setActionPlanKey(actionPlanKey); issue.setAuthorLogin(authorLogin); issue.setNew(false); diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml index 76fb97eaadf..cd9e5cfa79d 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml @@ -31,6 +31,7 @@ i.updated_at as updatedAt, r.plugin_rule_key as ruleKey, r.plugin_name as ruleRepo, + r.language as language, p.kee as componentKey, root.kee as rootComponentKey </sql> diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java index ddda3b57f71..791c7125556 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDtoTest.java @@ -59,6 +59,7 @@ public class IssueDtoTest { .setKee("100") .setRuleId(1) .setRuleKey("squid", "AvoidCycle") + .setLanguage("xoo") .setComponentKey("org.sonar.sample:Sample") .setRootComponentKey("org.sonar.sample") .setComponentId(1l) @@ -82,6 +83,7 @@ public class IssueDtoTest { DefaultIssue issue = dto.toDefaultIssue(); assertThat(issue.key()).isEqualTo("100"); assertThat(issue.ruleKey().toString()).isEqualTo("squid:AvoidCycle"); + assertThat(issue.language()).isEqualTo("xoo"); assertThat(issue.componentKey()).isEqualTo("org.sonar.sample:Sample"); assertThat(issue.componentId()).isEqualTo(1L); assertThat(issue.projectKey()).isEqualTo("org.sonar.sample"); |