diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-12-30 19:20:20 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-12-30 19:20:20 +0100 |
commit | faea9ba2b320ddbce864c5f3f0c4e29cc477f800 (patch) | |
tree | fd42f67e9b563f960aebf362c26921bf82ec9456 /sonar-core | |
parent | 5fdff45fc6e56b5240e619d296d9975a317b94ea (diff) | |
download | sonarqube-faea9ba2b320ddbce864c5f3f0c4e29cc477f800.tar.gz sonarqube-faea9ba2b320ddbce864c5f3f0c4e29cc477f800.zip |
SONAR-5849 Improve the way to get modules tree by using components.moduleUuid
Diffstat (limited to 'sonar-core')
4 files changed, 3 insertions, 45 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/component/ProjectRefentialsComponentDto.java b/sonar-core/src/main/java/org/sonar/core/component/ProjectRefentialsComponentDto.java deleted file mode 100644 index e531993ce5d..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/component/ProjectRefentialsComponentDto.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.core.component; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class ProjectRefentialsComponentDto extends ComponentDto { - - private String parentModuleKey; - - @CheckForNull - public String getParentModuleKey() { - return parentModuleKey; - } - - public void setParentModuleKey(@Nullable String parentModuleKey) { - this.parentModuleKey = parentModuleKey; - } -} diff --git a/sonar-core/src/main/java/org/sonar/core/component/db/ComponentMapper.java b/sonar-core/src/main/java/org/sonar/core/component/db/ComponentMapper.java index 789af967e65..b37a53f6b52 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/db/ComponentMapper.java +++ b/sonar-core/src/main/java/org/sonar/core/component/db/ComponentMapper.java @@ -22,7 +22,6 @@ package org.sonar.core.component.db; import org.apache.ibatis.annotations.Param; import org.sonar.core.component.ComponentDto; -import org.sonar.core.component.ProjectRefentialsComponentDto; import javax.annotation.CheckForNull; @@ -82,7 +81,7 @@ public interface ComponentMapper { /** * Return all modules children (not returning itself) from a module key */ - List<ProjectRefentialsComponentDto> findChildrenModulesFromModule(@Param("moduleKey") String moduleKey); + List<ComponentDto> findChildrenModulesFromModule(@Param("moduleKey") String moduleKey); long countById(long id); diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java index a06112e2597..2f3fdafe259 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java @@ -36,7 +36,6 @@ import org.sonar.core.activity.db.ActivityDto; import org.sonar.core.activity.db.ActivityMapper; import org.sonar.core.cluster.WorkQueue; import org.sonar.core.component.ComponentDto; -import org.sonar.core.component.ProjectRefentialsComponentDto; import org.sonar.core.component.SnapshotDto; import org.sonar.core.component.db.ComponentMapper; import org.sonar.core.component.db.SnapshotMapper; @@ -131,7 +130,6 @@ public class MyBatis implements BatchComponent, ServerComponent { loadAlias(conf, "ActiveDashboard", ActiveDashboardDto.class); loadAlias(conf, "Author", AuthorDto.class); loadAlias(conf, "Component", ComponentDto.class); - loadAlias(conf, "ProjectRefentialsComponent", ProjectRefentialsComponentDto.class); loadAlias(conf, "Dashboard", DashboardDto.class); loadAlias(conf, "Dependency", DependencyDto.class); loadAlias(conf, "DuplicationUnit", DuplicationUnitDto.class); diff --git a/sonar-core/src/main/resources/org/sonar/core/component/db/ComponentMapper.xml b/sonar-core/src/main/resources/org/sonar/core/component/db/ComponentMapper.xml index 2af4bfc0438..2fe0703ec10 100644 --- a/sonar-core/src/main/resources/org/sonar/core/component/db/ComponentMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/component/db/ComponentMapper.xml @@ -132,12 +132,10 @@ </where> </select> - <select id="findChildrenModulesFromModule" parameterType="String" resultType="ProjectRefentialsComponent"> - SELECT <include refid="componentColumns"/>, parent.kee as parentModuleKey + <select id="findChildrenModulesFromModule" parameterType="String" resultType="Component"> + SELECT <include refid="componentColumns"/> FROM projects p INNER JOIN (<include refid="org.sonar.core.component.db.SnapshotMapper.selectChildrenModulesFromModuleQuery" />) snapshotModules on snapshotModules.resourceId=p.id - LEFT OUTER JOIN snapshots parent_snapshot on parent_snapshot.id = snapshotModules.parentId - LEFT OUTER JOIN projects parent on parent.id = parent_snapshot.project_id </select> <select id="findProjectUuids" resultType="String"> |