diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-06-01 12:43:03 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-06-01 12:49:06 +0200 |
commit | eb31baeceeec4ec36a792fc4905a2981b3fd2925 (patch) | |
tree | e4920f85e97b156385a22d870b4f9b0a17ffa991 /sonar-core/src | |
parent | 5fc1d3a3561060fb941ef98d4caffe3e71c7ee50 (diff) | |
download | sonarqube-eb31baeceeec4ec36a792fc4905a2981b3fd2925.tar.gz sonarqube-eb31baeceeec4ec36a792fc4905a2981b3fd2925.zip |
Revert "Revert "Revert "SONAR-6259 Validate project and module keys"""
This reverts commit e0819b36e967c7b5c6f192475bf78648c3906214.
Diffstat (limited to 'sonar-core/src')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/component/db/ComponentMapper.java | 18 | ||||
-rw-r--r-- | sonar-core/src/main/resources/org/sonar/core/component/db/ComponentMapper.xml | 17 |
2 files changed, 25 insertions, 10 deletions
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 7eac6cd994c..424b8a269bf 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 @@ -20,17 +20,18 @@ package org.sonar.core.component.db; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.session.RowBounds; import org.sonar.core.component.ComponentDto; import org.sonar.core.component.FilePathWithHashDto; import org.sonar.core.component.UuidWithProjectUuidDto; +import javax.annotation.CheckForNull; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + /** * @since 4.3 */ @@ -46,6 +47,11 @@ public interface ComponentMapper { ComponentDto selectByUuid(String uuid); /** + * Return direct modules from a project/module + */ + List<ComponentDto> selectModulesByProject(@Param("projectKey") String projectKey); + + /** * Return sub project of component keys */ List<ComponentDto> selectSubProjectsByComponentUuids(@Param("uuids") Collection<String> uuids); @@ -90,7 +96,7 @@ public interface ComponentMapper { /** * Return all components of a project */ - List<ComponentDto> selectComponentsFromProjectKeyAndScope(@Param("projectKey") String projectKey, @Nullable @Param("scope") String scope); + List<ComponentDto> selectComponentsFromProjectKey(@Param("projectKey") String projectKey); /** * Return technical projects from a view or a sub-view 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 8c58c026256..ad195fe0815 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 @@ -64,6 +64,18 @@ </where> </select> + <select id="selectModulesByProject" parameterType="String" resultType="Component"> + SELECT <include refid="componentColumns"/> + FROM projects p + INNER JOIN snapshots s ON s.project_id=p.id AND s.islast=${_true} + INNER JOIN snapshots parent_snapshots ON parent_snapshots.id=s.parent_snapshot_id AND parent_snapshots.islast=${_true} + INNER JOIN projects parent ON parent.id=parent_snapshots.project_id AND parent.enabled=${_true} AND parent.kee=#{projectKey} + <where> + AND p.enabled=${_true} + AND p.scope='PRJ' + </where> + </select> + <select id="selectByKeys" parameterType="String" resultType="Component"> select <include refid="componentColumns"/> from projects p @@ -201,15 +213,12 @@ </where> </select> - <select id="selectComponentsFromProjectKeyAndScope" parameterType="map" resultType="Component"> + <select id="selectComponentsFromProjectKey" parameterType="map" resultType="Component"> SELECT <include refid="componentColumns"/> FROM projects p INNER JOIN projects root ON root.uuid=p.project_uuid AND root.kee=#{projectKey} <where> AND p.enabled=${_true} - <if test="scope != null"> - AND p.scope=#{scope} - </if> </where> </select> |