public class AccountingLineParserBase extends Object implements AccountingLineParser
AccountingLine
s for TransactionalDocument
sModifier and Type | Field and Description |
---|---|
protected static String[] |
DEFAULT_FORMAT |
Constructor and Description |
---|
AccountingLineParserBase() |
Modifier and Type | Method and Description |
---|---|
protected String[] |
chooseFormat(Class<? extends AccountingLine> accountingLineClass) |
String |
getExpectedAccountingLineFormatAsString(Class<? extends AccountingLine> accountingLineClass) |
protected Class |
getSourceAccountingLineClass(AccountingDocument accountingDocument)
Given a document, determines what class the source lines of that document uses
|
String[] |
getSourceAccountingLineFormat() |
protected Class |
getTargetAccountingLineClass(AccountingDocument accountingDocument)
Given a document, determines what class that document uses for target accounting lines
|
String[] |
getTargetAccountingLineFormat() |
protected List<AccountingLine> |
importAccountingLines(String fileName,
InputStream stream,
AccountingDocument transactionalDocument,
boolean isSource)
Calls the appropriate parseAccountingLine method
|
List |
importSourceAccountingLines(String fileName,
InputStream stream,
AccountingDocument document)
generates a list of
SourceAccountingLine from the inputStream |
List |
importTargetAccountingLines(String fileName,
InputStream stream,
AccountingDocument document)
generates a list of
TargetAccountingLine from the inputStream |
protected Map<String,String> |
parseAccountingLine(Class<? extends AccountingLine> accountingLineClass,
String lineToParse)
Parses the csv line
|
SourceAccountingLine |
parseSourceAccountingLine(AccountingDocument transactionalDocument,
String sourceAccountingLineString)
parses a comma deliminated string into an
SourceAccountingLine by populating the attributes found in the
getSourceAccountingLineFormat() |
TargetAccountingLine |
parseTargetAccountingLine(AccountingDocument transactionalDocument,
String targetAccountingLineString)
parses a comma deliminated string into an
TargetAccountingLine by populating the attributes found in the
getTargetAccountingLineFormat() |
protected void |
performCustomSourceAccountingLinePopulation(Map<String,String> attributeValueMap,
SourceAccountingLine sourceAccountingLine,
String accountingLineAsString)
Should be voerriden by documents to perform any additional
SourceAccountingLine population |
protected void |
performCustomTargetAccountingLinePopulation(Map<String,String> attributeValueMap,
TargetAccountingLine targetAccountingLine,
String accountingLineAsString)
Should be overridden by documents to perform any additional
TargetAccountingLine attribute population |
protected AccountingLine |
populateAccountingLine(AccountingDocument transactionalDocument,
Class<? extends AccountingLine> accountingLineClass,
String accountingLineAsString,
Map<String,String> attributeValueMap,
Integer sequenceNumber)
Populates a source/target line with values
|
protected void |
putCommonAttributesInMap(Map<String,String> attributeValueMap,
AccountingDocument document,
Integer sequenceNumber)
Places fields common to both source/target accounting lines in the attribute map
|
String[] |
removeChartFromFormatIfNeeded(String[] format)
If accounts can cross charts, returns the given format;
otherwise returns the format with ChartOfAccountsCode field removed.
|
protected String |
retrieveAttributeLabel(Class clazz,
String attributeName) |
protected void |
validateImportedAccountingLine(AccountingLine line,
String accountingLineAsString)
performs any additional accounting line validation
|
protected static final String[] DEFAULT_FORMAT
public AccountingLineParserBase()
public String[] getSourceAccountingLineFormat()
getSourceAccountingLineFormat
in interface AccountingLineParser
SourceAccountingLine
attribute formatorg.kuali.rice.krad.bo.AccountingLineParser#getSourceAccountingLineFormat()
public String[] getTargetAccountingLineFormat()
getTargetAccountingLineFormat
in interface AccountingLineParser
TargetAccountingLine
attribute formatorg.kuali.rice.krad.bo.AccountingLineParser#getTargetAccountingLineFormat()
public String[] removeChartFromFormatIfNeeded(String[] format)
public String getExpectedAccountingLineFormatAsString(Class<? extends AccountingLine> accountingLineClass)
getExpectedAccountingLineFormatAsString
in interface AccountingLineParser
String[]
attribute format with each attribute seperated by a comma.org.kuali.rice.krad.bo.AccountingLineParser#getExpectedAccountingLineFormatAsString(java.lang.Class)
public SourceAccountingLine parseSourceAccountingLine(AccountingDocument transactionalDocument, String sourceAccountingLineString)
AccountingLineParser
SourceAccountingLine
by populating the attributes found in the
getSourceAccountingLineFormat()parseSourceAccountingLine
in interface AccountingLineParser
org.kuali.rice.krad.bo.AccountingLineParser#parseSourceAccountingLine(org.kuali.rice.krad.document.TransactionalDocument,
java.lang.String)
protected Class getSourceAccountingLineClass(AccountingDocument accountingDocument)
accountingDocument
- the document to find the class of the source lines forpublic TargetAccountingLine parseTargetAccountingLine(AccountingDocument transactionalDocument, String targetAccountingLineString)
AccountingLineParser
TargetAccountingLine
by populating the attributes found in the
getTargetAccountingLineFormat()parseTargetAccountingLine
in interface AccountingLineParser
org.kuali.rice.krad.bo.AccountingLineParser#parseTargetAccountingLine(org.kuali.rice.krad.document.TransactionalDocument,
java.lang.String)
protected Class getTargetAccountingLineClass(AccountingDocument accountingDocument)
accountingDocument
- the document to determine the target accounting line class forprotected AccountingLine populateAccountingLine(AccountingDocument transactionalDocument, Class<? extends AccountingLine> accountingLineClass, String accountingLineAsString, Map<String,String> attributeValueMap, Integer sequenceNumber)
transactionalDocument
- accountingLineClass
- accountingLineAsString
- attributeValueMap
- sequenceNumber
- protected void putCommonAttributesInMap(Map<String,String> attributeValueMap, AccountingDocument document, Integer sequenceNumber)
attributeValueMap
- document
- sequenceNumber
- protected Map<String,String> parseAccountingLine(Class<? extends AccountingLine> accountingLineClass, String lineToParse)
accountingLineClass
- lineToParse
- protected void performCustomSourceAccountingLinePopulation(Map<String,String> attributeValueMap, SourceAccountingLine sourceAccountingLine, String accountingLineAsString)
SourceAccountingLine
populationattributeValueMap
- sourceAccountingLine
- accountingLineAsString
- protected void performCustomTargetAccountingLinePopulation(Map<String,String> attributeValueMap, TargetAccountingLine targetAccountingLine, String accountingLineAsString)
TargetAccountingLine
attribute populationattributeValueMap
- targetAccountingLine
- accountingLineAsString
- protected List<AccountingLine> importAccountingLines(String fileName, InputStream stream, AccountingDocument transactionalDocument, boolean isSource)
stream
- transactionalDocument
- isSource
- public final List importSourceAccountingLines(String fileName, InputStream stream, AccountingDocument document)
AccountingLineParser
SourceAccountingLine
from the inputStreamimportSourceAccountingLines
in interface AccountingLineParser
SourceAccountingLine
sorg.kuali.rice.krad.bo.AccountingLineParser#importSourceAccountingLines(java.io.InputStream,
org.kuali.rice.krad.document.TransactionalDocument)
public final List importTargetAccountingLines(String fileName, InputStream stream, AccountingDocument document)
AccountingLineParser
TargetAccountingLine
from the inputStreamimportTargetAccountingLines
in interface AccountingLineParser
SourceAccountingLine
sorg.kuali.rice.krad.bo.AccountingLineParser#importTargetAccountingLines(java.io.InputStream,
org.kuali.rice.krad.document.TransactionalDocument)
protected void validateImportedAccountingLine(AccountingLine line, String accountingLineAsString) throws AccountingLineParserException
line
- accountingLineAsString
- AccountingLineParserException
protected String retrieveAttributeLabel(Class clazz, String attributeName)
protected String[] chooseFormat(Class<? extends AccountingLine> accountingLineClass)
Copyright © 2004–2014 The Kuali Foundation. All rights reserved.