aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-07-26 16:11:54 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-07-28 09:14:54 +0200
commitf4a5427ca6a024184e7336a45d4806525aafe687 (patch)
treef803c505fdec29caf62fce7f2769e3e5c8d0a27b /server
parent4b8e398f903d3daa69b35c1e10c0c67a5852c2f0 (diff)
downloadsonarqube-f4a5427ca6a024184e7336a45d4806525aafe687.tar.gz
sonarqube-f4a5427ca6a024184e7336a45d4806525aafe687.zip
SONAR-7917 Drop WS api/dashboards/show
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWs.java44
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWsAction.java28
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/ShowAction.java124
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/package-info.java24
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java3
-rw-r--r--server/sonar-server/src/main/resources/org/sonar/server/dashboard/ws/show-example.json2
6 files changed, 0 insertions, 225 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWs.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWs.java
deleted file mode 100644
index 706d1a913e5..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWs.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.dashboard.ws;
-
-import org.sonar.api.server.ws.WebService;
-
-public class DashboardsWs implements WebService {
-
- private final DashboardsWsAction[] actions;
-
- public DashboardsWs(DashboardsWsAction... actions) {
- this.actions = actions;
- }
-
- @Override
- public void define(Context context) {
- NewController controller = context.createController("api/dashboards");
- controller.setSince("5.0");
- controller.setDescription("Manage dashboards and widgets.");
-
- for (DashboardsWsAction action : actions) {
- action.define(controller);
- }
- controller.done();
- }
-
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWsAction.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWsAction.java
deleted file mode 100644
index 240ea2eef4f..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWsAction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.dashboard.ws;
-
-import org.sonar.server.ws.WsAction;
-
-public interface DashboardsWsAction extends WsAction {
-
- // Marker interface
-
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/ShowAction.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/ShowAction.java
deleted file mode 100644
index 8de586023d0..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/ShowAction.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.dashboard.ws;
-
-import com.google.common.collect.ListMultimap;
-import java.util.Collection;
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.Response;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.api.utils.text.JsonWriter;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
-import org.sonar.db.dashboard.DashboardDto;
-import org.sonar.db.dashboard.WidgetDto;
-import org.sonar.db.dashboard.WidgetPropertyDto;
-import org.sonar.db.user.UserDto;
-import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.server.user.UserSession;
-
-public class ShowAction implements DashboardsWsAction {
-
- private static final String PARAM_KEY = "key";
-
- private final DbClient dbClient;
- private final UserSession userSession;
-
- public ShowAction(DbClient dbClient, UserSession userSession) {
- this.dbClient = dbClient;
- this.userSession = userSession;
- }
-
- @Override
- public void define(WebService.NewController newController) {
- WebService.NewAction action = newController.createAction("show")
- .setDescription("Get details of a dashboard (name, description, layout and widgets).")
- .setInternal(true)
- .setSince("5.0")
- .setResponseExample(getClass().getResource("show-example.json"))
- .setHandler(this);
- action.createParam(PARAM_KEY)
- .setDescription("Dashboard key")
- .setExampleValue("12345")
- .setRequired(true);
- }
-
- @Override
- public void handle(Request request, Response response) throws Exception {
- DbSession dbSession = dbClient.openSession(false);
- try {
- Integer userId = userSession.getUserId();
- DashboardDto dashboard = dbClient.dashboardDao().selectAllowedByKey(dbSession, request.mandatoryParamAsLong(PARAM_KEY),
- userId != null ? userId.longValue() : null);
- if (dashboard == null) {
- throw new NotFoundException();
- }
-
- JsonWriter json = response.newJsonWriter();
- json.beginObject();
- json.prop("key", dashboard.getKey());
- json.prop("name", dashboard.getName());
- json.prop("layout", dashboard.getColumnLayout());
- json.prop("desc", dashboard.getDescription());
- json.prop("global", dashboard.getGlobal());
- json.prop("shared", dashboard.getShared());
- if (dashboard.getUserId() != null) {
- UserDto user = dbClient.userDao().selectUserById(dashboard.getUserId());
- if (user != null) {
- json.name("owner").beginObject();
- // TODO to be shared and extracted from here
- json.prop("login", user.getLogin());
- json.prop("name", user.getName());
- json.endObject();
- }
- }
- // load widgets and related properties
- json.name("widgets").beginArray();
- Collection<WidgetDto> widgets = dbClient.widgetDao().findByDashboard(dbSession, dashboard.getKey());
- ListMultimap<Long, WidgetPropertyDto> propertiesByWidget = WidgetPropertyDto.groupByWidgetId(
- dbClient.widgetPropertyDao().selectByDashboard(dbSession, dashboard.getKey()));
- for (WidgetDto widget : widgets) {
- json.beginObject();
- json.prop("id", widget.getId());
- json.prop("key", widget.getWidgetKey());
- json.prop("name", widget.getName());
- json.prop("desc", widget.getDescription());
- json.prop("col", widget.getColumnIndex());
- json.prop("row", widget.getRowIndex());
- json.prop("configured", widget.getConfigured());
- json.prop("componentId", widget.getResourceId());
- json.name("props").beginArray();
- for (WidgetPropertyDto prop : propertiesByWidget.get(widget.getId())) {
- json.beginObject();
- json.prop("key", prop.getPropertyKey());
- json.prop("val", prop.getTextValue());
- json.endObject();
- }
- json.endArray().endObject();
- }
-
- json.endArray();
- json.endObject();
- json.close();
- } finally {
- dbSession.close();
- }
- }
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/package-info.java
deleted file mode 100644
index c47aaf0955c..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.server.dashboard.ws;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
index 75620ab5bfb..fd273db83d6 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
@@ -79,7 +79,6 @@ import org.sonar.server.dashboard.widget.TimeMachineWidget;
import org.sonar.server.dashboard.widget.TimelineWidget;
import org.sonar.server.dashboard.widget.TreemapWidget;
import org.sonar.server.dashboard.widget.WelcomeWidget;
-import org.sonar.server.dashboard.ws.DashboardsWs;
import org.sonar.server.debt.DebtModelBackup;
import org.sonar.server.debt.DebtModelPluginRepository;
import org.sonar.server.debt.DebtModelService;
@@ -328,8 +327,6 @@ public class PlatformLevel4 extends PlatformLevel {
BatchWsModule.class,
// Dashboard
- DashboardsWs.class,
- org.sonar.server.dashboard.ws.ShowAction.class,
GlobalDefaultDashboard.class,
AlertsWidget.class,
CoverageWidget.class,
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/ws/show-example.json b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/ws/show-example.json
deleted file mode 100644
index 2c63c085104..00000000000
--- a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/ws/show-example.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-}