@review_screens_by_vid=nil
if current_user && has_role?(:user, @resource)
- @review_screens_by_vid = RuleFailure.available_java_screens_for_violations(violations, @resource.project, current_user)
+ @review_screens_by_vid = RuleFailure.available_java_screens_for_violations(violations, @resource, current_user)
end
render :action => 'index', :layout => !request.xhr?
end
# TODO remove parameters 'id' and 'command' from params
error_message = nil
begin
- RuleFailure.execute_command(params[:command], violation, violation.snapshot.root_snapshot.project, current_user, params)
+ RuleFailure.execute_command(params[:command], violation, current_user, params)
rescue Exception => e
error_message=Api::Utils.exception_message(e, :backtrace => false)
end
#
# Constraint : all the violations are in the same project
#
- def self.available_java_screens_for_violations(violations, project, user)
+ def self.available_java_screens_for_violations(violations, resource, user)
reviews = violations.map { |violation| to_java_workflow_review(violation) }
- context = to_java_workflow_context(project, user)
+ context = to_java_workflow_context(resource, user)
Java::OrgSonarServerUi::JRubyFacade.getInstance().listAvailableReviewsScreens(reviews, context)
end
end
end
- def self.execute_command(command_key, violation, project, user, parameters)
+ def self.execute_command(command_key, violation, user, parameters)
review = to_java_workflow_review(violation)
- context = to_java_workflow_context(project, user)
+ context = to_java_workflow_context(violation.resource, user)
Java::OrgSonarServerUi::JRubyFacade.getInstance().executeReviewCommand(command_key, review, context, parameters)
end
java_review
end
- def self.to_java_workflow_context(project, user)
+ def self.to_java_workflow_context(resource, user)
java_context = Java::OrgSonarApiWorkflowInternal::DefaultWorkflowContext.new
java_context.setUserId(user.id)
java_context.setUserLogin(user.login)
java_context.setUserName(user.name)
java_context.setUserEmail(user.email)
java_context.setIsAdmin(user.has_role?(:admin))
- java_context.setProjectId(project.id)
+ java_context.setProjectId(resource.root_project.id)
java_context
end