org.jasig.schedassist.web.owner.relationships
Class CSVFileImportFormController
java.lang.Object
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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IMPORT_FUTURE_NAME
public static final String IMPORT_FUTURE_NAME
CSVFileImportFormController
public CSVFileImportFormController()
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 © 2011 Jasig. All Rights Reserved.