aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-common
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2024-10-24 10:54:15 +0200
committersonartech <sonartech@sonarsource.com>2024-10-24 20:02:44 +0000
commite0a940902f37156757e84544d0a876f47f69040f (patch)
tree988c74e5242ad1bb349148601bb207b7cf515b09 /server/sonar-webserver-common
parentc11922595bf67a70a38588a6f7763fb6f6c14501 (diff)
downloadsonarqube-e0a940902f37156757e84544d0a876f47f69040f.tar.gz
sonarqube-e0a940902f37156757e84544d0a876f47f69040f.zip
SONAR-23427 Stop relying on Qualifiers, Scopes and ResourceType from the plugin API
Diffstat (limited to 'server/sonar-webserver-common')
-rw-r--r--server/sonar-webserver-common/src/it/java/org/sonar/server/common/component/ComponentUpdaterIT.java18
-rw-r--r--server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/DefaultTemplatesResolverImplIT.java14
-rw-r--r--server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/GroupPermissionChangerIT.java13
-rw-r--r--server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/PermissionTemplateServiceIT.java10
-rw-r--r--server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/UserPermissionChangerIT.java10
-rw-r--r--server/sonar-webserver-common/src/main/java/org/sonar/server/common/component/ComponentUpdater.java10
-rw-r--r--server/sonar-webserver-common/src/main/java/org/sonar/server/common/component/NewComponent.java2
-rw-r--r--server/sonar-webserver-common/src/main/java/org/sonar/server/common/permission/DefaultTemplatesResolverImpl.java32
-rw-r--r--server/sonar-webserver-common/src/main/java/org/sonar/server/common/permission/PermissionTemplateService.java10
-rw-r--r--server/sonar-webserver-common/src/main/java/org/sonar/server/common/project/ProjectCreator.java2
-rw-r--r--server/sonar-webserver-common/src/test/java/org/sonar/server/common/almsettings/DefaultDevOpsProjectCreatorTest.java4
11 files changed, 61 insertions, 64 deletions
diff --git a/server/sonar-webserver-common/src/it/java/org/sonar/server/common/component/ComponentUpdaterIT.java b/server/sonar-webserver-common/src/it/java/org/sonar/server/common/component/ComponentUpdaterIT.java
index 3ac8d1490dc..03c0dea0122 100644
--- a/server/sonar-webserver-common/src/it/java/org/sonar/server/common/component/ComponentUpdaterIT.java
+++ b/server/sonar-webserver-common/src/it/java/org/sonar/server/common/component/ComponentUpdaterIT.java
@@ -26,8 +26,8 @@ import org.apache.commons.lang3.StringUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.resources.Scopes;
+import org.sonar.db.component.ComponentQualifiers;
+import org.sonar.db.component.ComponentScopes;
import org.sonar.api.utils.System2;
import org.sonar.api.web.UserRole;
import org.sonar.core.util.SequenceUuidFactory;
@@ -37,7 +37,7 @@ import org.sonar.db.audit.AuditPersister;
import org.sonar.db.component.BranchDto;
import org.sonar.db.component.BranchType;
import org.sonar.db.component.ComponentDto;
-import org.sonar.db.component.ResourceTypesRule;
+import org.sonar.server.component.ComponentTypesRule;
import org.sonar.db.project.CreationMethod;
import org.sonar.db.project.ProjectDto;
import org.sonar.db.user.UserDto;
@@ -72,9 +72,9 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.sonar.api.resources.Qualifiers.APP;
-import static org.sonar.api.resources.Qualifiers.PROJECT;
-import static org.sonar.api.resources.Qualifiers.VIEW;
+import static org.sonar.db.component.ComponentQualifiers.APP;
+import static org.sonar.db.component.ComponentQualifiers.PROJECT;
+import static org.sonar.db.component.ComponentQualifiers.VIEW;
import static org.sonar.db.component.BranchDto.DEFAULT_MAIN_BRANCH_NAME;
public class ComponentUpdaterIT {
@@ -110,7 +110,7 @@ public class ComponentUpdaterIT {
new IndexersImpl(new PermissionIndexer(db.getDbClient(), es.client())),
Set.of(new UserPermissionChanger(db.getDbClient(), new SequenceUuidFactory()),
new GroupPermissionChanger(db.getDbClient(), new SequenceUuidFactory())));
- private final PermissionService permissionService = new PermissionServiceImpl(new ResourceTypesRule().setRootQualifiers(Qualifiers.PROJECT));
+ private final PermissionService permissionService = new PermissionServiceImpl(new ComponentTypesRule().setRootQualifiers(ComponentQualifiers.PROJECT));
private final ComponentUpdater underTest = new ComponentUpdater(db.getDbClient(), i18n, system2,
permissionTemplateService,
@@ -134,8 +134,8 @@ public class ComponentUpdaterIT {
assertThat(loaded.getKey()).isEqualTo(DEFAULT_PROJECT_KEY);
assertThat(loaded.name()).isEqualTo(DEFAULT_PROJECT_NAME);
assertThat(loaded.longName()).isEqualTo(DEFAULT_PROJECT_NAME);
- assertThat(loaded.qualifier()).isEqualTo(Qualifiers.PROJECT);
- assertThat(loaded.scope()).isEqualTo(Scopes.PROJECT);
+ assertThat(loaded.qualifier()).isEqualTo(ComponentQualifiers.PROJECT);
+ assertThat(loaded.scope()).isEqualTo(ComponentScopes.PROJECT);
assertThat(loaded.uuid()).isNotNull();
assertThat(loaded.branchUuid()).isEqualTo(loaded.uuid());
assertThat(loaded.isPrivate()).isEqualTo(PRIVATE_COMPONENT.isPrivate());
diff --git a/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/DefaultTemplatesResolverImplIT.java b/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/DefaultTemplatesResolverImplIT.java
index 2a3716ab1af..0df5c81c8b1 100644
--- a/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/DefaultTemplatesResolverImplIT.java
+++ b/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/DefaultTemplatesResolverImplIT.java
@@ -24,22 +24,22 @@ import org.junit.Test;
import org.sonar.api.utils.System2;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
-import org.sonar.db.component.ResourceTypesRule;
+import org.sonar.server.component.ComponentTypesRule;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.sonar.api.resources.Qualifiers.APP;
-import static org.sonar.api.resources.Qualifiers.PROJECT;
-import static org.sonar.api.resources.Qualifiers.VIEW;
+import static org.sonar.db.component.ComponentQualifiers.APP;
+import static org.sonar.db.component.ComponentQualifiers.PROJECT;
+import static org.sonar.db.component.ComponentQualifiers.VIEW;
public class DefaultTemplatesResolverImplIT {
@Rule
public DbTester db = DbTester.create(System2.INSTANCE);
- private ResourceTypesRule resourceTypesWithPortfoliosInstalled = new ResourceTypesRule().setRootQualifiers(PROJECT, APP, VIEW);
- private ResourceTypesRule resourceTypesWithApplicationInstalled = new ResourceTypesRule().setRootQualifiers(PROJECT, APP);
- private ResourceTypesRule resourceTypes = new ResourceTypesRule().setRootQualifiers(PROJECT);
+ private ComponentTypesRule resourceTypesWithPortfoliosInstalled = new ComponentTypesRule().setRootQualifiers(PROJECT, APP, VIEW);
+ private ComponentTypesRule resourceTypesWithApplicationInstalled = new ComponentTypesRule().setRootQualifiers(PROJECT, APP);
+ private ComponentTypesRule resourceTypes = new ComponentTypesRule().setRootQualifiers(PROJECT);
private DefaultTemplatesResolverImpl underTestWithPortfoliosInstalled = new DefaultTemplatesResolverImpl(db.getDbClient(), resourceTypesWithPortfoliosInstalled);
private DefaultTemplatesResolverImpl underTestWithApplicationInstalled = new DefaultTemplatesResolverImpl(db.getDbClient(), resourceTypesWithApplicationInstalled);
diff --git a/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/GroupPermissionChangerIT.java b/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/GroupPermissionChangerIT.java
index 03e760bea6b..f33fa23f127 100644
--- a/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/GroupPermissionChangerIT.java
+++ b/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/GroupPermissionChangerIT.java
@@ -24,23 +24,20 @@ import org.apache.commons.lang3.StringUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.resources.ResourceTypes;
+import org.sonar.db.component.ComponentQualifiers;
+import org.sonar.server.component.ComponentTypes;
import org.sonar.api.utils.System2;
import org.sonar.api.web.UserRole;
import org.sonar.core.util.SequenceUuidFactory;
import org.sonar.core.util.Uuids;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
-import org.sonar.db.component.ResourceTypesRule;
+import org.sonar.server.component.ComponentTypesRule;
import org.sonar.db.permission.GlobalPermission;
import org.sonar.db.permission.GroupPermissionDto;
import org.sonar.db.project.ProjectDto;
import org.sonar.db.user.GroupDto;
import org.sonar.db.user.UserDto;
-import org.sonar.server.common.permission.GroupPermissionChange;
-import org.sonar.server.common.permission.GroupPermissionChanger;
-import org.sonar.server.common.permission.Operation;
import org.sonar.server.exceptions.BadRequestException;
import org.sonar.server.permission.PermissionService;
import org.sonar.server.permission.PermissionServiceImpl;
@@ -58,8 +55,8 @@ public class GroupPermissionChangerIT {
@Rule
public DbTester db = DbTester.create(System2.INSTANCE);
- private final ResourceTypes resourceTypes = new ResourceTypesRule().setRootQualifiers(Qualifiers.PROJECT);
- private final PermissionService permissionService = new PermissionServiceImpl(resourceTypes);
+ private final ComponentTypes componentTypes = new ComponentTypesRule().setRootQualifiers(ComponentQualifiers.PROJECT);
+ private final PermissionService permissionService = new PermissionServiceImpl(componentTypes);
private final GroupPermissionChanger underTest = new GroupPermissionChanger(db.getDbClient(), new SequenceUuidFactory());
private GroupDto group;
diff --git a/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/PermissionTemplateServiceIT.java b/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/PermissionTemplateServiceIT.java
index d7095c13bcd..b275ea696a3 100644
--- a/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/PermissionTemplateServiceIT.java
+++ b/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/PermissionTemplateServiceIT.java
@@ -29,7 +29,7 @@ import org.sonar.api.web.UserRole;
import org.sonar.core.util.SequenceUuidFactory;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
-import org.sonar.db.component.ResourceTypesRule;
+import org.sonar.server.component.ComponentTypesRule;
import org.sonar.db.permission.GlobalPermission;
import org.sonar.db.permission.template.PermissionTemplateDbTester;
import org.sonar.db.permission.template.PermissionTemplateDto;
@@ -47,16 +47,16 @@ import org.sonar.server.tester.UserSessionRule;
import static java.util.Collections.singletonList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.sonar.api.resources.Qualifiers.APP;
-import static org.sonar.api.resources.Qualifiers.PROJECT;
-import static org.sonar.api.resources.Qualifiers.VIEW;
+import static org.sonar.db.component.ComponentQualifiers.APP;
+import static org.sonar.db.component.ComponentQualifiers.PROJECT;
+import static org.sonar.db.component.ComponentQualifiers.VIEW;
public class PermissionTemplateServiceIT {
@Rule
public DbTester dbTester = DbTester.create();
- private final ResourceTypesRule resourceTypesRule = new ResourceTypesRule().setRootQualifiers(PROJECT, VIEW, APP);
+ private final ComponentTypesRule resourceTypesRule = new ComponentTypesRule().setRootQualifiers(PROJECT, VIEW, APP);
private final DefaultTemplatesResolver defaultTemplatesResolver = new DefaultTemplatesResolverImpl(dbTester.getDbClient(), resourceTypesRule);
private final PermissionService permissionService = new PermissionServiceImpl(resourceTypesRule);
private final UserSessionRule userSession = UserSessionRule.standalone();
diff --git a/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/UserPermissionChangerIT.java b/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/UserPermissionChangerIT.java
index 479a28e81d4..ec722605fd7 100644
--- a/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/UserPermissionChangerIT.java
+++ b/server/sonar-webserver-common/src/it/java/org/sonar/server/common/permission/UserPermissionChangerIT.java
@@ -24,14 +24,14 @@ import org.apache.commons.lang3.StringUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.resources.ResourceTypes;
+import org.sonar.db.component.ComponentQualifiers;
+import org.sonar.server.component.ComponentTypes;
import org.sonar.api.utils.System2;
import org.sonar.api.web.UserRole;
import org.sonar.core.util.SequenceUuidFactory;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
-import org.sonar.db.component.ResourceTypesRule;
+import org.sonar.server.component.ComponentTypesRule;
import org.sonar.db.entity.EntityDto;
import org.sonar.db.permission.GlobalPermission;
import org.sonar.db.user.GroupDto;
@@ -52,8 +52,8 @@ public class UserPermissionChangerIT {
@Rule
public DbTester db = DbTester.create(System2.INSTANCE);
- private final ResourceTypes resourceTypes = new ResourceTypesRule().setRootQualifiers(Qualifiers.PROJECT);
- private final PermissionService permissionService = new PermissionServiceImpl(resourceTypes);
+ private final ComponentTypes componentTypes = new ComponentTypesRule().setRootQualifiers(ComponentQualifiers.PROJECT);
+ private final PermissionService permissionService = new PermissionServiceImpl(componentTypes);
private final UserPermissionChanger underTest = new UserPermissionChanger(db.getDbClient(), new SequenceUuidFactory());
private UserDto user1;
private UserDto user2;
diff --git a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/component/ComponentUpdater.java b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/component/ComponentUpdater.java
index e42e77a33e1..13d8d703b29 100644
--- a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/component/ComponentUpdater.java
+++ b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/component/ComponentUpdater.java
@@ -26,8 +26,8 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.resources.Scopes;
+import org.sonar.db.component.ComponentQualifiers;
+import org.sonar.db.component.ComponentScopes;
import org.sonar.api.utils.System2;
import org.sonar.core.i18n.I18n;
import org.sonar.core.util.UuidFactory;
@@ -61,7 +61,7 @@ import static org.sonar.server.exceptions.BadRequestException.throwBadRequestExc
public class ComponentUpdater {
- private static final Set<String> PROJ_APP_QUALIFIERS = Set.of(Qualifiers.PROJECT, Qualifiers.APP);
+ private static final Set<String> PROJ_APP_QUALIFIERS = Set.of(ComponentQualifiers.PROJECT, ComponentQualifiers.APP);
private static final String KEY_ALREADY_EXISTS_ERROR = "Could not create %s with key: \"%s\". A similar key already exists: \"%s\"";
private static final String MALFORMED_KEY_ERROR = "Malformed key for %s: '%s'. %s.";
private final DbClient dbClient;
@@ -196,7 +196,7 @@ public class ComponentUpdater {
.setName(newComponent.name())
.setDescription(newComponent.description())
.setLongName(newComponent.name())
- .setScope(Scopes.PROJECT)
+ .setScope(ComponentScopes.PROJECT)
.setQualifier(newComponent.qualifier())
.setPrivate(newComponent.isPrivate())
.setCreatedAt(new Date(now));
@@ -236,7 +236,7 @@ public class ComponentUpdater {
}
private static boolean isPortfolio(ComponentDto componentDto) {
- return Qualifiers.VIEW.contains(componentDto.qualifier());
+ return ComponentQualifiers.VIEW.contains(componentDto.qualifier());
}
private BranchDto createMainBranch(DbSession session, String componentUuid, String projectUuid, @Nullable String mainBranch) {
diff --git a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/component/NewComponent.java b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/component/NewComponent.java
index 8167bdae6ab..720c4942a5f 100644
--- a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/component/NewComponent.java
+++ b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/component/NewComponent.java
@@ -23,7 +23,7 @@ import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
-import static org.sonar.api.resources.Qualifiers.PROJECT;
+import static org.sonar.db.component.ComponentQualifiers.PROJECT;
import static org.sonar.db.component.ComponentValidator.checkComponentKey;
import static org.sonar.db.component.ComponentValidator.checkComponentName;
import static org.sonar.db.component.ComponentValidator.checkComponentQualifier;
diff --git a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/permission/DefaultTemplatesResolverImpl.java b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/permission/DefaultTemplatesResolverImpl.java
index ec32b6d3cf6..ea5a9337af3 100644
--- a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/permission/DefaultTemplatesResolverImpl.java
+++ b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/permission/DefaultTemplatesResolverImpl.java
@@ -19,9 +19,9 @@
*/
package org.sonar.server.common.permission;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.resources.ResourceType;
-import org.sonar.api.resources.ResourceTypes;
+import org.sonar.db.component.ComponentQualifiers;
+import org.sonar.server.component.ComponentType;
+import org.sonar.server.component.ComponentTypes;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.server.property.InternalProperties;
@@ -29,11 +29,11 @@ import org.sonar.server.property.InternalProperties;
public class DefaultTemplatesResolverImpl implements DefaultTemplatesResolver {
private final DbClient dbClient;
- private final ResourceTypes resourceTypes;
+ private final ComponentTypes componentTypes;
- public DefaultTemplatesResolverImpl(DbClient dbClient, ResourceTypes resourceTypes) {
+ public DefaultTemplatesResolverImpl(DbClient dbClient, ComponentTypes componentTypes) {
this.dbClient = dbClient;
- this.resourceTypes = resourceTypes;
+ this.componentTypes = componentTypes;
}
@Override
@@ -45,27 +45,27 @@ public class DefaultTemplatesResolverImpl implements DefaultTemplatesResolver {
String defaultPortfolioTemplate = null;
String defaultApplicationTemplate = null;
- if (isPortfolioEnabled(resourceTypes)) {
+ if (isPortfolioEnabled(componentTypes)) {
defaultPortfolioTemplate = dbClient.internalPropertiesDao().selectByKey(dbSession, InternalProperties.DEFAULT_PORTFOLIO_TEMPLATE).orElse(defaultProjectTemplate);
}
- if (isApplicationEnabled(resourceTypes)) {
+ if (isApplicationEnabled(componentTypes)) {
defaultApplicationTemplate = dbClient.internalPropertiesDao().selectByKey(dbSession, InternalProperties.DEFAULT_APPLICATION_TEMPLATE).orElse(defaultProjectTemplate);
}
return new ResolvedDefaultTemplates(defaultProjectTemplate, defaultApplicationTemplate, defaultPortfolioTemplate);
}
- private static boolean isPortfolioEnabled(ResourceTypes resourceTypes) {
- return resourceTypes.getRoots()
+ private static boolean isPortfolioEnabled(ComponentTypes componentTypes) {
+ return componentTypes.getRoots()
.stream()
- .map(ResourceType::getQualifier)
- .anyMatch(Qualifiers.VIEW::equals);
+ .map(ComponentType::getQualifier)
+ .anyMatch(ComponentQualifiers.VIEW::equals);
}
- private static boolean isApplicationEnabled(ResourceTypes resourceTypes) {
- return resourceTypes.getRoots()
+ private static boolean isApplicationEnabled(ComponentTypes componentTypes) {
+ return componentTypes.getRoots()
.stream()
- .map(ResourceType::getQualifier)
- .anyMatch(Qualifiers.APP::equals);
+ .map(ComponentType::getQualifier)
+ .anyMatch(ComponentQualifiers.APP::equals);
}
}
diff --git a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/permission/PermissionTemplateService.java b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/permission/PermissionTemplateService.java
index 3857d0c3f9c..b5170a88709 100644
--- a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/permission/PermissionTemplateService.java
+++ b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/permission/PermissionTemplateService.java
@@ -30,7 +30,7 @@ import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
-import org.sonar.api.resources.Qualifiers;
+import org.sonar.db.component.ComponentQualifiers;
import org.sonar.api.server.ServerSide;
import org.sonar.core.util.UuidFactory;
import org.sonar.db.DbClient;
@@ -79,7 +79,7 @@ public class PermissionTemplateService {
return true;
}
- ProjectDto projectDto = new ProjectDto().setKey(projectKey).setQualifier(Qualifiers.PROJECT);
+ ProjectDto projectDto = new ProjectDto().setKey(projectKey).setQualifier(ComponentQualifiers.PROJECT);
PermissionTemplateDto template = findTemplate(dbSession, projectDto);
if (template == null) {
return false;
@@ -208,13 +208,13 @@ public class PermissionTemplateService {
String qualifier = entityDto.getQualifier();
DefaultTemplatesResolver.ResolvedDefaultTemplates resolvedDefaultTemplates = defaultTemplatesResolver.resolve(dbSession);
switch (qualifier) {
- case Qualifiers.PROJECT:
+ case ComponentQualifiers.PROJECT:
return dbClient.permissionTemplateDao().selectByUuid(dbSession, resolvedDefaultTemplates.getProject());
- case Qualifiers.VIEW:
+ case ComponentQualifiers.VIEW:
String portDefaultTemplateUuid = resolvedDefaultTemplates.getPortfolio().orElseThrow(
() -> new IllegalStateException("Failed to find default template for portfolios"));
return dbClient.permissionTemplateDao().selectByUuid(dbSession, portDefaultTemplateUuid);
- case Qualifiers.APP:
+ case ComponentQualifiers.APP:
String appDefaultTemplateUuid = resolvedDefaultTemplates.getApplication().orElseThrow(
() -> new IllegalStateException("Failed to find default template for applications"));
return dbClient.permissionTemplateDao().selectByUuid(dbSession, appDefaultTemplateUuid);
diff --git a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/project/ProjectCreator.java b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/project/ProjectCreator.java
index 22cf07233f4..d456a065757 100644
--- a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/project/ProjectCreator.java
+++ b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/project/ProjectCreator.java
@@ -30,7 +30,7 @@ import org.sonar.server.component.ComponentCreationData;
import org.sonar.server.project.ProjectDefaultVisibility;
import org.sonar.server.user.UserSession;
-import static org.sonar.api.resources.Qualifiers.PROJECT;
+import static org.sonar.db.component.ComponentQualifiers.PROJECT;
@ServerSide
public class ProjectCreator {
diff --git a/server/sonar-webserver-common/src/test/java/org/sonar/server/common/almsettings/DefaultDevOpsProjectCreatorTest.java b/server/sonar-webserver-common/src/test/java/org/sonar/server/common/almsettings/DefaultDevOpsProjectCreatorTest.java
index cc4fb7ec19b..4c56fea19ef 100644
--- a/server/sonar-webserver-common/src/test/java/org/sonar/server/common/almsettings/DefaultDevOpsProjectCreatorTest.java
+++ b/server/sonar-webserver-common/src/test/java/org/sonar/server/common/almsettings/DefaultDevOpsProjectCreatorTest.java
@@ -29,7 +29,7 @@ import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
-import org.sonar.api.resources.Qualifiers;
+import org.sonar.db.component.ComponentQualifiers;
import org.sonar.api.web.UserRole;
import org.sonar.auth.DevOpsPlatformSettings;
import org.sonar.db.DbClient;
@@ -325,7 +325,7 @@ class DefaultDevOpsProjectCreatorTest {
NewComponent newComponent = componentCreationParameters.newComponent();
assertThat(newComponent.isProject()).isTrue();
- assertThat(newComponent.qualifier()).isEqualTo(Qualifiers.PROJECT);
+ assertThat(newComponent.qualifier()).isEqualTo(ComponentQualifiers.PROJECT);
assertThat(newComponent.key()).isEqualTo(expectedKey);
assertThat(newComponent.name()).isEqualTo(REPOSITORY_NAME);
}