aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-04-30 16:17:58 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-04-30 16:17:58 +0200
commit65a6f6d2484de42c29972fb5d34e41dba84e8692 (patch)
tree8f64739f58ab6768bf437c8d448b017cadcf1dec /sonar-plugin-api
parent238f713bf3d10a388f2bbabf1163008f95e15e67 (diff)
downloadsonarqube-65a6f6d2484de42c29972fb5d34e41dba84e8692.tar.gz
sonarqube-65a6f6d2484de42c29972fb5d34e41dba84e8692.zip
SONAR-3755 Add assigned parameter to IssueQuery
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueQuery.java16
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java2
2 files changed, 18 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 b480b29b39f..796a6d42df7 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
@@ -46,6 +46,7 @@ public class IssueQuery {
private final Collection<RuleKey> rules;
private final Collection<String> userLogins;
private final Collection<String> assignees;
+ private final Boolean assigned;
private final Date createdAfter;
private final Date createdBefore;
private final String sort;
@@ -67,6 +68,7 @@ public class IssueQuery {
this.rules = builder.rules;
this.userLogins = builder.userLogins;
this.assignees = builder.assignees;
+ this.assigned = builder.assigned;
this.createdAfter = builder.createdAfter;
this.createdBefore = builder.createdBefore;
this.sort = builder.sort;
@@ -111,6 +113,10 @@ public class IssueQuery {
return assignees;
}
+ public Boolean assigned() {
+ return assigned;
+ }
+
public Date createdAfter() {
return createdAfter;
}
@@ -167,6 +173,7 @@ public class IssueQuery {
private Collection<RuleKey> rules;
private Collection<String> userLogins;
private Collection<String> assignees;
+ private Boolean assigned = null;
private Date createdAfter;
private Date createdBefore;
private String sort;
@@ -222,6 +229,15 @@ public class IssueQuery {
return this;
}
+ /**
+ * If true, it will return all issues assigned to someone
+ * If false, it will return all issues not assigned to someone
+ */
+ public Builder assigned(Boolean assigned) {
+ this.assigned = assigned;
+ return this;
+ }
+
public Builder createdAfter(Date createdAfter) {
this.createdAfter = createdAfter;
return this;
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 484119de21d..5a9d955bac1 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
@@ -43,6 +43,7 @@ public class IssueQueryTest {
.rules(Lists.newArrayList(RuleKey.of("squid", "AvoidCycle")))
.userLogins(Lists.newArrayList("crunky"))
.assignees(Lists.newArrayList("gargantua"))
+ .assigned(true)
.createdAfter(new Date())
.createdBefore(new Date())
.sort("assignee")
@@ -57,6 +58,7 @@ public class IssueQueryTest {
assertThat(query.componentRoots()).containsOnly("org.struts:core");
assertThat(query.userLogins()).containsOnly("crunky");
assertThat(query.assignees()).containsOnly("gargantua");
+ assertThat(query.assigned()).isTrue();
assertThat(query.rules()).containsOnly(RuleKey.of("squid", "AvoidCycle"));
assertThat(query.createdAfter()).isNotNull();
assertThat(query.createdBefore()).isNotNull();