org.kuali.rice.krad.web.controller
Class UifControllerBase

java.lang.Object
  extended by org.kuali.rice.krad.web.controller.UifControllerBase
Direct Known Subclasses:
CacheAdminController, CourseOfferingController, DocumentControllerBase, IncidentReportController, IngesterController, InquiryController, LookupController, RegistrationController, StatsController, UifComponentsTestController, UILayoutTestController, UITestController

public abstract class UifControllerBase
extends Object

Base controller class for views within the KRAD User Interface Framework Provides common methods such as:

All subclass controller methods after processing should call one of the #getUIFModelAndView methods to setup the View and return the ModelAndView instance.

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

Field Summary
protected static String REDIRECT_PREFIX
           
 
Constructor Summary
UifControllerBase()
           
 
Method Summary
 org.springframework.web.servlet.ModelAndView addLine(UifFormBase uifForm, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Called by the add line action for a new collection line.
 org.springframework.web.servlet.ModelAndView cancel(UifFormBase form, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Just returns as if return with no value was selected.
 void checkViewAuthorization(UifFormBase form, String methodToCall)
          Invokes the configured ViewAuthorizer to verify the user has access to open the view.
 org.springframework.web.servlet.ModelAndView close(UifFormBase form, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Just returns as if return with no value was selected.
protected abstract  UifFormBase createInitialForm(javax.servlet.http.HttpServletRequest request)
          Called to create a new model(form) object when necessary.
 org.springframework.web.servlet.ModelAndView deleteLine(UifFormBase uifForm, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Called by the delete line action for a model collection.
protected  org.springframework.web.servlet.ModelAndView getUIFModelAndView(UifFormBase form)
           
protected  org.springframework.web.servlet.ModelAndView getUIFModelAndView(UifFormBase form, String pageId)
          Configures the ModelAndView instance containing the form data and pointing to the UIF generic spring view
protected  ViewService getViewService()
           
 UifFormBase initForm(javax.servlet.http.HttpServletRequest request)
          Create/obtain the model(form) object before it is passed to the Binder/BeanWrapper.
 org.springframework.web.servlet.ModelAndView navigate(UifFormBase form, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles menu navigation between view pages
 AttributeQueryResult performFieldQuery(UifFormBase form, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Invoked to execute the AttributeQuery associated with a field given the query parameters found in the request.
 AttributeQueryResult performFieldSuggest(UifFormBase form, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Invoked to provide the options for a suggest widget.
 org.springframework.web.servlet.ModelAndView performLookup(UifFormBase form, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Builds up a URL to the lookup view based on the given post action parameters and redirects
protected  org.springframework.web.servlet.ModelAndView performRedirect(UifFormBase form, String baseUrl, Properties urlParameters)
          Builds a ModelAndView instance configured to redirect to the URL formed by joining the base URL with the given URL parameters
 org.springframework.web.servlet.ModelAndView refresh(UifFormBase form, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          handles an ajax refresh
 org.springframework.web.servlet.ModelAndView returnToHistory(UifFormBase form, boolean homeFlag)
          Invoked to navigate back to a history entry.
 org.springframework.web.servlet.ModelAndView returnToHub(UifFormBase form)
          Invoked to navigate back to the first page in history.
 org.springframework.web.servlet.ModelAndView returnToPrevious(UifFormBase form)
          Invoked to navigate back one page in history..
 org.springframework.web.servlet.ModelAndView start(UifFormBase form, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Initial method called when requesting a new view instance which checks authorization and forwards the view for rendering
 org.springframework.web.servlet.ModelAndView toggleInactiveRecordDisplay(UifFormBase uifForm, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Invoked to toggle the show inactive indicator on the selected collection group and then rerun the component lifecycle and rendering based on the updated indicator and form data
 org.springframework.web.servlet.ModelAndView updateComponent(UifFormBase form, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Updates the current component by retrieving a fresh copy from the dictionary, running its component lifecycle, and returning it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REDIRECT_PREFIX

protected static final String REDIRECT_PREFIX
See Also:
Constant Field Values
Constructor Detail

UifControllerBase

public UifControllerBase()
Method Detail

initForm

@ModelAttribute(value="KualiForm")
public final UifFormBase initForm(javax.servlet.http.HttpServletRequest request)
Create/obtain the model(form) object before it is passed to the Binder/BeanWrapper. This method is not intended to be overridden by client applications as it handles framework setup and session maintenance. Clients should override createIntialForm() instead when they need custom form initialization.

Parameters:
request - - the http request that was made

createInitialForm

protected abstract UifFormBase createInitialForm(javax.servlet.http.HttpServletRequest request)
Called to create a new model(form) object when necessary. This usually occurs on the initial request in a conversation (when the model is not present in the session). This method must be overridden when extending a controller and using a different form type than the superclass.

Parameters:
request - - the http request that was made

start

@RequestMapping(params="methodToCall=start")
public org.springframework.web.servlet.ModelAndView start(@ModelAttribute(value="KualiForm")
                                                                         UifFormBase form,
                                                                         org.springframework.validation.BindingResult result,
                                                                         javax.servlet.http.HttpServletRequest request,
                                                                         javax.servlet.http.HttpServletResponse response)
Initial method called when requesting a new view instance which checks authorization and forwards the view for rendering


checkViewAuthorization

public void checkViewAuthorization(UifFormBase form,
                                   String methodToCall)
                            throws AuthorizationException
Invokes the configured ViewAuthorizer to verify the user has access to open the view. An exception is thrown if access has not been granted

Note this method is invoked automatically by the controller interceptor for each request

Parameters:
form - - form instance containing the request data
methodToCall - - the request parameter 'methodToCall' which is used to determine the controller method invoked
Throws:
AuthorizationException

addLine

@RequestMapping(method=POST,
                params="methodToCall=addLine")
public org.springframework.web.servlet.ModelAndView addLine(@ModelAttribute(value="KualiForm")
                                                                           UifFormBase uifForm,
                                                                           org.springframework.validation.BindingResult result,
                                                                           javax.servlet.http.HttpServletRequest request,
                                                                           javax.servlet.http.HttpServletResponse response)
Called by the add line action for a new collection line. Method determines which collection the add action was selected for and invokes the view helper service to add the line


deleteLine

@RequestMapping(method=POST,
                params="methodToCall=deleteLine")
public org.springframework.web.servlet.ModelAndView deleteLine(@ModelAttribute(value="KualiForm")
                                                                              UifFormBase uifForm,
                                                                              org.springframework.validation.BindingResult result,
                                                                              javax.servlet.http.HttpServletRequest request,
                                                                              javax.servlet.http.HttpServletResponse response)
Called by the delete line action for a model collection. Method determines which collection the action was selected for and the line index that should be removed, then invokes the view helper service to process the action


toggleInactiveRecordDisplay

@RequestMapping(method=POST,
                params="methodToCall=toggleInactiveRecordDisplay")
public org.springframework.web.servlet.ModelAndView toggleInactiveRecordDisplay(@ModelAttribute(value="KualiForm")
                                                                                               UifFormBase uifForm,
                                                                                               org.springframework.validation.BindingResult result,
                                                                                               javax.servlet.http.HttpServletRequest request,
                                                                                               javax.servlet.http.HttpServletResponse response)
Invoked to toggle the show inactive indicator on the selected collection group and then rerun the component lifecycle and rendering based on the updated indicator and form data

Parameters:
request - - request object that should contain the request component id (for the collection group) and the show inactive indicator value

cancel

@RequestMapping(params="methodToCall=cancel")
public org.springframework.web.servlet.ModelAndView cancel(@ModelAttribute(value="KualiForm")
                                                                          UifFormBase form,
                                                                          org.springframework.validation.BindingResult result,
                                                                          javax.servlet.http.HttpServletRequest request,
                                                                          javax.servlet.http.HttpServletResponse response)
Just returns as if return with no value was selected.


close

@RequestMapping(params="methodToCall=close")
public org.springframework.web.servlet.ModelAndView close(@ModelAttribute(value="KualiForm")
                                                                         UifFormBase form,
                                                                         org.springframework.validation.BindingResult result,
                                                                         javax.servlet.http.HttpServletRequest request,
                                                                         javax.servlet.http.HttpServletResponse response)
Just returns as if return with no value was selected.


returnToPrevious

@RequestMapping(params="methodToCall=returnToPrevious")
public org.springframework.web.servlet.ModelAndView returnToPrevious(@ModelAttribute(value="KualiForm")
                                                                                    UifFormBase form)
Invoked to navigate back one page in history..

Parameters:
form - - form object that should contain the history object

returnToHub

@RequestMapping(params="methodToCall=returnToHub")
public org.springframework.web.servlet.ModelAndView returnToHub(@ModelAttribute(value="KualiForm")
                                                                               UifFormBase form)
Invoked to navigate back to the first page in history.

Parameters:
form - - form object that should contain the history object

returnToHistory

public org.springframework.web.servlet.ModelAndView returnToHistory(UifFormBase form,
                                                                    boolean homeFlag)
Invoked to navigate back to a history entry. The homeFlag will determine whether navigation will be back to the first or last history entry.

Parameters:
form - - form object that should contain the history object
homeFlag - - if true will navigate back to first entry else will navigate to last entry in the history

navigate

@RequestMapping(method=POST,
                params="methodToCall=navigate")
public org.springframework.web.servlet.ModelAndView navigate(@ModelAttribute(value="KualiForm")
                                                                            UifFormBase form,
                                                                            org.springframework.validation.BindingResult result,
                                                                            javax.servlet.http.HttpServletRequest request,
                                                                            javax.servlet.http.HttpServletResponse response)
Handles menu navigation between view pages


refresh

@RequestMapping(params="methodToCall=refresh")
public org.springframework.web.servlet.ModelAndView refresh(@ModelAttribute(value="KualiForm")
                                                                           UifFormBase form,
                                                                           org.springframework.validation.BindingResult result,
                                                                           javax.servlet.http.HttpServletRequest request,
                                                                           javax.servlet.http.HttpServletResponse response)
                                                     throws Exception
handles an ajax refresh

The query form plugin activates this request via a form post, where on the JS side, org.kuali.rice.krad.uif.UifParameters#RENDER_FULL_VIEW is set to false

Parameters:
form - - Holds properties necessary to determine the View instance that will be used to render the UI
result - - represents binding results
request - - http servlet request data
response - - http servlet response object
Returns:
the ModelAndView object
Throws:
Exception

updateComponent

@RequestMapping(method=POST,
                params="methodToCall=updateComponent")
public org.springframework.web.servlet.ModelAndView updateComponent(@ModelAttribute(value="KualiForm")
                                                                                   UifFormBase form,
                                                                                   org.springframework.validation.BindingResult result,
                                                                                   javax.servlet.http.HttpServletRequest request,
                                                                                   javax.servlet.http.HttpServletResponse response)
Updates the current component by retrieving a fresh copy from the dictionary, running its component lifecycle, and returning it

Parameters:
request - - the request must contain reqComponentId that specifies the component to retrieve

performLookup

@RequestMapping(method=POST,
                params="methodToCall=performLookup")
public org.springframework.web.servlet.ModelAndView performLookup(@ModelAttribute(value="KualiForm")
                                                                                 UifFormBase form,
                                                                                 org.springframework.validation.BindingResult result,
                                                                                 javax.servlet.http.HttpServletRequest request,
                                                                                 javax.servlet.http.HttpServletResponse response)
Builds up a URL to the lookup view based on the given post action parameters and redirects


performFieldSuggest

@RequestMapping(method=GET,
                params="methodToCall=performFieldSuggest")
@ResponseBody
public AttributeQueryResult performFieldSuggest(@ModelAttribute(value="KualiForm")
                                                                            UifFormBase form,
                                                                            org.springframework.validation.BindingResult result,
                                                                            javax.servlet.http.HttpServletRequest request,
                                                                            javax.servlet.http.HttpServletResponse response)
Invoked to provide the options for a suggest widget. The valid options are retrieved by the associated AttributeQuery for the field containing the suggest widget. The controller method picks out the query parameters from the request and calls AttributeQueryService to perform the suggest query and prepare the result object that will be exposed with JSON


performFieldQuery

@RequestMapping(method=GET,
                params="methodToCall=performFieldQuery")
@ResponseBody
public AttributeQueryResult performFieldQuery(@ModelAttribute(value="KualiForm")
                                                                          UifFormBase form,
                                                                          org.springframework.validation.BindingResult result,
                                                                          javax.servlet.http.HttpServletRequest request,
                                                                          javax.servlet.http.HttpServletResponse response)
Invoked to execute the AttributeQuery associated with a field given the query parameters found in the request. This controller method picks out the query parameters from the request and calls AttributeQueryService to perform the field query and prepare the result object that will be exposed with JSON. The result is then used to update field values in the UI with client script.


performRedirect

protected org.springframework.web.servlet.ModelAndView performRedirect(UifFormBase form,
                                                                       String baseUrl,
                                                                       Properties urlParameters)
Builds a ModelAndView instance configured to redirect to the URL formed by joining the base URL with the given URL parameters

Parameters:
form - - current form instance
baseUrl - - base url to redirect to
urlParameters - - properties containing key/value pairs for the url parameters, if null or empty, the baseUrl will be used as the full URL
Returns:
ModelAndView configured to redirect to the given URL

getUIFModelAndView

protected org.springframework.web.servlet.ModelAndView getUIFModelAndView(UifFormBase form)

getUIFModelAndView

protected org.springframework.web.servlet.ModelAndView getUIFModelAndView(UifFormBase form,
                                                                          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
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

getViewService

protected ViewService getViewService()


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.