]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6256 Drop dependencies.from_resource_id and dependencies.to_resource_id 235/head
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 21 Apr 2015 15:30:16 +0000 (17:30 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 21 Apr 2015 15:34:06 +0000 (17:34 +0200)
18 files changed:
server/sonar-server/src/main/java/org/sonar/server/db/migrations/MigrationSteps.java
server/sonar-server/src/main/java/org/sonar/server/db/migrations/v52/AddDependenciesComponentUuidColumns.java
server/sonar-server/src/main/java/org/sonar/server/db/migrations/v52/DropDependenciesComponentColumns.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/DropDependenciesComponentColumnsTest.java [new file with mode: 0644]
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/dependency_tree_controller.rb
server/sonar-web/src/main/webapp/WEB-INF/app/models/dependency.rb
server/sonar-web/src/main/webapp/WEB-INF/db/migrate/911_remove_dependencies_component_ids.rb [new file with mode: 0644]
sonar-batch/src/main/java/org/sonar/batch/index/DependencyPersister.java
sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
sonar-core/src/test/java/org/sonar/core/dependency/DependencyMapperTest.java
sonar-core/src/test/resources/org/sonar/core/dependency/DependencyMapperTest/fixture.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml
sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml
sonar-plugin-api/src/main/java/org/sonar/api/design/DependencyDto.java

index 127709ccafdd55a9ea49961561195e048c64873f..2da008de6de2c9d572062a0d9fb15dc64ee1dff0 100644 (file)
@@ -65,6 +65,7 @@ import org.sonar.server.db.migrations.v51.RemovePermissionsOnModulesMigrationSte
 import org.sonar.server.db.migrations.v51.RenameComponentRelatedParamsInIssueFilters;
 import org.sonar.server.db.migrations.v51.UpdateProjectsModuleUuidPath;
 import org.sonar.server.db.migrations.v52.AddDependenciesComponentUuidColumns;
+import org.sonar.server.db.migrations.v52.DropDependenciesComponentColumns;
 import org.sonar.server.db.migrations.v52.FeedDependenciesComponentUuids;
 import org.sonar.server.db.migrations.v52.FeedEventsComponentUuid;
 import org.sonar.server.db.migrations.v52.FeedProjectLinksComponentUuid;
@@ -139,6 +140,7 @@ public interface MigrationSteps {
     FeedEventsComponentUuid.class,
     MoveProjectProfileAssociation.class,
     AddDependenciesComponentUuidColumns.class,
-    FeedDependenciesComponentUuids.class
+    FeedDependenciesComponentUuids.class,
+    DropDependenciesComponentColumns.class
     );
 }
index 276cc572ab96b08e37e438d110c3bb971abdd408..e4f6d31c06189bc5094be5c3407f411ffe3afb33 100644 (file)
@@ -26,6 +26,8 @@ import org.sonar.server.db.migrations.DdlChange;
 
 import java.sql.SQLException;
 
+import static org.sonar.server.db.migrations.AddColumnsBuilder.ColumnDef.Type.STRING;
+
 /**
  * Add the following columns to the dependencies table :
  * - from_component_uuid
@@ -50,14 +52,14 @@ public class AddDependenciesComponentUuidColumns extends DdlChange {
       .addColumn(
         new AddColumnsBuilder.ColumnDef()
           .setName("from_component_uuid")
-          .setType(AddColumnsBuilder.ColumnDef.Type.STRING)
+          .setType(STRING)
           .setLimit(50)
           .setNullable(true)
       )
       .addColumn(
         new AddColumnsBuilder.ColumnDef()
           .setName("to_component_uuid")
-          .setType(AddColumnsBuilder.ColumnDef.Type.STRING)
+          .setType(STRING)
           .setLimit(50)
           .setNullable(true)
       )
diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v52/DropDependenciesComponentColumns.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v52/DropDependenciesComponentColumns.java
new file mode 100644 (file)
index 0000000..973d38a
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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.server.db.migrations.v52;
+
+import com.google.common.annotations.VisibleForTesting;
+import org.sonar.core.persistence.Database;
+import org.sonar.server.db.migrations.DdlChange;
+import org.sonar.server.db.migrations.DropColumnsBuilder;
+
+import java.sql.SQLException;
+
+/**
+ * Remove the following columns from the dependencies table :
+ * - from_resource_id
+ * - to_resource_id
+ */
+public class DropDependenciesComponentColumns extends DdlChange {
+
+  private final Database db;
+
+  public DropDependenciesComponentColumns(Database db) {
+    super(db);
+    this.db = db;
+  }
+
+  @Override
+  public void execute(Context context) throws SQLException {
+    context.execute(generateSql());
+  }
+
+  @VisibleForTesting
+  String generateSql() {
+    return new DropColumnsBuilder(db.getDialect(), "dependencies", "from_resource_id", "to_resource_id")
+      .build();
+  }
+
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/DropDependenciesComponentColumnsTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/DropDependenciesComponentColumnsTest.java
new file mode 100644 (file)
index 0000000..3147195
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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.server.db.migrations.v52;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.sonar.core.persistence.Database;
+import org.sonar.core.persistence.dialect.PostgreSql;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class DropDependenciesComponentColumnsTest {
+
+  DropDependenciesComponentColumns migration;
+
+  Database database;
+
+  @Before
+  public void setUp() throws Exception {
+    database = mock(Database.class);
+    migration = new DropDependenciesComponentColumns(database);
+  }
+
+  @Test
+  public void generate_sql_on_postgresql() throws Exception {
+    when(database.getDialect()).thenReturn(new PostgreSql());
+    assertThat(migration.generateSql()).isEqualTo(
+      "ALTER TABLE dependencies DROP COLUMN from_resource_id, DROP COLUMN to_resource_id"
+      );
+  }
+
+}
index 0d93e544c186294398d3844d1e170628e6323478..12222ce82fc7911d263e97c7d2902688c7e0c32a 100644 (file)
@@ -66,7 +66,7 @@ class Api::DependencyTreeController < Api::ApiController
       dependencies.each do |dep|
         hash={
           :did => dep.id.to_s,
-          :rid => dep.to_resource_id.to_s,
+          :rid => dep.to.id.to_s,
           :w => dep.weight,
           :u => dep.usage,
           :s => dep.to_scope,
index c6ff4617d0f4783459bf34abb87be8f66d0dca0b..7505640f1ca8b137c3f8ac66ad580d98f1ecfdee 100644 (file)
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 #
 class Dependency < ActiveRecord::Base
-  belongs_to :from, :class_name => 'Project', :foreign_key => 'from_resource_id'
+  belongs_to :from, :class_name => 'Project', :foreign_key => 'from_component_uuid', :primary_key => 'uuid'
   belongs_to :from_snapshot, :class_name => 'Snapshot', :foreign_key => 'from_snapshot_id'
 
-  belongs_to :to, :class_name => 'Project', :foreign_key => 'to_resource_id'
+  belongs_to :to, :class_name => 'Project', :foreign_key => 'to_component_uuid', :primary_key => 'uuid'
   belongs_to :to_snapshot, :class_name => 'Snapshot', :foreign_key => 'to_snapshot_id'
 
   belongs_to :project, :class_name => 'Project', :foreign_key => 'project_id'
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/911_remove_dependencies_component_ids.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/911_remove_dependencies_component_ids.rb
new file mode 100644 (file)
index 0000000..623c6e3
--- /dev/null
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+#
+# SonarQube 5.2
+# SONAR-6256
+#
+class RemoveDependenciesComponentIds < ActiveRecord::Migration
+
+  def self.up
+    execute_java_migration('org.sonar.server.db.migrations.v52.DropDependenciesComponentColumns')
+  end
+
+end
index 13c73e278f5b39cee451862f1160352ff051f644..c882eb9ef68b2bc64aa35be5de891adfa0a69176 100644 (file)
@@ -64,11 +64,11 @@ public final class DependencyPersister {
     model.setUsage(dependency.getUsage());
     model.setWeight(dependency.getWeight());
 
-    model.setFromResourceId(fromResource.resource().getId());
+    model.setFromComponentUuid(fromResource.resource().getUuid());
     model.setFromScope(fromResource.resource().getScope());
     model.setFromSnapshotId(fromResource.snapshotId());
 
-    model.setToResourceId(toResource.resource().getId());
+    model.setToComponentUuid(toResource.resource().getUuid());
     model.setToScope(toResource.resource().getScope());
     model.setToSnapshotId(toResource.snapshotId());
 
index 87410d7a8cb7392f851f17df67ba86e64498d8f8..531a662b6bffdc4a9bb89e3afc9963b970b02378 100644 (file)
@@ -33,7 +33,7 @@ import java.util.List;
  */
 public class DatabaseVersion implements BatchComponent, ServerComponent {
 
-  public static final int LAST_VERSION = 910;
+  public static final int LAST_VERSION = 911;
 
   /**
    * List of all the tables.n
index 1f19a2ff695a5b1d0ea80b3b7aa844a0d0a9b62b..97fa66aea45b7735bba9fad5d6610a51f98979e1 100644 (file)
@@ -334,6 +334,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('907');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('908');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('909');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('910');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('911');
 
 INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482', null, null);
 ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
index 78b7586205d5318cffd40c29936092ffec673e56..77e26efde37177917e03afe2bbfc84193acc3149 100644 (file)
@@ -6,10 +6,8 @@ CREATE TABLE "GROUPS_USERS" (
 CREATE TABLE "DEPENDENCIES" (
   "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
   "FROM_SNAPSHOT_ID" INTEGER,
-  "FROM_RESOURCE_ID" INTEGER,
   "FROM_COMPONENT_UUID" VARCHAR(50),
   "TO_SNAPSHOT_ID" INTEGER,
-  "TO_RESOURCE_ID" INTEGER,
   "TO_COMPONENT_UUID" VARCHAR(50),
   "DEP_USAGE" VARCHAR(30),
   "DEP_WEIGHT" INTEGER,
index 5c16ce4108e52e7a99aa8b4ac0af1eaec48b9301..e42fa5ff68d9384e933bc8fda27da32f5caa6bd3 100644 (file)
@@ -22,32 +22,46 @@ package org.sonar.core.dependency;
 import com.google.common.collect.Lists;
 import org.apache.ibatis.session.ResultContext;
 import org.apache.ibatis.session.ResultHandler;
-import org.apache.ibatis.session.SqlSession;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
 import org.junit.Test;
-import org.sonar.core.persistence.AbstractDaoTestCase;
-import org.sonar.core.persistence.MyBatis;
+import org.sonar.core.persistence.DbSession;
+import org.sonar.core.persistence.DbTester;
 
 import java.util.List;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class DependencyMapperTest extends AbstractDaoTestCase {
+public class DependencyMapperTest {
+
+  @ClassRule
+  public static DbTester dbtester = new DbTester();
+
+  DbSession session;
+
+  @Before
+  public void setUp() throws Exception {
+    dbtester.truncateTables();
+    session = dbtester.myBatis().openSession(false);
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    session.close();
+  }
+
   @Test
-  public void should_find_all() {
-    setupData("fixture");
+  public void select_all_dependencies() {
+    dbtester.prepareDbUnit(getClass(), "fixture.xml");
 
     final List<DependencyDto> dependencies = Lists.newArrayList();
 
-    SqlSession session = getMyBatis().openSession();
-    try {
-      session.getMapper(DependencyMapper.class).selectAll(new ResultHandler() {
-        public void handleResult(ResultContext context) {
-          dependencies.add((DependencyDto) context.getResultObject());
-        }
-      });
-    } finally {
-      MyBatis.closeQuietly(session);
-    }
+    session.getMapper(DependencyMapper.class).selectAll(new ResultHandler() {
+      public void handleResult(ResultContext context) {
+        dependencies.add((DependencyDto) context.getResultObject());
+      }
+    });
 
     assertThat(dependencies).hasSize(2);
 
index 7e8a8e9f677dcca2e235391b329a3384799e2fbd..f190e3a42215c465563d6951074b124a3545258f 100644 (file)
@@ -1,4 +1,4 @@
 <dataset>
-  <dependencies id="1" from_resource_id="100" to_resource_id="101" from_snapshot_id="1000" to_snapshot_id="1001" dep_usage="compile" dep_weight="1" />
-  <dependencies id="2" from_resource_id="200" to_resource_id="201" from_snapshot_id="2000" to_snapshot_id="2001" dep_usage="provided" dep_weight="1" />
-</dataset>
\ No newline at end of file
+  <dependencies id="1" from_component_uuid="ABCD" to_component_uuid="EFGH" from_snapshot_id="1000" to_snapshot_id="1001" dep_usage="compile" dep_weight="1" />
+  <dependencies id="2" from_component_uuid="DCBA" to_component_uuid="HGFE" from_snapshot_id="2000" to_snapshot_id="2001" dep_usage="provided" dep_weight="1" />
+</dataset>
index 9a0a675bc2429ba5195ea1e8f07cccce64b469e2..286d4dd8447fdf681d5441a47bdca2f5a7127ff0 100644 (file)
@@ -22,7 +22,7 @@
                     person_id="[null]"
                     text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
                     alert_status="[null]" description="[null]" measure_data="[null]"/>
-  <dependencies id="1" from_resource_id="1" from_component_uuid="A" from_snapshot_id="1" to_resource_id="30" to_component_uuid="CC" to_snapshot_id="30"
+  <dependencies id="1" from_component_uuid="A" from_snapshot_id="1" to_component_uuid="CC" to_snapshot_id="30"
                 parent_dependency_id="[null]" project_snapshot_id="1"
                 dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
   <events id="1" name="Version 1.0" component_uuid="1" snapshot_id="1" category="VERSION" description="[null]"
index 4c5a6d70b1ca4d06376978c6630102092a854d80..a6280de86f87602260dd6f1d146cb5a9c4dc9397 100644 (file)
@@ -21,7 +21,7 @@
                     person_id="[null]"
                     text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
                     alert_status="[null]" description="[null]" measure_data="[null]"/>
-  <dependencies id="1" from_resource_id="1" from_component_uuid="A" from_snapshot_id="1" to_resource_id="30" to_component_uuid="CC" to_snapshot_id="30"
+  <dependencies id="1" from_component_uuid="A" from_snapshot_id="1" to_component_uuid="CC" to_snapshot_id="30"
                 parent_dependency_id="[null]" project_snapshot_id="1"
                 dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
   <events id="1" name="Version 1.0" component_uuid="1" snapshot_id="1" category="VERSION" description="[null]"
                     person_id="[null]"
                     text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
                     alert_status="[null]" description="[null]" measure_data="[null]"/>
-  <dependencies id="2" from_resource_id="10" from_component_uuid="AA" from_snapshot_id="10" to_resource_id="5" to_component_uuid="E" to_snapshot_id="5"
+  <dependencies id="2" from_component_uuid="AA" from_snapshot_id="10" to_component_uuid="E" to_snapshot_id="5"
                 parent_dependency_id="[null]" project_snapshot_id="5"
                 dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
-  <dependencies id="3" from_resource_id="5" from_component_uuid="C" from_snapshot_id="5" to_resource_id="300" to_component_uuid="CCC" to_snapshot_id="300"
+  <dependencies id="3" from_component_uuid="C" from_snapshot_id="5" to_component_uuid="CCC" to_snapshot_id="300"
                 parent_dependency_id="[null]" project_snapshot_id="5"
                 dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
   <events id="2" name="Version 1.0" component_uuid="5" snapshot_id="5" category="VERSION" description="[null]"
index 92b18f08cf74cf090bdbe8bd8cfce242c6545e9c..1a70186c778fead79907fb0eaadddb59390271b8 100644 (file)
@@ -72,11 +72,11 @@ Note that measures, events and reviews are not deleted.
                     text_value="[null]" tendency="[null]" measure_date="[null]" alert_status="[null]"
                     description="[null]" measure_data="[null]"/>
 
-  <dependencies id="3" from_resource_id="33" from_component_uuid="CC" from_snapshot_id="33" to_resource_id="44" to_component_uuid="DD" to_snapshot_id="44"
+  <dependencies id="3" from_component_uuid="CC" from_snapshot_id="33" to_component_uuid="DD" to_snapshot_id="44"
                 parent_dependency_id="[null]" project_snapshot_id="[null]"
                 dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
 
-  <dependencies id="4" from_resource_id="55" from_component_uuid="EE" from_snapshot_id="55" to_resource_id="66" to_component_uuid="FF" to_snapshot_id="66"
+  <dependencies id="4" from_component_uuid="EE" from_snapshot_id="55" to_component_uuid="FF" to_snapshot_id="66"
                 parent_dependency_id="[null]" project_snapshot_id="2"
                 dep_usage="USES" dep_weight="1" from_scope="LIB" to_scope="PRJ"/>
 
index 7881def58d335406a5afdffd5043e219d85b11a1..2aa70e077c01448f3bedef8711f058f195cb04af 100644 (file)
                     tendency="[null]" measure_date="[null]" alert_status="[null]" description="[null]"
                     measure_data="[null]"/>
 
-  <dependencies id="1" from_resource_id="1" from_component_uuid="A" from_snapshot_id="1" to_resource_id="2" to_component_uuid="B" to_snapshot_id="2"
+  <dependencies id="1" from_component_uuid="A" from_snapshot_id="1" to_component_uuid="B" to_snapshot_id="2"
                 parent_dependency_id="[null]" project_snapshot_id="[null]"
                 dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
 
-  <dependencies id="2" from_resource_id="3" from_component_uuid="C" from_snapshot_id="3" to_resource_id="1" to_component_uuid="A" to_snapshot_id="1"
+  <dependencies id="2" from_component_uuid="C" from_snapshot_id="3" to_component_uuid="A" to_snapshot_id="1"
                 parent_dependency_id="[null]" project_snapshot_id="2"
                 dep_usage="USES" dep_weight="1" from_scope="LIB" to_scope="PRJ"/>
 
                     text_value="[null]" tendency="[null]" measure_date="[null]" alert_status="[null]"
                     description="[null]" measure_data="[null]"/>
 
-  <dependencies id="3" from_resource_id="33" from_component_uuid="CC" from_snapshot_id="33" to_resource_id="44" to_component_uuid="DD" to_snapshot_id="44"
+  <dependencies id="3" from_component_uuid="CC" from_snapshot_id="33" to_component_uuid="DD" to_snapshot_id="44"
                 parent_dependency_id="[null]" project_snapshot_id="[null]"
                 dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
 
-  <dependencies id="4" from_resource_id="55" from_component_uuid="EE" from_snapshot_id="55" to_resource_id="66" to_component_uuid="FF" to_snapshot_id="66"
+  <dependencies id="4" from_component_uuid="EE" from_snapshot_id="55" to_component_uuid="FF" to_snapshot_id="66"
                 parent_dependency_id="[null]" project_snapshot_id="2"
                 dep_usage="USES" dep_weight="1" from_scope="LIB" to_scope="PRJ"/>
 
index 80075f7ee0c775dae7a8d8d96abd788fd35dabb5..5e575bc09e29770fff67fbbdf8e8f7448e0c7d7c 100644 (file)
@@ -24,7 +24,11 @@ import org.apache.commons.lang.builder.HashCodeBuilder;
 import org.apache.commons.lang.builder.ReflectionToStringBuilder;
 import org.apache.commons.lang.builder.ToStringStyle;
 
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
 
 @Entity
 @Table(name = "dependencies")
@@ -38,8 +42,8 @@ public class DependencyDto {
   @Column(name = "from_snapshot_id", updatable = true, nullable = false)
   private Integer fromSnapshotId;
 
-  @Column(name = "from_resource_id", updatable = true, nullable = false)
-  private Integer fromResourceId;
+  @Column(name = "from_component_uuid", updatable = true, nullable = false)
+  private String fromComponentUuid;
 
   @Column(name = "from_scope", updatable = true, nullable = true)
   private String fromScope;
@@ -47,8 +51,8 @@ public class DependencyDto {
   @Column(name = "to_snapshot_id", updatable = true, nullable = false)
   private Integer toSnapshotId;
 
-  @Column(name = "to_resource_id", updatable = true, nullable = false)
-  private Integer toResourceId;
+  @Column(name = "to_component_uuid", updatable = true, nullable = false)
+  private String toComponentUuid;
 
   @Column(name = "to_scope", updatable = true, nullable = true)
   private String toScope;
@@ -82,12 +86,12 @@ public class DependencyDto {
     return this;
   }
 
-  public Integer getFromResourceId() {
-    return fromResourceId;
+  public String getFromComponentUuid() {
+    return fromComponentUuid;
   }
 
-  public DependencyDto setFromResourceId(Integer fromResourceId) {
-    this.fromResourceId = fromResourceId;
+  public DependencyDto setFromComponentUuid(String fromComponentUuid) {
+    this.fromComponentUuid = fromComponentUuid;
     return this;
   }
 
@@ -100,12 +104,12 @@ public class DependencyDto {
     return this;
   }
 
-  public Integer getToResourceId() {
-    return toResourceId;
+  public String getToComponentUuid() {
+    return toComponentUuid;
   }
 
-  public DependencyDto setToResourceId(Integer toResourceId) {
-    this.toResourceId = toResourceId;
+  public DependencyDto setToComponentUuid(String toComponentUuid) {
+    this.toComponentUuid = toComponentUuid;
     return this;
   }