aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-04-14 09:15:46 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-04-14 09:15:46 +0200
commita74d2a51765e1270d790a1ad14384d58aa2530c4 (patch)
tree83da30af96af6fc734ec02997b8bec8d0d12b671 /server/sonar-web/src
parent82f8dcb57883807ca88af4eb62fe4a51678380a7 (diff)
downloadsonarqube-a74d2a51765e1270d790a1ad14384d58aa2530c4.tar.gz
sonarqube-a74d2a51765e1270d790a1ad14384d58aa2530c4.zip
SONAR-5851 temporary resurrect profiles/export RoR API
Diffstat (limited to 'server/sonar-web/src')
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb
index 28a940f72ec..0c815c44eab 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb
@@ -28,4 +28,25 @@ class ProfilesController < ApplicationController
render :action => 'index'
end
+ # GET /profiles/export?name=<profile name>&language=<language>&format=<exporter key>
+ def export
+ language = params[:language]
+ if params[:name].blank?
+ profile = Internal.qprofile_service.getDefault(language)
+ else
+ profile = Internal.qprofile_loader.getByLangAndName(language, CGI::unescape(params[:name]))
+ end
+ not_found('Profile not found') unless profile
+
+ if params[:format].blank?
+ # standard sonar format
+ result = Internal.qprofile_service.backup(profile.getKee())
+ send_data(result, :type => 'text/xml', :disposition => 'inline')
+ else
+ exporter_key = params[:format]
+ result = Internal.qprofile_exporters.export(profile.getKee(), exporter_key)
+ send_data(result, :type => Internal.qprofile_exporters.mimeType(exporter_key), :disposition => 'inline')
+ end
+ end
+
end