Class StringDataSheetUtils

java.lang.Object
de.xima.fc.gui.utils.data.StringDataSheetUtils

public class StringDataSheetUtils extends Object
Utility Class containing helper methods for working with a data grid model of type String
Author:
XIMA MEDIA GmbH
  • Method Details

    • 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 a StringDataSheet for the given sheet name
      Parameters:
      data - byte array of excel file (.xls or .xlsx)
      sheetName - String of sheet name to generate StringDataSheets 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 a Map with StringDataSheets (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 generate StringDataSheets 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 a Map with StringDataSheets (values) and their names (key)
      Parameters:
      data - byte array of excel file (.xls or .xlsx)
      Returns:
      Map with sheet names and sheets
      Throws:
      Exception - when an error during the reading occurs
    • getDataSheetFromTemplate

      public static final StringDataSheet getDataSheetFromTemplate(Textbaustein template, Locale clientLocale, String technicalNameKeyColumn, String displayNameKeyColumn, String technicalNameDefaultColumn) throws IOException
      Create a StringDataSheet object and returns it. The entries are read from the given Textbaustein.
      Parameters:
      template - the Textbaustein object with the language specific overloaded properties
      clientLocale - the locale of the current Mandant object
      technicalNameKeyColumn - technical name for the key column
      displayNameKeyColumn - display name for the key column
      technicalNameDefaultColumn - 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 prefill
      clientLocale - the locale of the current Mandant-object
      keyColumnName - the name of the 'key' column
      propKeyReferences - 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 objects
      columnNameForPropertyKey - name of the columns, which represents the key's for the properties-objects
      columnNameForDefault - name of the column, with represents the default locale for the client
      currentClientLocale - the current locale of Mandant-object
      Returns:
      a Map-object with all overloaded Properties
    • findSheetDimensions

      public static SheetDimension findSheetDimensions(org.apache.poi.ss.usermodel.Sheet sheet)