Package com.basiscomponents.db
Class ResultSetImporter
- java.lang.Object
-
- com.basiscomponents.db.ResultSetImporter
-
public class ResultSetImporter extends Object
This class provides static methods to create a com.basiscomponents.db.ResultSet object from different formats.
-
-
Constructor Summary
Constructors Constructor Description ResultSetImporter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ResultSet
readExcel(File excelFile)
Parses the given Excel file and returns a com.basiscomponents.db.ResultSet with the data defined the the Excel file.static ResultSet
readExcel(File excelFile, DataRow attributesRecord)
Parses the given Excel file and returns a com.basiscomponents.db.ResultSet with the data defined the the Excel file.static ResultSet
readExcel(File excelFile, DataRow attributesRecord, List<String> columnNames, Boolean firstRowHasData)
Parses the given Excel file and returns a com.basiscomponents.db.ResultSet with the data defined the the Excel file.
-
-
-
Method Detail
-
readExcel
public static ResultSet readExcel(File excelFile) throws Exception
Parses the given Excel file and returns a com.basiscomponents.db.ResultSet with the data defined the the Excel file.
Note: The first row of the Excel file must contain the column names, else an Exception gets thrown.- Parameters:
excelFile
- The Excel File to parse.- Returns:
- ResultSet with the data defined in the given Excel file.
- Throws:
Exception
- See Also:
readExcel(File, DataRow)
,readExcel(File, DataRow, List, Boolean)
-
readExcel
public static ResultSet readExcel(File excelFile, DataRow attributesRecord) throws Exception
Parses the given Excel file and returns a com.basiscomponents.db.ResultSet with the data defined the the Excel file. The method uses the given DataRow(Attributes record) to determine and set the correct field types in the ResultSet.
Note: The first row of the Excel file must contain the column names, else an Exception gets thrown.- Parameters:
excelFile
- The Excel File to parse.attributesRecord
- The DataRow used to set the correct data types for the fields defined in the Excel file.- Returns:
- ResultSet with the data defined in the given Excel file.
- Throws:
Exception
- See Also:
readExcel(File)
,readExcel(File, DataRow, List, Boolean)
-
readExcel
public static ResultSet readExcel(File excelFile, DataRow attributesRecord, List<String> columnNames, Boolean firstRowHasData) throws Exception
Parses the given Excel file and returns a com.basiscomponents.db.ResultSet with the data defined the the Excel file. The method uses the given DataRow(Attributes record) to determine and set the correct field types in the ResultSet. The given boolean value determines whether the first line contains the column headers or not. If it is set to true, the first row will be treated as normal row with field values and the given List will then be used to initialize the field names. If it is set to false, the first row will be used to initialize the field names.- Parameters:
excelFile
- The Excel File to parse.attributesRecord
- he DataRow used to set the correct data types for the fields defined in the Excel file.columnNames
- The column names to use(Only required if the firstRowHasData boolean is set to true).firstRowHasData
- The boolean value used to determine if the first row contains the column headers or not.- Returns:
- ResultSet with the data defined in the given Excel file.
- Throws:
Exception
- See Also:
readExcel(File)
,readExcel(File, DataRow)
-
-