aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorEric Hartmann <hartmann.eric@gmail.com>2012-04-16 20:12:14 +0200
committerEric Hartmann <hartmann.eric@gmail.com>2012-04-16 20:12:14 +0200
commitbb543651438f4a8a7551764f990c362fd17fa945 (patch)
treea51a7f5dd13cd4ff86e26462eb766ff61cf40018 /sonar-server
parent589f41e3bc33f23fa0a40be54110bbc877c0b7c4 (diff)
parentb18d8090f7a48aaa6e7b4b5f272b14546016c7ae (diff)
downloadsonarqube-bb543651438f4a8a7551764f990c362fd17fa945.tar.gz
sonarqube-bb543651438f4a8a7551764f990c362fd17fa945.zip
Merge branch 'release-3.0'
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/platform/GlobalSettingsUpdater.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/platform/ServerDatabaseSettingsLoader.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/plugins/ApplicationDeployer.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/review.rb62
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/profiles/compare.html.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/280_drop_table_rules_categories.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/281_clean_reviews_with_null_booleans.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/282_update_reviews_boolean_columns.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/283_add_authors_primary_key.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/285_add_resource_index_primary_key.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/286_add_indices_to_resource_index.rb2
20 files changed, 51 insertions, 56 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/platform/GlobalSettingsUpdater.java b/sonar-server/src/main/java/org/sonar/server/platform/GlobalSettingsUpdater.java
index 83d6e146f4e..d2d65070bce 100644
--- a/sonar-server/src/main/java/org/sonar/server/platform/GlobalSettingsUpdater.java
+++ b/sonar-server/src/main/java/org/sonar/server/platform/GlobalSettingsUpdater.java
@@ -29,7 +29,7 @@ import java.util.List;
/**
* Update cache of global settings (see org.sonar.api.config.Settings) and notify org.sonar.api.config.GlobalPropertyChangeHandler extensions
*
- * @since 2.15
+ * @since 3.0
*/
public class GlobalSettingsUpdater {
private ServerSettings settings;
diff --git a/sonar-server/src/main/java/org/sonar/server/platform/ServerDatabaseSettingsLoader.java b/sonar-server/src/main/java/org/sonar/server/platform/ServerDatabaseSettingsLoader.java
index b0eb1eef2af..0596e81cfcb 100644
--- a/sonar-server/src/main/java/org/sonar/server/platform/ServerDatabaseSettingsLoader.java
+++ b/sonar-server/src/main/java/org/sonar/server/platform/ServerDatabaseSettingsLoader.java
@@ -22,7 +22,7 @@ package org.sonar.server.platform;
import org.sonar.core.properties.PropertiesDao;
/**
- * @since 2.15
+ * @since 3.0
*/
public final class ServerDatabaseSettingsLoader {
diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/ApplicationDeployer.java b/sonar-server/src/main/java/org/sonar/server/plugins/ApplicationDeployer.java
index e73ddb5e6aa..279990f6da2 100644
--- a/sonar-server/src/main/java/org/sonar/server/plugins/ApplicationDeployer.java
+++ b/sonar-server/src/main/java/org/sonar/server/plugins/ApplicationDeployer.java
@@ -38,7 +38,7 @@ import java.io.IOException;
* Ruby on Rails requires the files to be on filesystem but not in Java classpath (JAR). This component extracts
* all the needed files from plugins and copy them to $SONAR_HOME/temp
*
- * @since 2.15
+ * @since 3.0
*/
public class ApplicationDeployer {
private static final Logger LOG = LoggerFactory.getLogger(ApplicationDeployer.class);
diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java b/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java
index 9896957f62e..da957fc62a1 100644
--- a/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java
+++ b/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java
@@ -36,7 +36,7 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;
/**
- * @since 2.15
+ * @since 3.0
*/
public final class ClassLoaderUtils {
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb
index 2f339ca6457..e7ff73455d3 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb
@@ -40,7 +40,7 @@ class Api::ReviewsController < Api::ApiController
# - 'assignees'
#
def index
- reviews=select_authorized(:user, Review.search(params), :project)
+ reviews=select_authorized(:user, Review.search(params.merge({'limit' => 500})), :project)
render_reviews(reviews, params[:output] == 'HTML')
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb
index bb973147d3e..38e4837bf24 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb
@@ -36,7 +36,8 @@ class ProjectReviewsController < ApplicationController
if @project
access_denied unless has_role?(:user, @project)
- found_reviews = Review.search(params)
+ # 'id' is the id of the project, so it should be removed from the search params
+ found_reviews = Review.search(params.reject {|k,v| k=='id'})
@reviews = select_authorized(:user, found_reviews, :project)
if found_reviews.size != @reviews.size
@security_exclusions = true
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
index b6325df13f3..2342c9eb750 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
@@ -313,6 +313,7 @@ class ReviewsController < ApplicationController
end
options['sort'] = @sort unless @sort.blank?
options['asc'] = @asc
+ options['limit']=500
found_reviews = Review.search(options)
@reviews = select_authorized(:user, found_reviews, :project)
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb
index eae03bffe58..0703ecec5ce 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb
@@ -30,7 +30,7 @@ class RolesController < ApplicationController
end
def projects
- # for backward-compatibility with versions of views plugin that do not depend on sonar 2.15
+ # for backward-compatibility with versions of views plugin that do not depend on sonar 3.0
if java_facade.hasPlugin('views')
@qualifiers = (['VW', 'SVW'] + java_facade.getQualifiersWithProperty('hasRolePolicy').to_a).compact.uniq
else
@@ -46,7 +46,7 @@ class RolesController < ApplicationController
conditions_values[:search]="#{params[:q].downcase}%"
end
- @pagination = Api::Pagination.new(params.merge(:per_page => 50))
+ @pagination = Api::Pagination.new(params)
@projects=Project.find(:all,
:include => %w(user_roles group_roles index),
:conditions => [conditions_sql, conditions_values],
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb
index bb6c2034e7d..09eda567abc 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb
@@ -79,7 +79,7 @@ class Api::Utils
end
# Returns a new array created by sorting arr
- # Since Sonar 2.15
+ # Since Sonar 3.0
#
# Examples :
# Api::Utils.insensitive_sort(['foo', 'bar'])
@@ -103,7 +103,7 @@ class Api::Utils
# Sorts arr
- # Since Sonar 2.15
+ # Since Sonar 3.0
#
# Examples :
# Api::Utils.insensitive_sort!(['foo', 'bar'])
@@ -126,7 +126,7 @@ class Api::Utils
end
#
- # Since Sonar 2.15
+ # Since Sonar 3.0
#
def self.valid_period_index?(index)
Api::Utils.is_integer?(index) && index.to_i > 0 && index.to_i <6
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb
index 01f6542dfee..10c3a136c78 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb
@@ -29,6 +29,7 @@ class ProjectMeasure < ActiveRecord::Base
belongs_to :rule
belongs_to :project
belongs_to :characteristic
+ belongs_to :person, :class_name => 'Project', :foreign_key => 'person_id'
has_one :measure_data, :class_name => 'MeasureData', :foreign_key => 'measure_id'
def metric
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
index 2ca3c693b7e..7ee6e2281b7 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
@@ -232,19 +232,19 @@ class Review < ActiveRecord::Base
def active?
status == STATUS_OPEN || status == STATUS_REOPENED
end
-
+
def linked_to? (action_plan)
action_plans.include? action_plan
end
-
+
def planned?
action_plans.size!=0
end
-
+
def assigned?
assignee_id != nil
end
-
+
# used as long as we currently allow to link a review to only 1 action plan.
def action_plan
action_plans[0]
@@ -259,18 +259,17 @@ class Review < ActiveRecord::Base
def self.search(options={})
conditions=[]
values={}
+ no_need_for_db_request = false
- if options['ids'].present?
+ if options['id'].present?
+ conditions << 'id=:id'
+ values[:id]=options['id'].to_i
+ elsif options['ids'].present?
ids=options['ids'].split(',')
- if ids.size > 1
- conditions << 'id in (:ids)'
- values[:ids]=ids.map { |id| id.to_i }
- else
- conditions << 'id=:id'
- values[:id]=ids[0].to_i
- end
+ conditions << 'id in (:ids)'
+ values[:ids]=ids.map { |id| id.to_i }
else
-
+
# --- 'review_type' is deprecated since 2.9 ---
# Following code just for backward compatibility
review_type = options['review_type']
@@ -381,29 +380,22 @@ class Review < ActiveRecord::Base
end
end
- sort=options['sort']
- asc=options['asc']
- if sort
- if asc
- sort += ' ASC, reviews.updated_at DESC'
- else
- sort += ' DESC, reviews.updated_at DESC'
- end
- else
- sort = 'reviews.updated_at DESC'
- end
+ sort_field=(options['sort'].blank? ? 'updated_at' : options['sort'])
+ asc=(options['asc'] ? 'ASC' : 'DESC')
+ sort_sql="reviews.#{sort_field} #{asc}"
+ sort_sql += ', reviews.updated_at DESC' unless sort_field=='updated_at'
found_reviews = []
- found_reviews = Review.find(:all, :include => ['review_comments', 'project', 'assignee', 'resource', 'user'], :conditions => [conditions.join(' AND '), values], :order => sort, :limit => 200) unless no_need_for_db_request
+ found_reviews = Review.find(:all, :include => ['review_comments', 'project', 'assignee', 'resource', 'user'], :conditions => [conditions.join(' AND '), values], :order => sort_sql, :limit => options['limit']) unless no_need_for_db_request
found_reviews
end
- #
- #
- # XML AND JSON UTILITY METHODS
- #
- #
+#
+#
+# XML AND JSON UTILITY METHODS
+#
+#
def self.reviews_to_xml(reviews, convert_markdown=false)
xml = Builder::XmlMarkup.new(:indent => 0)
@@ -477,11 +469,11 @@ class Review < ActiveRecord::Base
json
end
- #
- #
- # PRIVATE METHODS
- #
- #
+#
+#
+# PRIVATE METHODS
+#
+#
private
def assign_project
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/compare.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/compare.html.erb
index 74c0418d429..7cda38ad0c0 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/compare.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/compare.html.erb
@@ -46,7 +46,7 @@
<table class="data width100 marginbottom10" id="in1-rules">
<thead>
<tr>
- <th><a name="in1"/><%= message('quality_profiles.x_rules_only_in', :params => @in1.size) -%>
+ <th><a name="in1"/><%= message('quality_profiles.x_rules_only_in', :params => @in1.size) %>
<a href="<%= url_for :controller => 'rules_configuration', :action => 'index', :id => @profile1.id -%>"><%= h @profile1.name %></a>
</th>
</tr>
@@ -73,7 +73,7 @@
<table class="data width100 marginbottom10" id="in2-rules">
<thead>
<tr>
- <th><a name="in2"/><%= message('quality_profiles.x_rules_only_in', :params => @in2.size) -%>
+ <th><a name="in2"/><%= message('quality_profiles.x_rules_only_in', :params => @in2.size) %>
<a href="<%= url_for :controller => 'rules_configuration', :action => 'index', :id => @profile2.id -%>"><%= h @profile2.name %></a>
</th>
</tr>
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb
index c9ca527aa16..5719e1d73be 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb
@@ -24,7 +24,7 @@
class CreateAuthors < ActiveRecord::Migration
def self.up
- # removed in version 2.15, see migration 283
+ # removed in version 3.0, see migration 283
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/280_drop_table_rules_categories.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/280_drop_table_rules_categories.rb
index 71a74decd53..632715741f9 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/280_drop_table_rules_categories.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/280_drop_table_rules_categories.rb
@@ -19,7 +19,7 @@
#
#
-# Sonar 2.15
+# Sonar 3.0
#
class DropTableRulesCategories < ActiveRecord::Migration
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/281_clean_reviews_with_null_booleans.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/281_clean_reviews_with_null_booleans.rb
index 1f7dac497e0..64991fb5752 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/281_clean_reviews_with_null_booleans.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/281_clean_reviews_with_null_booleans.rb
@@ -19,7 +19,7 @@
#
#
-# Sonar 2.15
+# Sonar 3.0
#
class CleanReviewsWithNullBooleans < ActiveRecord::Migration
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/282_update_reviews_boolean_columns.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/282_update_reviews_boolean_columns.rb
index e2b7515daf0..31c94f8dbb6 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/282_update_reviews_boolean_columns.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/282_update_reviews_boolean_columns.rb
@@ -19,7 +19,7 @@
#
#
-# Sonar 2.15
+# Sonar 3.0
#
class UpdateReviewsBooleanColumns < ActiveRecord::Migration
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/283_add_authors_primary_key.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/283_add_authors_primary_key.rb
index c129df42b1f..1490860f5c8 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/283_add_authors_primary_key.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/283_add_authors_primary_key.rb
@@ -19,7 +19,7 @@
#
#
-# Sonar 2.15
+# Sonar 3.0
#
class AddAuthorsPrimaryKey < ActiveRecord::Migration
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb
index 9d2e7230198..46c94543a2f 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb
@@ -19,7 +19,7 @@
#
#
-# Sonar 2.15
+# Sonar 3.0
#
class AddDefaultDescriptionToManualRules < ActiveRecord::Migration
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/285_add_resource_index_primary_key.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/285_add_resource_index_primary_key.rb
index aa5ca2f5ae2..b7c3c6562de 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/285_add_resource_index_primary_key.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/285_add_resource_index_primary_key.rb
@@ -19,7 +19,7 @@
#
#
-# Sonar 2.15
+# Sonar 3.0
#
class AddResourceIndexPrimaryKey < ActiveRecord::Migration
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/286_add_indices_to_resource_index.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/286_add_indices_to_resource_index.rb
index ad75ab81b83..e6c604f9852 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/286_add_indices_to_resource_index.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/286_add_indices_to_resource_index.rb
@@ -19,7 +19,7 @@
#
#
-# Sonar 2.15
+# Sonar 3.0
#
class AddIndicesToResourceIndex < ActiveRecord::Migration