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

java.lang.Object
  extended by org.kuali.rice.krad.web.controller.UifControllerBase
Direct Known Subclasses:
CacheAdminController, ConfigurationTestViewUifController, CourseOfferingController, DataAttributesTestUifController, DialogTestViewUifController, DocumentControllerBase, IncidentReportController, IngesterController, InquiryController, LookupController, RegistrationController, StatsController, UifClientListener, 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)

Constructor Summary
UifControllerBase()
           
 
Method Summary
 org.springframework.web.servlet.ModelAndView addBlankLine(UifFormBase uifForm)
          Called by the add blank line action for a new collection line
 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.
 org.springframework.web.servlet.ModelAndView checkForm(UifFormBase form, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Checks the form/view against all current and future validations and returns warnings for any validations that fail
 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  boolean getBooleanDialogResponse(String dialogId, UifFormBase form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles modal dialog interactions for a view controller When a controller method wishes to prompt the user for additional information before continuing to process the request.
protected  String getStringDialogResponse(String dialogId, UifFormBase form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles a modal dialog interaction with the client user when a String response is desired
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
 org.springframework.web.servlet.view.UrlBasedViewResolver getViewResolver()
           
protected  ViewService getViewService()
           
protected  boolean hasDialogBeenAnswered(String dialogId, UifFormBase form)
          returns whether the dialog has already been answered by the user
protected  boolean hasDialogBeenDisplayed(String dialogId, UifFormBase form)
          returns whether this dialog has been displayed on the client
 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
 void renderView(org.springframework.web.servlet.ModelAndView mv, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String viewName)
          Renders the view manually from the controller level instead of returning back to the Spring Dispatcher servlet
 org.springframework.web.servlet.ModelAndView returnFromLightbox(UifFormBase form, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Common return point for dialogs.
 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 saveLine(UifFormBase uifForm, org.springframework.validation.BindingResult result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Called by the save line action for a new collection line.
 void setViewResolver(org.springframework.web.servlet.view.UrlBasedViewResolver viewResolver)
           
protected  org.springframework.web.servlet.ModelAndView showDialog(String dialogId, UifFormBase form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Complete the response directly and launch lightbox with dialog content upon returning back to the client.
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 createInitialForm() 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


addBlankLine

@RequestMapping(method=POST,
                params="methodToCall=addBlankLine")
public org.springframework.web.servlet.ModelAndView addBlankLine(@ModelAttribute(value="KualiForm")
                                                                                UifFormBase uifForm)
Called by the add blank 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 blank line.

Parameters:
uifForm - - form instance containing the request data
Returns:
the ModelAndView object

saveLine

@RequestMapping(method=POST,
                params="methodToCall=saveLine")
public org.springframework.web.servlet.ModelAndView saveLine(@ModelAttribute(value="KualiForm")
                                                                            UifFormBase uifForm,
                                                                            org.springframework.validation.BindingResult result,
                                                                            javax.servlet.http.HttpServletRequest request,
                                                                            javax.servlet.http.HttpServletResponse response)
Called by the save line action for a new collection line. Does server side validation and provides hook for client application to persist specific data.


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

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


checkForm

@RequestMapping(method=POST,
                params="methodToCall=checkForm")
public org.springframework.web.servlet.ModelAndView checkForm(@ModelAttribute(value="KualiForm")
                                                                             UifFormBase form,
                                                                             org.springframework.validation.BindingResult result,
                                                                             javax.servlet.http.HttpServletRequest request,
                                                                             javax.servlet.http.HttpServletResponse response)
Checks the form/view against all current and future validations and returns warnings for any validations that fail


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.


hasDialogBeenDisplayed

protected boolean hasDialogBeenDisplayed(String dialogId,
                                         UifFormBase form)
returns whether this dialog has been displayed on the client

Parameters:
dialogId - - the id of the dialog
form - - form instance containing the request data
Returns:
boolean - true if dialog has been displayed, false if not

hasDialogBeenAnswered

protected boolean hasDialogBeenAnswered(String dialogId,
                                        UifFormBase form)
returns whether the dialog has already been answered by the user

Parameters:
dialogId - - identifier for the dialog group
form - - form instance containing the request data
Returns:
boolean - true if client has already responded to the dialog, false otherwise

getBooleanDialogResponse

protected boolean getBooleanDialogResponse(String dialogId,
                                           UifFormBase form,
                                           javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response)
                                    throws Exception
Handles modal dialog interactions for a view controller When a controller method wishes to prompt the user for additional information before continuing to process the request.

If this modal dialog has not yet been presented to the user, a redirect back to the client is performed to display the modal dialog as a Lightbox. The DialogGroup identified by the dialogId is used as the Lightbox content.

If the dialog has already been answered by the user. The boolean value representing the option chosen by the user is returned back to the calling controller

Parameters:
dialogId - - identifier of the dialog group
form - - form instance containing the request data
request - - the http request
response - - the http response
Returns:
boolean - true if user chose affirmative response, false if negative response was chosen
Throws:
Exception

getStringDialogResponse

protected String getStringDialogResponse(String dialogId,
                                         UifFormBase form,
                                         javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response)
                                  throws Exception
Handles a modal dialog interaction with the client user when a String response is desired

Similar to askYesOrNoQuestion() but returns a string instead of a boolean. The string value is the key string of the key/value pair assigned to the button that the user chose.

Parameters:
dialogId - - identifier of the dialog group
form - - form instance containing the request data
request - - the http request
response - - the http response
Returns:
Throws:
Exception

showDialog

protected org.springframework.web.servlet.ModelAndView showDialog(String dialogId,
                                                                  UifFormBase form,
                                                                  javax.servlet.http.HttpServletRequest request,
                                                                  javax.servlet.http.HttpServletResponse response)
                                                           throws Exception
Complete the response directly and launch lightbox with dialog content upon returning back to the client.

Need to build up the view/component properly as we would if we returned normally back to the DispatcherServlet from the controller method.

Parameters:
dialogId - - id of the dialog or group to use as content in the lightbox.
form - - the form associated with the view
request - - the http request
response - - the http response
Returns:
will return void. actually, won't return at all.
Throws:
Exception

renderView

public void renderView(org.springframework.web.servlet.ModelAndView mv,
                       javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response,
                       String viewName)
                throws Exception
Renders the view manually from the controller level instead of returning back to the Spring Dispatcher servlet

Parameters:
mv -
request -
response -
viewName -
Throws:
Exception

returnFromLightbox

@RequestMapping(params="methodToCall=returnFromLightbox")
public org.springframework.web.servlet.ModelAndView returnFromLightbox(@ModelAttribute(value="KualiForm")
                                                                                      UifFormBase form,
                                                                                      org.springframework.validation.BindingResult result,
                                                                                      javax.servlet.http.HttpServletRequest request,
                                                                                      javax.servlet.http.HttpServletResponse response)
                                                                throws Exception
Common return point for dialogs.

Determines the user responses to the dialog. Performs dialog management and then redirects to the original contoller method.

Parameters:
form - - current form
result - - binding result
request - - http request
response - - http response
Returns:
ModelAndView setup for redirect to original controller methodToCall
Throws:
Exception

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()

getViewResolver

public org.springframework.web.servlet.view.UrlBasedViewResolver getViewResolver()

setViewResolver

public void setViewResolver(org.springframework.web.servlet.view.UrlBasedViewResolver viewResolver)


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