"active_filters",
"active_rules",
"active_rule_changes",
+ "active_rule_notes",
"active_rule_parameters",
"active_rule_param_changes",
"alerts",
"resource_index",
"reviews",
"review_comments",
+ "rule_failures",
+ "rule_notes",
"rules",
"rules_categories",
"rules_parameters",
"rules_profiles",
- "rule_failures",
"schema_migrations",
"snapshots",
"snapshot_sources",
public final static int VERSION_UNKNOWN = -1;
- public static final int LAST_VERSION = 251;
+ public static final int LAST_VERSION = 252;
public static final int VERSION_2_13 = 241;
public final static String TABLE_NAME = "schema_migrations";
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('241');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('250');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('251');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('252');
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', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null);
ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
"REVIEW_ID" INTEGER
);
+CREATE TABLE "ACTIVE_RULE_NOTES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "ACTIVE_RULE_ID" INTEGER,
+ "USER_LOGIN" VARCHAR(40),
+ "DATA" BLOB(2147483647),
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP
+);
+
+CREATE TABLE "RULE_NOTES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "RULE_ID" INTEGER,
+ "USER_LOGIN" VARCHAR(40),
+ "DATA" BLOB(2147483647),
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP
+);
+
-- ----------------------------------------------
-- DDL Statements for indexes
CREATE INDEX "INDEX_ACTION_PLANS_REVIEWS_ON_REVIEW_ID" ON "ACTION_PLANS_REVIEWS" ("REVIEW_ID");
+CREATE INDEX "INDEX_ACTIVE_RULE_NOTES_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_NOTES" ("ACTIVE_RULE_ID");
+
+CREATE INDEX "INDEX_RULE_NOTES_ON_ACTIVE_RULE_ID" ON "RULE_NOTES" ("RULE_ID");
+
-- ----------------------------------------------
-- DDL Statements for keys
ALTER TABLE "LOADED_TEMPLATES" ADD CONSTRAINT "SQL110927104437650" PRIMARY KEY ("ID");
ALTER TABLE "ACTION_PLANS" ADD CONSTRAINT "SQL110927104447650" PRIMARY KEY ("ID");
+
+ALTER TABLE "ACTIVE_RULE_NOTES" ADD CONSTRAINT "SQL110927104847650" PRIMARY KEY ("ID");
+
+ALTER TABLE "RULE_NOTES" ADD CONSTRAINT "SQL110927184847650" PRIMARY KEY ("ID");
options[:priorities]=params[:priorities].split(',') if params[:priorities]
options[:status]=params[:status]
options[:searchtext]=params[:searchtext]
- options[:include_parameters]=true
+ options[:include_parameters_and_notes]=true
options[:inheritance]=params[:inheritance]
@rules = Rule.search(java_facade, {
:profile => @profile, :status => @status, :priorities => @priorities, :inheritance => @inheritance,
- :plugins => @plugins, :searchtext => @searchtext, :include_parameters => true, :language => @profile.language})
+ :plugins => @plugins, :searchtext => @searchtext, :include_parameters_and_notes => true, :language => @profile.language})
unless @searchtext.blank?
if @status==STATUS_ACTIVE
@hidden_inactives=Rule.search(java_facade, {
:profile => @profile, :status => STATUS_INACTIVE, :priorities => @priorities,
- :plugins => @plugins, :language => @profile.language, :searchtext => @searchtext, :include_parameters => false}).size
+ :plugins => @plugins, :language => @profile.language, :searchtext => @searchtext, :include_parameters_and_notes => false}).size
elsif @status==STATUS_INACTIVE
@hidden_actives=Rule.search(java_facade, {
:profile => @profile, :status => STATUS_ACTIVE, :priorities => @priorities,
- :plugins => @plugins, :language => @profile.language, :searchtext => @searchtext, :include_parameters => false}).size
+ :plugins => @plugins, :language => @profile.language, :searchtext => @searchtext, :include_parameters_and_notes => false}).size
end
end
belongs_to :rules_profile, :class_name => 'Profile', :foreign_key => 'profile_id'
belongs_to :rule
has_many :active_rule_parameters, :dependent => :destroy
+ has_one :active_rule_note
+ alias_attribute :note, :active_rule_note
def level
failure_level
--- /dev/null
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2012 SonarSource
+# 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 ActiveRuleNote < ActiveRecord::Base
+ belongs_to :active_rule
+ alias_attribute :text, :data
+
+ validates_presence_of :active_rule, :message => "can't be empty"
+ validates_presence_of :user_login, :message => "can't be empty"
+
+end
has_many :active_rules, :class_name => 'ActiveRule', :foreign_key => 'profile_id', :dependent => :destroy, :include => ['rule']
has_many :projects, :order => 'name asc'
has_many :active_rules_with_params, :class_name => 'ActiveRule', :foreign_key => 'profile_id',
- :include => ['active_rule_parameters']
+ :include => ['active_rule_parameters', 'active_rule_note']
validates_uniqueness_of :name, :scope => :language, :case_sensitive => false
validates_presence_of :name
has_many :rule_failures
has_many :active_rules
belongs_to :parent, :class_name => 'Rule', :foreign_key => 'parent_id'
+ has_one :rule_note
+ alias_attribute :note, :rule_note
def repository_key
plugin_name
values[:key] = searchtext
end
- includes=(options[:include_parameters] ? :rules_parameters : nil)
+ includes=(options[:include_parameters_and_notes] ? [:rules_parameters, :rule_note] : nil)
rules = Rule.find(:all, :include => includes, :conditions => [conditions.join(" AND "), values]).sort
filter(rules, options)
end
--- /dev/null
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2012 SonarSource
+# 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 RuleNote < ActiveRecord::Base
+ belongs_to :rule
+ alias_attribute :text, :data
+
+ validates_presence_of :rule, :message => "can't be empty"
+ validates_presence_of :user_login, :message => "can't be empty"
+
+end
page.toggle "desc_#{rule.id}"
end
%>
- <br/>
<div id="desc_<%= rule.id -%>" class="rule_desc" style="display:none">
- <%= rule.description %>
+ <span class="subtitle"><%= message('key') -%>: <%= rule.plugin_rule_key -%></span>
+ <div style="margin:8px 0px"><%= rule.description %></div>
<table style="margin: 10px 0">
<% rule.parameters.each do |parameter|
active_parameter = active_rule.active_param_by_param_id(parameter.id) if active_rule
:locals => {:parameter => parameter, :active_parameter => active_parameter, :profile => profile, :active_rule => active_rule, :is_admin => is_admin } %>
</tbody>
<% end %>
- <tr>
- <td width="10%" nowrap class="left"><%= message('key') -%>: </td>
- <td class="left"><%= rule.plugin_rule_key -%></td>
- </tr>
</table>
<% if is_admin %>
<% if rule.template? %>
--- /dev/null
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2012 SonarSource
+# 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
+#
+
+#
+# Sonar 2.14
+#
+class AddRuleAndActiveRuleNotes < ActiveRecord::Migration
+
+ def self.up
+ create_table :active_rule_notes do |t|
+ t.timestamps
+ t.column :active_rule_id, :integer, :null => true
+ t.column :user_login, :string, :null => true, :limit => 40
+ t.column :data, :binary, :null => true
+ end
+ add_index :active_rule_notes, :active_rule_id
+
+
+ create_table :rule_notes do |t|
+ t.timestamps
+ t.column :rule_id, :integer, :null => true
+ t.column :user_login, :string, :null => true, :limit => 40
+ t.column :data, :binary, :null => true
+ end
+ add_index :rule_notes, :rule_id
+ end
+
+end