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

java.lang.Object
  extended by org.kuali.rice.krad.web.controller.UifControllerBase
      extended by org.kuali.rice.krad.web.controller.UifExportController

@Controller
@RequestMapping(value="/export")
public class UifExportController
extends UifControllerBase

Controller that handles table export requests.

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

Constructor Summary
UifExportController()
           
 
Method Summary
protected  UifFormBase createInitialForm(javax.servlet.http.HttpServletRequest request)
          Retrieves the session form for the form key request parameter so we can initialize a form instance of the same type the view was rendered with.
protected  String getContentType(String formatType)
          Reviews and returns a valid content type, defaults to text/csv.
protected  String getValidatedFormatType(String formatType)
          Reviews and returns a valid format type, defaults to csv.
protected  String retrieveTableData(UifFormBase form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Generates exportable table data based on the rich table selected.
protected  void setAttachmentResponseHeader(javax.servlet.http.HttpServletResponse response, String filename, String contentType)
          Creates consistent setup of attachment response header.
 String tableCsvRetrieval(UifFormBase form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Generates exportable table data as CSV based on the rich table selected.
 String tableXlsRetrieval(UifFormBase form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Generates exportable table data in xsl based on the rich table selected.
 String tableXmlRetrieval(UifFormBase form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Generates exportable table data based on the rich table selected.
 
Methods inherited from class org.kuali.rice.krad.web.controller.UifControllerBase
addBlankLine, addLine, back, cancel, checkForm, checkViewAuthorization, defaultMapping, deleteLine, getBooleanDialogResponse, getMessageView, getStringDialogResponse, getUIFModelAndView, getUIFModelAndView, getUIFModelAndView, getUIFModelAndViewWithInit, getViewService, hasDialogBeenAnswered, hasDialogBeenDisplayed, initForm, navigate, performFieldQuery, performFieldSuggest, performLookup, performRedirect, performRedirect, refresh, resetDialogStatus, retrieveCollectionPage, returnFromLightbox, returnToHistory, returnToHub, returnToPrevious, saveLine, sessionTimeout, showDialog, start, tableJsonRetrieval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UifExportController

public UifExportController()
Method Detail

createInitialForm

protected UifFormBase createInitialForm(javax.servlet.http.HttpServletRequest request)
Retrieves the session form for the form key request parameter so we can initialize a form instance of the same type the view was rendered with. 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.

Specified by:
createInitialForm in class UifControllerBase
Parameters:
request - - the http request that was made

tableCsvRetrieval

@MethodAccessible
@RequestMapping(method=GET,
                params="methodToCall=tableCsvRetrieval",
                produces="text/csv")
@ResponseBody
public String tableCsvRetrieval(@ModelAttribute(value="KualiForm")
                                                                             UifFormBase form,
                                                                             javax.servlet.http.HttpServletRequest request,
                                                                             javax.servlet.http.HttpServletResponse response)
Generates exportable table data as CSV based on the rich table selected.


tableXlsRetrieval

@MethodAccessible
@RequestMapping(method=GET,
                params="methodToCall=tableXlsRetrieval",
                produces="application/vnd.ms-excel")
@ResponseBody
public String tableXlsRetrieval(@ModelAttribute(value="KualiForm")
                                                                             UifFormBase form,
                                                                             javax.servlet.http.HttpServletRequest request,
                                                                             javax.servlet.http.HttpServletResponse response)
Generates exportable table data in xsl based on the rich table selected.


tableXmlRetrieval

@MethodAccessible
@RequestMapping(method=GET,
                params="methodToCall=tableXmlRetrieval",
                produces="application/xml")
@ResponseBody
public String tableXmlRetrieval(@ModelAttribute(value="KualiForm")
                                                                             UifFormBase form,
                                                                             javax.servlet.http.HttpServletRequest request,
                                                                             javax.servlet.http.HttpServletResponse response)
Generates exportable table data based on the rich table selected.


retrieveTableData

protected String retrieveTableData(@ModelAttribute(value="KualiForm")
                                   UifFormBase form,
                                   javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response)
Generates exportable table data based on the rich table selected.

First the lifecycle process is run to rebuild the collection group, then TableExporter is invoked to build the export data from the collection.


setAttachmentResponseHeader

protected void setAttachmentResponseHeader(javax.servlet.http.HttpServletResponse response,
                                           String filename,
                                           String contentType)
Creates consistent setup of attachment response header.

Parameters:
response - http response object
filename - name of the return file
contentType - return content type

getValidatedFormatType

protected String getValidatedFormatType(String formatType)
Reviews and returns a valid format type, defaults to csv.

Parameters:
formatType - format type to validate
Returns:
valid format type

getContentType

protected String getContentType(String formatType)
Reviews and returns a valid content type, defaults to text/csv.

Parameters:
formatType - format type to return content type for
Returns:
valid content type


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.