aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2011-04-28 08:50:54 +0200
committerFabrice Bellingard <bellingard@gmail.com>2011-04-28 15:15:49 +0200
commitc3fabd05ae340704746d2b3be87b584bdd0da475 (patch)
treedab8469d0b567c7b34cd8a87498cbf974b173ad5 /sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers
parent50a43f7b9dab293b61fabe742252dca659f2e4ca (diff)
downloadsonarqube-c3fabd05ae340704746d2b3be87b584bdd0da475.tar.gz
sonarqube-c3fabd05ae340704746d2b3be87b584bdd0da475.zip
SONAR-2382 Create a new "reviews" web service API
Diffstat (limited to 'sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers')
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java57
1 files changed, 57 insertions, 0 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java
new file mode 100644
index 00000000000..cdaf3c2bb63
--- /dev/null
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java
@@ -0,0 +1,57 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.wsclient.unmarshallers;
+
+import org.sonar.wsclient.services.Review;
+import org.sonar.wsclient.services.WSUtils;
+
+/**
+ * @since 2.8
+ */
+public class ReviewUnmarshaller extends AbstractUnmarshaller<Review> {
+
+ @Override
+ protected Review parse(Object json) {
+ WSUtils utils = WSUtils.getINSTANCE();
+
+ Review review = new Review();
+ review.setId(utils.getLong(json, "id"));
+ review.setCreatedAt(utils.getDateTime(json, "createdAt"));
+ review.setUpdatedAt(utils.getDateTime(json, "updatedAt"));
+ review.setAuthorLogin(utils.getString(json, "author"));
+ review.setAssigneeLogin(utils.getString(json, "assignee"));
+ review.setTitle(utils.getString(json, "title"));
+ review.setType(utils.getString(json, "type"));
+ review.setStatus(utils.getString(json, "status"));
+ review.setSeverity(utils.getString(json, "severity"));
+ review.setResourceKee(utils.getString(json, "resource"));
+ review.setLine(utils.getInteger(json, "line"));
+
+ Object comments = utils.getField(json, "comments");
+ if (comments != null) {
+ for (int i = 0; i < utils.getArraySize(comments); i++) {
+ Object comment = utils.getArrayElement(comments, i);
+ review.addComments(utils.getDateTime(comment, "updatedAt"), utils.getString(comment, "author"), utils.getString(comment, "text"));
+ }
+ }
+
+ return review;
+ }
+}