Package com.basiscomponents.util
Class JLibDataFileHandler
- java.lang.Object
-
- com.basiscomponents.util.JLibDataFileHandler
-
public class JLibDataFileHandler extends Object
Imports the data of a Data File into a com.basiscomponents.db.ResultSet object using the BASIS JLib.
-
-
Field Summary
Fields Modifier and Type Field Description static String
FILTER_KNUM
static String
FILTER_RANGE_FROM
static String
FILTER_RANGE_TO
static String
FILTER_VALUE
-
Constructor Summary
Constructors Constructor Description JLibDataFileHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]
cutEmptyTailInRecord(byte[] record)
cuts the leading tail of zeros at the end of the array and returns a smaller arrayString
getTemplatedString()
Returns the Templated String.void
remove(DataRow dr)
ResultSet
retrieve()
Returns a ResultSet object with the content of the Data file based on the specified filter, offset, field selection.void
setFieldSelection(DataRow fieldSelection)
Sets the field names to be retrieved from the Data file to the field name's of the given DataRow object.void
setFile(String filePath, String template)
Sets the path of the Data file and its Templated String.void
setFilter(DataRow filter)
Sets the filter to apply while retrieving the records from the Data file.void
setOffset(int record, int count)
Sets the offset and the record index to start from when retrieving the Data from the Data file.DataRow
write(DataRow dr)
-
-
-
Field Detail
-
FILTER_KNUM
public static final String FILTER_KNUM
- See Also:
- Constant Field Values
-
FILTER_RANGE_FROM
public static final String FILTER_RANGE_FROM
- See Also:
- Constant Field Values
-
FILTER_RANGE_TO
public static final String FILTER_RANGE_TO
- See Also:
- Constant Field Values
-
FILTER_VALUE
public static final String FILTER_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setFile
public void setFile(String filePath, String template) throws com.basis.startup.type.BBjException
Sets the path of the Data file and its Templated String.- Parameters:
filePath
- The path of the Data filetemplate
- The Templated String matching the Data file- Throws:
com.basis.startup.type.BBjException
-
setOffset
public void setOffset(int record, int count)
Sets the offset and the record index to start from when retrieving the Data from the Data file.- Parameters:
record
- The record index to start fromcount
- The number of records to read from the offset.
-
setFilter
public void setFilter(DataRow filter)
Sets the filter to apply while retrieving the records from the Data file. Currently the filter can be used to specify:- a range of values(from-to)
- an exact primary key value
- the KNUM to use
Use the following the field names:- JLibResultSetImporter.FILTER_KNUM
- JLibResultSetImporter.FILTER_RANGE_FROM
- JLibResultSetImporter.FILTER_RANGE_TO
- JLibResultSetImporter.FILTER_VALUE
- Parameters:
filter
- The filter to set.
-
setFieldSelection
public void setFieldSelection(DataRow fieldSelection)
Sets the field names to be retrieved from the Data file to the field name's of the given DataRow object.- Parameters:
fieldSelection
- The DataRow whose field names will be set as field selection.
-
write
public DataRow write(DataRow dr) throws com.basis.filesystem.FilesystemException, NoSuchFieldException, com.basis.startup.type.BBjException
- Throws:
com.basis.filesystem.FilesystemException
NoSuchFieldException
com.basis.startup.type.BBjException
-
cutEmptyTailInRecord
protected byte[] cutEmptyTailInRecord(byte[] record)
cuts the leading tail of zeros at the end of the array and returns a smaller array- Parameters:
record
- array to be trimmed- Returns:
- smaller byte array that is a trimmed version of the original one.
-
remove
public void remove(DataRow dr) throws com.basis.filesystem.FilesystemException
- Throws:
com.basis.filesystem.FilesystemException
-
retrieve
public ResultSet retrieve() throws IndexOutOfBoundsException, NoSuchFieldException, Exception
Returns a ResultSet object with the content of the Data file based on the specified filter, offset, field selection.- Returns:
- A ResultSet object with the records of the data file.
- Throws:
IndexOutOfBoundsException
NoSuchFieldException
Exception
-
getTemplatedString
public String getTemplatedString()
Returns the Templated String.- Returns:
- The Templated String.
-
-