Class ExceptionsController
In: app/controllers/exceptions_controller.rb
Parent: ApplicationController

Controller class is used to handle all the views for exception handling feature.

Methods

Public Instance methods

Method is used to set the status for an exception as closed.

[Source]

     # File app/controllers/exceptions_controller.rb, line 121
121:   def close_exception
122:     app_id = App.get_application_data(params[:app_name]).id
123:     exceptions = AppException.get_exception_details_by_exception_message(params[:exception_name], app_id)
124:     exceptions.each do |exception|
125:       exception.update_attribute(:exception_status, 0)
126:     end
127:     redirect_to :action => 'index'
128:   end

Method is used to list all closed exceptions for an application.

[Source]

     # File app/controllers/exceptions_controller.rb, line 103
103:   def closed_exceptions(app_name)
104:     app_id = App.get_application_data(app_name).id
105:     @application_name = app_name
106:     @size = AppException.get_all_closed_exceptions(app_id).size
107:     @exceptions = AppException.get_closed_exceptions(app_id,0)
108:     render :partial => 'close_exception_list_partial', :locals => {:start => 0}
109:   end

This methos is used to put the exception count on the home tab of the admin panel.

[Source]

    # File app/controllers/exceptions_controller.rb, line 65
65:   def get_exception
66:     exceptions_count = get_exceptions(params[:app_name]).size  
67:     if  exceptions_count > 0
68:       link_text = "Yes (#{exceptions_count})"
69:       exception_span_data = link_text
70:     else
71:       exception_span_data = "No"
72:     end
73:     render :partial => 'link_partial',:locals => {:data => exception_span_data}
74:   end

Method sets the application name in the in the session and redirect it to the method index.

[Source]

    # File app/controllers/exceptions_controller.rb, line 77
77:   def get_exceptions_list
78:     session[:exceptions_application_name] = params[:application_name]
79:     redirect_to :action => 'index'
80:   end

Method is used to set the status for an exception as ignored.

[Source]

     # File app/controllers/exceptions_controller.rb, line 131
131:   def ignore_exception
132:     app_id = App.get_application_data(params[:app_name]).id
133:     exceptions = AppException.get_exception_details_by_exception_message(params[:exception_name], app_id)
134:     exceptions.each do |exception|
135:       exception.update_attribute(:exception_status,2)
136:     end
137:     redirect_to :action => 'index'
138:   end

Method is used to list all ignored exceptions for an application.

[Source]

     # File app/controllers/exceptions_controller.rb, line 112
112:   def ignored_exceptions(app_name)
113:     app_id = App.get_application_data(app_name).id
114:     @application_name = app_name
115:     @size = AppException.get_all_ignored_exceptions(app_id).size
116:     @exceptions = AppException.get_ignored_exceptions(app_id)
117:     render :partial => 'ignored_exception_list_partial', :locals => {:start => 0}
118:   end

the method is to render the index page of exception tab. on this page the exception of the first application in the application array is deiplayed.

[Source]

    # File app/controllers/exceptions_controller.rb, line 29
29:   def index
30:     @apps = get_application_list_for_exceptions
31:     session[:application_name] = get_application_list[0]
32:     if session[:exceptions_application_name].nil?
33:       app = @apps[0]
34:       session[:exceptions_application_name] = app
35:     else
36:       app = session[:exceptions_application_name]
37:     end  
38:     @application_name = app
39:     app_id = App.get_application_data(app).id
40:     @start = 0
41:     @size = AppException.get_all_open_exceptions(app_id).size
42:     @exceptions = AppException.get_open_exceptions(app_id, @start)
43:   end

This method is to display the list of exceptions as selection made from select box.

[Source]

    # File app/controllers/exceptions_controller.rb, line 54
54:   def list
55:     @application_name = params[:application_name]
56:     session[:exceptions_application_name] = @application_name
57:     app_id = App.get_application_data(@application_name).id
58:     @start = 0
59:     @size = AppException.get_all_open_exceptions(app_id).size
60:     @exceptions = AppException.get_open_exceptions(app_id)
61:     render :partial => 'exceptions_listing_partial'
62:   end

Method is used to list the exceptions with different status.

[Source]

    # File app/controllers/exceptions_controller.rb, line 83
83:   def list_statuswise_exceptions
84:     if params[:status_name] == 'Ignored'
85:       ignored_exceptions(params[:app_name])
86:     elsif params[:status_name] == 'Closed'
87:       closed_exceptions(params[:app_name])
88:     else  
89:       opened_exceptions(params[:app_name])
90:     end
91:   end

Method is used to list all open exceptions for an application.

[Source]

     # File app/controllers/exceptions_controller.rb, line 94
 94:   def opened_exceptions(app_name)
 95:     app_id = App.get_application_data(app_name).id
 96:     @application_name = app_name
 97:     @size = AppException.get_all_open_exceptions(app_id).size
 98:     @exceptions = AppException.get_open_exceptions(app_id,0)
 99:     render :partial => 'exception_list_partial', :locals => {:start => 0}
100:   end

Method is used to set the status for an exception as reopened.

[Source]

     # File app/controllers/exceptions_controller.rb, line 141
141:   def reopen_exception
142:     app_id = App.get_application_data(params[:app_name]).id
143:     exceptions = AppException.get_exception_details_by_exception_message(params[:exception_name], app_id)
144:     exceptions.each do |exception|
145:       exception.update_attribute(:exception_status,1)
146:     end
147:     redirect_to :action => 'index'
148:   end

Gives the array of five closed exceptions for pagination.

[Source]

     # File app/controllers/exceptions_controller.rb, line 161
161:   def required_closed_exceptions
162:     app_id = App.get_application_data(params[:app_name]).id
163:     @application_name = params[:app_name]
164:     @start = params[:start].to_i
165:     @size = AppException.get_all_closed_exceptions(app_id).size
166:     @exceptions = AppException.get_closed_exceptions(app_id,@start)
167:     render :partial => 'close_exception_list_partial', :locals => {:start => @start}
168:   end

Gives the array of five ignored exceptions for pagination.

[Source]

     # File app/controllers/exceptions_controller.rb, line 171
171:   def required_ignored_exceptions
172:     app_id = App.get_application_data(params[:app_name]).id
173:     @application_name = params[:app_name]
174:     @start = params[:start].to_i
175:     @size = AppException.get_all_ignored_exceptions(app_id).size
176:     @exceptions = AppException.get_ignored_exceptions(app_id,@start)
177:     render :partial => 'ignored_exception_list_partial', :locals => {:start => @start}
178:   end

Gives the array of five open exceptions for pagination.

[Source]

     # File app/controllers/exceptions_controller.rb, line 151
151:   def required_open_exceptions
152:     app_id = App.get_application_data(params[:app_name]).id
153:     @application_name = params[:app_name]
154:     @start = params[:start].to_i
155:     @size = AppException.get_all_open_exceptions(app_id).size
156:     @exceptions = AppException.get_open_exceptions(app_id,@start)
157:     render :partial => 'exception_list_partial', :locals => {:start => @start}
158:   end

This method is to display the information of the specific exception.

[Source]

    # File app/controllers/exceptions_controller.rb, line 46
46:   def show
47:     app_id = App.get_application_data(params[:application_name]).id
48:     @excep = AppException.get_exception_details_by_id(params[:id])
49:     @exceptions = AppException.get_exception_details_by_exception_message(@excep.exception_message, app_id)
50:     render :partial => 'show'
51:   end

[Validate]