org.kuali.kfs.module.endow.document
Class EndowmentAccountingLineParserBase

java.lang.Object
  extended by org.kuali.kfs.module.endow.document.EndowmentAccountingLineParserBase
All Implemented Interfaces:
EndowmentAccountingLineParser

public class EndowmentAccountingLineParserBase
extends Object
implements EndowmentAccountingLineParser


Field Summary
protected static String[] DEFAULT_FORMAT
           
 
Constructor Summary
EndowmentAccountingLineParserBase()
           
 
Method Summary
protected  String[] chooseFormat(Class<? extends EndowmentAccountingLine> accountingLineClass)
          Gets the accounting line format.
 String getExpectedEndowmentAccountingLineFormatAsString(Class<? extends EndowmentAccountingLine> accountingLineClass)
           
protected  Class getSourceEndowmentAccountingLineClass(EndowmentAccountingLinesDocument accountingDocument)
          Given a document, determines what class the source lines of that document uses
 String[] getSourceEndowmentAccountingLineFormat()
           
protected  Class getTargetEndowmentAccountingLineClass(EndowmentAccountingLinesDocument accountingDocument)
          Given a document, determines what class that document uses for target accounting lines
 String[] getTargetEndowmentAccountingLineFormat()
           
protected  List<EndowmentAccountingLine> importAccountingLines(String fileName, InputStream stream, EndowmentAccountingLinesDocument transactionalDocument, boolean isSource)
          Calls the appropriate parseAccountingLine method
 List importSourceEndowmentAccountingLines(String fileName, InputStream stream, EndowmentAccountingLinesDocument document)
          Generates a list of SourceEndowmentAccountingLine from the inputStream
 List importTargetEndowmentAccountingLines(String fileName, InputStream stream, EndowmentAccountingLinesDocument document)
          Generates a list of TargetEndowmentAccountingLine from the inputStream
protected  Map<String,String> parseAccountingLine(Class<? extends EndowmentAccountingLine> accountingLineClass, String lineToParse)
          Parses the csv line
 SourceEndowmentAccountingLine parseSourceEndowmentAccountingLine(EndowmentAccountingLinesDocument transactionalDocument, String sourceAccountingLineString)
          Parses a comma delimited string into an SourceEndowmentAccountingLine by populating the attributes found in the getSourceAccountingLineFormat()
 TargetEndowmentAccountingLine parseTargetEndowmentAccountingLine(EndowmentAccountingLinesDocument transactionalDocument, String targetAccountingLineString)
          Parses a comma delimited string into an TargetEndowmentAccountingLine by populating the attributes found in the getTargetAccountingLineFormat()
protected  void performCustomSourceAccountingLinePopulation(Map<String,String> attributeValueMap, SourceEndowmentAccountingLine sourceAccountingLine, String accountingLineAsString)
          Should be overriden by documents to perform any additional SourceAccountingLine population
protected  void performCustomTargetAccountingLinePopulation(Map<String,String> attributeValueMap, TargetEndowmentAccountingLine targetAccountingLine, String accountingLineAsString)
          Should be overridden by documents to perform any additional TargetAccountingLine attribute population
protected  EndowmentAccountingLine populateAccountingLine(EndowmentAccountingLinesDocument transactionalDocument, Class<? extends EndowmentAccountingLine> accountingLineClass, String accountingLineAsString, Map<String,String> attributeValueMap, Integer sequenceNumber)
          Populates a source/target line with values
protected  void putCommonAttributesInMap(Map<String,String> attributeValueMap, EndowmentAccountingLinesDocument document, Integer sequenceNumber)
          Places fields common to both source/target endowment accounting lines in the attribute map
protected  String retrieveAttributeLabel(Class clazz, String attributeName)
          Retrieves label for given attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FORMAT

protected static final String[] DEFAULT_FORMAT
Constructor Detail

EndowmentAccountingLineParserBase

public EndowmentAccountingLineParserBase()
Method Detail

getSourceEndowmentAccountingLineFormat

public String[] getSourceEndowmentAccountingLineFormat()
Specified by:
getSourceEndowmentAccountingLineFormat in interface EndowmentAccountingLineParser
Returns:
SourceEndowmentAccountingLine attribute format
See Also:
EndowmentAccountingLineParser.getSourceEndowmentAccountingLineFormat()

getTargetEndowmentAccountingLineFormat

public String[] getTargetEndowmentAccountingLineFormat()
Specified by:
getTargetEndowmentAccountingLineFormat in interface EndowmentAccountingLineParser
Returns:
TargetEndowmentAccountingLine attribute format
See Also:
EndowmentAccountingLineParser.getTargetEndowmentAccountingLineFormat()

getExpectedEndowmentAccountingLineFormatAsString

public String getExpectedEndowmentAccountingLineFormatAsString(Class<? extends EndowmentAccountingLine> accountingLineClass)
Specified by:
getExpectedEndowmentAccountingLineFormatAsString in interface EndowmentAccountingLineParser
Returns:
String representation of the String[] attribute format with each attribute separated by a comma.
See Also:
EndowmentAccountingLineParser.getExpectedEndowmentAccountingLineFormatAsString(java.lang.Class)

parseSourceEndowmentAccountingLine

public SourceEndowmentAccountingLine parseSourceEndowmentAccountingLine(EndowmentAccountingLinesDocument transactionalDocument,
                                                                        String sourceAccountingLineString)
Description copied from interface: EndowmentAccountingLineParser
Parses a comma delimited string into an SourceEndowmentAccountingLine by populating the attributes found in the getSourceAccountingLineFormat()

Specified by:
parseSourceEndowmentAccountingLine in interface EndowmentAccountingLineParser
Returns:
SourceEndowmentAccountingLine
See Also:
EndowmentAccountingLineParser.parseSourceEndowmentAccountingLine(org.kuali.kfs.module.endow.document.EndowmentAccountingLinesDocument, java.lang.String)

getSourceEndowmentAccountingLineClass

protected Class getSourceEndowmentAccountingLineClass(EndowmentAccountingLinesDocument accountingDocument)
Given a document, determines what class the source lines of that document uses

Parameters:
accountingDocument - the document to find the class of the source lines for
Returns:
the class of the source lines

parseTargetEndowmentAccountingLine

public TargetEndowmentAccountingLine parseTargetEndowmentAccountingLine(EndowmentAccountingLinesDocument transactionalDocument,
                                                                        String targetAccountingLineString)
Description copied from interface: EndowmentAccountingLineParser
Parses a comma delimited string into an TargetEndowmentAccountingLine by populating the attributes found in the getTargetAccountingLineFormat()

Specified by:
parseTargetEndowmentAccountingLine in interface EndowmentAccountingLineParser
Returns:
TargetEndowmentAccountingLine
See Also:
EndowmentAccountingLineParser.parseTargetEndowmentAccountingLine(org.kuali.kfs.module.endow.document.EndowmentAccountingLinesDocument, java.lang.String)

getTargetEndowmentAccountingLineClass

protected Class getTargetEndowmentAccountingLineClass(EndowmentAccountingLinesDocument accountingDocument)
Given a document, determines what class that document uses for target accounting lines

Parameters:
accountingDocument - the document to determine the target accounting line class for
Returns:
the class of the target lines for the given document

populateAccountingLine

protected EndowmentAccountingLine populateAccountingLine(EndowmentAccountingLinesDocument transactionalDocument,
                                                         Class<? extends EndowmentAccountingLine> accountingLineClass,
                                                         String accountingLineAsString,
                                                         Map<String,String> attributeValueMap,
                                                         Integer sequenceNumber)
Populates a source/target line with values

Parameters:
transactionalDocument -
accountingLineClass -
accountingLineAsString -
attributeValueMap -
sequenceNumber -
Returns:
AccountingLine

putCommonAttributesInMap

protected void putCommonAttributesInMap(Map<String,String> attributeValueMap,
                                        EndowmentAccountingLinesDocument document,
                                        Integer sequenceNumber)
Places fields common to both source/target endowment accounting lines in the attribute map

Parameters:
attributeValueMap -
document -
sequenceNumber -

parseAccountingLine

protected Map<String,String> parseAccountingLine(Class<? extends EndowmentAccountingLine> accountingLineClass,
                                                 String lineToParse)
Parses the csv line

Parameters:
accountingLineClass -
lineToParse -
Returns:
Map containing accounting line attribute,value pairs

performCustomSourceAccountingLinePopulation

protected void performCustomSourceAccountingLinePopulation(Map<String,String> attributeValueMap,
                                                           SourceEndowmentAccountingLine sourceAccountingLine,
                                                           String accountingLineAsString)
Should be overriden by documents to perform any additional SourceAccountingLine population

Parameters:
attributeValueMap -
sourceAccountingLine -
accountingLineAsString -

performCustomTargetAccountingLinePopulation

protected void performCustomTargetAccountingLinePopulation(Map<String,String> attributeValueMap,
                                                           TargetEndowmentAccountingLine targetAccountingLine,
                                                           String accountingLineAsString)
Should be overridden by documents to perform any additional TargetAccountingLine attribute population

Parameters:
attributeValueMap -
targetAccountingLine -
accountingLineAsString -

importAccountingLines

protected List<EndowmentAccountingLine> importAccountingLines(String fileName,
                                                              InputStream stream,
                                                              EndowmentAccountingLinesDocument transactionalDocument,
                                                              boolean isSource)
Calls the appropriate parseAccountingLine method

Parameters:
stream -
transactionalDocument -
isSource -
Returns:
List

importSourceEndowmentAccountingLines

public final List importSourceEndowmentAccountingLines(String fileName,
                                                       InputStream stream,
                                                       EndowmentAccountingLinesDocument document)
Description copied from interface: EndowmentAccountingLineParser
Generates a list of SourceEndowmentAccountingLine from the inputStream

Specified by:
importSourceEndowmentAccountingLines in interface EndowmentAccountingLineParser
Returns:
List containing SourceEndowmentAccountingLines
See Also:
EndowmentAccountingLineParser.importSourceEndowmentAccountingLines(java.lang.String, java.io.InputStream, org.kuali.kfs.module.endow.document.EndowmentAccountingLinesDocument)

importTargetEndowmentAccountingLines

public final List importTargetEndowmentAccountingLines(String fileName,
                                                       InputStream stream,
                                                       EndowmentAccountingLinesDocument document)
Description copied from interface: EndowmentAccountingLineParser
Generates a list of TargetEndowmentAccountingLine from the inputStream

Specified by:
importTargetEndowmentAccountingLines in interface EndowmentAccountingLineParser
Returns:
List containing TargetEndowmentAccountingLines
See Also:
EndowmentAccountingLineParser.importTargetEndowmentAccountingLines(java.lang.String, java.io.InputStream, org.kuali.kfs.module.endow.document.EndowmentAccountingLinesDocument)

retrieveAttributeLabel

protected String retrieveAttributeLabel(Class clazz,
                                        String attributeName)
Retrieves label for given attribute.

Parameters:
clazz -
attributeName -
Returns:

chooseFormat

protected String[] chooseFormat(Class<? extends EndowmentAccountingLine> accountingLineClass)
Gets the accounting line format.

Parameters:
accountingLineClass -
Returns:


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