diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-11-07 15:54:16 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-11-09 16:47:34 +0100 |
commit | 6d53f242b31429e30df708d258e7fe78a1079062 (patch) | |
tree | a5dc196a1d9aa853626314a13135a45b9ccbbbd0 /sonar-db/src/main | |
parent | b11c4820efc403a3902d47964b17a7a1da0b3960 (diff) | |
download | sonarqube-6d53f242b31429e30df708d258e7fe78a1079062.tar.gz sonarqube-6d53f242b31429e30df708d258e7fe78a1079062.zip |
SONAR-8354 Remove dao related to dashboards
Diffstat (limited to 'sonar-db/src/main')
23 files changed, 2 insertions, 1248 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/DaoModule.java b/sonar-db/src/main/java/org/sonar/db/DaoModule.java index 7a11ad95208..17fb1ec6268 100644 --- a/sonar-db/src/main/java/org/sonar/db/DaoModule.java +++ b/sonar-db/src/main/java/org/sonar/db/DaoModule.java @@ -32,10 +32,6 @@ import org.sonar.db.component.ComponentLinkDao; import org.sonar.db.component.ResourceDao; import org.sonar.db.component.ResourceIndexDao; import org.sonar.db.component.SnapshotDao; -import org.sonar.db.dashboard.ActiveDashboardDao; -import org.sonar.db.dashboard.DashboardDao; -import org.sonar.db.dashboard.WidgetDao; -import org.sonar.db.dashboard.WidgetPropertyDao; import org.sonar.db.duplication.DuplicationDao; import org.sonar.db.event.EventDao; import org.sonar.db.issue.IssueChangeDao; @@ -77,7 +73,6 @@ import org.sonar.db.user.UserTokenDao; public class DaoModule extends Module { private static final List<Class<? extends Dao>> classes = ImmutableList.<Class<? extends Dao>>builder().add( - ActiveDashboardDao.class, AuthorDao.class, AuthorizationDao.class, CeActivityDao.class, @@ -86,7 +81,6 @@ public class DaoModule extends Module { ComponentDao.class, ComponentLinkDao.class, CustomMeasureDao.class, - DashboardDao.class, DuplicationDao.class, EventDao.class, FileSourceDao.class, @@ -126,9 +120,7 @@ public class DaoModule extends Module { UserDao.class, UserGroupDao.class, UserPermissionDao.class, - UserTokenDao.class, - WidgetDao.class, - WidgetPropertyDao.class).build(); + UserTokenDao.class).build(); @Override protected void configureModule() { diff --git a/sonar-db/src/main/java/org/sonar/db/DbClient.java b/sonar-db/src/main/java/org/sonar/db/DbClient.java index 16eaa687271..a4aebb92ea1 100644 --- a/sonar-db/src/main/java/org/sonar/db/DbClient.java +++ b/sonar-db/src/main/java/org/sonar/db/DbClient.java @@ -32,10 +32,6 @@ import org.sonar.db.component.ComponentLinkDao; import org.sonar.db.component.ResourceDao; import org.sonar.db.component.ResourceIndexDao; import org.sonar.db.component.SnapshotDao; -import org.sonar.db.dashboard.ActiveDashboardDao; -import org.sonar.db.dashboard.DashboardDao; -import org.sonar.db.dashboard.WidgetDao; -import org.sonar.db.dashboard.WidgetPropertyDao; import org.sonar.db.duplication.DuplicationDao; import org.sonar.db.event.EventDao; import org.sonar.db.issue.IssueChangeDao; @@ -108,10 +104,6 @@ public class DbClient { private final CeQueueDao ceQueueDao; private final CeTaskInputDao ceTaskInputDao; private final CeScannerContextDao ceScannerContextDao; - private final DashboardDao dashboardDao; - private final ActiveDashboardDao activeDashboardDao; - private final WidgetDao widgetDao; - private final WidgetPropertyDao widgetPropertyDao; private final FileSourceDao fileSourceDao; private final AuthorDao authorDao; private final ResourceIndexDao componentIndexDao; @@ -169,10 +161,6 @@ public class DbClient { ceQueueDao = getDao(map, CeQueueDao.class); ceTaskInputDao = getDao(map, CeTaskInputDao.class); ceScannerContextDao = getDao(map, CeScannerContextDao.class); - dashboardDao = getDao(map, DashboardDao.class); - activeDashboardDao = getDao(map, ActiveDashboardDao.class); - widgetDao = getDao(map, WidgetDao.class); - widgetPropertyDao = getDao(map, WidgetPropertyDao.class); fileSourceDao = getDao(map, FileSourceDao.class); authorDao = getDao(map, AuthorDao.class); componentIndexDao = getDao(map, ResourceIndexDao.class); @@ -322,22 +310,6 @@ public class DbClient { return ceScannerContextDao; } - public DashboardDao dashboardDao() { - return dashboardDao; - } - - public ActiveDashboardDao activeDashboardDao() { - return activeDashboardDao; - } - - public WidgetDao widgetDao() { - return widgetDao; - } - - public WidgetPropertyDao widgetPropertyDao() { - return widgetPropertyDao; - } - public FileSourceDao fileSourceDao() { return fileSourceDao; } diff --git a/sonar-db/src/main/java/org/sonar/db/MyBatis.java b/sonar-db/src/main/java/org/sonar/db/MyBatis.java index cd885f5c3c1..ba299882dda 100644 --- a/sonar-db/src/main/java/org/sonar/db/MyBatis.java +++ b/sonar-db/src/main/java/org/sonar/db/MyBatis.java @@ -48,14 +48,6 @@ import org.sonar.db.component.SnapshotDto; import org.sonar.db.component.SnapshotMapper; import org.sonar.db.component.UuidWithProjectUuidDto; import org.sonar.db.component.ViewsSnapshotDto; -import org.sonar.db.dashboard.ActiveDashboardDto; -import org.sonar.db.dashboard.ActiveDashboardMapper; -import org.sonar.db.dashboard.DashboardDto; -import org.sonar.db.dashboard.DashboardMapper; -import org.sonar.db.dashboard.WidgetDto; -import org.sonar.db.dashboard.WidgetMapper; -import org.sonar.db.dashboard.WidgetPropertyDto; -import org.sonar.db.dashboard.WidgetPropertyMapper; import org.sonar.db.debt.RequirementMigrationDto; import org.sonar.db.duplication.DuplicationMapper; import org.sonar.db.duplication.DuplicationUnitDto; @@ -166,7 +158,6 @@ public class MyBatis { MyBatisConfBuilder confBuilder = new MyBatisConfBuilder(database); // DTO aliases, keep them sorted alphabetically - confBuilder.loadAlias("ActiveDashboard", ActiveDashboardDto.class); confBuilder.loadAlias("ActiveRule", ActiveRuleDto.class); confBuilder.loadAlias("ActiveRuleParam", ActiveRuleParamDto.class); confBuilder.loadAlias("Author", AuthorDto.class); @@ -174,7 +165,6 @@ public class MyBatis { confBuilder.loadAlias("ComponentLink", ComponentLinkDto.class); confBuilder.loadAlias("ComponentWithSnapshot", ComponentDtoWithSnapshotId.class); confBuilder.loadAlias("CustomMeasure", CustomMeasureDto.class); - confBuilder.loadAlias("Dashboard", DashboardDto.class); confBuilder.loadAlias("DuplicationUnit", DuplicationUnitDto.class); confBuilder.loadAlias("Event", EventDto.class); confBuilder.loadAlias("FilePathWithHash", FilePathWithHashDto.class); @@ -217,15 +207,12 @@ public class MyBatis { confBuilder.loadAlias("User", UserDto.class); confBuilder.loadAlias("UuidWithProjectUuid", UuidWithProjectUuidDto.class); confBuilder.loadAlias("ViewsSnapshot", ViewsSnapshotDto.class); - confBuilder.loadAlias("WidgetProperty", WidgetPropertyDto.class); - confBuilder.loadAlias("Widget", WidgetDto.class); // ResourceMapper has to be loaded before IssueMapper because this last one used it confBuilder.loadMapper(ResourceMapper.class); // keep them sorted alphabetically Class<?>[] mappers = { - ActiveDashboardMapper.class, ActiveRuleMapper.class, AuthorMapper.class, AuthorizationMapper.class, @@ -237,7 +224,6 @@ public class MyBatis { ComponentLinkMapper.class, ComponentMapper.class, CustomMeasureMapper.class, - DashboardMapper.class, DuplicationMapper.class, EventMapper.class, FileSourceMapper.class, @@ -278,9 +264,7 @@ public class MyBatis { UserGroupMapper.class, UserMapper.class, UserPermissionMapper.class, - UserTokenMapper.class, - WidgetMapper.class, - WidgetPropertyMapper.class + UserTokenMapper.class }; confBuilder.loadMappers(mappers); diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDao.java b/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDao.java deleted file mode 100644 index ab72f8f98b3..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDao.java +++ /dev/null @@ -1,94 +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.db.dashboard; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.apache.ibatis.session.SqlSession; -import org.sonar.db.Dao; -import org.sonar.db.DbSession; -import org.sonar.db.MyBatis; - -public class ActiveDashboardDao implements Dao { - - private MyBatis mybatis; - - public ActiveDashboardDao(MyBatis mybatis) { - this.mybatis = mybatis; - } - - public void insert(DbSession session, ActiveDashboardDto activeDashboardDto) { - mapper(session).insert(activeDashboardDto); - session.commit(); - } - - public void insert(ActiveDashboardDto activeDashboardDto) { - DbSession session = mybatis.openSession(false); - try { - insert(session, activeDashboardDto); - session.commit(); - } finally { - MyBatis.closeQuietly(session); - } - } - - @CheckForNull - public ActiveDashboardDto selectById(DbSession session, long id){ - return mapper(session).selectById(id); - } - - public int selectMaxOrderIndexForNullUser() { - SqlSession session = mybatis.openSession(false); - try { - Integer max = mapper(session).selectMaxOrderIndexForNullUser(); - return max != null ? max.intValue() : 0; - } finally { - session.close(); - } - - } - - public List<DashboardDto> selectGlobalDashboardsForUserLogin(@Nullable String login) { - SqlSession session = mybatis.openSession(false); - try { - return mapper(session).selectGlobalDashboardsForUserLogin(login); - } finally { - session.close(); - } - } - - public List<DashboardDto> selectProjectDashboardsForUserLogin(@Nullable String login) { - SqlSession session = mybatis.openSession(false); - try { - return selectProjectDashboardsForUserLogin(session, login); - } finally { - session.close(); - } - } - - public List<DashboardDto> selectProjectDashboardsForUserLogin(SqlSession session, @Nullable String login) { - return mapper(session).selectProjectDashboardsForUserLogin(login); - } - - private static ActiveDashboardMapper mapper(SqlSession session) { - return session.getMapper(ActiveDashboardMapper.class); - } -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDto.java b/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDto.java deleted file mode 100644 index 6db7d489c61..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDto.java +++ /dev/null @@ -1,106 +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.db.dashboard; - -import java.util.Objects; - -public final class ActiveDashboardDto { - private Long id; - private Long dashboardId; - private Long userId; - private Integer orderIndex; - - /** - * @return the id - */ - public Long getId() { - return id; - } - - /** - * @param id the id to set - */ - public ActiveDashboardDto setId(Long id) { - this.id = id; - return this; - } - - /** - * @return the dashboardId - */ - public Long getDashboardId() { - return dashboardId; - } - - /** - * @param dashboardId the dashboardId to set - */ - public ActiveDashboardDto setDashboardId(Long dashboardId) { - this.dashboardId = dashboardId; - return this; - } - - /** - * @return the userId - */ - public Long getUserId() { - return userId; - } - - /** - * @param userId the userId to set - */ - public ActiveDashboardDto setUserId(Long userId) { - this.userId = userId; - return this; - } - - /** - * @return the orderIndex - */ - public Integer getOrderIndex() { - return orderIndex; - } - - /** - * @param orderIndex the orderIndex to set - */ - public ActiveDashboardDto setOrderIndex(Integer orderIndex) { - this.orderIndex = orderIndex; - return this; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ActiveDashboardDto that = (ActiveDashboardDto) o; - return !(id != null ? !id.equals(that.id) : that.id != null); - } - - @Override - public int hashCode() { - return Objects.hashCode(id); - } -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardMapper.java b/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardMapper.java deleted file mode 100644 index d0f3d834ff5..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardMapper.java +++ /dev/null @@ -1,39 +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.db.dashboard; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.apache.ibatis.annotations.Param; - -public interface ActiveDashboardMapper { - - void insert(ActiveDashboardDto activeDashboardDto); - - ActiveDashboardDto selectById(long id); - - @CheckForNull - Integer selectMaxOrderIndexForNullUser(); - - List<DashboardDto> selectGlobalDashboardsForUserLogin(@Nullable @Param("login") String login); - - List<DashboardDto> selectProjectDashboardsForUserLogin(@Nullable @Param("login") String login); -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java b/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java deleted file mode 100644 index 8e2a90ff2ce..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java +++ /dev/null @@ -1,89 +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.db.dashboard; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.apache.ibatis.session.SqlSession; -import org.sonar.db.Dao; -import org.sonar.db.DbSession; -import org.sonar.db.MyBatis; - -public class DashboardDao implements Dao { - - private MyBatis mybatis; - - public DashboardDao(MyBatis mybatis) { - this.mybatis = mybatis; - } - - public DashboardDto selectGlobalDashboard(String name) { - SqlSession session = mybatis.openSession(false); - try { - DashboardMapper mapper = session.getMapper(DashboardMapper.class); - return mapper.selectGlobalDashboard(name); - } finally { - MyBatis.closeQuietly(session); - } - } - - public void insert(DbSession session, DashboardDto dashboardDto) { - DashboardMapper dashboardMapper = session.getMapper(DashboardMapper.class); - WidgetMapper widgetMapper = session.getMapper(WidgetMapper.class); - WidgetPropertyMapper widgetPropertyMapper = session.getMapper(WidgetPropertyMapper.class); - dashboardMapper.insert(dashboardDto); - for (WidgetDto widgetDto : dashboardDto.getWidgets()) { - widgetDto.setDashboardId(dashboardDto.getId()); - widgetMapper.insert(widgetDto); - for (WidgetPropertyDto widgetPropertyDto : widgetDto.getWidgetProperties()) { - widgetPropertyDto.setWidgetId(widgetDto.getId()); - widgetPropertyMapper.insert(widgetPropertyDto); - } - } - } - - public void insert(DashboardDto dashboardDto) { - DbSession session = mybatis.openSession(false); - try { - insert(session, dashboardDto); - session.commit(); - } finally { - MyBatis.closeQuietly(session); - } - } - - @CheckForNull - public DashboardDto selectById(DbSession session, long id) { - return mapper(session).selectById(id); - } - - /** - * Get dashboard if allowed : shared or owned by logged-in user - * @param userId id of logged-in user, null if anonymous - */ - @CheckForNull - public DashboardDto selectAllowedByKey(DbSession session, Long key, @Nullable Long userId) { - return mapper(session).selectAllowedById(key, userId != null ? userId : -1L); - } - - private static DashboardMapper mapper(DbSession session) { - return session.getMapper(DashboardMapper.class); - } -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDto.java b/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDto.java deleted file mode 100644 index a70ad3f6b6c..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDto.java +++ /dev/null @@ -1,105 +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.db.dashboard; - -import com.google.common.collect.Lists; -import java.util.Collection; -import java.util.List; -import org.sonar.db.Dto; - -public final class DashboardDto extends Dto<Long> { - - private Long id; - private Long userId; - private String name; - private String description; - private String columnLayout; - private boolean shared; - private List<WidgetDto> widgetDtos = Lists.newArrayList(); - - public Long getId() { - return id; - } - - @Override - public Long getKey() { - return id; - } - - public DashboardDto setId(Long id) { - this.id = id; - return this; - } - - public Long getUserId() { - return userId; - } - - public DashboardDto setUserId(Long userId) { - this.userId = userId; - return this; - } - - public String getName() { - return name; - } - - public DashboardDto setName(String name) { - this.name = name; - return this; - } - - public String getDescription() { - return description; - } - - public DashboardDto setDescription(String description) { - this.description = description; - return this; - } - - public String getColumnLayout() { - return columnLayout; - } - - public DashboardDto setColumnLayout(String columnLayout) { - this.columnLayout = columnLayout; - return this; - } - - public boolean getShared() { - return shared; - } - - public DashboardDto setShared(boolean shared) { - this.shared = shared; - return this; - } - - public Collection<WidgetDto> getWidgets() { - return widgetDtos; - } - - public DashboardDto addWidget(WidgetDto widgetDto) { - widgetDtos.add(widgetDto); - return this; - } - -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardMapper.java b/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardMapper.java deleted file mode 100644 index 720ceb5b770..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardMapper.java +++ /dev/null @@ -1,49 +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.db.dashboard; - -import javax.annotation.CheckForNull; -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Options; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; - -public interface DashboardMapper { - - String COLUMNS = "id, user_id as \"userId\", name, description, column_layout as \"columnLayout\", " + - "shared, created_at as \"createdAt\", updated_at as \"updatedAt\""; - - @CheckForNull - @Select("select " + COLUMNS + " from dashboards where id=#{id}") - DashboardDto selectById(long id); - - @CheckForNull - @Select("select " + COLUMNS + " from dashboards where id=#{id} and (shared=${_true} or user_id=${userId})") - DashboardDto selectAllowedById(@Param("id") long id, @Param("userId") long userId); - - @CheckForNull - @Select("select " + COLUMNS + " from dashboards WHERE name=#{id} and user_id is null") - DashboardDto selectGlobalDashboard(String name); - - @Insert("INSERT INTO dashboards (user_id, name, description, column_layout, shared, created_at, updated_at) " + - "VALUES (#{userId}, #{name}, #{description}, #{columnLayout}, #{shared}, #{createdAt}, #{updatedAt})") - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void insert(DashboardDto dashboardDto); -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDao.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDao.java deleted file mode 100644 index 0b39fccf929..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDao.java +++ /dev/null @@ -1,74 +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.db.dashboard; - -import java.util.Collection; -import org.sonar.db.Dao; -import org.sonar.db.DbSession; -import org.sonar.db.MyBatis; - -public class WidgetDao implements Dao { - - private MyBatis myBatis; - - public WidgetDao(MyBatis myBatis) { - this.myBatis = myBatis; - } - - public WidgetDto selectByKey(Long widgetId) { - DbSession session = myBatis.openSession(false); - try { - return selectByKey(session, widgetId); - } finally { - MyBatis.closeQuietly(session); - } - } - - public WidgetDto selectByKey(DbSession session, Long widgetId) { - return mapper(session).selectById(widgetId); - } - - public WidgetDto update(WidgetDto item) { - DbSession session = myBatis.openSession(false); - try { - return update(session, item); - } finally { - MyBatis.closeQuietly(session); - } - } - - public WidgetDto update(DbSession session, WidgetDto item) { - mapper(session).update(item); - return item; - } - - public Collection<WidgetDto> findByDashboard(DbSession session, long dashboardKey) { - return mapper(session).selectByDashboard(dashboardKey); - } - - public Collection<WidgetDto> findAll(DbSession session) { - return mapper(session).selectAll(); - } - - private static WidgetMapper mapper(DbSession session) { - return session.getMapper(WidgetMapper.class); - } - -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDto.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDto.java deleted file mode 100644 index d44d5dc678c..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDto.java +++ /dev/null @@ -1,205 +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.db.dashboard; - -import com.google.common.collect.Lists; -import java.util.Collection; -import java.util.Date; -import java.util.List; - -public class WidgetDto { - private Long id; - private Long dashboardId; - private String widgetKey; - private String name; - private String description; - private Integer columnIndex; - private Integer rowIndex; - private boolean configured; - private Integer resourceId; - private Date createdAt; - private Date updatedAt; - private List<WidgetPropertyDto> widgetPropertyDtos = Lists.newArrayList(); - - /** - * @return the id - */ - public Long getId() { - return id; - } - - /** - * @param id the id to set - */ - public WidgetDto setId(Long id) { - this.id = id; - return this; - } - - /** - * @return the dashboardId - */ - public Long getDashboardId() { - return dashboardId; - } - - /** - * @param dashboardId the dashboardId to set - */ - public WidgetDto setDashboardId(Long dashboardId) { - this.dashboardId = dashboardId; - return this; - } - - public String getWidgetKey() { - return widgetKey; - } - - public WidgetDto setWidgetKey(String s) { - this.widgetKey = s; - return this; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public WidgetDto setName(String name) { - this.name = name; - return this; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public WidgetDto setDescription(String description) { - this.description = description; - return this; - } - - /** - * @return the columnIndex - */ - public Integer getColumnIndex() { - return columnIndex; - } - - /** - * @param columnIndex the columnIndex to set - */ - public WidgetDto setColumnIndex(Integer columnIndex) { - this.columnIndex = columnIndex; - return this; - } - - /** - * @return the rowIndex - */ - public Integer getRowIndex() { - return rowIndex; - } - - /** - * @param rowIndex the rowIndex to set - */ - public WidgetDto setRowIndex(Integer rowIndex) { - this.rowIndex = rowIndex; - return this; - } - - /** - * @return the configured - */ - public boolean getConfigured() { - return configured; - } - - /** - * @param configured the configured to set - */ - public WidgetDto setConfigured(boolean configured) { - this.configured = configured; - return this; - } - - /** - * @return the widgetProperties - */ - public Collection<WidgetPropertyDto> getWidgetProperties() { - return widgetPropertyDtos; - } - - /** - * @param widgetPropertyDto the widgetProperty to set - */ - public WidgetDto addWidgetProperty(WidgetPropertyDto widgetPropertyDto) { - widgetPropertyDtos.add(widgetPropertyDto); - return this; - } - - /** - * @return the resourceId - * @since 3.1 - */ - public Integer getResourceId() { - return resourceId; - } - - /** - * @param resourceId the resourceId to set - * @since 3.1 - */ - public WidgetDto setResourceId(Integer resourceId) { - this.resourceId = resourceId; - return this; - } - - public WidgetDto setCreatedAt(Date datetime) { - this.createdAt = datetime; - return this; - } - - public WidgetDto setUpdatedAt(Date datetime) { - this.updatedAt = datetime; - return this; - } - - public final Date getCreatedAt() { - return this.createdAt; - } - - public final Date getUpdatedAt() { - return this.updatedAt; - } - -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetMapper.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetMapper.java deleted file mode 100644 index a169f5d8028..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetMapper.java +++ /dev/null @@ -1,57 +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.db.dashboard; - -import java.util.Collection; -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Options; -import org.apache.ibatis.annotations.Update; - -public interface WidgetMapper { - - @Insert("insert into widgets (dashboard_id, widget_key, name, description, column_index, " + - " row_index, configured, created_at, updated_at, resource_id)" + - " values (#{dashboardId,jdbcType=INTEGER}, #{widgetKey,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, " + - " #{description,jdbcType=VARCHAR}, #{columnIndex,jdbcType=INTEGER}, " + - " #{rowIndex,jdbcType=INTEGER}, #{configured,jdbcType=BOOLEAN}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{resourceId,jdbcType=INTEGER})") - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void insert(WidgetDto widgetDto); - - WidgetDto selectById(long widgetId); - - Collection<WidgetDto> selectByDashboard(long dashboardKey); - - Collection<WidgetDto> selectAll(); - - @Update("UPDATE widgets SET " + - "dashboard_id=#{dashboardId,jdbcType=INTEGER}, " + - "widget_key=#{widgetKey,jdbcType=VARCHAR}, " + - "name=#{name,jdbcType=VARCHAR}, " + - "description=#{description,jdbcType=VARCHAR}, " + - "column_index=#{columnIndex,jdbcType=INTEGER}, " + - "row_index=#{rowIndex,jdbcType=INTEGER}, " + - "configured=#{configured,jdbcType=BOOLEAN}, " + - "created_at=#{createdAt,jdbcType=TIMESTAMP}, " + - "updated_at=#{updatedAt,jdbcType=TIMESTAMP}, " + - "resource_id=#{resourceId,jdbcType=INTEGER} " + - "WHERE id=#{id}") - @Options(useGeneratedKeys = false) - void update(WidgetDto item); -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDao.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDao.java deleted file mode 100644 index 7f1a66c54e3..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDao.java +++ /dev/null @@ -1,88 +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.db.dashboard; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import org.sonar.db.Dao; -import org.sonar.db.DbSession; -import org.sonar.db.MyBatis; - -import static org.sonar.db.DatabaseUtils.executeLargeInputs; - -public class WidgetPropertyDao implements Dao { - - private final MyBatis myBatis; - - public WidgetPropertyDao(MyBatis myBatis) { - this.myBatis = myBatis; - } - - public WidgetPropertyDto insert(WidgetPropertyDto item) { - DbSession session = myBatis.openSession(false); - try { - return insert(session, item); - } finally { - MyBatis.closeQuietly(session); - } - } - - public WidgetPropertyDto insert(DbSession session, WidgetPropertyDto item) { - mapper(session).insert(item); - return item; - } - - public void insert(DbSession session, Collection<WidgetPropertyDto> items) { - for (WidgetPropertyDto item : items) { - insert(session, item); - } - } - - public WidgetPropertyDto selectByKey(Long propertyId) { - DbSession session = myBatis.openSession(false); - try { - return selectByKey(session, propertyId); - } finally { - MyBatis.closeQuietly(session); - } - } - - public WidgetPropertyDto selectByKey(DbSession session, Long propertyId) { - return mapper(session).selectById(propertyId); - } - - public Collection<WidgetPropertyDto> selectByDashboard(DbSession session, long dashboardKey) { - return mapper(session).selectByDashboard(dashboardKey); - } - - public void deleteByWidgetIds(DbSession session, List<Long> widgetIdsWithPropertiesToDelete) { - executeLargeInputs( - widgetIdsWithPropertiesToDelete, - input -> { - mapper(session).deleteByWidgetIds(input); - return Collections.emptyList(); - }); - } - - private static WidgetPropertyMapper mapper(DbSession session) { - return session.getMapper(WidgetPropertyMapper.class); - } -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDto.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDto.java deleted file mode 100644 index 55f975a8833..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDto.java +++ /dev/null @@ -1,75 +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.db.dashboard; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ListMultimap; -import java.util.Collection; - -public class WidgetPropertyDto { - private Long id; - private Long widgetId; - private String propertyKey; - private String textValue; - - public Long getId() { - return id; - } - - public WidgetPropertyDto setId(Long id) { - this.id = id; - return this; - } - - public Long getWidgetId() { - return widgetId; - } - - public WidgetPropertyDto setWidgetId(Long widgetId) { - this.widgetId = widgetId; - return this; - } - - public String getPropertyKey() { - return propertyKey; - } - - public WidgetPropertyDto setPropertyKey(String s) { - this.propertyKey = s; - return this; - } - - public String getTextValue() { - return textValue; - } - - public WidgetPropertyDto setTextValue(String s) { - this.textValue = s; - return this; - } - - public static ListMultimap<Long, WidgetPropertyDto> groupByWidgetId(Collection<WidgetPropertyDto> properties) { - ListMultimap<Long, WidgetPropertyDto> group = ArrayListMultimap.create(); - for (WidgetPropertyDto property : properties) { - group.put(property.getWidgetId(), property); - } - return group; - } -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyMapper.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyMapper.java deleted file mode 100644 index 8c962eced8e..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyMapper.java +++ /dev/null @@ -1,46 +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.db.dashboard; - -import java.util.Collection; -import java.util.List; -import javax.annotation.CheckForNull; -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Options; -import org.apache.ibatis.annotations.Select; - -public interface WidgetPropertyMapper { - - String COLUMNS = "wp.id, wp.widget_id as \"widgetId\", wp.kee as \"propertyKey\", wp.text_value as \"textValue\""; - - @Insert("insert into widget_properties (widget_id, kee, text_value) values (#{widgetId}, #{propertyKey}, #{textValue})") - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void insert(WidgetPropertyDto dto); - - @CheckForNull - @Select("select " + COLUMNS + " from widget_properties wp where wp.id=#{id}") - WidgetPropertyDto selectById(long propertyId); - - @Select("select " + COLUMNS + " from widget_properties wp " + - "inner join widgets w on w.id=wp.widget_id where w.dashboard_id=#{id}") - Collection<WidgetPropertyDto> selectByDashboard(long dashboardKey); - - void deleteByWidgetIds(List<Long> widgetIds); -} diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/package-info.java b/sonar-db/src/main/java/org/sonar/db/dashboard/package-info.java deleted file mode 100644 index 10b4706f3bc..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/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.db.dashboard; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-db/src/main/java/org/sonar/db/user/UserDao.java b/sonar-db/src/main/java/org/sonar/db/user/UserDao.java index b75b14d7ce9..74bd4355b9f 100644 --- a/sonar-db/src/main/java/org/sonar/db/user/UserDao.java +++ b/sonar-db/src/main/java/org/sonar/db/user/UserDao.java @@ -157,8 +157,6 @@ public class UserDao implements Dao { } mapper.removeUserFromGroups(dto.getId()); - mapper.deleteUserActiveDashboards(dto.getId()); - mapper.deleteUnsharedUserDashboards(dto.getId()); mapper.deleteUnsharedUserIssueFilters(dto.getLogin()); mapper.deleteUserIssueFilterFavourites(dto.getLogin()); mapper.deleteUnsharedUserMeasureFilters(dto.getId()); diff --git a/sonar-db/src/main/java/org/sonar/db/user/UserMapper.java b/sonar-db/src/main/java/org/sonar/db/user/UserMapper.java index 9088a71b618..8795c1e4c7e 100644 --- a/sonar-db/src/main/java/org/sonar/db/user/UserMapper.java +++ b/sonar-db/src/main/java/org/sonar/db/user/UserMapper.java @@ -66,10 +66,6 @@ public interface UserMapper { void removeUserFromGroups(long userId); - void deleteUserActiveDashboards(long userId); - - void deleteUnsharedUserDashboards(long userId); - void deleteUnsharedUserIssueFilters(String login); void deleteUserIssueFilterFavourites(String login); diff --git a/sonar-db/src/main/resources/org/sonar/db/dashboard/ActiveDashboardMapper.xml b/sonar-db/src/main/resources/org/sonar/db/dashboard/ActiveDashboardMapper.xml deleted file mode 100644 index 9349e3c8bdb..00000000000 --- a/sonar-db/src/main/resources/org/sonar/db/dashboard/ActiveDashboardMapper.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - -<mapper namespace="org.sonar.db.dashboard.ActiveDashboardMapper"> - - <sql id="activeDashboardColumns"> - ad.id, - ad.user_id as "userId", - ad.dashboard_id as "dashboardId", - ad.order_index as "orderIndex" - </sql> - - <insert id="insert" parameterType="ActiveDashboard" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> - INSERT INTO active_dashboards (dashboard_id, user_id, order_index) - VALUES (#{dashboardId}, #{userId}, #{orderIndex}) - </insert> - - <select id="selectById" resultType="ActiveDashboard"> - SELECT <include refid="activeDashboardColumns"/> - FROM active_dashboards ad - WHERE ad.id=#{id} - </select> - - <select id="selectMaxOrderIndexForNullUser" resultType="Integer"> - SELECT MAX(order_index) - FROM active_dashboards - WHERE user_id IS NULL - </select> - - <sql id="dashboardColumns"> - d.id, d.user_id as "userId", d.name, d.description, d.column_layout as "columnLayout", - d.shared, d.created_at as "createdAt", d.updated_at as "updatedAt" - </sql> - - <select id="selectGlobalDashboardsForUserLogin" parameterType="String" resultType="Dashboard"> - SELECT - <include refid="dashboardColumns"/> - FROM dashboards d - INNER JOIN active_dashboards ad on d.id=ad.dashboard_id - LEFT OUTER JOIN users u on u.id=ad.user_id - <where> - <choose> - <when test="login == null"> - AND u.login IS NULL - </when> - <otherwise> - AND u.login=#{login} - </otherwise> - </choose> - </where> - ORDER BY order_index ASC - </select> - - <select id="selectProjectDashboardsForUserLogin" parameterType="String" resultType="Dashboard"> - SELECT - <include refid="dashboardColumns"/> - FROM dashboards d - INNER JOIN active_dashboards ad on d.id=ad.dashboard_id - LEFT OUTER JOIN users u on u.id=ad.user_id - <where> - <choose> - <when test="login == null"> - AND u.login IS NULL - </when> - <otherwise> - AND u.login=#{login} - </otherwise> - </choose> - </where> - ORDER BY order_index ASC - </select> - -</mapper> diff --git a/sonar-db/src/main/resources/org/sonar/db/dashboard/DashboardMapper.xml b/sonar-db/src/main/resources/org/sonar/db/dashboard/DashboardMapper.xml deleted file mode 100644 index ce27a44c73b..00000000000 --- a/sonar-db/src/main/resources/org/sonar/db/dashboard/DashboardMapper.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - -<mapper namespace="org.sonar.db.dashboard.DashboardMapper"> - -</mapper> diff --git a/sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetMapper.xml b/sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetMapper.xml deleted file mode 100644 index a631f84b6a7..00000000000 --- a/sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetMapper.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - -<mapper namespace="org.sonar.db.dashboard.WidgetMapper"> - - <sql id="selectColumns"> - w.id as "id", - w.dashboard_id as "dashboardId", - w.widget_key as "widgetKey", - w.name as "name", - w.description as "description", - w.column_index as "columnIndex", - w.row_index as "rowIndex", - w.configured as "configured", - w.created_at as "createdAt", - w.updated_at as "updatedAt", - w.resource_id as "resourceId" - </sql> - - <select id="selectById" parameterType="Long" resultType="Widget"> - select - <include refid="selectColumns"/> - from widgets w where w.id=#{id} - </select> - - <select id="selectByDashboard" parameterType="Long" resultType="Widget"> - select - <include refid="selectColumns"/> - from widgets w where w.dashboard_id=#{id} - </select> - - <select id="selectAll" resultType="Widget"> - select - <include refid="selectColumns"/> - from widgets w - </select> - -</mapper> diff --git a/sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetPropertyMapper.xml b/sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetPropertyMapper.xml deleted file mode 100644 index a2bf8024a7f..00000000000 --- a/sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetPropertyMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - -<mapper namespace="org.sonar.db.dashboard.WidgetPropertyMapper"> - - <delete id="deleteByWidgetIds" parameterType="map"> - DELETE FROM widget_properties - WHERE widget_id IN - <foreach collection="list" open="(" close=")" item="wid" separator=",">#{wid}</foreach> - </delete> - -</mapper> diff --git a/sonar-db/src/main/resources/org/sonar/db/user/UserMapper.xml b/sonar-db/src/main/resources/org/sonar/db/user/UserMapper.xml index cde781fd0ab..7087a0a4b2f 100644 --- a/sonar-db/src/main/resources/org/sonar/db/user/UserMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/user/UserMapper.xml @@ -127,14 +127,6 @@ DELETE FROM properties WHERE user_id=#{id} </delete> - <delete id="deleteUnsharedUserDashboards" parameterType="long"> - DELETE FROM dashboards WHERE user_id=#{id} and shared <> ${_true} - </delete> - - <delete id="deleteUserActiveDashboards" parameterType="long"> - DELETE FROM active_dashboards WHERE user_id=#{id} - </delete> - <delete id="deleteUnsharedUserMeasureFilters" parameterType="long"> DELETE FROM measure_filters WHERE user_id=#{id} and shared <> ${_true} </delete> |