diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-08 20:29:03 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-08 20:29:03 +0000 |
commit | 0dd067a3efa7f4821fcc4643850b69ba8ac94137 (patch) | |
tree | 9aed96ae5de33d24c267739dfa3bb18b47ddb406 | |
parent | 39b5479f0e61ceb731990eefa8df81306eb6f571 (diff) | |
download | sonarqube-0dd067a3efa7f4821fcc4643850b69ba8ac94137.tar.gz sonarqube-0dd067a3efa7f4821fcc4643850b69ba8ac94137.zip |
add CHARACTERISTICS.DESCRIPTION
10 files changed, 63 insertions, 21 deletions
diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java index 5549aeff502..f258d01481f 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java +++ b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java @@ -30,7 +30,7 @@ import javax.persistence.*; public class SchemaMigration { public final static int VERSION_UNKNOWN = -1; - public static final int LAST_VERSION = 137; + public static final int LAST_VERSION = 138; public final static String TABLE_NAME = "schema_migrations"; diff --git a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/noDefinitionsToRegister-result.xml b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/noDefinitionsToRegister-result.xml index 7635d06bd99..e1f6a9edc04 100644 --- a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/noDefinitionsToRegister-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/noDefinitionsToRegister-result.xml @@ -2,9 +2,9 @@ <quality_models id="1" name="M1" /> <quality_models id="2" name="M2" /> - <characteristics id="1" kee="M1C1" name="M1C1" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" /> - <characteristics id="2" kee="M1C2" name="M1C2" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="2" /> - <characteristics id="3" kee="M2C1" name="M2C1" quality_model_id="2" rule_id="[null]" characteristic_order="1" depth="1"/> + <characteristics id="1" kee="M1C1" name="M1C1" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" description="[null]" /> + <characteristics id="2" kee="M1C2" name="M1C2" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="2" description="[null]" /> + <characteristics id="3" kee="M2C1" name="M2C1" quality_model_id="2" rule_id="[null]" characteristic_order="1" depth="1" description="[null]"/> <characteristic_edges child_id="2" parent_id="1"/> </dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/registerOnlyNewDefinitions-result.xml b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/registerOnlyNewDefinitions-result.xml index 0477a531971..a33aec7b5e5 100644 --- a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/registerOnlyNewDefinitions-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/registerOnlyNewDefinitions-result.xml @@ -5,9 +5,9 @@ <!-- NEW MODEL --> <quality_models id="3" name="NEWMODEL" /> - <characteristics id="1" kee="M1C1" name="M1C1" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" /> - <characteristics id="2" kee="M1C2" name="M1C2" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="2" /> - <characteristics id="3" kee="M2C1" name="M2C1" quality_model_id="2" rule_id="[null]" characteristic_order="1" depth="1"/> + <characteristics id="1" kee="M1C1" name="M1C1" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" description="[null]" /> + <characteristics id="2" kee="M1C2" name="M1C2" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="2" description="[null]" /> + <characteristics id="3" kee="M2C1" name="M2C1" quality_model_id="2" rule_id="[null]" characteristic_order="1" depth="1" description="[null]"/> <characteristic_edges child_id="2" parent_id="1"/> </dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/reset-result.xml b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/reset-result.xml index 91c5773b8ff..4eaeb3441d9 100644 --- a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/reset-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/reset-result.xml @@ -3,12 +3,12 @@ <quality_models id="2" name="M2" /> <quality_models id="3" name="M1" /> - <!--<characteristics id="1" kee="M1C1" name="M1C1" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" />--> - <!--<characteristics id="2" kee="M1C2" name="M1C2" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="2" />--> - <characteristics id="3" kee="M2C1" name="M2C1" quality_model_id="2" rule_id="[null]" characteristic_order="1" depth="1" /> - <characteristics id="4" kee="NEWM1C1A" name="NEWM1C1A" quality_model_id="3" rule_id="[null]" characteristic_order="1" depth="2"/> - <characteristics id="5" kee="NEWM1C1" name="NEWM1C1" quality_model_id="3" rule_id="[null]" characteristic_order="1" depth="1"/> - <characteristics id="6" kee="NEWM1C2" name="NEWM1C2" quality_model_id="3" rule_id="[null]" characteristic_order="2" depth="1"/> + <!--<characteristics id="1" kee="M1C1" name="M1C1" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" description="[null]" />--> + <!--<characteristics id="2" kee="M1C2" name="M1C2" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="2" description="[null]"/>--> + <characteristics id="3" kee="M2C1" name="M2C1" quality_model_id="2" rule_id="[null]" characteristic_order="1" depth="1" description="[null]" /> + <characteristics id="4" kee="NEWM1C1A" name="NEWM1C1A" quality_model_id="3" rule_id="[null]" characteristic_order="1" depth="2" description="[null]"/> + <characteristics id="5" kee="NEWM1C1" name="NEWM1C1" quality_model_id="3" rule_id="[null]" characteristic_order="1" depth="1" description="[null]"/> + <characteristics id="6" kee="NEWM1C2" name="NEWM1C2" quality_model_id="3" rule_id="[null]" characteristic_order="2" depth="1" description="[null]"/> <!--<characteristic_edges child_id="2" parent_id="1"/>--> <characteristic_edges child_id="4" parent_id="5"/> diff --git a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/shared.xml index 7635d06bd99..e1f6a9edc04 100644 --- a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/shared.xml +++ b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelProviderTest/shared.xml @@ -2,9 +2,9 @@ <quality_models id="1" name="M1" /> <quality_models id="2" name="M2" /> - <characteristics id="1" kee="M1C1" name="M1C1" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" /> - <characteristics id="2" kee="M1C2" name="M1C2" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="2" /> - <characteristics id="3" kee="M2C1" name="M2C1" quality_model_id="2" rule_id="[null]" characteristic_order="1" depth="1"/> + <characteristics id="1" kee="M1C1" name="M1C1" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" description="[null]" /> + <characteristics id="2" kee="M1C2" name="M1C2" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="2" description="[null]" /> + <characteristics id="3" kee="M2C1" name="M2C1" quality_model_id="2" rule_id="[null]" characteristic_order="1" depth="1" description="[null]"/> <characteristic_edges child_id="2" parent_id="1"/> </dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/saveModelAndCharacteristics.xml b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/saveModelAndCharacteristics.xml index 693d4448b8d..7c9b11d41a8 100644 --- a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/saveModelAndCharacteristics.xml +++ b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/saveModelAndCharacteristics.xml @@ -1,4 +1,4 @@ <dataset> <quality_models id="1" name="initial" /> - <characteristics id="1" kee="FAKE" name="fake" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" /> + <characteristics id="1" kee="FAKE" name="fake" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" description="[null]" /> </dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testGraphOfCharacteristics.xml b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testGraphOfCharacteristics.xml index 70a69a6a1ba..c0dc6f60071 100644 --- a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testGraphOfCharacteristics.xml +++ b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testGraphOfCharacteristics.xml @@ -1,8 +1,8 @@ <dataset> <quality_models id="1" name="initial" /> - <characteristics id="1" kee="FAKE1" name="fake1" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1"/> - <characteristics id="2" kee="FAKE2" name="fake2" quality_model_id="1" rule_id="[null]" characteristic_order="2" depth="1" /> + <characteristics id="1" kee="FAKE1" name="fake1" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" description="[null]"/> + <characteristics id="2" kee="FAKE2" name="fake2" quality_model_id="1" rule_id="[null]" characteristic_order="2" depth="1" description="[null]" /> <characteristic_edges child_id="2" parent_id="1"/> </dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testTreeOfCharacteristics.xml b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testTreeOfCharacteristics.xml index 6dcd2a78d63..2b3b22aaf38 100644 --- a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testTreeOfCharacteristics.xml +++ b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testTreeOfCharacteristics.xml @@ -1,5 +1,5 @@ <dataset> <quality_models id="1" name="initial" /> - <characteristics id="1" kee="FAKE" name="fake" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" /> + <characteristics id="1" kee="FAKE" name="fake" quality_model_id="1" rule_id="[null]" characteristic_order="1" depth="1" description="[null]" /> <characteristic_edges child_id="1" parent_id="1"/> </dataset>
\ No newline at end of file diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Characteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Characteristic.java index 22bf78e2b3b..ba09013cb23 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Characteristic.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Characteristic.java @@ -26,8 +26,10 @@ import org.hibernate.annotations.Sort; import org.hibernate.annotations.SortType; import org.sonar.api.rules.Rule; -import java.util.*; import javax.persistence.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; /** * @since 2.3 @@ -63,6 +65,9 @@ public final class Characteristic implements Comparable<Characteristic> { @JoinColumn(name = "rule_id") private Rule rule; + @Column(name = "description", nullable = true, length = 4000) + private String description; + @ManyToMany @JoinTable( @@ -211,6 +216,15 @@ public final class Characteristic implements Comparable<Characteristic> { return this; } + public String getDescription() { + return description; + } + + public Characteristic setDescription(String s) { + this.description = s; + return this; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -243,6 +257,7 @@ public final class Characteristic implements Comparable<Characteristic> { .append("key", key) .append("name", name) .append("rule", rule) + .append("description", description) .toString(); } diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/138_add_characteristic_description.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/138_add_characteristic_description.rb new file mode 100644 index 00000000000..88f1f5147af --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/138_add_characteristic_description.rb @@ -0,0 +1,27 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2009 SonarSource SA +# mailto:contact AT sonarsource DOT com +# +# Sonar 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. +# +# Sonar 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 Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# +class AddCharacteristicDescription < ActiveRecord::Migration + + def self.up + add_column 'characteristics', 'description', :string, :null => true, :limit => 4000 + Characteristic.reset_column_information + end + +end |