Class ImportAbstract

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.sql.ResultSet, java.sql.Wrapper, AwareVTI
    Direct Known Subclasses:
    Import

    abstract class ImportAbstract
    extends VTITemplate

    • Field Detail

      • columnNames

        java.lang.String[] columnNames
      • numberOfColumns

        int numberOfColumns
      • columnWidths

        int[] columnWidths
      • lineNumber

        int lineNumber
      • nextRow

        java.lang.String[] nextRow
      • noOfColumnsExpected

        int noOfColumnsExpected
      • lobsInExtFile

        protected boolean lobsInExtFile
      • tableColumnTypesStr

        java.lang.String tableColumnTypesStr
      • tableColumnTypes

        int[] tableColumnTypes
      • columnTypeNamesString

        java.lang.String columnTypeNamesString
      • columnTypeNames

        java.lang.String[] columnTypeNames
      • udtClassNamesString

        java.lang.String udtClassNamesString
      • udtClasses

        java.util.HashMap udtClasses
      • wasNull

        private boolean wasNull
    • Constructor Detail

      • ImportAbstract

        ImportAbstract()
    • Method Detail

      • getImportReadData

        abstract ImportReadData getImportReadData()
                                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • doAllTheWork

        void doAllTheWork()
                   throws java.lang.Exception
        Does all the work
        Throws:
        java.lang.Exception - if there is an error
      • loadColumnNames

        void loadColumnNames()
      • getMetaData

        public java.sql.ResultSetMetaData getMetaData()
        Gets the resultset meta data
        Specified by:
        getMetaData in interface java.sql.ResultSet
        Overrides:
        getMetaData in class VTITemplate
        Throws:
        java.sql.SQLException - if there is an error
      • getRow

        public int getRow()
                   throws java.sql.SQLException
        gets the next row
        Specified by:
        getRow in interface java.sql.ResultSet
        Overrides:
        getRow in class VTITemplate
        Throws:
        java.sql.SQLException - if there is an error
      • getCurrentLineNumber

        public int getCurrentLineNumber()
        gets the current line number
      • next

        public boolean next()
                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • close

        public void close()
                   throws java.sql.SQLException
        closes the resultset
        Throws:
        java.sql.SQLException - if there is an error
      • wasNull

        public boolean wasNull()
        Specified by:
        wasNull in interface java.sql.ResultSet
        Overrides:
        wasNull in class VTITemplate
      • getString

        public java.lang.String getString​(int columnIndex)
                                   throws java.sql.SQLException
        Specified by:
        getString in interface java.sql.ResultSet
        Overrides:
        getString in class VTITemplate
        Throws:
        java.sql.SQLException - if there is an error
      • getClob

        public java.sql.Clob getClob​(int columnIndex)
                              throws java.sql.SQLException
        Returns java.sql.Clob type object that contains the column data from the import file.
        Specified by:
        getClob in interface java.sql.ResultSet
        Overrides:
        getClob in class VTITemplate
        Parameters:
        columnIndex - number of the column. starts at 1.
        Throws:
        java.sql.SQLException - if any occurs during create of the clob object.
      • getBlob

        public java.sql.Blob getBlob​(int columnIndex)
                              throws java.sql.SQLException
        Returns java.sql.Blob type object that contains the column data from the import file.
        Specified by:
        getBlob in interface java.sql.ResultSet
        Overrides:
        getBlob in class VTITemplate
        Parameters:
        columnIndex - number of the column. starts at 1.
        Throws:
        java.sql.SQLException - if any occurs during create of the blob object.
      • getObject

        public java.lang.Object getObject​(int columnIndex)
                                   throws java.sql.SQLException
        Returns Object that contains the column data from the import file.
        Specified by:
        getObject in interface java.sql.ResultSet
        Overrides:
        getObject in class VTITemplate
        Parameters:
        columnIndex - number of the column. starts at 1.
        Throws:
        java.sql.SQLException - if any error occurs.
      • readObject

        public static java.lang.Object readObject​(byte[] bytes)
                                           throws java.lang.Exception
        Read a serializable from a set of bytes.
        Throws:
        java.lang.Exception
      • destringifyObject

        public static java.lang.Object destringifyObject​(java.lang.String raw)
                                                  throws java.lang.Exception
        Read an object which was serialized to a string using StringUtil
        Throws:
        java.lang.Exception
      • getBytes

        public byte[] getBytes​(int columnIndex)
                        throws java.sql.SQLException
        Returns byte array that contains the column data from the import file.
        Specified by:
        getBytes in interface java.sql.ResultSet
        Overrides:
        getBytes in class VTITemplate
        Parameters:
        columnIndex - number of the column. starts at 1.
        Throws:
        java.sql.SQLException - if any error occurs.
      • isColumnInExtFile

        private boolean isColumnInExtFile​(int colIndex)
        Check if for this column type, real data is stored in an external file and only the reference is in the main import file.
        Parameters:
        colIndex - number of the column. starts at 1.
        Returns:
        true, if the column data in a different file from the main import file , otherwise false.
      • importError

        public java.sql.SQLException importError​(java.lang.Exception ex)
        Close the stream and wrap exception in a SQLException
        Parameters:
        ex - Exception causing the import error
        Throws:
        java.sql.SQLException