org.kuali.rice.kns.web.struts.action
Class KualiMultipleValueLookupAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by org.apache.struts.actions.BaseAction
          extended by org.apache.struts.actions.DispatchAction
              extended by org.kuali.rice.kns.web.struts.action.KualiAction
                  extended by org.kuali.rice.kns.web.struts.action.KualiLookupAction
                      extended by org.kuali.rice.kns.web.struts.action.KualiMultipleValueLookupAction
All Implemented Interfaces:
KualiTableRenderAction

public class KualiMultipleValueLookupAction
extends KualiLookupAction
implements KualiTableRenderAction

This class serves as the struts action for implementing multiple value lookups


Field Summary
static int DEFAULT_MAX_ROWS_PER_PAGE
          If there is no app param defined for the # rows/page, then this value will be used for the default
 
Fields inherited from class org.kuali.rice.kns.web.struts.action.KualiAction
FORM_ACTION, FORWARD_NEXT, FORWARD_TEXT_AREA_UPDATE, METHOD_TO_CALL, POST_TEXT_AREA_TO_PARENT, TEXT_AREA_FIELD_ANCHOR, TEXT_AREA_FIELD_LABEL, TEXT_AREA_FIELD_NAME, TEXT_AREA_MAX_LENGTH, TEXT_AREA_READ_ONLY
 
Fields inherited from class org.apache.struts.actions.DispatchAction
clazz, log, methods, types
 
Fields inherited from class org.apache.struts.actions.BaseAction
messages
 
Fields inherited from class org.apache.struts.action.Action
servlet
 
Constructor Summary
KualiMultipleValueLookupAction()
           
 
Method Summary
 org.apache.struts.action.ActionForward cancel(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method overrides the super class cancel method because it is basically equivalent to clicking prepare to return none
 org.apache.struts.action.ActionForward clearValues(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          clearValues - clears the values of all the fields on the jsp.
 org.apache.struts.action.ActionForward export(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method prepares to export results.
protected  int getMaxRowsPerPage(MultipleValueLookupForm multipleValueLookupForm)
          This method computes the max number of rows that should be rendered per page for a multiple value lookup.
protected  Collection performMultipleValueLookup(MultipleValueLookupForm multipleValueLookupForm, List<ResultRow> resultTable, int maxRowsPerPage, boolean bounded)
          This method performs the lookup and returns a collection of lookup items.
protected  List<ResultRow> prepareToExport(MultipleValueLookupForm multipleValueLookupForm)
          This method performs the operations necessary for a multiple value lookup to export the rows via display tag Note: this method assumes that the export will be opened in a new browser window, therefore, persisting the selected checkboxes will not be needed.
 org.apache.struts.action.ActionForward prepareToReturnNone(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method returns none of the selected results and redirects back to the lookup caller.
protected  void prepareToReturnNone(MultipleValueLookupForm multipleValueLookupForm)
          This method performs the operations necessary for a multiple value lookup to return no results to the calling page
protected  void prepareToReturnSelectedResultBOs(MultipleValueLookupForm multipleValueLookupForm)
          This method performs the operations necessary for a multiple value lookup keep track of which results have been selected to be returned to the calling document.
 org.apache.struts.action.ActionForward prepareToReturnSelectedResults(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method does the processing necessary to return selected results and sends a redirect back to the lookup caller
 org.apache.struts.action.ActionForward search(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method performs the search, and will be responsible for persisting the results via the LookupResultsService.
 org.apache.struts.action.ActionForward selectAll(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method selects all results across all pages
protected  List<ResultRow> selectAll(MultipleValueLookupForm multipleValueLookupForm, int maxRowsPerPage)
          This method performs the operations necessary for a multiple value lookup to select all of the results and rerender the page
 org.apache.struts.action.ActionForward sort(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method sorts a column.
protected  List<ResultRow> sort(MultipleValueLookupForm multipleValueLookupForm, int maxRowsPerPage)
          This method performs the operations necessary for a multiple value lookup to sort results and rerender the page
 org.apache.struts.action.ActionForward switchToPage(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method switches to another page on a multi-value lookup
protected  List<ResultRow> switchToPage(MultipleValueLookupForm multipleValueLookupForm, int maxRowsPerPage)
          This method performs the operations necessary for a multiple value lookup to switch to another page of results and rerender the page
 org.apache.struts.action.ActionForward unselectAll(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method unselects all results across all pages
protected  List<ResultRow> unselectAll(MultipleValueLookupForm multipleValueLookupForm, int maxRowsPerPage)
          This method performs the operations necessary for a multiple value lookup to unselect all of the results and rerender the page
 
Methods inherited from class org.kuali.rice.kns.web.struts.action.KualiLookupAction
checkAuthorization, customLookupableMethodCall, execute, refresh, start, supressActionsIfNeeded, viewResults
 
Methods inherited from class org.kuali.rice.kns.web.struts.action.KualiAction
addMethodToCallToUncheckedList, defaultDispatch, dispatchMethod, doProcessingAfterPost, findMethodToCall, getApplicationBaseUrl, getBusinessObjectAuthorizationService, getEncryptionService, getHeaderTabDispatch, getHeaderTabNavigateTo, getImageContext, getKualiModuleService, getLineToDelete, getReturnLocation, getRoleQualification, getSelectedLine, getTabToToggle, headerTab, hideAllTabs, isModuleLocked, performInquiry, performLookup, performQuestionWithInput, performQuestionWithInputAgainBecauseOfErrors, performQuestionWithoutInput, performWorkgroupLookup, postTextAreaToParent, retrieveLookupParameterValue, showAllTabs, toggleTab, updateTextArea, validateLookupInquiryFullParameter
 
Methods inherited from class org.apache.struts.actions.DispatchAction
cancelled, getMethod, getMethodName, getParameter, unspecified
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_ROWS_PER_PAGE

public static final int DEFAULT_MAX_ROWS_PER_PAGE
If there is no app param defined for the # rows/page, then this value will be used for the default

See Also:
getMaxRowsPerPage(MultipleValueLookupForm), Constant Field Values
Constructor Detail

KualiMultipleValueLookupAction

public KualiMultipleValueLookupAction()
Method Detail

search

public org.apache.struts.action.ActionForward search(org.apache.struts.action.ActionMapping mapping,
                                                     org.apache.struts.action.ActionForm form,
                                                     javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response)
                                              throws Exception
This method performs the search, and will be responsible for persisting the results via the LookupResultsService. This overrides the superclass's search action method b/c of the differences in how the results are generated and it populates certain attributes that are specific to MultipleValueLookupForm

Overrides:
search in class KualiLookupAction
Parameters:
mapping -
form - must be an instance of MultipleValueLookupForm
request -
response -
Throws:
Exception

switchToPage

public org.apache.struts.action.ActionForward switchToPage(org.apache.struts.action.ActionMapping mapping,
                                                           org.apache.struts.action.ActionForm form,
                                                           javax.servlet.http.HttpServletRequest request,
                                                           javax.servlet.http.HttpServletResponse response)
                                                    throws Exception
This method switches to another page on a multi-value lookup

Specified by:
switchToPage in interface KualiTableRenderAction
Parameters:
mapping -
form - must be an instance of MultipleValueLookupForm
request -
response -
Returns:
Throws:
Exception

sort

public org.apache.struts.action.ActionForward sort(org.apache.struts.action.ActionMapping mapping,
                                                   org.apache.struts.action.ActionForm form,
                                                   javax.servlet.http.HttpServletRequest request,
                                                   javax.servlet.http.HttpServletResponse response)
                                            throws Exception
This method sorts a column. If the page is currently sorted on a certain column, and the same column is selected to be sorted again, then the results will be reversed. After the search method is called, it is difficult to determine the sort order of the result table, so no column is considered sorted. So, after a search, we were to click sort on an already sorted column, it would appear to have no effect. Subsequent clicks would tell you

Specified by:
sort in interface KualiTableRenderAction
Parameters:
mapping -
form - must be an instance of MultipleValueLookupForm
request -
response -
Returns:
Throws:
Exception

prepareToReturnSelectedResults

public org.apache.struts.action.ActionForward prepareToReturnSelectedResults(org.apache.struts.action.ActionMapping mapping,
                                                                             org.apache.struts.action.ActionForm form,
                                                                             javax.servlet.http.HttpServletRequest request,
                                                                             javax.servlet.http.HttpServletResponse response)
                                                                      throws Exception
This method does the processing necessary to return selected results and sends a redirect back to the lookup caller

Parameters:
mapping -
form - must be an instance of MultipleValueLookupForm
request -
response -
Returns:
Throws:
Exception

selectAll

public org.apache.struts.action.ActionForward selectAll(org.apache.struts.action.ActionMapping mapping,
                                                        org.apache.struts.action.ActionForm form,
                                                        javax.servlet.http.HttpServletRequest request,
                                                        javax.servlet.http.HttpServletResponse response)
                                                 throws Exception
This method selects all results across all pages

Parameters:
mapping -
form - must be an instance of MultipleValueLookupForm
request -
response -
Returns:
Throws:
Exception

unselectAll

public org.apache.struts.action.ActionForward unselectAll(org.apache.struts.action.ActionMapping mapping,
                                                          org.apache.struts.action.ActionForm form,
                                                          javax.servlet.http.HttpServletRequest request,
                                                          javax.servlet.http.HttpServletResponse response)
                                                   throws Exception
This method unselects all results across all pages

Parameters:
mapping -
form - must be an instance of MultipleValueLookupForm
request -
response -
Returns:
Throws:
Exception

cancel

public org.apache.struts.action.ActionForward cancel(org.apache.struts.action.ActionMapping mapping,
                                                     org.apache.struts.action.ActionForm form,
                                                     javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response)
                                              throws Exception
This method overrides the super class cancel method because it is basically equivalent to clicking prepare to return none

Overrides:
cancel in class KualiLookupAction
Throws:
Exception
See Also:
KualiLookupAction.cancel(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

prepareToReturnNone

public org.apache.struts.action.ActionForward prepareToReturnNone(org.apache.struts.action.ActionMapping mapping,
                                                                  org.apache.struts.action.ActionForm form,
                                                                  javax.servlet.http.HttpServletRequest request,
                                                                  javax.servlet.http.HttpServletResponse response)
                                                           throws Exception
This method returns none of the selected results and redirects back to the lookup caller.

Parameters:
mapping -
form - must be an instance of MultipleValueLookupForm
request -
response -
Returns:
Throws:
Exception

export

public org.apache.struts.action.ActionForward export(org.apache.struts.action.ActionMapping mapping,
                                                     org.apache.struts.action.ActionForm form,
                                                     javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response)
                                              throws Exception
This method prepares to export results. Note: this method will not look for any rows selected since the last page view, so it is best that exporting opens in a new browser window.

Parameters:
mapping -
form - must be an instance of MultipleValueLookupForm
request -
response -
Returns:
Throws:
Exception

performMultipleValueLookup

protected Collection performMultipleValueLookup(MultipleValueLookupForm multipleValueLookupForm,
                                                List<ResultRow> resultTable,
                                                int maxRowsPerPage,
                                                boolean bounded)
This method performs the lookup and returns a collection of lookup items. Also initializes values in the form that will allow the multiple value lookup page to render

Parameters:
multipleValueLookupForm -
resultTable - a list of result rows (used to generate what's shown in the UI). This list will be modified by this method
maxRowsPerPage -
bounded - whether the results will be bounded
Returns:
the list of result BOs, possibly bounded by size

switchToPage

protected List<ResultRow> switchToPage(MultipleValueLookupForm multipleValueLookupForm,
                                       int maxRowsPerPage)
This method performs the operations necessary for a multiple value lookup to switch to another page of results and rerender the page

Parameters:
multipleValueLookupForm -
maxRowsPerPage -
Returns:
a list of result rows, used by the UI to render the page

sort

protected List<ResultRow> sort(MultipleValueLookupForm multipleValueLookupForm,
                               int maxRowsPerPage)
This method performs the operations necessary for a multiple value lookup to sort results and rerender the page

Parameters:
multipleValueLookupForm -
maxRowsPerPage -
Returns:
a list of result rows, used by the UI to render the page

prepareToReturnSelectedResultBOs

protected void prepareToReturnSelectedResultBOs(MultipleValueLookupForm multipleValueLookupForm)
This method performs the operations necessary for a multiple value lookup keep track of which results have been selected to be returned to the calling document. Note, this method does not actually requery for the results.

Parameters:
multipleValueLookupForm -

prepareToReturnNone

protected void prepareToReturnNone(MultipleValueLookupForm multipleValueLookupForm)
This method performs the operations necessary for a multiple value lookup to return no results to the calling page

Parameters:
multipleValueLookupForm -

prepareToExport

protected List<ResultRow> prepareToExport(MultipleValueLookupForm multipleValueLookupForm)
This method performs the operations necessary for a multiple value lookup to export the rows via display tag Note: this method assumes that the export will be opened in a new browser window, therefore, persisting the selected checkboxes will not be needed.

Parameters:
multipleValueLookupForm -
Returns:
a list of result rows, to be used by display tag to render the results

selectAll

protected List<ResultRow> selectAll(MultipleValueLookupForm multipleValueLookupForm,
                                    int maxRowsPerPage)
This method performs the operations necessary for a multiple value lookup to select all of the results and rerender the page

Parameters:
multipleValueLookupForm -
maxRowsPerPage -
Returns:
a list of result rows, used by the UI to render the page

clearValues

public org.apache.struts.action.ActionForward clearValues(org.apache.struts.action.ActionMapping mapping,
                                                          org.apache.struts.action.ActionForm form,
                                                          javax.servlet.http.HttpServletRequest request,
                                                          javax.servlet.http.HttpServletResponse response)
                                                   throws IOException,
                                                          javax.servlet.ServletException
Description copied from class: KualiLookupAction
clearValues - clears the values of all the fields on the jsp.

Overrides:
clearValues in class KualiLookupAction
Throws:
IOException
javax.servlet.ServletException

unselectAll

protected List<ResultRow> unselectAll(MultipleValueLookupForm multipleValueLookupForm,
                                      int maxRowsPerPage)
This method performs the operations necessary for a multiple value lookup to unselect all of the results and rerender the page

Parameters:
multipleValueLookupForm -
maxRowsPerPage -
Returns:
a list of result rows, used by the UI to render the page

getMaxRowsPerPage

protected int getMaxRowsPerPage(MultipleValueLookupForm multipleValueLookupForm)
This method computes the max number of rows that should be rendered per page for a multiple value lookup. This method first looks for an application parameter in FS_PARM_T, group SYSTEM, multipleValueLookupResultsPerPage if someone wants to implement something where a user can decide how many results to display per page, this method is the place to do it. Make this method read form values to determine the max rows per page based on the user inputs

Parameters:
multipleValueLookupForm - the form
Returns:
See Also:
KRADConstants.SystemGroupParameterNames.MULTIPLE_VALUE_LOOKUP_RESULTS_PER_PAGE, DEFAULT_MAX_ROWS_PER_PAGE


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