Class UploadToRowColExcel

  • All Implemented Interfaces:
    org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.SheetContentsHandler

    public class UploadToRowColExcel
    extends java.lang.Object
    implements org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.SheetContentsHandler
    Responsible to read an Excel xlsx file from a BLOB and write it row and cell to bcd_dataupload_rowcol
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cell​(java.lang.String cellReference, java.lang.String formattedValue, org.apache.poi.xssf.usermodel.XSSFComment comment)
      Callback for a detected cell Skipped cells will be added,
      void endRow​(int rowNum)
      Callback for row finish
      void headerFooter​(java.lang.String text, boolean isHeader, java.lang.String tagName)  
      void process()
      Open the file with the given uploadId, split it into rows and cells and write it to bcd_dataupload_staging
      void process​(org.apache.poi.openxml4j.opc.OPCPackage xlsxPackage)
      Processes whole workbook, currently only the first sheet is read
      void processSheet​(org.apache.poi.xssf.model.StylesTable styles, org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable strings, org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.SheetContentsHandler sheetHandler, java.io.InputStream sheetInputStream)
      Process a single sheet.
      void startRow​(int rowNum)
      New Row
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.SheetContentsHandler

        endSheet
    • Field Detail

      • DATA_FORMAT_LOCALE

        public static final java.util.Locale DATA_FORMAT_LOCALE
    • Constructor Detail

      • UploadToRowColExcel

        public UploadToRowColExcel​(UploadControl uc,
                                   UploadToRowCol uploadToRowCol)
                            throws java.lang.Exception
        Constructor
        Parameters:
        uc -
        uploadToRowCol -
        Throws:
        java.lang.Exception
    • Method Detail

      • process

        public void process()
                     throws java.lang.Exception
        Open the file with the given uploadId, split it into rows and cells and write it to bcd_dataupload_staging
        Throws:
        java.lang.Exception
      • startRow

        public void startRow​(int rowNum)
                      throws java.lang.RuntimeException
        New Row
        Specified by:
        startRow in interface org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.SheetContentsHandler
        Throws:
        java.lang.RuntimeException
      • endRow

        public void endRow​(int rowNum)
                    throws java.lang.RuntimeException
        Callback for row finish
        Specified by:
        endRow in interface org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.SheetContentsHandler
        Throws:
        java.lang.RuntimeException
      • cell

        public void cell​(java.lang.String cellReference,
                         java.lang.String formattedValue,
                         org.apache.poi.xssf.usermodel.XSSFComment comment)
                  throws java.lang.RuntimeException
        Callback for a detected cell Skipped cells will be added,
        Specified by:
        cell in interface org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.SheetContentsHandler
        Throws:
        java.lang.RuntimeException
      • headerFooter

        public void headerFooter​(java.lang.String text,
                                 boolean isHeader,
                                 java.lang.String tagName)
        Specified by:
        headerFooter in interface org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.SheetContentsHandler
      • process

        public void process​(org.apache.poi.openxml4j.opc.OPCPackage xlsxPackage)
                     throws java.io.IOException,
                            org.apache.poi.openxml4j.exceptions.OpenXML4JException,
                            org.xml.sax.SAXException,
                            javax.xml.parsers.ParserConfigurationException
        Processes whole workbook, currently only the first sheet is read
        Parameters:
        xlsxPackage -
        Throws:
        java.io.IOException
        org.apache.poi.openxml4j.exceptions.OpenXML4JException
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
      • processSheet

        public void processSheet​(org.apache.poi.xssf.model.StylesTable styles,
                                 org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable strings,
                                 org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.SheetContentsHandler sheetHandler,
                                 java.io.InputStream sheetInputStream)
                          throws java.io.IOException,
                                 org.xml.sax.SAXException,
                                 javax.xml.parsers.ParserConfigurationException
        Process a single sheet. Currently all data of the sheet is read TODO handle merged cells
        Parameters:
        styles -
        strings -
        sheetHandler -
        sheetInputStream -
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException