Package de.xima.fc.gui.utils.data
Class StringDataSheetUtils
- java.lang.Object
-
- de.xima.fc.gui.utils.data.StringDataSheetUtils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SheetDimension
findSheetDimensions(org.apache.poi.ss.usermodel.Sheet sheet)
static String
getCSVStringFromDataSheet(StringDataSheet sheet)
static StringDataSheet
getDataSheet(String data, CSVFormatWrapper csvFormat, int startAtLine)
static StringDataSheet
getDataSheetFromCSVByteArray(byte[] bytes, CSVFormatWrapper csvFormat, int startAtLine)
static StringDataSheet
getDataSheetFromCSVString(String csvString, CSVFormatWrapper csvFormat, int startAtLine)
static StringDataSheet
getDataSheetFromExcelByteArray(byte[] data, String sheetName, int startAtLine)
Generates aStringDataSheet
for the given sheet namestatic StringDataSheet
getDataSheetFromTemplate(Textbaustein template, Locale clientLocale, String technicalNameKeyColumn, String displayNameKeyColumn, String technicalNameDefaultColumn)
Create aStringDataSheet
object and returns it.static Map<String,StringDataSheet>
getDataSheetsFromExcelByteArray(byte[] data)
Generates aMap
withStringDataSheet
s (values) and their names (key)static Map<String,StringDataSheet>
getDataSheetsFromExcelByteArray(byte[] data, List<String> sheetNames)
Generates aMap
withStringDataSheet
s (values) and their names (key) for the given sheet namesstatic StringDataSheet
getDefaultDataSheet()
static Map<String,Properties>
getPropertyObjectsFromDataSheet(StringDataSheet dataSheet, String columnNameForPropertyKey, String columnNameForDefault, Locale currentClientLocale)
Generates a Properties-Object from all Columns in given data sheet.static Charset
guessCharset(InputStream is)
static void
prefillDataSheetReferencesFromSystemProperties(ADataSheet<String> sheet, Locale clientLocale, String keyColumnName, String propKeyReferences)
Fills the given data sheet with the data from the system properties.
-
-
-
Method Detail
-
getDefaultDataSheet
public static final StringDataSheet getDefaultDataSheet()
-
getCSVStringFromDataSheet
public static final String getCSVStringFromDataSheet(StringDataSheet sheet)
-
getDataSheetFromCSVString
public static final StringDataSheet getDataSheetFromCSVString(String csvString, CSVFormatWrapper csvFormat, int startAtLine) throws Exception
- Throws:
Exception
-
getDataSheet
public static final StringDataSheet getDataSheet(String data, CSVFormatWrapper csvFormat, int startAtLine) throws Exception
- Throws:
Exception
-
getDataSheetFromCSVByteArray
public static final StringDataSheet getDataSheetFromCSVByteArray(byte[] bytes, CSVFormatWrapper csvFormat, int startAtLine) throws Exception
- Throws:
Exception
-
guessCharset
public static Charset guessCharset(InputStream is) throws IOException
- Throws:
IOException
-
getDataSheetFromExcelByteArray
public static final StringDataSheet getDataSheetFromExcelByteArray(byte[] data, String sheetName, int startAtLine) throws Exception
Generates aStringDataSheet
for the given sheet name- Parameters:
data
- byte array of excel file (.xls or .xlsx)sheetName
-String
of sheet name to generateStringDataSheet
s for- Returns:
StringDataSheet
for given sheet name- Throws:
Exception
- when an error during the reading occurs
-
getDataSheetsFromExcelByteArray
public static final Map<String,StringDataSheet> getDataSheetsFromExcelByteArray(byte[] data, List<String> sheetNames) throws Exception
Generates aMap
withStringDataSheet
s (values) and their names (key) for the given sheet names- Parameters:
data
- byte array of excel file (.xls or .xlsx)sheetNames
-List
of names to generateStringDataSheet
s for- Returns:
Map
with sheet names and sheets- Throws:
Exception
- when an error during the reading occurs
-
getDataSheetsFromExcelByteArray
public static final Map<String,StringDataSheet> getDataSheetsFromExcelByteArray(byte[] data) throws Exception
Generates aMap
withStringDataSheet
s (values) and their names (key)
-
getDataSheetFromTemplate
public static final StringDataSheet getDataSheetFromTemplate(Textbaustein template, Locale clientLocale, String technicalNameKeyColumn, String displayNameKeyColumn, String technicalNameDefaultColumn) throws IOException
Create aStringDataSheet
object and returns it. The entries are read from the givenTextbaustein
.- Parameters:
template
- theTextbaustein
object with the language specific overloaded propertiesclientLocale
- the locale of the currentMandant
objecttechnicalNameKeyColumn
- technical name for the key columndisplayNameKeyColumn
- display name for the key columntechnicalNameDefaultColumn
- technical name of the default column- Returns:
- the read
StringDataSheet
- Throws:
IOException
- when an error during the reading occurs
-
prefillDataSheetReferencesFromSystemProperties
public static final void prefillDataSheetReferencesFromSystemProperties(ADataSheet<String> sheet, Locale clientLocale, String keyColumnName, String propKeyReferences)
Fills the given data sheet with the data from the system properties.- Parameters:
sheet
- the data sheet to prefillclientLocale
- the locale of the currentMandant
-objectkeyColumnName
- the name of the 'key' columnpropKeyReferences
- name of the i18n properties file key, which holds the reference values
-
getPropertyObjectsFromDataSheet
public static final Map<String,Properties> getPropertyObjectsFromDataSheet(StringDataSheet dataSheet, String columnNameForPropertyKey, String columnNameForDefault, Locale currentClientLocale)
Generates a Properties-Object from all Columns in given data sheet. One column from the data sheet must be defined as properties key.- Parameters:
dataSheet
- contains the data for the properties objectscolumnNameForPropertyKey
- name of the columns, which represents the key's for the properties-objectscolumnNameForDefault
- name of the column, with represents the default locale for the clientcurrentClientLocale
- the current locale ofMandant
-object- Returns:
- a
Map
-object with all overloaded Properties
-
findSheetDimensions
public static SheetDimension findSheetDimensions(org.apache.poi.ss.usermodel.Sheet sheet)
-
-