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 SheetDimensionfindSheetDimensions(org.apache.poi.ss.usermodel.Sheet sheet) static final Stringstatic final StringDataSheetgetDataSheet(String data, CSVFormatWrapper csvFormat, int startAtLine) static final StringDataSheetgetDataSheetFromCSVByteArray(byte[] bytes, CSVFormatWrapper csvFormat, int startAtLine) static final StringDataSheetgetDataSheetFromCSVString(String csvString, CSVFormatWrapper csvFormat, int startAtLine) static final StringDataSheetgetDataSheetFromExcelByteArray(byte[] data, String sheetName, int startAtLine) Generates aStringDataSheetfor the given sheet namestatic final StringDataSheetgetDataSheetFromTemplate(Textbaustein template, Locale clientLocale, String technicalNameKeyColumn, String displayNameKeyColumn, String technicalNameDefaultColumn) Create aStringDataSheetobject and returns it.static final Map<String,StringDataSheet> getDataSheetsFromExcelByteArray(byte[] data) Generates aMapwithStringDataSheets (values) and their names (key)static final Map<String,StringDataSheet> getDataSheetsFromExcelByteArray(byte[] data, List<String> sheetNames) Generates aMapwithStringDataSheets (values) and their names (key) for the given sheet namesstatic final StringDataSheetstatic 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 Charsetstatic final voidprefillDataSheetReferencesFromSystemProperties(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 aStringDataSheetfor the given sheet name- Parameters:
data- byte array of excel file (.xls or .xlsx)sheetName-Stringof sheet name to generateStringDataSheets for- Returns:
StringDataSheetfor 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 aMapwithStringDataSheets (values) and their names (key) for the given sheet names- Parameters:
data- byte array of excel file (.xls or .xlsx)sheetNames-Listof names to generateStringDataSheets for- Returns:
Mapwith 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 aMapwithStringDataSheets (values) and their names (key) -
getDataSheetFromTemplate
public static final StringDataSheet getDataSheetFromTemplate(Textbaustein template, Locale clientLocale, String technicalNameKeyColumn, String displayNameKeyColumn, String technicalNameDefaultColumn) throws IOException Create aStringDataSheetobject and returns it. The entries are read from the givenTextbaustein.- Parameters:
template- theTextbausteinobject with the language specific overloaded propertiesclientLocale- the locale of the currentMandantobjecttechnicalNameKeyColumn- 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
-