|
Index of Basic knowledge for developing Fat-Clients with Java |
|
Last
revision of this document: |
This
is document contains the code for Class JSBS_DBA_Set.
For easy
'cut and paste' ;-)
For an overview of the idea of Data-Base-Access Objects please refer to Using Business Objects to handle data-storage and -retrieval .
package
js_base.dba;
import
java.util.*;
import
java.sql.*;
/**
*
* @author kurt@javascout.biz
*
@date 2006-11-16
*
* @description
*
Base-Class for Data-Base-Access (DBA) Objects holding sets of
data-records.
* This class can be inherited by
DBA_Set Objects designed for a dedicated database-table.
*
* @change-log
*
when who why
*
--------------------------------------------------------
*
*/
public
class JSBS_DBA_Set
{
/*
* Vector
holding the set of read data-records.
* This variable
does not define the structure of the vector content;
* the
conversion has to be done within the class inheriting this
base-class.
*/
public
Vector
vecRecordSet = new
Vector();
/*
* String
with a possible Error-Message from the database system.
*/
public
String
ErrorMsg = "";
/*
* Values
in java.sql.Date format to compare the validity range of the read
record
* with the 'actual' date passed as value in the
structure JSBS_MinimalParameters. */
protected
java.sql.Date
locdteReadValidFrom;
protected
java.sql.Date
locdteReadValidTill;
protected
java.sql.Date
locdteActualDate;
/*
* --------------------
* Method
to compare if a given date is within a date-range.
* Necessary
in all derived methods. */
protected
boolean isWithinDateRange(java.sql.Date
parmActualDate,
java.sql.Date
parmValidFrom,
java.sql.Date
parmValidTill) {
/* Convert
from the format java.sql.Date to a comparable format,
* compare
and return the result. */
/*
* The
first comparison checks, that the data-set was not terminated at the
actual date;
* the second comparison checks, that the
data-set does not start in the future. */
return
((parmValidFrom.getTime() <=
parmValidTill.getTime())
||
(parmValidFrom.getTime()
<= parmActualDate.getTime()));
}
}