diff options
Diffstat (limited to 'server/sonar-db-dao/src/main/java/org/sonar/db')
7 files changed, 170 insertions, 0 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 9f3ed9ab4fe..f2e51452023 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 @@ -107,6 +107,7 @@ import org.sonar.db.user.UserDao; import org.sonar.db.user.UserDismissedMessagesDao; import org.sonar.db.user.UserGroupDao; import org.sonar.db.user.UserTokenDao; +import org.sonar.db.user.ai.UserAiToolUsageDao; import org.sonar.db.webhook.WebhookDao; import org.sonar.db.webhook.WebhookDeliveryDao; @@ -196,6 +197,7 @@ public class DaoModule extends Module { SnapshotDao.class, SessionTokensDao.class, TelemetryMetricsSentDao.class, + UserAiToolUsageDao.class, UserDao.class, UserDismissedMessagesDao.class, UserGroupDao.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 fc0faf5c348..027055a5075 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 @@ -107,6 +107,7 @@ import org.sonar.db.user.UserDao; import org.sonar.db.user.UserDismissedMessagesDao; import org.sonar.db.user.UserGroupDao; import org.sonar.db.user.UserTokenDao; +import org.sonar.db.user.ai.UserAiToolUsageDao; import org.sonar.db.webhook.WebhookDao; import org.sonar.db.webhook.WebhookDeliveryDao; @@ -135,6 +136,7 @@ public class DbClient { private final UserDao userDao; private final UserGroupDao userGroupDao; private final UserTokenDao userTokenDao; + private final UserAiToolUsageDao userAiToolUsageDao; private final GroupMembershipDao groupMembershipDao; private final RoleDao roleDao; private final GroupPermissionDao groupPermissionDao; @@ -232,6 +234,7 @@ public class DbClient { userDao = getDao(map, UserDao.class); userGroupDao = getDao(map, UserGroupDao.class); userTokenDao = getDao(map, UserTokenDao.class); + userAiToolUsageDao = getDao(map, UserAiToolUsageDao.class); groupMembershipDao = getDao(map, GroupMembershipDao.class); roleDao = getDao(map, RoleDao.class); groupPermissionDao = getDao(map, GroupPermissionDao.class); @@ -412,6 +415,10 @@ public class DbClient { return userDao; } + public UserAiToolUsageDao userAiToolUsageDao() { + return userAiToolUsageDao; + } + public UserGroupDao userGroupDao() { return userGroupDao; } 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 bdbccd5491e..7dfa94e518a 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 @@ -183,6 +183,7 @@ import org.sonar.db.user.UserTelemetryDto; import org.sonar.db.user.UserTokenCount; import org.sonar.db.user.UserTokenDto; import org.sonar.db.user.UserTokenMapper; +import org.sonar.db.user.ai.UserAiToolUsageMapper; import org.sonar.db.webhook.WebhookDeliveryMapper; import org.sonar.db.webhook.WebhookMapper; import org.springframework.beans.factory.annotation.Autowired; @@ -359,6 +360,7 @@ public class MyBatis { SessionTokenMapper.class, SnapshotMapper.class, TelemetryMetricsSentMapper.class, + UserAiToolUsageMapper.class, UserDismissedMessagesMapper.class, UserGroupMapper.class, UserMapper.class, diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/UserAiToolUsageDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/UserAiToolUsageDao.java new file mode 100644 index 00000000000..e678b59da6b --- /dev/null +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/UserAiToolUsageDao.java @@ -0,0 +1,39 @@ +/* + * SonarQube + * Copyright (C) 2009-2024 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.ai; + +import java.util.List; +import org.sonar.db.Dao; +import org.sonar.db.DbSession; + +public class UserAiToolUsageDao implements Dao { + + public void insert(DbSession dbSession, UserAiToolUsageDto userAiToolUsageDto) { + mapper(dbSession).insert(userAiToolUsageDto); + } + + public List<UserAiToolUsageDto> selectAll(DbSession dbSession) { + return mapper(dbSession).selectAll(); + } + + private static UserAiToolUsageMapper mapper(DbSession session) { + return session.getMapper(UserAiToolUsageMapper.class); + } +} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/UserAiToolUsageDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/UserAiToolUsageDto.java new file mode 100644 index 00000000000..63d90cb0855 --- /dev/null +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/UserAiToolUsageDto.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2024 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.ai; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class UserAiToolUsageDto { + + private String uuid = null; + private String userUuid = null; + private Long activatedAt = null; + private Long lastActivityAt = null; + + public String getUuid() { + return uuid; + } + + public UserAiToolUsageDto setUuid(String uuid) { + this.uuid = uuid; + return this; + } + + public String getUserUuid() { + return userUuid; + } + + public UserAiToolUsageDto setUserUuid(String userUuid) { + this.userUuid = userUuid; + return this; + } + + public Long getActivatedAt() { + return activatedAt; + } + + public UserAiToolUsageDto setActivatedAt(Long activatedAt) { + this.activatedAt = activatedAt; + return this; + } + + @CheckForNull + public Long getLastActivityAt() { + return lastActivityAt; + } + + public UserAiToolUsageDto setLastActivityAt(@Nullable Long lastActivityAt) { + this.lastActivityAt = lastActivityAt; + return this; + } +} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/UserAiToolUsageMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/UserAiToolUsageMapper.java new file mode 100644 index 00000000000..6c3ac6c3043 --- /dev/null +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/UserAiToolUsageMapper.java @@ -0,0 +1,29 @@ +/* + * SonarQube + * Copyright (C) 2009-2024 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.ai; + +import java.util.List; + +public interface UserAiToolUsageMapper { + + void insert(UserAiToolUsageDto userAiToolUsageDto); + + List<UserAiToolUsageDto> selectAll(); +} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/package-info.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/package-info.java new file mode 100644 index 00000000000..dc395949b00 --- /dev/null +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/ai/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2024 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. + */ +@ParametersAreNonnullByDefault +package org.sonar.db.user.ai; + +import javax.annotation.ParametersAreNonnullByDefault; |