diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-01-13 11:51:25 +0100 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-01-16 11:38:43 +0100 |
commit | e09bee5fed18be0ff8730c510ff3d72156957529 (patch) | |
tree | 38bbcc2c99c14651d3446ae96e42790d910dcaf1 /sonar-db | |
parent | ce6c8125cffe4f1b390977d08deedc4656a02c74 (diff) | |
download | sonarqube-e09bee5fed18be0ff8730c510ff3d72156957529.tar.gz sonarqube-e09bee5fed18be0ff8730c510ff3d72156957529.zip |
SONAR-8595 remove ComponentDto.organizationKey
remove join on table ORGANIZATIONS in ComponentMapper.xml which was used to populate this field
Diffstat (limited to 'sonar-db')
3 files changed, 5 insertions, 35 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java b/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java index 32e22ffc618..a7c4576e4a7 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java @@ -50,12 +50,6 @@ public class ComponentDto implements Component { private String organizationUuid; /** - * The key of the organization the components belongs to. Read-only and nullable as it is populated only by some - * requests joining on the organizations table. - */ - private String organizationKey; - - /** * Non-empty and unique functional key */ private String kee; @@ -142,10 +136,6 @@ public class ComponentDto implements Component { return this; } - public String getOrganizationKey() { - return organizationKey; - } - public String uuid() { return uuid; } diff --git a/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml index bb0d24b393e..13fe82a2aa3 100644 --- a/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml @@ -29,11 +29,8 @@ <select id="selectByKey" parameterType="String" resultType="Component"> SELECT - <include refid="componentColumns"/>, - o.kee as organizationKey + <include refid="componentColumns"/> FROM projects p - inner join organizations o on - o.uuid = p.organization_uuid where p.kee=#{key} </select> @@ -59,11 +56,8 @@ <select id="selectByUuid" parameterType="String" resultType="Component"> SELECT - <include refid="componentColumns"/>, - o.kee as organizationKey + <include refid="componentColumns"/> FROM projects p - inner join organizations o on - o.uuid = p.organization_uuid where p.uuid=#{uuid} </select> @@ -113,11 +107,8 @@ <select id="selectByUuids" parameterType="String" resultType="Component"> select - <include refid="componentColumns"/>, - o.kee as organizationKey + <include refid="componentColumns"/> from projects p - inner join organizations o on - o.uuid = p.organization_uuid where p.uuid in <foreach collection="uuids" open="(" close=")" item="uuid" separator=","> @@ -275,8 +266,7 @@ <select id="selectByQuery" resultType="Component"> select - <include refid="componentColumns"/>, - o.kee as organizationKey + <include refid="componentColumns"/> <include refid="sqlSelectByQuery"/> ORDER BY LOWER(p.name), p.name, p.id </select> @@ -288,8 +278,6 @@ <sql id="sqlSelectByQuery"> from projects p - inner join organizations o on - o.uuid = p.organization_uuid where p.enabled=${_true} AND p.copy_component_uuid is null @@ -343,11 +331,8 @@ <select id="selectDescendants" resultType="Component"> select - <include refid="componentColumns"/>, - o.kee as organizationKey + <include refid="componentColumns"/> from projects p - inner join organizations o on - o.uuid = p.organization_uuid <include refid="selectDescendantsJoins"/> <where> <include refid="selectDescendantsFilters"/> diff --git a/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java index a82695097b4..ef8b746b497 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java @@ -76,7 +76,6 @@ public class ComponentDaoTest { ComponentDto result = underTest.selectByUuid(dbSession, "U1").get(); assertThat(result).isNotNull(); assertThat(result.getOrganizationUuid()).isEqualTo("org1"); - assertThat(result.getOrganizationKey()).isEqualTo("org1_key"); assertThat(result.uuid()).isEqualTo("U1"); assertThat(result.getUuidPath()).isEqualTo("uuid_path_of_U1"); assertThat(result.moduleUuid()).isEqualTo("module_uuid_of_U1"); @@ -154,7 +153,6 @@ public class ComponentDaoTest { ComponentDto result = optional.get(); assertThat(result.getOrganizationUuid()).isEqualTo("org1"); - assertThat(result.getOrganizationKey()).isEqualTo("org1_key"); assertThat(result.uuid()).isEqualTo("U4"); assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java"); assertThat(result.path()).isEqualTo("path_of_U4"); @@ -256,7 +254,6 @@ public class ComponentDaoTest { ComponentDto result = results.get(0); assertThat(result.getOrganizationUuid()).isEqualTo("org1"); - assertThat(result.getOrganizationKey()).isEqualTo("org1_key"); assertThat(result.uuid()).isEqualTo("U4"); assertThat(result.moduleUuid()).isEqualTo("module_uuid_of_U4"); assertThat(result.moduleUuidPath()).isEqualTo("module_uuid_path_of_U4"); @@ -784,7 +781,6 @@ public class ComponentDaoTest { assertThat(count).isEqualTo(9); assertThat(result).extracting(ComponentDto::name).containsExactly("project-2", "project-3", "project-4"); assertThat(result).extracting(ComponentDto::getOrganizationUuid).containsOnly(organizationDto.getUuid()); - assertThat(result).extracting(ComponentDto::getOrganizationKey).containsOnly(organizationDto.getKey()); } @Test @@ -1000,7 +996,6 @@ public class ComponentDaoTest { List<ComponentDto> components = underTest.selectDescendants(dbSession, dbQuery); assertThat(components).extracting("uuid").containsOnly("project-copy-uuid", "subview-uuid"); assertThat(components).extracting("organizationUuid").containsOnly(organizationDto.getUuid()); - assertThat(components).extracting("organizationKey").containsOnly(organizationDto.getKey()); } private static ComponentTreeQuery.Builder newTreeQuery(String baseUuid) { |