aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-04-22 12:06:38 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-04-22 12:06:38 +0200
commit617bd05a326531e8d64faa8ba0bf54fbe0bce421 (patch)
treed8856eaf58d3db52f6610f451506d29a76d7d672 /sonar-plugin-api
parentcc5bd59de2151261944161f5324e0adc329a8cd2 (diff)
downloadsonarqube-617bd05a326531e8d64faa8ba0bf54fbe0bce421.tar.gz
sonarqube-617bd05a326531e8d64faa8ba0bf54fbe0bce421.zip
ONAR-5132 Issues search WS should allow to search by language
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueQuery.java11
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java5
2 files changed, 16 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueQuery.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueQuery.java
index 9d58e10a966..fc4458e49a5 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueQuery.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueQuery.java
@@ -67,6 +67,7 @@ public class IssueQuery {
private final Collection<String> actionPlans;
private final Collection<String> reporters;
private final Collection<String> assignees;
+ private final Collection<String> languages;
private final Boolean assigned;
private final Boolean planned;
private final Boolean resolved;
@@ -95,6 +96,7 @@ public class IssueQuery {
this.actionPlans = defaultCollection(builder.actionPlans);
this.reporters = defaultCollection(builder.reporters);
this.assignees = defaultCollection(builder.assignees);
+ this.languages = defaultCollection(builder.languages);
this.assigned = builder.assigned;
this.planned = builder.planned;
this.resolved = builder.resolved;
@@ -148,6 +150,9 @@ public class IssueQuery {
public Collection<String> assignees() {
return assignees;
}
+ public Collection<String> languages() {
+ return languages;
+ }
@CheckForNull
public Boolean assigned() {
@@ -233,6 +238,7 @@ public class IssueQuery {
private Collection<String> actionPlans;
private Collection<String> reporters;
private Collection<String> assignees;
+ private Collection<String> languages;
private Boolean assigned = null;
private Boolean planned = null;
private Boolean resolved = null;
@@ -299,6 +305,11 @@ public class IssueQuery {
return this;
}
+ public Builder languages(@Nullable Collection<String> l) {
+ this.languages = l;
+ return this;
+ }
+
/**
* If true, it will return all issues assigned to someone
* If false, it will return all issues not assigned to someone
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java
index 75b12dedb05..933934f838f 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java
@@ -47,6 +47,7 @@ public class IssueQueryTest {
.actionPlans(newArrayList("AP1", "AP2"))
.reporters(newArrayList("crunky"))
.assignees(newArrayList("gargantua"))
+ .languages(newArrayList("xoo"))
.assigned(true)
.hideRules(true)
.createdAfter(new Date())
@@ -68,6 +69,7 @@ public class IssueQueryTest {
assertThat(query.componentRoots()).containsOnly("org.struts:core");
assertThat(query.reporters()).containsOnly("crunky");
assertThat(query.assignees()).containsOnly("gargantua");
+ assertThat(query.languages()).containsOnly("xoo");
assertThat(query.assigned()).isTrue();
assertThat(query.hideRules()).isTrue();
assertThat(query.rules()).containsOnly(RuleKey.of("squid", "AvoidCycle"));
@@ -123,6 +125,7 @@ public class IssueQueryTest {
.resolutions(null)
.rules(null)
.severities(null)
+ .languages(null)
.build();
assertThat(query.issueKeys()).isEmpty();
assertThat(query.components()).isEmpty();
@@ -134,6 +137,7 @@ public class IssueQueryTest {
assertThat(query.resolutions()).isEmpty();
assertThat(query.rules()).isEmpty();
assertThat(query.severities()).isEmpty();
+ assertThat(query.languages()).isEmpty();
}
@Test
@@ -149,6 +153,7 @@ public class IssueQueryTest {
assertThat(query.resolutions()).isEmpty();
assertThat(query.rules()).isEmpty();
assertThat(query.severities()).isEmpty();
+ assertThat(query.languages()).isEmpty();
assertThat(query.assigned()).isNull();
assertThat(query.createdAfter()).isNull();
assertThat(query.createdBefore()).isNull();