public class ImportProcessor
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private FlashServletContext |
ivContext
The current context for the servlet or thread using this class.
|
private java.util.HashMap<java.lang.String,Import<? extends JDBCObject<?>>> |
ivImportObjects
A cache of import object instances.
|
private int |
ivNumOfRecords
The number of processed records
|
private ImportParser |
ivParser
A reference to the current import parser.
|
private static long |
serialVersionUID
The class' serialization version id.
|
Constructor and Description |
---|
ImportProcessor(FlashServletContext ctx)
Constructs a new instance of the import processor class with the given
servlet or thread context.
|
Modifier and Type | Method and Description |
---|---|
private int |
getActionCode(java.lang.String action,
int lineNo)
Returns the action code for specified
action parameter or -1
if the action is not valid. |
FlashServletContext |
getContext()
Returns the current context for the servlet or thread using this class.
|
Import<? extends JDBCObject<?>> |
getImportObject(java.lang.String ident,
int lineNo)
Creates and returns the import object for the
ident import type. |
void |
housekeeping()
Garbage collection: Kills (nullifies) the import objects and their
associated objects used during import.
|
void |
logFooter(boolean sysOK,
int lineNo)
Writes the log file's footer with number of file lines processed, number
of records processed and final result of processing (OK if processing
ended normally).
|
void |
logHeader(java.lang.String fileName)
Writes the log file's header with input file name.
|
void |
processLine(java.lang.String line,
int lineNo)
Parses a text line into a collection of values and performs import actions.
|
void |
processValues(java.lang.String line,
int lineNo,
java.util.ArrayList<java.lang.String> values)
Performs import actions as defined by the supplied collection of values.
|
private static final long serialVersionUID
private FlashServletContext ivContext
private ImportParser ivParser
private java.util.HashMap<java.lang.String,Import<? extends JDBCObject<?>>> ivImportObjects
private int ivNumOfRecords
public ImportProcessor(FlashServletContext ctx)
ctx
- (FlashServletContext) The current servlet or thread context.public FlashServletContext getContext()
public void processLine(java.lang.String line, int lineNo)
line
- (String) The text line being processed.lineNo
- (int) The input file line number being processed.public void processValues(java.lang.String line, int lineNo, java.util.ArrayList<java.lang.String> values)
line
- (String) The text line or spreadsheet row being processed.lineNo
- (int) The line number or row number being processed.values
- (ArrayList) The values to process.private int getActionCode(java.lang.String action, int lineNo)
action
parameter or -1
if the action is not valid.action
- (int) Action to be performed (i.e. add, update, delete).lineNo
- (int) The number of the processed input file line.-1
if action not valid.public Import<? extends JDBCObject<?>> getImportObject(java.lang.String ident, int lineNo)
ident
import type.ident
- (String) The identifier for the type of import record.lineNo
- (int) The number of the processed input file line.public void logHeader(java.lang.String fileName)
fileName
- (String) The name of the input file.public void logFooter(boolean sysOK, int lineNo)
sysOK
- (boolean) Indicates if the input processing ended
normally (i.e. with no unexpected system errors).lineNo
- (int) The number of file lines processed.public void housekeeping()