org.kuali.kfs.sys.batch.service
Interface BatchInputFileService

All Known Implementing Classes:
BatchInputFileServiceImpl

public interface BatchInputFileService

Interface defining methods to manage batch input files.


Method Summary
 boolean isBatchInputTypeActive(BatchInputFileType batchInputFileType)
          Checks if the batch input type is active (can be used for upload).
 boolean isFileUserIdentifierProperlyFormatted(String fileUserIdentifier)
          Returns whether a file user identifier is properly formatted.
 List<String> listBatchTypeFilesForUser(BatchInputFileType batchInputFileType, org.kuali.rice.kim.bo.Person user)
          Returns a list of batch type file names (without path) that the given user has permissions to manage.
 List<String> listInputFileNamesWithDoneFile(BatchInputFileType batchInputFileType)
          Returns a list of existing input files for the batch type that have an associated .done file
 Object parse(BatchInputFileType batchInputFileType, byte[] fileByteContent)
          Unmarshalls the file contents to an Object using the digestor and digestor rules file specified in the batch input type.
 String save(org.kuali.rice.kim.bo.Person user, BatchInputFileType inputType, String fileUserIdentifier, InputStream fileContents, Object parsedObject)
          Stores the inputstream as a file on the server, identified by the given user file name.
 boolean validate(BatchInputFileType inputType, Object parsedObject)
          Using the input type object parses and validates the file contents by calling validate on the batch input type.
 

Method Detail

parse

Object parse(BatchInputFileType batchInputFileType,
             byte[] fileByteContent)
Unmarshalls the file contents to an Object using the digestor and digestor rules file specified in the batch input type.

Parameters:
batchInputFileType - - batch input file type for the file to parse
fileByteContent - - byte contents of file to parse
Returns:
- Object built from the file contents based on its xml unmarshalling rules

validate

boolean validate(BatchInputFileType inputType,
                 Object parsedObject)
Using the input type object parses and validates the file contents by calling validate on the batch input type. If there were validation errors, GlobalVariables.errorMap will contain the error messages.

Parameters:
inputType - - instance of a BatchInputFileType
parsedObject - - the Object built from parsing xml contents
Returns:
boolean - true if validation was successful, false if there were errors

save

String save(org.kuali.rice.kim.bo.Person user,
            BatchInputFileType inputType,
            String fileUserIdentifier,
            InputStream fileContents,
            Object parsedObject)
            throws org.kuali.rice.kns.exception.AuthorizationException,
                   FileStorageException
Stores the inputstream as a file on the server, identified by the given user file name.

Parameters:
user - - user who is requesting the save
inputType - - instance of a BatchInputFileType
fileUserIdentifier - - file identifier specified by user
fileContents - - contents of the uploaded file
parsedObject - - object parsed from the input file
Returns:
String - name of file that was saved, or null if errors were enountered
Throws:
FileStorageException - - if errors were encountered while attempting to write the file
org.kuali.rice.kns.exception.AuthorizationException

isBatchInputTypeActive

boolean isBatchInputTypeActive(BatchInputFileType batchInputFileType)
Checks if the batch input type is active (can be used for upload).

Parameters:
batchInputFileType - - input type to check is active
Returns:
boolean - true if type is active, false if not active

listBatchTypeFilesForUser

List<String> listBatchTypeFilesForUser(BatchInputFileType batchInputFileType,
                                       org.kuali.rice.kim.bo.Person user)
                                       throws org.kuali.rice.kns.exception.AuthorizationException
Returns a list of batch type file names (without path) that the given user has permissions to manage. Path is intentionally excluded to prevent security problems arising from giving users access to the full path.

Parameters:
user - - user for checking permissions
Returns:
List - List of filenames
Throws:
org.kuali.rice.kns.exception.AuthorizationException

listInputFileNamesWithDoneFile

List<String> listInputFileNamesWithDoneFile(BatchInputFileType batchInputFileType)
Returns a list of existing input files for the batch type that have an associated .done file

Parameters:
batchInputFileType - - batch type to retieve files for
Returns:
List - List of filenames

isFileUserIdentifierProperlyFormatted

boolean isFileUserIdentifierProperlyFormatted(String fileUserIdentifier)
Returns whether a file user identifier is properly formatted.

Parameters:
fileUserIdentifier -
Returns:


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