aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-07-27 10:59:00 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2011-07-27 12:12:01 +0200
commit58a8a74c05def9176479b2cf951c49f398cb72f8 (patch)
tree336eabec56e974a6668c3547c1ee64c12dca5a66 /sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers
parentea0fb362a7dd6188973c0cb27291720ae71c29ca (diff)
downloadsonarqube-58a8a74c05def9176479b2cf951c49f398cb72f8.tar.gz
sonarqube-58a8a74c05def9176479b2cf951c49f398cb72f8.zip
SONAR-2648 New web service /api/manual_measures
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/ManualMeasureUnmarshaller.java45
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java1
2 files changed, 46 insertions, 0 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ManualMeasureUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ManualMeasureUnmarshaller.java
new file mode 100644
index 00000000000..f3b1a2d7bf8
--- /dev/null
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ManualMeasureUnmarshaller.java
@@ -0,0 +1,45 @@
+/*
+ * 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.ManualMeasure;
+import org.sonar.wsclient.services.WSUtils;
+
+/**
+ * @since 2.10
+ */
+public class ManualMeasureUnmarshaller extends AbstractUnmarshaller<ManualMeasure> {
+
+ @Override
+ protected ManualMeasure parse(Object json) {
+ WSUtils utils = WSUtils.getINSTANCE();
+ return new ManualMeasure()
+ .setId(utils.getLong(json, "id"))
+ .setMetricKey(utils.getString(json, "metric"))
+ .setResourceKey(utils.getString(json, "resource"))
+ .setCreatedAt(utils.getDateTime(json, "created_at"))
+ .setUpdatedAt(utils.getDateTime(json, "updated_at"))
+ .setUserLogin(utils.getString(json, "login"))
+ .setUserName(utils.getString(json, "username"))
+ .setValue(utils.getDouble(json, "val"))
+ .setTextValue(utils.getString(json, "text"))
+ ;
+ }
+}
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java
index 71be7418dcf..5974603e3d4 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java
@@ -48,6 +48,7 @@ public final class Unmarshallers {
unmarshallers.put(TimeMachine.class, new TimeMachineUnmarshaller());
unmarshallers.put(Profile.class, new ProfileUnmarshaller());
unmarshallers.put(Review.class, new ReviewUnmarshaller());
+ unmarshallers.put(ManualMeasure.class, new ManualMeasureUnmarshaller());
}
public static <MODEL extends Model> Unmarshaller<MODEL> forModel(Class<MODEL> modelClass) {