diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-05-12 21:29:40 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-05-12 21:29:40 +0200 |
commit | 5765e0955d1516e035e7a970be9b992d9a90b270 (patch) | |
tree | 984a2cb5dada83778de77d36a57b798647bfd3e8 /sonar-plugin-api | |
parent | 2b27e74cff921c1fa9a96fa4b5e5e5c11aad2352 (diff) | |
download | sonarqube-5765e0955d1516e035e7a970be9b992d9a90b270.tar.gz sonarqube-5765e0955d1516e035e7a970be9b992d9a90b270.zip |
SONAR-3755 refactor comments
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java | 5 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueQuery.java | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java index 61bfe64f6b1..1def6c0099f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java @@ -75,7 +75,7 @@ public interface Issue extends Serializable { String status(); /** - * The type of resolution. Return null if the issue is not resolved. + * The type of resolution, or null if the issue is not resolved. */ @CheckForNull String resolution(); @@ -106,5 +106,8 @@ public interface Issue extends Serializable { @CheckForNull String actionPlanKey(); + /** + * Non-null list of comments, ordered by chronological order + */ List<IssueComment> comments(); } 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 cf28674d90d..87f0e462347 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 @@ -25,7 +25,6 @@ import org.apache.commons.lang.builder.ReflectionToStringBuilder; import org.sonar.api.rule.RuleKey; import javax.annotation.Nullable; - import java.util.Collection; import java.util.Date; @@ -174,6 +173,7 @@ public class IssueQuery { private static final int DEFAULT_PAGE_SIZE = 100; private static final int MAX_PAGE_SIZE = 1000; private static final int DEFAULT_PAGE_INDEX = 1; + private static final int MAX_ISSUE_KEYS = 1000; private Collection<String> issueKeys; private Collection<String> severities; @@ -286,8 +286,6 @@ public class IssueQuery { } public Builder pageSize(@Nullable Integer i) { - Preconditions.checkArgument(i == null || i > 0, "Page size must be greater than 0 (got " + i + ")"); - Preconditions.checkArgument(i == null || i < MAX_PAGE_SIZE, "Page size must be less than " + MAX_PAGE_SIZE + " (got " + i + ")"); this.pageSize = (i == null ? DEFAULT_PAGE_SIZE : i.intValue()); return this; } @@ -299,6 +297,12 @@ public class IssueQuery { } public IssueQuery build() { + Preconditions.checkArgument(pageSize > 0, "Page size must be greater than 0 (got " + pageSize + ")"); + Preconditions.checkArgument(pageSize < MAX_PAGE_SIZE, "Page size must be less than " + MAX_PAGE_SIZE + " (got " + pageSize + ")"); + if (issueKeys != null) { + Preconditions.checkArgument(issueKeys.size() < MAX_ISSUE_KEYS, "Number of issue keys must be less than " + MAX_ISSUE_KEYS + " (got " + issueKeys.size() + ")"); + } + return new IssueQuery(this); } } |