org.kuali.rice.kns.uif.util
Class UifWebUtils

java.lang.Object
  extended by org.kuali.rice.kns.uif.util.UifWebUtils

public class UifWebUtils
extends Object

Provides helper methods that will be used during the request lifecycle

Created to avoid duplication of the methods used by the UifHandlerExceptionResolver

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
private static org.apache.log4j.Logger LOG
           
 
Constructor Summary
UifWebUtils()
           
 
Method Summary
static void checkMethodToCallAuthorization(javax.servlet.http.HttpServletRequest request, UifControllerBase controller, UifFormBase form)
          Verify the user is authorized to invoke the controller method according to the module that owns the functionality.
static org.springframework.web.servlet.ModelAndView getComponentModelAndView(Component component, Object model)
           
static UifFormBase getFormFromRequest(javax.servlet.http.HttpServletRequest request)
          Gets the form from the request.
protected static SessionDocumentService getSessionDocumentService()
           
static org.springframework.web.servlet.ModelAndView getUIFModelAndView(UifFormBase form, String viewId, String pageId)
          Configures the ModelAndView instance containing the form data and pointing to the UIF generic spring view
protected static ViewService getViewService()
           
static void postControllerHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView)
          After the controller logic is executed, the form is placed into session and the corresponding view is prepared for rendering
static void prepareViewForRendering(UifFormBase form)
          Prepares the View instance contained on the form for rendering
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG
Constructor Detail

UifWebUtils

public UifWebUtils()
Method Detail

getFormFromRequest

public static UifFormBase getFormFromRequest(javax.servlet.http.HttpServletRequest request)
Gets the form from the request.

Looks for the form on the session by using the form key. If the form is not on the session it will attempt to get it from the database.

Parameters:
request - the http request
Returns:
the form from request

getUIFModelAndView

public static org.springframework.web.servlet.ModelAndView getUIFModelAndView(UifFormBase form,
                                                                              String viewId,
                                                                              String pageId)
Configures the ModelAndView instance containing the form data and pointing to the UIF generic spring view

Parameters:
form - - Form instance containing the model data
viewId - - Id of the View to return
pageId - - Id of the page within the view that should be rendered, can be left blank in which the current or default page is rendered
Returns:
ModelAndView object with the contained form

getComponentModelAndView

public static org.springframework.web.servlet.ModelAndView getComponentModelAndView(Component component,
                                                                                    Object model)

postControllerHandle

public static void postControllerHandle(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response,
                                        Object handler,
                                        org.springframework.web.servlet.ModelAndView modelAndView)
                                 throws Exception
After the controller logic is executed, the form is placed into session and the corresponding view is prepared for rendering

Throws:
Exception

checkMethodToCallAuthorization

public static void checkMethodToCallAuthorization(javax.servlet.http.HttpServletRequest request,
                                                  UifControllerBase controller,
                                                  UifFormBase form)
Verify the user is authorized to invoke the controller method according to the module that owns the functionality. This is done post handle to be able to access the form and whatever processing was done TODO: should this be throwing some exception?

Parameters:
request - - current HTTP request containing method to call parameter
controller - - controller that was invoked
form - - form instance containing the data

prepareViewForRendering

public static void prepareViewForRendering(UifFormBase form)
Prepares the View instance contained on the form for rendering

First a check is made to verify the view instance contained on the form has the same id as the view id on the form (id that was requested), if not a new view instance is retrieved for that view id. Then a check on the view status is made to determine if we need to run the full view life-cycle (in the case of a finalized view), or just the build steps (apply model and finalize). Finally the page is set on the view to reflect the page that was requested

Parameters:
form - - form instance containing the data and view instance

getSessionDocumentService

protected static SessionDocumentService getSessionDocumentService()

getViewService

protected static ViewService getViewService()


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.