org.kuali.kfs.gl.batch.service.impl
Class ReconciliationParserServiceImpl

java.lang.Object
  extended by org.kuali.kfs.gl.batch.service.impl.ReconciliationParserServiceImpl
All Implemented Interfaces:
ReconciliationParserService

public class ReconciliationParserServiceImpl
extends Object
implements ReconciliationParserService

Format of the reconciliation file:

  C tableid rowcount ; 
  S field1 dollaramount ; 
  S field2 dollaramount ; 
  E checksum ;
 
The character '#' and everything following it on that line is ignored. Whitespace characters are tab and space.

A 'C' 'S' or 'E' must be the first character on a line unless the line is entirely whitespace or a comment. The case of these three codes is not significant.

Semi-colons are required before any possible comments on C S or E lines. Any amount of whitespace delimits the elements of C, S and E lines. (If an S line contains field1+field2 for the field element, take care NOT to put any whitespace between the 'field1', the '+' and the 'field2'.)

Tableid is an arbitrary identifier for the record

Rowcount must be a non-negative integer. Fieldn is the technical fieldname(s) in the target database. Case *is* significant, since this must match the database name(s) exactly.

Dollaramount may be negative; the check is significant to 4 decimal places.

The checksum on line E is the number of C and S lines. A C line and a terminating E line are mandatory; S lines are optional.

There may be more than one C-E block per metadata file.

In general, this implementation of the parser attempts to be error tolerant. It primarily looks at the C-E block that is being looked for, by ignoring all other C-E blocks. A C-E block is "looked for" when the table ID of the C line is passed in as a parameter of #parseReconciliationData(Reader, String). However, if the C lines of any blocks before the looked for block are incorrect, then it is likely to cause undesired behavior.


Constructor Summary
ReconciliationParserServiceImpl()
           
 
Method Summary
 ReconciliationBlock parseReconciliationBlock(Reader reader, String tableId)
          Parses a reconciliation file
protected  String stripCommentsAndTrim(String line)
          Removes comments and trims whitespace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReconciliationParserServiceImpl

public ReconciliationParserServiceImpl()
Method Detail

parseReconciliationBlock

public ReconciliationBlock parseReconciliationBlock(Reader reader,
                                                    String tableId)
                                             throws IOException
Parses a reconciliation file

Specified by:
parseReconciliationBlock in interface ReconciliationParserService
Parameters:
reader - a source of data from which to build a reconciliation
tableId - defined within the reconciliation file; defines which block to parse
Returns:
parsed reconciliation data
Throws:
IOException - thrown if the file cannot be written for any reason
See Also:
org.kuali.kfs.gl.batch.service.ReconciliationParserService#parseReconciliatioData(java.io.Reader)

stripCommentsAndTrim

protected String stripCommentsAndTrim(String line)
Removes comments and trims whitespace

Parameters:
line - the line
Returns:
stripped and trimmed line


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