Package de.xima.fc.gui.utils.data
Class StringDataSheetUtils
java.lang.Object
de.xima.fc.gui.utils.data.StringDataSheetUtils
Utility Class containing helper methods for working with a data grid model of type
String
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptionstatic SheetDimension
findSheetDimensions
(org.apache.poi.ss.usermodel.Sheet sheet) static final String
static final StringDataSheet
getDataSheet
(String data, CSVFormatWrapper csvFormat, int startAtLine) static final StringDataSheet
getDataSheetFromCSVByteArray
(byte[] bytes, CSVFormatWrapper csvFormat, int startAtLine) static final StringDataSheet
getDataSheetFromCSVString
(String csvString, CSVFormatWrapper csvFormat, int startAtLine) static final StringDataSheet
getDataSheetFromExcelByteArray
(byte[] data, String sheetName, int startAtLine) Generates aStringDataSheet
for the given sheet namestatic final StringDataSheet
getDataSheetFromTemplate
(Textbaustein template, Locale clientLocale, String technicalNameKeyColumn, String displayNameKeyColumn, String technicalNameDefaultColumn) Create aStringDataSheet
object and returns it.static final Map<String,
StringDataSheet> getDataSheetsFromExcelByteArray
(byte[] data) Generates aMap
withStringDataSheet
s (values) and their names (key)static final Map<String,
StringDataSheet> getDataSheetsFromExcelByteArray
(byte[] data, List<String> sheetNames) Generates aMap
withStringDataSheet
s (values) and their names (key) for the given sheet namesstatic final StringDataSheet
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.static Charset
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.
-
Method Details
-
getDefaultDataSheet
-
getCSVStringFromDataSheet
-
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
- 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
-