public class CSVTable extends Object
| Constructor and Description |
|---|
CSVTable(Table<?> table,
File data)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addColumn(String csvName,
String poemName)
Add column definitions to this table.
|
void |
addColumn(String csvName,
String poemName,
boolean isPrimaryKey)
Add column definitions, perhaps Primary Keys, to this table.
|
void |
addColumn(String csvName,
String foreignPoemName,
CSVTable foreignTable)
Add column definitions for foreign keys to this table.
|
void |
define()
Process the first line to define columns.
|
void |
emptyTable()
Delete all Persistents from the Poem table.
|
String |
getName()
Used in debugging to display name of table being emptied.
|
void |
load(boolean writeOnFly)
Parse the CSV data file and store the data for saving later.
|
CSVRecord |
parseRecord()
Reads the file until is has seen an object's-worth of
field values (ie until it sees an EOF or a line starting
with '$') which it returns in a hashtable (null if there are
no field values).
|
void |
report(boolean recordDetails,
boolean fieldDetails,
Writer output)
Return a string reporting on the data added to this table.
|
void |
writeRecords()
Write the records to the database,
called if we are not writing each record to db as we go.
|
public void define()
throws IOException
IOExceptionpublic void addColumn(String csvName, String poemName)
public void addColumn(String csvName, String poemName, boolean isPrimaryKey) throws CSVPrimaryKeyColumnAlreadySetException
public void addColumn(String csvName, String foreignPoemName, CSVTable foreignTable)
public void load(boolean writeOnFly)
throws IOException,
CSVParseException,
NoPrimaryKeyInCSVTableException,
CSVWriteDownException
writeOnFly - whether to commit each line to db as we goIOException - if there is a file system problemCSVParseException - if the is a malformed field in the CSVCSVWriteDownExceptionNoPrimaryKeyInCSVTableExceptionpublic CSVRecord parseRecord() throws IOException, CSVParseException
IOException - if there is a problem with the file systemCSVParseException - if there is a problem parsing the inputpublic void emptyTable()
public void writeRecords()
throws NoPrimaryKeyInCSVTableException,
CSVWriteDownException
public void report(boolean recordDetails,
boolean fieldDetails,
Writer output)
throws IOException
IOExceptionpublic String getName()
Copyright © 2000–2021 PanEris. All rights reserved.