org.jasig.schedassist.web.owner.relationships
Class CSVFileImportFormController

java.lang.Object
  extended by org.jasig.schedassist.web.owner.relationships.CSVFileImportFormController
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean

@Controller
@RequestMapping(value={"/owner/create-relationships-import.html","/delegate/create-relationships-import.html"})
public class CSVFileImportFormController
extends Object
implements org.springframework.beans.factory.DisposableBean

Controller that allows a IScheduleOwner to upload a CSV file containing username-relationship pairs. Instead of processing the file on submission, a FileImportCallable is created and submitted to the required ExecutorService, which will process the file asynchronously. After an upload, if the owner visits this form controller again before the processing is complete they will see a note to that effect. Once the processing is complete, visiting the form will show a status report of the CSV import. Important Note: The ExecutorService wired into this class really should be exclusive to this class. This class implements DisposableBean; within the destroy() the ExecutorService.shutdownNow() method is invoked, which may cause non-deterministic behavior for any other class that uses the same ExecutorService instance.

Version:
$Id: CSVFileImportFormController.java 2050 2010-04-30 16:01:31Z npblair $
Author:
Nicholas Blair, nblair@doit.wisc.edu

Field Summary
static String IMPORT_FUTURE_NAME
           
 
Constructor Summary
CSVFileImportFormController()
           
 
Method Summary
 void destroy()
          Invokes ExecutorService.shutdownNow() on the configured instance.
 String getIdentifyingAttributeName()
           
 void setCalendarAccountDao(ICalendarAccountDao calendarAccountDao)
           
 void setExecutorService(ExecutorService executorService)
           
 void setIdentifyingAttributeName(String identifyingAttributeName)
           
 void setMutableRelationshipDao(MutableRelationshipDao mutableRelationshipDao)
           
 void setVisitorDao(VisitorDao visitorDao)
           
protected  String showForm(org.springframework.ui.ModelMap model, javax.servlet.http.HttpServletRequest request, boolean dismiss)
           
protected  String uploadFile(org.springframework.ui.ModelMap model, org.springframework.web.multipart.MultipartFile file, javax.servlet.http.HttpServletRequest request)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMPORT_FUTURE_NAME

public static final String IMPORT_FUTURE_NAME
Constructor Detail

CSVFileImportFormController

public CSVFileImportFormController()
Method Detail

setIdentifyingAttributeName

public void setIdentifyingAttributeName(String identifyingAttributeName)
Parameters:
identifyingAttributeName -

getIdentifyingAttributeName

public String getIdentifyingAttributeName()
Returns:
the attribute used to commonly uniquely identify an account

setExecutorService

public void setExecutorService(@Qualifier(value="fileImportExecutorService")
                               ExecutorService executorService)
Parameters:
executorService - the executorService to set

setMutableRelationshipDao

public void setMutableRelationshipDao(MutableRelationshipDao mutableRelationshipDao)
Parameters:
mutableRelationshipDao - the mutableRelationshipDao to set

setVisitorDao

public void setVisitorDao(VisitorDao visitorDao)
Parameters:
visitorDao - the visitorDao to set

setCalendarAccountDao

public void setCalendarAccountDao(ICalendarAccountDao calendarAccountDao)
Parameters:
calendarAccountDao - the calendarAccountDao to set

destroy

public void destroy()
             throws Exception
Invokes ExecutorService.shutdownNow() on the configured instance.

Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
Exception
See Also:
DisposableBean.destroy()

uploadFile

@RequestMapping(method=POST)
protected String uploadFile(org.springframework.ui.ModelMap model,
                                           @RequestParam(value="file")
                                           org.springframework.web.multipart.MultipartFile file,
                                           javax.servlet.http.HttpServletRequest request)
                     throws NotRegisteredException
Parameters:
file -
Returns:
Throws:
NotRegisteredException

showForm

@RequestMapping(method=GET)
protected String showForm(org.springframework.ui.ModelMap model,
                                         javax.servlet.http.HttpServletRequest request,
                                         @RequestParam(value="dismiss",required=false,defaultValue="false")
                                         boolean dismiss)
                   throws InterruptedException,
                          ExecutionException,
                          NotRegisteredException
Parameters:
request -
dismiss -
Returns:
Throws:
InterruptedException
ExecutionException
NotRegisteredException


Copyright © 2012 Jasig. All Rights Reserved.