Class ExcelImportJXL

java.lang.Object
sk.iway.iwcm.xls.ExcelImportJXL
Direct Known Subclasses:
AtrExcelImport, DefaultEntityImporter, DictionaryTooltipXLSImport, EmailExcelImport, EmailExcelImportUnsubscribe, ExcelImportQA, ImportStructureExcel, ImportUsersXLS, MeninyImport, PricelistExcelImport

public class ExcelImportJXL extends Object
ExcelImportJXL.java - Superclass pre import udajov z excelu do databazy, prvy riadok obsahuje nazvy stlpcov, importuje sa pomocou JXL API (pozna Excel 95)
  • Field Details

    • headerCells

      protected jxl.Cell[] headerCells
    • headerNames

      protected String[] headerNames
    • headerNamesOriginal

      protected String[] headerNamesOriginal
    • in

      protected InputStream in
    • request

      protected javax.servlet.http.HttpServletRequest request
    • out

      protected PrintWriter out
    • rowCounter

      protected int rowCounter
    • rowsInSheet

      protected int rowsInSheet
    • fileName

      protected String fileName
  • Constructor Details

    • ExcelImportJXL

      public ExcelImportJXL(InputStream in, javax.servlet.http.HttpServletRequest request, PrintWriter out)
  • Method Details

    • formatHeaderName

      public static String formatHeaderName(String name)
      Upravi header name - je to Lower Case, zrusi dvojite medzery
      Parameters:
      name -
      Returns:
    • formatHeaderNameOriginal

      public static String formatHeaderNameOriginal(String name)
    • setUpdateField

      public boolean setUpdateField(String tableName)
      Nastavi stlpec updated v databaze v tabulke tableName na false
      Parameters:
      tableName -
      Returns:
    • deleteNotUpdated

      public boolean deleteNotUpdated(String tableName)
      vymaze z databazy zaznamy, ktore nie su updatnute
      Parameters:
      tableName -
      Returns:
    • setHeader

      protected void setHeader(jxl.Cell[] row)
      Nastavi Map, ktora prevadza meno na cislo stlpca. Meno je vzdy lowercase
      Parameters:
      row -
    • saveRow

      protected void saveRow(Connection db_conn, jxl.Cell[] row, jxl.Sheet sheet, Prop prop) throws Exception
      pridanie riadku do zoznamu riadkov
      Parameters:
      row -
      Throws:
      Exception
    • afterImportJob

      protected void afterImportJob(Prop prop)
    • doImport

      public void doImport(Prop prop)
    • doImport

      public void doImport(String sheetName, Prop prop)
    • importSheet

      public void importSheet(jxl.Sheet sheet, Prop prop)
      vykonanie importu
    • print

      public void print(String message)
    • println

      public void println(String message)
    • println

      public void println(String message, int row)
    • printlnError

      public void printlnError(String message)
    • printlnError

      public void printlnError(String message, int row)
    • scrollWindow

      public void scrollWindow(int amount)
    • dropQuote

      public String dropQuote(String text)
      zmaze uvodzovky a apostrofy z textu
      Parameters:
      text -
      Returns:
    • getCell

      public jxl.Cell getCell(jxl.Cell[] row, String name) throws Exception
      Throws:
      Exception
    • getValue

      public String getValue(jxl.Cell[] row, String name) throws Exception
      Throws:
      Exception
    • getValue

      public static String getValue(jxl.Cell cell)
      Ziska hodnotu bunky ako String
      Parameters:
      cell - Description of the Parameter
      Returns:
      The value value
    • getIntValue

      public int getIntValue(jxl.Cell[] row, String name) throws Exception
      Throws:
      Exception
    • getIntValue

      public static int getIntValue(jxl.Cell cell)
      vrati celociselnu hodnotu bunky
      Parameters:
      cell -
      Returns:
    • getBooleanValue

      public boolean getBooleanValue(jxl.Cell[] row, String name) throws Exception
      Throws:
      Exception
    • getBooleanValue

      public static boolean getBooleanValue(jxl.Cell cell)
      vrati true ak je v bunke napisane ano, pravda, alebo nieco podobne
      Parameters:
      cell -
      Returns:
    • getFileName

      public String getFileName()
      Returns:
      Returns the fileName.
    • setFileName

      public void setFileName(String fileName)
      Parameters:
      fileName - The fileName to set.
    • getDouble

      public double getDouble(jxl.Cell[] row, String name) throws Exception
      Throws:
      Exception
    • getDouble

      public double getDouble(jxl.Cell[] row, String name, double defaultValue) throws Exception
      Throws:
      Exception
    • getDouble

      protected double getDouble(jxl.Cell cell)
    • getDouble

      protected double getDouble(jxl.Cell cell, double defaultValue)
    • log

      public void log(String text)
    • logErr

      public void logErr(String text)
    • getHeaderName

      public String getHeaderName(int pos)
      Vrati nazov stlpca pre zadanu poziciu, alebo null
      Parameters:
      pos -
      Returns:
    • getHeaderNameOriginal

      public String getHeaderNameOriginal(int pos)
    • getDateValue

      public Date getDateValue(jxl.Cell[] row, String name) throws Exception
      vrati Date pre zadanu bunku
      Parameters:
      row -
      name -
      Returns:
      Throws:
      Exception
    • getDateValue

      public static Date getDateValue(jxl.Cell cell)
    • trim

      public static String trim(String s)
      trimne aj tvrde medzery
      Parameters:
      s -
      Returns: