--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * 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.gwt.unmarshallers;
+
+import com.google.gwt.json.client.JSONObject;
+import org.sonar.gwt.JsonUtils;
+import org.sonar.wsclient.services.Event;
+
+public class EventUnmarshaller extends AbstractUnmarshaller<Event> {
+
+ protected Event parse(JSONObject json) {
+ return new Event()
+ .setId(JsonUtils.getString(json, "id"))
+ .setResourceKey(JsonUtils.getString(json, "rk"))
+ .setName(JsonUtils.getString(json, "n"))
+ .setCategory(JsonUtils.getString(json, "c"))
+ .setDate(JsonUtils.getDate(json, "dt"))
+ .setDescription(JsonUtils.getString(json, "ds"))
+ .setData(JsonUtils.getString(json, "data"));
+ }
+}
JSONArray array = map.get(dateTimeStr).isArray();
List<String> measures = new ArrayList<String>();
for (int i = 0; i < JsonUtils.getArraySize(array); i++) {
- JSONValue elem = JsonUtils.getArray(array, i);
+ // We can't use JsonUtils.getArray here, because it returns JSONObject instead of JSONValue
+ JSONValue elem = array.get(i);
measures.add(JsonUtils.getAsString(elem));
}
data.put(JsonUtils.parseDateTime(dateTimeStr), measures);
unmarshallers.put(Violation.class, new ViolationUnmarshaller());
unmarshallers.put(Server.class, new ServerUnmarshaller());
unmarshallers.put(DependencyTree.class, new DependencyTreeUnmarshaller());
+ unmarshallers.put(Event.class, new EventUnmarshaller());
+ // TODO
+ // FavouriteUnmarshaller
+ // PluginUnmarshaller
+ // RuleUnmarshaller
unmarshallers.put(TimeMachineData.class, new TimeMachineUnmarshaller());
}