com.agimatec.utility.fileimport
Class LineImportProcessor

java.lang.Object
  extended by com.agimatec.utility.fileimport.ImporterProcessor
      extended by com.agimatec.utility.fileimport.LineImportProcessor

public class LineImportProcessor
extends ImporterProcessor

Description: Import a file line-by-line, e.g. for csv-/comma-separated/fixed-column-length files.
User: roman.stumm
Date: 22.11.2007
Time: 11:56:57
Copyright: Agimatec GmbH


Field Summary
protected  Object currentLine
           
protected  Map currentRow
           
protected  Object headerLine
           
protected  LineReader lineReader
           
protected  LineImporterSpec spec
           
 
Fields inherited from class com.agimatec.utility.fileimport.ImporterProcessor
cancelled, errorCount, importer, lastError, rowCount
 
Constructor Summary
LineImportProcessor(LineImporterSpec spec, Importer importer)
           
 
Method Summary
 Object getCurrentLine()
          the current row/line itself as it came from the LineReader
 Map getCurrentRow()
          the current row/line itself as it was transferred to a map
protected  Object getHeaderLine()
           
 LineReader getLineReader()
           
 LineImporterSpec getSpec()
           
 void importFrom(Closeable aReader)
          API - this method starts the import process.
protected  void importRow(Object aLine)
          import a record from the file and do what is required with the data.
 void release()
           
protected  void setFieldValue(int fieldIdx, Object singleValue)
           
protected  Map transferRow(Object aRecord)
          parse a specified record and save the record data in the root model.
 
Methods inherited from class com.agimatec.utility.fileimport.ImporterProcessor
getErrorCount, getErrorWriter, getImporter, getLastError, getRowCount, handleException, handleRowException, isCancelled, log, logFinished, setCancelled, setErrorWriter, setLastError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spec

protected final LineImporterSpec spec

lineReader

protected LineReader lineReader

headerLine

protected Object headerLine

currentLine

protected Object currentLine

currentRow

protected Map currentRow
Constructor Detail

LineImportProcessor

public LineImportProcessor(LineImporterSpec spec,
                           Importer importer)
Method Detail

getSpec

public LineImporterSpec getSpec()
Specified by:
getSpec in class ImporterProcessor

importFrom

public void importFrom(Closeable aReader)
                throws ImporterException
API - this method starts the import process. It imports the data read from the given reader. The reader is closed afterwards.

Overrides:
importFrom in class ImporterProcessor
Parameters:
aReader - - reader to read the import data from.
Throws:
Exception
ImporterException

importRow

protected void importRow(Object aLine)
                  throws ImporterException
import a record from the file and do what is required with the data.

Parameters:
aLine - - a line of data of one record
Throws:
ImporterException

release

public void release()
Overrides:
release in class ImporterProcessor

transferRow

protected Map transferRow(Object aRecord)
                   throws IOException
parse a specified record and save the record data in the root model.

Throws:
IOException

setFieldValue

protected void setFieldValue(int fieldIdx,
                             Object singleValue)

getHeaderLine

protected Object getHeaderLine()

getCurrentRow

public Map getCurrentRow()
the current row/line itself as it was transferred to a map

Returns:

getLineReader

public LineReader getLineReader()

getCurrentLine

public Object getCurrentLine()
the current row/line itself as it came from the LineReader

Returns:


Copyright © 2008-2011. All Rights Reserved.