public class SolrXMLIngestor extends ExcelIngestorBase
ExcelIngestorBase| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
filename
The filename.
|
protected org.apache.log4j.Logger |
logger
The logger.
|
private boolean |
merge
The merge.
|
private Table |
table
The table.
|
private java.lang.String |
tableName
The table name.
|
private static java.lang.String |
TEMP_FILE
The Constant TEMP_FILE.
|
illegalChars| Constructor and Description |
|---|
SolrXMLIngestor(java.lang.String tableName,
java.lang.String filename,
boolean merge)
Instantiates a new solr xml ingestor.
|
| Modifier and Type | Method and Description |
|---|---|
private boolean |
buildTable(org.dom4j.Document doc)
Builds the table.
|
private void |
findElementsByName(org.dom4j.Element root,
java.lang.String name,
java.util.ArrayList<org.dom4j.Element> list)
Find elements by name.
|
java.util.ArrayList<java.lang.String> |
getColumnHeaders()
Gets the column headers.
|
java.util.ArrayList<java.lang.String> |
getColumnHeaders(java.lang.String fileName)
When given the name of an existing file, returns the columns which exist
in the top sheet of that excel file.
|
IngestResult |
ingest()
Ingest.
|
IngestResult |
ingestFile(java.lang.String tableName,
java.lang.String fileName,
boolean merge)
Ingests the requested columns in to tableName from the provided file.
|
java.util.ArrayList<Column> |
listColumns(java.lang.String fileName)
When given the name of an existing file, returns the columns which exist
in the top sheet of that excel file.
|
static void |
main(java.lang.String[] args)
The main method.
|
private void |
makeRow(Table t,
java.lang.String name,
java.util.ArrayList<org.dom4j.Element> fields,
java.lang.String columns)
Make row.
|
org.dom4j.Document |
parse(java.io.File file)
Parses the.
|
private void |
updateHeader(Table t,
java.util.ArrayList<org.dom4j.Element> fields)
Update header.
|
checkForDups, echo, fixString, traceprivate java.lang.String tableName
private java.lang.String filename
private Table table
private boolean merge
protected org.apache.log4j.Logger logger
private static final java.lang.String TEMP_FILE
public SolrXMLIngestor(java.lang.String tableName,
java.lang.String filename,
boolean merge)
tableName - the table namefilename - the filenamemerge - the merge flag (true = merge, false = replace)public IngestResult ingest()
public java.util.ArrayList<java.lang.String> getColumnHeaders()
private boolean buildTable(org.dom4j.Document doc)
doc - the dom4j Documentprivate void updateHeader(Table t, java.util.ArrayList<org.dom4j.Element> fields)
t - the Tablefields - the fieldsTableprivate void makeRow(Table t, java.lang.String name, java.util.ArrayList<org.dom4j.Element> fields, java.lang.String columns)
t - the Tablename - the namefields - the fieldscolumns - the columnsprivate void findElementsByName(org.dom4j.Element root,
java.lang.String name,
java.util.ArrayList<org.dom4j.Element> list)
root - the rootname - the namelist - the listpublic org.dom4j.Document parse(java.io.File file)
throws org.dom4j.DocumentException,
java.io.IOException
file - the fileorg.dom4j.DocumentExceptionjava.io.IOException - Signals that an I/O exception has occurred.public java.util.ArrayList<Column> listColumns(java.lang.String fileName)
ExcelIngestorBaselistColumns in class ExcelIngestorBasefileName - the file namepublic java.util.ArrayList<java.lang.String> getColumnHeaders(java.lang.String fileName)
ExcelIngestorBasegetColumnHeaders in class ExcelIngestorBasefileName - the file namepublic IngestResult ingestFile(java.lang.String tableName, java.lang.String fileName, boolean merge)
ExcelIngestorBaseingestFile in class ExcelIngestorBasetableName - the table namefileName - the file namemerge - flag to merge with existing data in the table (true = merge, false = replace)public static void main(java.lang.String[] args)
args - the arguments