org.kuali.kfs.sys.batch.service.impl
Class BatchInputFileSetServiceImpl

java.lang.Object
  extended by org.kuali.kfs.sys.batch.service.impl.BatchInputFileSetServiceImpl
All Implemented Interfaces:
BatchInputFileSetService
Direct Known Subclasses:
AssetBarcodeInventoryInputFileServiceImpl

public class BatchInputFileSetServiceImpl
extends Object
implements BatchInputFileSetService

Base implementation to manipulate batch input file sets from the batch upload screen


Constructor Summary
BatchInputFileSetServiceImpl()
           
 
Method Summary
protected  void copyInputStreamToFile(InputStream source, File outputFile, byte[] buf)
           
protected  Map<String,File> copyStreamsToTemporaryDirectory(org.kuali.rice.kim.bo.Person user, BatchInputFileSetType inputType, String fileUserIdentifier, Map<String,InputStream> typeToStreamMap, Date creationDate)
           
protected  void deleteTempFiles(Map<String,File> typeToTempFiles)
           
protected  String generateDoneFileName(org.kuali.rice.kim.bo.Person user, BatchInputFileSetType inputType, String fileUserIdentifier, Date creationDate)
          Generates the file name of the done file, if supported by the underlying input type
protected  String generateFileName(org.kuali.rice.kim.bo.Person user, BatchInputFileSetType inputType, String fileUserIdentifier, String fileType, Date creationDate)
          Generates the file name of a file (not the done file)
protected  String generateTempFileName(org.kuali.rice.kim.bo.Person user, BatchInputFileSetType inputType, String fileUserIdentifier, String fileType, Date creationDate)
          Generates the file name of a file (not the done file)
protected  org.kuali.rice.kns.service.KualiConfigurationService getKualiConfigurationService()
           
protected  String getTempDirectoryName()
           
 boolean isBatchInputTypeActive(BatchInputFileSetType batchInputFileSetType)
          Checks if the batch input type is active (can be used for upload).
 boolean isFileUserIdentifierProperlyFormatted(String fileUserIdentifier)
          Returns whether a file set identifier is properly formatted.
 Map<String,String> save(org.kuali.rice.kim.bo.Person user, BatchInputFileSetType inputType, String fileUserIdentifier, Map<String,InputStream> typeToStreamMap)
          Stores the input streams (the values in the Map parameter) as files on the server, identified by the given user file name and file user identifier
 void setKualiConfigurationService(org.kuali.rice.kns.service.KualiConfigurationService kualiConfigurationService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchInputFileSetServiceImpl

public BatchInputFileSetServiceImpl()
Method Detail

generateFileName

protected String generateFileName(org.kuali.rice.kim.bo.Person user,
                                  BatchInputFileSetType inputType,
                                  String fileUserIdentifier,
                                  String fileType,
                                  Date creationDate)
Generates the file name of a file (not the done file)

Parameters:
user - the user who uploaded or will upload the file
inputType - the file set type
fileUserIdentifier - the file identifier
fileType - the file type
Returns:
the file name, starting with the directory path

generateTempFileName

protected String generateTempFileName(org.kuali.rice.kim.bo.Person user,
                                      BatchInputFileSetType inputType,
                                      String fileUserIdentifier,
                                      String fileType,
                                      Date creationDate)
Generates the file name of a file (not the done file)

Parameters:
user - the user who uploaded or will upload the file
inputType - the file set type
fileUserIdentifier - the file identifier
fileType - the file type
Returns:
the file name, starting with the directory path

generateDoneFileName

protected String generateDoneFileName(org.kuali.rice.kim.bo.Person user,
                                      BatchInputFileSetType inputType,
                                      String fileUserIdentifier,
                                      Date creationDate)
Generates the file name of the done file, if supported by the underlying input type

Parameters:
user - the user who uploaded or will upload the file
inputType - the file set type
fileUserIdentifier - the file identifier
fileType - the file type
Returns:
the file name, starting with the directory path

isBatchInputTypeActive

public boolean isBatchInputTypeActive(BatchInputFileSetType batchInputFileSetType)
Description copied from interface: BatchInputFileSetService
Checks if the batch input type is active (can be used for upload).

Specified by:
isBatchInputTypeActive in interface BatchInputFileSetService
Returns:
boolean - true if type is active, false if not active
See Also:
BatchInputFileSetService.isBatchInputTypeActive(org.kuali.kfs.sys.batch.BatchInputFileSetType)

save

public Map<String,String> save(org.kuali.rice.kim.bo.Person user,
                               BatchInputFileSetType inputType,
                               String fileUserIdentifier,
                               Map<String,InputStream> typeToStreamMap)
                        throws org.kuali.rice.kns.exception.AuthorizationException,
                               FileStorageException
Description copied from interface: BatchInputFileSetService
Stores the input streams (the values in the Map parameter) as files on the server, identified by the given user file name and file user identifier

Specified by:
save in interface BatchInputFileSetService
Parameters:
user - - user who is requesting the save
inputType - - instance of a BatchInputFileSetType
fileUserIdentifier - - file identifier specified by user
typeToStreamMap - - contents of the uploaded files, keyed by the input file type
Returns:
a Map of type to file name mappings of the saved files
Throws:
FileStorageException - - if errors were encountered while attempting to write the file
org.kuali.rice.kns.exception.AuthorizationException
See Also:
BatchInputFileSetService.save(org.kuali.rice.kim.bo.Person, org.kuali.kfs.sys.batch.BatchInputFileSetType, java.lang.String, java.util.Map)

copyStreamsToTemporaryDirectory

protected Map<String,File> copyStreamsToTemporaryDirectory(org.kuali.rice.kim.bo.Person user,
                                                           BatchInputFileSetType inputType,
                                                           String fileUserIdentifier,
                                                           Map<String,InputStream> typeToStreamMap,
                                                           Date creationDate)
                                                    throws FileStorageException
Throws:
FileStorageException

copyInputStreamToFile

protected void copyInputStreamToFile(InputStream source,
                                     File outputFile,
                                     byte[] buf)
                              throws IOException
Throws:
IOException

getTempDirectoryName

protected String getTempDirectoryName()

isFileUserIdentifierProperlyFormatted

public boolean isFileUserIdentifierProperlyFormatted(String fileUserIdentifier)
Description copied from interface: BatchInputFileSetService
Returns whether a file set identifier is properly formatted.

Specified by:
isFileUserIdentifierProperlyFormatted in interface BatchInputFileSetService
Returns:
See Also:
BatchInputFileSetService.isFileUserIdentifierProperlyFormatted(java.lang.String)

getKualiConfigurationService

protected org.kuali.rice.kns.service.KualiConfigurationService getKualiConfigurationService()

setKualiConfigurationService

public void setKualiConfigurationService(org.kuali.rice.kns.service.KualiConfigurationService kualiConfigurationService)

deleteTempFiles

protected void deleteTempFiles(Map<String,File> typeToTempFiles)


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