aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main/java
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2022-03-29 16:20:40 -0500
committersonartech <sonartech@sonarsource.com>2022-04-01 08:22:58 +0000
commitdc84e9f271f4a72de0b55c0cfd141bf67e1ddeb8 (patch)
tree53d489c0daf9151261fcab862bd6ba23020e3697 /server/sonar-db-dao/src/main/java
parentd27e2321560f15d7d5a59e1c99c80891d7632bdd (diff)
downloadsonarqube-dc84e9f271f4a72de0b55c0cfd141bf67e1ddeb8.tar.gz
sonarqube-dc84e9f271f4a72de0b55c0cfd141bf67e1ddeb8.zip
SONAR-16139 Drop api/users/set_setting and related db table
Diffstat (limited to 'server/sonar-db-dao/src/main/java')
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java2
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java7
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java2
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/audit/model/PropertyNewValue.java9
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertiesDao.java79
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertiesMapper.java35
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertyDto.java80
7 files changed, 0 insertions, 214 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
index 514b8396379..c0c487f2f34 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
@@ -88,7 +88,6 @@ import org.sonar.db.user.SessionTokensDao;
import org.sonar.db.user.UserDao;
import org.sonar.db.user.UserDismissedMessagesDao;
import org.sonar.db.user.UserGroupDao;
-import org.sonar.db.user.UserPropertiesDao;
import org.sonar.db.user.UserTokenDao;
import org.sonar.db.webhook.WebhookDao;
import org.sonar.db.webhook.WebhookDeliveryDao;
@@ -165,7 +164,6 @@ public class DaoModule extends Module {
UserDismissedMessagesDao.class,
UserGroupDao.class,
UserPermissionDao.class,
- UserPropertiesDao.class,
UserTokenDao.class,
WebhookDao.class,
WebhookDeliveryDao.class);
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
index d4738c368d1..d545de23ae5 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
@@ -88,7 +88,6 @@ import org.sonar.db.user.SessionTokensDao;
import org.sonar.db.user.UserDao;
import org.sonar.db.user.UserDismissedMessagesDao;
import org.sonar.db.user.UserGroupDao;
-import org.sonar.db.user.UserPropertiesDao;
import org.sonar.db.user.UserTokenDao;
import org.sonar.db.webhook.WebhookDao;
import org.sonar.db.webhook.WebhookDeliveryDao;
@@ -117,7 +116,6 @@ public class DbClient {
private final UserDao userDao;
private final UserGroupDao userGroupDao;
private final UserTokenDao userTokenDao;
- private final UserPropertiesDao userPropertiesDao;
private final GroupMembershipDao groupMembershipDao;
private final RoleDao roleDao;
private final GroupPermissionDao groupPermissionDao;
@@ -197,7 +195,6 @@ public class DbClient {
userDao = getDao(map, UserDao.class);
userGroupDao = getDao(map, UserGroupDao.class);
userTokenDao = getDao(map, UserTokenDao.class);
- userPropertiesDao = getDao(map, UserPropertiesDao.class);
groupMembershipDao = getDao(map, GroupMembershipDao.class);
roleDao = getDao(map, RoleDao.class);
groupPermissionDao = getDao(map, GroupPermissionDao.class);
@@ -353,10 +350,6 @@ public class DbClient {
return userTokenDao;
}
- public UserPropertiesDao userPropertiesDao() {
- return userPropertiesDao;
- }
-
public GroupMembershipDao groupMembershipDao() {
return groupMembershipDao;
}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
index 05264bc1b8f..99875cdcbd7 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
@@ -151,7 +151,6 @@ import org.sonar.db.user.UserDto;
import org.sonar.db.user.UserGroupDto;
import org.sonar.db.user.UserGroupMapper;
import org.sonar.db.user.UserMapper;
-import org.sonar.db.user.UserPropertiesMapper;
import org.sonar.db.user.UserTokenCount;
import org.sonar.db.user.UserTokenDto;
import org.sonar.db.user.UserTokenMapper;
@@ -307,7 +306,6 @@ public class MyBatis {
UserGroupMapper.class,
UserMapper.class,
UserPermissionMapper.class,
- UserPropertiesMapper.class,
UserTokenMapper.class,
WebhookMapper.class,
WebhookDeliveryMapper.class
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/audit/model/PropertyNewValue.java b/server/sonar-db-dao/src/main/java/org/sonar/db/audit/model/PropertyNewValue.java
index 7ec024dc93e..6ed7738db0a 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/audit/model/PropertyNewValue.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/audit/model/PropertyNewValue.java
@@ -22,7 +22,6 @@ package org.sonar.db.audit.model;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.db.property.PropertyDto;
-import org.sonar.db.user.UserPropertyDto;
public class PropertyNewValue extends NewValue {
private String propertyKey;
@@ -48,14 +47,6 @@ public class PropertyNewValue extends NewValue {
@Nullable
private String qualifier;
- public PropertyNewValue(UserPropertyDto userPropertyDto, @Nullable String login) {
- this.propertyKey = userPropertyDto.getKey();
- this.userUuid = userPropertyDto.getUserUuid();
- this.userLogin = login;
-
- setValue(propertyKey, userPropertyDto.getValue());
- }
-
public PropertyNewValue(PropertyDto propertyDto, @Nullable String userLogin, @Nullable String componentKey, @Nullable String componentName, @Nullable String qualifier) {
this.propertyKey = propertyDto.getKey();
this.userUuid = propertyDto.getUserUuid();
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertiesDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertiesDao.java
deleted file mode 100644
index a9760372208..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertiesDao.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 SonarSource SA
- * mailto:info 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.user;
-
-import java.util.List;
-import javax.annotation.Nullable;
-import org.sonar.api.utils.System2;
-import org.sonar.core.util.UuidFactory;
-import org.sonar.db.Dao;
-import org.sonar.db.DbSession;
-import org.sonar.db.audit.AuditPersister;
-import org.sonar.db.audit.model.PropertyNewValue;
-
-public class UserPropertiesDao implements Dao {
-
- private final System2 system2;
- private final UuidFactory uuidFactory;
- private final AuditPersister auditPersister;
-
- public UserPropertiesDao(System2 system2, UuidFactory uuidFactory, AuditPersister auditPersister) {
- this.system2 = system2;
- this.uuidFactory = uuidFactory;
- this.auditPersister = auditPersister;
- }
-
- public List<UserPropertyDto> selectByUser(DbSession session, UserDto user) {
- return mapper(session).selectByUserUuid(user.getUuid());
- }
-
- public UserPropertyDto insertOrUpdate(DbSession session, UserPropertyDto dto, @Nullable String login) {
- long now = system2.now();
- boolean isUpdate = true;
- if (mapper(session).update(dto, now) == 0) {
- mapper(session).insert(dto.setUuid(uuidFactory.create()), now);
- isUpdate = false;
- }
-
- if (isUpdate) {
- auditPersister.updateProperty(session, new PropertyNewValue(dto, login), true);
- } else {
- auditPersister.addProperty(session, new PropertyNewValue(dto, login), true);
- }
-
- return dto;
- }
-
- public void deleteByUser(DbSession session, UserDto user) {
- List<UserPropertyDto> userProperties = selectByUser(session, user);
- int deletedRows = mapper(session).deleteByUserUuid(user.getUuid());
-
- if (deletedRows > 0) {
- userProperties.stream()
- .filter(p -> auditPersister.isTrackedProperty(p.getKey()))
- .forEach(p -> auditPersister.deleteProperty(session, new PropertyNewValue(p, user.getLogin()), true));
- }
- }
-
- private static UserPropertiesMapper mapper(DbSession session) {
- return session.getMapper(UserPropertiesMapper.class);
- }
-
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertiesMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertiesMapper.java
deleted file mode 100644
index f2ba305f19b..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertiesMapper.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 SonarSource SA
- * mailto:info 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.user;
-
-import java.util.List;
-import org.apache.ibatis.annotations.Param;
-
-public interface UserPropertiesMapper {
-
- List<UserPropertyDto> selectByUserUuid(@Param("userUuid") String userUuid);
-
- void insert(@Param("userProperty") UserPropertyDto userPropertyDto, @Param("now") long now);
-
- int update(@Param("userProperty") UserPropertyDto userPropertyDto, @Param("now") long now);
-
- int deleteByUserUuid(@Param("userUuid") String userUuid);
-
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertyDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertyDto.java
deleted file mode 100644
index 8d5030792bf..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserPropertyDto.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 SonarSource SA
- * mailto:info 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.user;
-
-public class UserPropertyDto {
-
- /**
- * Unique UUID identifier. Max size is 40. Can't be null.
- */
- private String uuid;
-
- /**
- * The UUID of the user the settings belongs to. Max size is 255. Can't be null.
- */
- private String userUuid;
-
- /**
- * The key of the settings. Max size is 100. Can't be null.
- */
- private String key;
-
- /**
- * The value of the settings. Max size is 4000. Can't be null.
- */
- private String value;
-
- public String getUuid() {
- return uuid;
- }
-
- UserPropertyDto setUuid(String uuid) {
- this.uuid = uuid;
- return this;
- }
-
- public String getUserUuid() {
- return userUuid;
- }
-
- public UserPropertyDto setUserUuid(String userUuid) {
- this.userUuid = userUuid;
- return this;
- }
-
- public String getKey() {
- return key;
- }
-
- public UserPropertyDto setKey(String key) {
- this.key = key;
- return this;
- }
-
- public String getValue() {
- return value;
- }
-
- public UserPropertyDto setValue(String value) {
- this.value = value;
- return this;
- }
-
-}