diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-03-17 15:44:09 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-03-17 15:46:12 +0100 |
commit | 3c664c31994c3e93f40e395f7b8339e8fa43ae11 (patch) | |
tree | 06273f002552a6461a896b3c314bd0f90f915cbe /sonar-core | |
parent | 2ec12bf1b6ea57eaaa2f1feae0df1b2f3f702d3c (diff) | |
download | sonarqube-3c664c31994c3e93f40e395f7b8339e8fa43ae11.tar.gz sonarqube-3c664c31994c3e93f40e395f7b8339e8fa43ae11.zip |
Remove Component.moduleKey
Diffstat (limited to 'sonar-core')
9 files changed, 2 insertions, 51 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java b/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java index ea287b50d3e..20f893145d6 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java +++ b/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java @@ -28,13 +28,7 @@ public class ComponentDto implements Component { private Long id; private String kee; - - // TODO delete it private String path; - - // TODO delete it - private String moduleKey; - private String name; private String longName; private String qualifier; @@ -71,16 +65,6 @@ public class ComponentDto implements Component { } @Override - public String moduleKey() { - return moduleKey; - } - - public ComponentDto setModuleKey(String moduleKey) { - this.moduleKey = moduleKey; - return this; - } - - @Override public String name() { return name; } diff --git a/sonar-core/src/main/java/org/sonar/core/component/ComponentVertex.java b/sonar-core/src/main/java/org/sonar/core/component/ComponentVertex.java index 7f3b65dd55e..a4bbdbed638 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/ComponentVertex.java +++ b/sonar-core/src/main/java/org/sonar/core/component/ComponentVertex.java @@ -32,10 +32,6 @@ public class ComponentVertex extends BeanVertex implements Component { return (String) getProperty("path"); } - public String moduleKey() { - return (String) getProperty("moduleKey"); - } - public String name() { return (String) getProperty("name"); } @@ -51,7 +47,6 @@ public class ComponentVertex extends BeanVertex implements Component { void copyFrom(Component component) { setProperty("key", component.key()); setProperty("path", component.path()); - setProperty("moduleKey", component.moduleKey()); setProperty("name", component.name()); setProperty("longName", component.longName()); setProperty("qualifier", component.qualifier()); diff --git a/sonar-core/src/main/java/org/sonar/core/component/ResourceComponent.java b/sonar-core/src/main/java/org/sonar/core/component/ResourceComponent.java index 6ae69cb3d3c..a818164409e 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/ResourceComponent.java +++ b/sonar-core/src/main/java/org/sonar/core/component/ResourceComponent.java @@ -20,7 +20,6 @@ package org.sonar.core.component; import com.google.common.base.Strings; -import org.apache.commons.lang.StringUtils; import org.sonar.api.component.Component; import org.sonar.api.database.model.Snapshot; import org.sonar.api.resources.Resource; @@ -30,7 +29,6 @@ import javax.annotation.Nullable; public class ResourceComponent implements Component { private String key; private String path; - private String moduleKey; private String name; private String longName; private String qualifier; @@ -41,8 +39,6 @@ public class ResourceComponent implements Component { public ResourceComponent(Resource resource, @Nullable Snapshot snapshot) { this.key = resource.getEffectiveKey(); this.path = resource.getPath(); - // Kind of a hack as it depends on format of resource effective key - this.moduleKey = StringUtils.removeEnd(resource.getEffectiveKey(), ":" + resource.getKey()); if (Strings.isNullOrEmpty(key)) { throw new IllegalArgumentException("Missing component key"); } @@ -69,11 +65,6 @@ public class ResourceComponent implements Component { return path; } - @Override - public String moduleKey() { - return moduleKey; - } - public String name() { return name; } diff --git a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java index 9196f989db2..f68ebc61fb5 100644 --- a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java +++ b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java @@ -301,7 +301,6 @@ public class ResourceDao { return new ComponentDto() .setId(resourceDto.getId()) .setKey(resourceDto.getKey()) - .setModuleKey(resourceDto.getModuleKey()) .setPath(resourceDto.getPath()) .setLongName(resourceDto.getLongName()) .setName(resourceDto.getName()) diff --git a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDto.java b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDto.java index c0831aa8e99..93dff81318e 100644 --- a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDto.java +++ b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDto.java @@ -29,7 +29,6 @@ public class ResourceDto { private String name; private String longName; private Long rootId; - private String moduleKey; private String path; private String scope; private String qualifier; @@ -94,15 +93,6 @@ public class ResourceDto { return this; } - public String getModuleKey() { - return moduleKey; - } - - public ResourceDto setModuleKey(String s) { - this.moduleKey = s; - return this; - } - public String getLongName() { return longName; } diff --git a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml index 6af9cbefeb2..73ea46711a8 100644 --- a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml @@ -54,7 +54,6 @@ <result property="key" column="kee"/> <result property="deprecatedKey" column="deprecated_kee"/> <result property="path" column="path"/> - <result property="moduleKey" column="moduleKey"/> <result property="name" column="name"/> <result property="longName" column="long_name"/> <result property="rootId" column="root_id"/> @@ -69,8 +68,7 @@ </resultMap> <select id="selectResources" parameterType="map" resultMap="resourceResultMap"> - select p.*, r.kee moduleKey - from projects p left outer join projects r on p.root_id=r.id + select * from projects p <where> <if test="qualifiers != null and qualifiers.length!=0"> and p.qualifier in @@ -103,8 +101,7 @@ </select> <select id="selectResource" parameterType="long" resultMap="resourceResultMap"> - select p.*, r.kee moduleKey - from projects p left outer join projects r on p.root_id=r.id + select * from projects p where p.id=#{id} </select> diff --git a/sonar-core/src/test/java/org/sonar/core/component/ComponentVertexTest.java b/sonar-core/src/test/java/org/sonar/core/component/ComponentVertexTest.java index eba9be60b8b..5a4a608ca9c 100644 --- a/sonar-core/src/test/java/org/sonar/core/component/ComponentVertexTest.java +++ b/sonar-core/src/test/java/org/sonar/core/component/ComponentVertexTest.java @@ -44,7 +44,6 @@ public class ComponentVertexTest { assertThat(vertex.name()).isEqualTo("Foo.java"); assertThat(vertex.qualifier()).isEqualTo(Qualifiers.FILE); assertThat(vertex.path()).isEqualTo("src/org/Foo.java"); - assertThat(vertex.moduleKey()).isEqualTo("myproject"); } @Test diff --git a/sonar-core/src/test/java/org/sonar/core/component/ResourceComponentTest.java b/sonar-core/src/test/java/org/sonar/core/component/ResourceComponentTest.java index 218b048948d..aa83169c91a 100644 --- a/sonar-core/src/test/java/org/sonar/core/component/ResourceComponentTest.java +++ b/sonar-core/src/test/java/org/sonar/core/component/ResourceComponentTest.java @@ -61,7 +61,6 @@ public class ResourceComponentTest { public void should_use_effective_key() { ResourceComponent component = new ResourceComponent(file); assertThat(component.key()).isEqualTo("myproject:path/to/foo.c"); - assertThat(component.moduleKey()).isEqualTo("myproject"); } @Test diff --git a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java index cbceab126b2..4de4f062024 100644 --- a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java @@ -73,7 +73,6 @@ public class ResourceDaoTest extends AbstractDaoTestCase { ResourceDto resource = dao.getResource(1L); assertThat(resource.getPath()).isNull(); - assertThat(resource.getModuleKey()).isNull(); assertThat(resource.getName()).isEqualTo("Struts"); assertThat(resource.getLongName()).isEqualTo("Apache Struts"); assertThat(resource.getScope()).isEqualTo("PRJ"); @@ -88,11 +87,9 @@ public class ResourceDaoTest extends AbstractDaoTestCase { ResourceDto dir = dao.getResource(3L); assertThat(dir.getPath()).isEqualTo("src/org/struts"); - assertThat(dir.getModuleKey()).isEqualTo("org.struts:struts-core"); ResourceDto file = dao.getResource(4L); assertThat(file.getPath()).isEqualTo("src/org/struts/RequestContext.java"); - assertThat(file.getModuleKey()).isEqualTo("org.struts:struts-core"); } @Test |