*/
public class DatabaseVersion implements BatchComponent, ServerComponent {
- public static final int LAST_VERSION = 361;
+ public static final int LAST_VERSION = 362;
public static enum Status {
UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('2');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('10');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('11');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('13');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('14');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('16');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('35');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('36');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('39');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('41');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('46');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('48');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('49');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('51');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('52');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('53');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('54');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('55');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('57');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('58');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('59');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('60');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('61');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('62');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('66');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('68');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('69');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('72');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('73');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('75');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('76');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('77');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('78');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('79');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('80');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('81');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('82');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('84');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('85');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('86');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('87');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('88');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('89');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('90');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('91');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('92');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('93');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('94');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('95');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('96');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('97');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('98');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('99');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('100');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('101');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('110');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('111');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('112');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('113');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('114');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('115');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('116');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('117');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('118');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('119');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('120');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('354');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('355');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('356');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('357');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('358');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('359');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('360');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('361');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('362');
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;
@require_links
end
+ def require_authentication?
+ criteria[:onFavourites]=='true'
+ end
+
def criteria(key=nil)
@criteria ||= HashWithIndifferentAccess.new
if key
+++ /dev/null
-#
-# Sonar, open source software quality management 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 3.4
-#
-class MoveExistingMeasureFilters < ActiveRecord::Migration
-
- # the new table
- class MeasureFilter < ActiveRecord::Base
- end
-
- # the old tables
- class FilterColumn < ActiveRecord::Base
- set_table_name 'filter_columns'
- end
- class Criteria < ActiveRecord::Base
- set_table_name 'criteria'
- end
- class Resource < ActiveRecord::Base
- set_table_name 'projects'
- end
- class OldFilter < ActiveRecord::Base
- set_table_name 'filters'
- end
-
- def self.up
- old_filters = OldFilter.find(:all)
- say_with_time "Moving #{old_filters.size} measure filters" do
- old_filters.each do |old_filter|
- move(old_filter)
- end
- end
- end
-
- private
-
- def self.move(old_filter)
- new_filter = MeasureFilter.new
- new_filter.name = old_filter.name
- new_filter.user_id = old_filter.user_id
- new_filter.shared = (old_filter.shared || old_filter.user_id.nil?)
- data = []
- data << 'onFavourites=true' if old_filter.favourites
- data << "baseId=#{old_filter.resource_id}" if old_filter.resource_id
- data << "pageSize=#{old_filter.page_size}" if old_filter.page_size
- data << "display=#{old_filter.default_view || 'list'}"
-
- move_columns(old_filter, data)
- move_criteria(old_filter, data)
-
- new_filter.data = data.join('|') unless data.empty?
- new_filter.save
- Filter.delete(old_filter.id)
- end
-
- def self.move_columns(old_filter, data)
- columns = []
- asc = nil
- sort = nil
- old_columns = FilterColumn.find(:all, :conditions => ['filter_id=?', old_filter.id], :order => 'order_index')
- old_columns.each do |old_column|
- column_key = old_column.family
- if old_column.kee
- column_key += ":#{old_column.kee}"
- column_key += ":#{old_filter.period_index}" if old_column.variation && old_filter.period_index
- end
- columns << column_key
- if old_column.sort_direction=='ASC'
- asc = true
- sort = column_key
- elsif old_column.sort_direction=='DESC'
- asc = false
- sort = column_key
- end
- end
- data << "cols=#{columns.join(',')}" unless columns.empty?
- if sort
- data << "sort=#{sort}"
- data << "asc=#{asc}"
- end
- end
-
- def self.move_criteria(old_filter, data)
- old_criteria = Criteria.find(:all, :conditions => ['filter_id=?', old_filter.id])
- metric_criteria_id=1
-
- old_criteria.each do |old|
- if old.family=='qualifier' && old.text_value.present?
- data << "qualifiers=#{old.text_value}"
- elsif old.family=='name' && old.text_value.present?
- data << "nameSearch=#{old.text_value}"
- elsif old.family=='key' && old.text_value.present?
- data << "keyRegexp=#{old.text_value}"
- elsif old.family=='language' && old.text_value.present?
- data << "languages=#{old.text_value}"
- elsif old.family=='date' && old.value && old.operator.present?
- data << "ageMaxDays=#{old.value}" if old.operator=='<'
- data << "ageMinDays=#{old.value}" if old.operator=='>'
- elsif old.family=='metric' && old.kee && old.operator && old.value
- data << "c#{metric_criteria_id}_metric=#{old.kee}"
- data << "c#{metric_criteria_id}_op=#{operator_code(old.operator)}"
- data << "c#{metric_criteria_id}_val=#{old.value}"
- data << "c#{metric_criteria_id}_period=#{old_filter.period_index}" if old_filter.period_index
- metric_criteria_id += 1
- elsif old.family=='direct-children' && old.text_value=='true'
- data << "onBaseComponents=true"
- end
- end
- end
-
- def self.operator_code(old_operator)
- case old_operator
- when '='
- 'eq'
- when '<'
- 'lt'
- when '<='
- 'lte'
- when '>'
- 'gt'
- when '>='
- 'gte'
- else
- 'eq'
- end
- end
-end
--- /dev/null
+#
+# Sonar, open source software quality management 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 3.4
+#
+class MoveExistingMeasureFilters < ActiveRecord::Migration
+
+ # the new table
+ class MeasureFilter < ActiveRecord::Base
+ end
+
+ # the old tables
+ class FilterColumn < ActiveRecord::Base
+ set_table_name 'filter_columns'
+ end
+ class Criteria < ActiveRecord::Base
+ set_table_name 'criteria'
+ end
+ class Resource < ActiveRecord::Base
+ set_table_name 'projects'
+ end
+ class OldFilter < ActiveRecord::Base
+ set_table_name 'filters'
+ end
+
+ def self.up
+ old_filters = OldFilter.find(:all)
+ say_with_time "Moving #{old_filters.size} measure filters" do
+ old_filters.each do |old_filter|
+ move(old_filter)
+ end
+ end
+ end
+
+ private
+
+ def self.move(old_filter)
+ new_filter = MeasureFilter.new
+ new_filter.name = old_filter.name
+ new_filter.user_id = old_filter.user_id
+ new_filter.shared = (old_filter.shared || old_filter.user_id.nil?)
+ data = []
+ data << 'onFavourites=true' if old_filter.favourites
+ data << "baseId=#{old_filter.resource_id}" if old_filter.resource_id
+ data << "pageSize=#{old_filter.page_size}" if old_filter.page_size
+ data << "display=#{old_filter.default_view || 'list'}"
+
+ move_columns(old_filter, data)
+ move_criteria(old_filter, data)
+
+ new_filter.data = data.join('|') unless data.empty?
+ new_filter.save
+ end
+
+ def self.move_columns(old_filter, data)
+ columns = []
+ asc = nil
+ sort = nil
+ old_columns = FilterColumn.find(:all, :conditions => ['filter_id=?', old_filter.id], :order => 'order_index')
+ old_columns.each do |old_column|
+ column_key = old_column.family
+ if old_column.kee
+ column_key += ":#{old_column.kee}"
+ column_key += ":#{old_filter.period_index}" if old_column.variation && old_filter.period_index
+ end
+ columns << column_key
+ if old_column.sort_direction=='ASC'
+ asc = true
+ sort = column_key
+ elsif old_column.sort_direction=='DESC'
+ asc = false
+ sort = column_key
+ end
+ end
+ data << "cols=#{columns.join(',')}" unless columns.empty?
+ if sort
+ data << "sort=#{sort}"
+ data << "asc=#{asc}"
+ end
+ end
+
+ def self.move_criteria(old_filter, data)
+ old_criteria = Criteria.find(:all, :conditions => ['filter_id=?', old_filter.id])
+ metric_criteria_id=1
+
+ old_criteria.each do |old|
+ if old.family=='qualifier' && old.text_value.present?
+ data << "qualifiers=#{old.text_value}"
+ elsif old.family=='name' && old.text_value.present?
+ data << "nameSearch=#{old.text_value}"
+ elsif old.family=='key' && old.text_value.present?
+ data << "keyRegexp=#{old.text_value}"
+ elsif old.family=='language' && old.text_value.present?
+ data << "languages=#{old.text_value}"
+ elsif old.family=='date' && old.value && old.operator.present?
+ data << "ageMaxDays=#{old.value}" if old.operator=='<'
+ data << "ageMinDays=#{old.value}" if old.operator=='>'
+ elsif old.family=='metric' && old.kee && old.operator && old.value
+ data << "c#{metric_criteria_id}_metric=#{old.kee}"
+ data << "c#{metric_criteria_id}_op=#{operator_code(old.operator)}"
+ data << "c#{metric_criteria_id}_val=#{old.value}"
+ data << "c#{metric_criteria_id}_period=#{old_filter.period_index}" if old_filter.period_index
+ metric_criteria_id += 1
+ elsif old.family=='direct-children' && old.text_value=='true'
+ data << "onBaseComponents=true"
+ end
+ end
+ end
+
+ def self.operator_code(old_operator)
+ case old_operator
+ when '='
+ 'eq'
+ when '<'
+ 'lt'
+ when '<='
+ 'lte'
+ when '>'
+ 'gt'
+ when '>='
+ 'gte'
+ else
+ 'eq'
+ end
+ end
+end
+++ /dev/null
-#
-# Sonar, open source software quality management 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 3.4
-#
-class MoveFilterWidgets < ActiveRecord::Migration
-
- class MeasureFilter < ActiveRecord::Base
- end
-
- class OldFilter < ActiveRecord::Base
- set_table_name :filters
- end
-
- class Widget < ActiveRecord::Base
- end
-
- class WidgetProperty < ActiveRecord::Base
- end
-
- class Dashboard < ActiveRecord::Base
- end
-
- def self.up
- widgets = Widget.find(:all, :conditions => ["widget_key='filter'"])
- say_with_time "Updading #{widgets.size} widgets" do
- widgets.each do |widget|
- dashboard = Dashboard.find_by_id(widget.dashboard_id)
- widget_property = WidgetProperty.find(:first, :conditions => {:widget_id => widget.id, :kee => 'filter'})
- if dashboard && widget_property && widget_property.text_value
- old_filter = OldFilter.find_by_kee(widget_property.text_value)
- if old_filter
- filter = MeasureFilter.find(:first, :conditions => ['name=? and user_id=?', old_filter.name, old_filter.user_id]) if old_filter.user_id
- filter = MeasureFilter.find(:first, :conditions => ['name=? and user_id is null', old_filter.name]) unless filter
- if filter
- widget_property.text_value = filter.id.to_s
- widget_property.save
- widget.widget_key = (filter.data.include?('display=treemap') ? 'measure_filter_treemap' : 'measure_filter_list')
- widget.save
- end
- end
- end
- end
- end
- end
-end
+++ /dev/null
-#
-# Sonar, open source software quality management 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 3.4
-#
-class DropFilterTables < ActiveRecord::Migration
-
- def self.up
- drop_table('filter_columns')
- drop_table('criteria')
- drop_table('filters')
- end
-
-end
--- /dev/null
+#
+# Sonar, open source software quality management 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 3.4
+#
+class MoveFilterWidgets < ActiveRecord::Migration
+
+ class MeasureFilter < ActiveRecord::Base
+ end
+
+ class OldFilter < ActiveRecord::Base
+ set_table_name :filters
+ end
+
+ class Widget < ActiveRecord::Base
+ end
+
+ class WidgetProperty < ActiveRecord::Base
+ end
+
+ class Dashboard < ActiveRecord::Base
+ end
+
+ def self.up
+ widgets = Widget.find(:all, :conditions => ["widget_key='filter'"])
+ say_with_time "Updading #{widgets.size} widgets" do
+ widgets.each do |widget|
+ dashboard = Dashboard.find_by_id(widget.dashboard_id)
+ widget_property = WidgetProperty.find(:first, :conditions => {:widget_id => widget.id, :kee => 'filter'})
+ if dashboard && widget_property && widget_property.text_value
+ old_filter = OldFilter.find_by_kee(widget_property.text_value)
+ if old_filter
+ filter = MeasureFilter.find(:first, :conditions => ['name=? and user_id=?', old_filter.name, old_filter.user_id]) if old_filter.user_id
+ filter = MeasureFilter.find(:first, :conditions => ['name=? and user_id is null', old_filter.name]) unless filter
+ if filter
+ widget_property.text_value=filter.id.to_s
+ widget_property.save
+ widget.widget_key=(filter.data.include?('display=treemap') ? 'measure_filter_treemap' : 'measure_filter_list')
+ widget.save
+ end
+ end
+ end
+ end
+ end
+ end
+end
--- /dev/null
+#
+# Sonar, open source software quality management 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 3.4
+#
+class DropFilterTables < ActiveRecord::Migration
+
+ def self.up
+ drop_table('filter_columns')
+ drop_table('criteria')
+ drop_table('filters')
+ end
+
+end