aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client/src/main/java/org/sonar
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-05-30 13:27:22 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-05-30 13:27:22 +0200
commita49b0c598c69d3b4b095f5b583368db4b6708282 (patch)
tree0839df2b1e7ddb411bb93dedf001fbb50a771c5c /sonar-ws-client/src/main/java/org/sonar
parent6c5dbb1cd3d9cc8775bd057bcac106a32a326332 (diff)
downloadsonarqube-a49b0c598c69d3b4b095f5b583368db4b6708282.tar.gz
sonarqube-a49b0c598c69d3b4b095f5b583368db4b6708282.zip
SONAR-3755 Add actionPlans in Issues Client WS
Diffstat (limited to 'sonar-ws-client/src/main/java/org/sonar')
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java5
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueJsonParser.java10
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issues.java15
3 files changed, 30 insertions, 0 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java
index ff9bad62e2c..7e8ca71744e 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java
@@ -99,6 +99,11 @@ public class Issue {
return JsonUtils.getString(json, "assignee");
}
+ @CheckForNull
+ public String actionPlan() {
+ return JsonUtils.getString(json, "actionPlan");
+ }
+
public Date creationDate() {
return JsonUtils.getDateTime(json, "creationDate");
}
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueJsonParser.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueJsonParser.java
index fc1b1fb6ccc..635a624758b 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueJsonParser.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueJsonParser.java
@@ -47,6 +47,7 @@ class IssueJsonParser {
parseUsers(result, jsonRoot);
parseComponents(result, jsonRoot);
parseProjects(result, jsonRoot);
+ parseActionPlans(result, jsonRoot);
parsePaging(result, jsonRoot);
return result;
}
@@ -93,6 +94,15 @@ class IssueJsonParser {
}
}
+ private void parseActionPlans(Issues result, Map jsonRoot) {
+ List<Map> jsonRules = (List) jsonRoot.get("actionPlans");
+ if (jsonRules != null) {
+ for (Map jsonRule : jsonRules) {
+ result.add(new ActionPlan(jsonRule));
+ }
+ }
+ }
+
List<String> parseTransitions(String json) {
List<String> transitions = new ArrayList<String>();
Map jRoot = (Map) JSONValue.parse(json);
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issues.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issues.java
index 9dcd5926c94..ff761f26cdf 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issues.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issues.java
@@ -37,6 +37,7 @@ public class Issues {
private final Map<String, User> usersByKey = new HashMap<String, User>();
private final Map<String, Component> componentsByKey = new HashMap<String, Component>();
private final Map<String, Component> projectsByKey = new HashMap<String, Component>();
+ private final Map<String, ActionPlan> actionPlansByKey = new HashMap<String, ActionPlan>();
private Paging paging;
private Boolean maxResultsReached;
@@ -83,6 +84,15 @@ public class Issues {
return projectsByKey.get(issue.projectKey());
}
+ public Collection<ActionPlan> actionPlans() {
+ return actionPlansByKey.values();
+ }
+
+ @CheckForNull
+ public ActionPlan actionPlans(Issue issue) {
+ return actionPlansByKey.get(issue.actionPlan());
+ }
+
public Paging paging() {
return paging;
}
@@ -106,6 +116,11 @@ public class Issues {
return this;
}
+ Issues add(ActionPlan actionPlan) {
+ actionPlansByKey.put(actionPlan.key(), actionPlan);
+ return this;
+ }
+
Issues addComponent(Component c) {
componentsByKey.put(c.key(), c);
return this;