public class FlatFileParserBase extends BatchInputFileTypeBase
| Modifier and Type | Field and Description |
|---|---|
protected org.kuali.rice.core.api.datetime.DateTimeService |
dateTimeService |
protected String |
fileNamePrefix |
protected String |
fileTypeIdentifier |
protected FlatFileSpecification |
flatFileSpecification |
protected static org.apache.log4j.Logger |
LOG |
protected FlatFileDataHandler |
processor |
protected String |
titleKey |
| Constructor and Description |
|---|
FlatFileParserBase() |
| Modifier and Type | Method and Description |
|---|---|
String |
getAuthorPrincipalName(File file)
Determines the principal name of the author of a file from the file name
|
String |
getFileName(String principalName,
Object parsedFileContents,
String fileUserIdentifier)
Returns the name of an uploaded file
|
String |
getFileNamePrefix() |
String |
getFileTypeIdentifer()
Returns the unique identifier (Spring bean id) for the batch input type.
|
FlatFileDataHandler |
getProcessor() |
String |
getTitleKey()
Returns the key for the application constants message to display as the title for the upload screen.
|
Object |
parse(byte[] fileByteContent)
Reads each line of the flat file and uses the injected FlatFileSpecification to parse into an object graph
|
void |
process(String fileName,
Object parsedFileContents)
Calls the processor if it is available
|
void |
setDateTimeService(org.kuali.rice.core.api.datetime.DateTimeService dateTimeService)
Sets an implementation of the DateTimeService for use in parsing
|
void |
setFileNamePrefix(String fileNamePrefix)
Sets the prefix of the file name which this parser reads
|
void |
setFileTypeIdentifer(String fileTypeIdentifier)
All foundation developers are brilliant at spelling!
|
void |
setFileTypeIdentifier(String fileTypeIdentifier)
The correctly spelled setter name - just to avoid injection confusion
|
void |
setFlatFileSpecification(AbstractFlatFileSpecificationBase flatFileClassIdentifier)
Sets the FlatFileSpecification that instructs how to carry out the parse
|
void |
setProcessor(FlatFileDataHandler processor)
Sets the processor which will validate and process the file once all flat file data has been parsed
|
void |
setTitleKey(String titleKey)
Sets the key of the message to show in the title bar of the upload page for this file
|
boolean |
validate(Object parsedFileContents)
Performs specific validation on the parsed file contents.
|
getDirectoryPath, getFileExtension, getFileName, setDirectoryPath, setFileExtensionprotected static org.apache.log4j.Logger LOG
protected FlatFileSpecification flatFileSpecification
protected String fileNamePrefix
protected org.kuali.rice.core.api.datetime.DateTimeService dateTimeService
protected String fileTypeIdentifier
protected FlatFileDataHandler processor
public FlatFileParserBase()
public String getFileName(String principalName, Object parsedFileContents, String fileUserIdentifier)
principalName - - principal name of the user who is uploading the fileparsedFileContents - - object populated with the uploaded file contentspublic void setFileTypeIdentifer(String fileTypeIdentifier)
fileTypeIdentifier - the file identifier to setpublic void setFileTypeIdentifier(String fileTypeIdentifier)
fileTypeIdentifier - the file type identifierpublic void setTitleKey(String titleKey)
titleKey - public FlatFileDataHandler getProcessor()
public void setProcessor(FlatFileDataHandler processor)
processor - the implementation of FlatFileDataHandler to utilizepublic Object parse(byte[] fileByteContent) throws ParseException
fileByteContent - the contents file to parseParseExceptionBatchInputFileType.parse(byte[])public void process(String fileName, Object parsedFileContents)
fileName - name of the fileparsedFileContents - objects populated with file contentspublic boolean validate(Object parsedFileContents)
BatchInputFileTypeparsedFileContents - - object populated with the uploaded file contentspublic void setFlatFileSpecification(AbstractFlatFileSpecificationBase flatFileClassIdentifier)
flatFileClassIdentifier - the FlatFileSpecification that instructs how to carry out the parsepublic void setFileNamePrefix(String fileNamePrefix)
fileNamePrefix - public void setDateTimeService(org.kuali.rice.core.api.datetime.DateTimeService dateTimeService)
dateTimeService - public String getAuthorPrincipalName(File file)
file - the file to determine the author ofpublic String getFileTypeIdentifer()
BatchInputFileTypepublic String getFileNamePrefix()
public String getTitleKey()
BatchInputTypeCopyright © 2004–2015 The Kuali Foundation. All rights reserved.