public abstract class CSVImport extends ExemptibleManagerImplementation
Modifier and Type | Class and Description |
---|---|
class |
CSVImport.NoDataFoundException |
Modifier and Type | Field and Description |
---|---|
protected AliveConfirmer |
aliveConfirmer |
protected DataObjectConstructionDetails |
docd
Data object construction details to use
|
protected int |
importCount |
protected int |
maxImport |
static java.lang.String[] |
openAlterNatives |
protected char[] |
preferredDelimiter |
protected SessionResources |
sessionResources |
protected StatusInfoPresenter |
statusInfoPresenter |
Constructor and Description |
---|
CSVImport(SessionResources sessionResources) |
Modifier and Type | Method and Description |
---|---|
void |
checkFile(java.io.BufferedReader bure,
java.lang.String[] mandatoryColumnNames) |
void |
checkFile(java.io.BufferedReader bure,
java.lang.String[][] mandatoryColumnNameAlternatives) |
java.lang.String |
checkFile(java.lang.String filePath,
java.lang.String[] mandatoryColumnNames) |
java.lang.String |
checkFile(java.lang.String filePath,
java.lang.String[][] mandatoryColumnNameAlternatives)
Checks the file and returns the suitable charset name to read it.
|
protected boolean |
checkFile(java.lang.String filePath,
java.lang.String[][] mandatoryColumnNameAlternatives,
java.lang.String charsetName) |
java.lang.String |
checkFile(java.lang.String filePath,
java.lang.String[] mandatoryColumnNames,
java.lang.String charsetName)
Returns the valid charset name if the file may be read using the specified charset name or null
if the specified charset name is not valid.
|
java.lang.String |
checkFileReturnCharset(java.lang.String filePath,
java.lang.String[][] mandatoryColumnNameAlternatives,
java.lang.String charsetName)
Returns the valid charset name if the file may be read using the specified charset name or null
if the specified charset name is not valid.
|
java.lang.String |
chooseSuitableCharsetFrom(java.lang.String filePath,
java.lang.String[] charsetOptions)
Returns a suitable charset name to read the file, trying in the order of charsetOptions.
|
int |
getImportAmount() |
static java.lang.String |
getMessage(java.lang.String[] mandatoryColumnNames) |
static java.lang.String |
getMessage(java.lang.String[][] mandatoryColumnNameAlternatives) |
java.lang.String |
getMessageWhatsMissing()
Returns message what's explicitly missing in first row, which is easer to understand for user than complete message of NoDataFoundException.
|
protected char |
guessDelimiter(java.io.BufferedReader bure) |
protected char |
guessDelimiter(java.lang.String firstLine) |
void |
setAliveConfirmer(AliveConfirmer aliveConfirmer) |
void |
setDataObjectConstructionDetails(DataObjectConstructionDetails docd) |
void |
setMaxImport(int maxImport)
Sets the maximum of entries to be imported
|
void |
setPreferredDelimiter(char[] preferredDelimiter) |
void |
setStatusInfoPresenter(StatusInfoPresenter statusInfoPresenter) |
protected void |
setStatusInformation(java.lang.String info) |
free, register
protected SessionResources sessionResources
protected DataObjectConstructionDetails docd
protected AliveConfirmer aliveConfirmer
protected char[] preferredDelimiter
protected StatusInfoPresenter statusInfoPresenter
protected int maxImport
protected int importCount
public static java.lang.String[] openAlterNatives
public CSVImport(SessionResources sessionResources)
public static java.lang.String getMessage(java.lang.String[] mandatoryColumnNames)
public static java.lang.String getMessage(java.lang.String[][] mandatoryColumnNameAlternatives)
public void setDataObjectConstructionDetails(DataObjectConstructionDetails docd)
public void setStatusInfoPresenter(StatusInfoPresenter statusInfoPresenter)
public void setMaxImport(int maxImport)
maxImport
- the maximum of entries to be importedpublic void setAliveConfirmer(AliveConfirmer aliveConfirmer)
public void setPreferredDelimiter(char[] preferredDelimiter)
public java.lang.String chooseSuitableCharsetFrom(java.lang.String filePath, java.lang.String[] charsetOptions)
filePath
- the path of the file to be checkedcharsetOptions
- the names of the charsets to be testedpublic void checkFile(java.io.BufferedReader bure, java.lang.String[] mandatoryColumnNames) throws CSVImport.NoDataFoundException
CSVImport.NoDataFoundException
public java.lang.String checkFile(java.lang.String filePath, java.lang.String[] mandatoryColumnNames) throws CSVImport.NoDataFoundException
CSVImport.NoDataFoundException
public java.lang.String checkFile(java.lang.String filePath, java.lang.String[] mandatoryColumnNames, java.lang.String charsetName) throws CSVImport.NoDataFoundException
filePath
- the path of the file to be checkedmandatoryColumnNames
- column names that are mandatorycharsetName
- the charset name to open the fileCSVImport.NoDataFoundException
public java.lang.String checkFileReturnCharset(java.lang.String filePath, java.lang.String[][] mandatoryColumnNameAlternatives, java.lang.String charsetName) throws CSVImport.NoDataFoundException
filePath
- the path of the file to be checkedmandatoryColumnNameAlternatives
- a list of alternatives of column names that are mandatorycharsetName
- the charset name to open the fileCSVImport.NoDataFoundException
public void checkFile(java.io.BufferedReader bure, java.lang.String[][] mandatoryColumnNameAlternatives) throws CSVImport.NoDataFoundException
CSVImport.NoDataFoundException
public java.lang.String checkFile(java.lang.String filePath, java.lang.String[][] mandatoryColumnNameAlternatives) throws CSVImport.NoDataFoundException
filePath
- the path of the file to be checkedmandatoryColumnNameAlternatives
- a list of alternatives of column names that are mandatoryCSVImport.NoDataFoundException
- if no alternative is fitting the needed data structureprotected boolean checkFile(java.lang.String filePath, java.lang.String[][] mandatoryColumnNameAlternatives, java.lang.String charsetName) throws CSVImport.NoDataFoundException
CSVImport.NoDataFoundException
protected char guessDelimiter(java.io.BufferedReader bure)
protected char guessDelimiter(java.lang.String firstLine)
public java.lang.String getMessageWhatsMissing()
protected void setStatusInformation(java.lang.String info)
public int getImportAmount()
Copyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de