openlsd.database.business.LSDExtDbDocument Class Reference

Inheritance diagram for openlsd.database.business.LSDExtDbDocument:

Inheritance graph
[legend]
Collaboration diagram for openlsd.database.business.LSDExtDbDocument:

Collaboration graph
[legend]

List of all members.


Detailed Description

Class that extends the native openlsd.database.data.LSDDbDocument class by including a openlsd.database.business.LSDBusiness object. openlsd.database.business.LSDBusiness is an abstract class that must be implemented to fit the business needs.
Author:
Frederic Bregier LGPL

Public Member Functions

 LSDExtDbDocument ()
 LSDExtDbDocument (long lid, long sid, long did, long size, LSDBusiness lsdb)
boolean get (ResultSet resultSet)
boolean getSimple (ResultSet resultSet)
LSDDbPreparedStatement setPGet (LSDDbAdmin admin, long lid, long sid, long did)
LSDDbPreparedStatement setPUpdate (LSDDbAdmin admin, long lid, long size, Timestamp docdate, String md5, LSDBusiness lsdb)
LSDDbPreparedStatement setPUpdate (LSDDbAdmin admin, long lid, long sid, long did, long size, Timestamp docdate, String md5, LSDBusiness lsdb)
int setPInsert (LSDDbAdmin admin, long lid, long sid, long did, long size, Timestamp docdate, String md5, LSDBusiness lsdb)
LSDDbPreparedStatement setPDel (LSDDbAdmin admin, long lid, LSDBusiness lsdb)
boolean get (LSDDbAdmin admin, long lid, LSDBusiness lsdb)
boolean get (LSDDbAdmin admin, long lid, long sid, long did)
boolean get (LSDDbAdmin admin, LSDDbPreparedStatement p_get_lsdB, long lid, long sid, long did)
boolean set (LSDDbAdmin admin)
boolean insert (LSDDbAdmin admin)
boolean update (LSDDbAdmin admin, String md5)
boolean update (LSDDbAdmin admin, boolean isCommit)
boolean updateFromLSD (LSDDbAdmin admin, boolean isCommit, boolean hasdate)
boolean del (LSDDbAdmin admin)
boolean delNoLock (LSDDbAdmin admin)
String toString ()
String toCSV ()
void assign (long lid, long sid, long did, long size)
boolean getFromLSD (ResultSet resultSet)
boolean isIdsKO ()

Static Public Member Functions

static boolean initBusiness (String lsdbclassname)
static String getFieldsValues (long lid, long sid, long did, long size, Timestamp docdate, String md5, LSDBusiness lsdb)
static LSDDbPreparedStatement setPGetValid (LSDDbAdmin admin)
static boolean setPGetValidFill (LSDDbAdmin admin, LSDDbPreparedStatement p_get_lsd, long lid, long sid)
static LSDDbPreparedStatement setPGet (LSDDbAdmin admin, long lid, LSDBusiness lsdb)
static LSDDbPreparedStatement preparePGet (LSDDbAdmin admin)
static LSDDbPreparedStatement setPGetExists (LSDDbAdmin admin, long lid, LSDBusiness lsdb)
static boolean getExists (LSDDbAdmin admin, long lid, LSDBusiness lsdb)
static boolean isExists (LSDDbAdmin admin, long lid, long filesize, LSDBusiness lsdb)
static boolean alterIndex (LSDDbAdmin admin)
static String get1rstFieldsValues (long lid, long sid, long did, long size, Timestamp docdate, String md5)
static String getFieldsValues (long lid, long sid, long did, long size, Timestamp docdate, String md5)
static String getWhereCondPils (String id)
static LSDDbPreparedStatement setPGetCount (LSDDbAdmin admin, long lid, Timestamp time)
static LSDDbPreparedStatement setPGetCount (LSDDbAdmin admin, long lid, Timestamp timestart, Timestamp timestop)
static LSDDbPreparedStatement setPGetCount (LSDDbAdmin admin, long lid, long sid)
static LSDDbPreparedStatement setPUpdate (LSDDbAdmin admin, long lid, long sid, long did, long size, Timestamp docdate, String md5)
static int setPInsert (LSDDbAdmin admin, long lid, long sid, long did, long size, Timestamp docdate, String md5)
static LSDDbPreparedStatement setPDel (LSDDbAdmin admin, long lid, long sid, long did)

Public Attributes

LSDBusiness lsdb = null
long lid = LSDConstants.invalide_idx
long sid = LSDConstants.invalide_idx
long did = LSDConstants.invalide_idx
long size = 0
Timestamp docdate = null
String md5 = null

Static Public Attributes

static LSDBusiness _lsdb = null
static String allfields = allfields1
static String insertfields = " ("+allfields+insertfields2
static String getWhereClauseBusiness = null
static String getFieldsSet = getFieldsSet1
static String getFieldsSetAll = null
static String getFieldsSetNULL = getFieldsSetNULL1
static String index = index1+" IDX_DOC_LIDMETIERDATE"
static final String EMPTYMD5 = "XXXXXXXXXXXXXXXX"
static final String table = " lsddocument "
static final String[] fields
static final int rlid = 0
static final int rsid = 1
static final int rdid = 2
static final int rsize = 3
static final int rdocdate = 4
static final int rmd5 = 5
static String getWhereClause
static String getFieldsSet1
static String getWhereClauseMD5 = getWhereClause+" AND "+fields[rmd5]+" = ? "
static String getWhereEmpty
static String getFieldsSetNULL1
static final String index1

Protected Member Functions

boolean eraseFromLSD (LSDDbAdmin admin, boolean isCommit)

Static Protected Attributes

static final String allfields1
static final String insertfields1
static final String insertfields2 = ") "

Constructor & Destructor Documentation

openlsd.database.business.LSDExtDbDocument.LSDExtDbDocument (  ) 

Create an empty ExtDocument

openlsd.database.business.LSDExtDbDocument.LSDExtDbDocument ( long  lid,
long  sid,
long  did,
long  size,
LSDBusiness  lsdb 
)

Create an ExtDocument from args

Parameters:
lid 
sid 
did 
size 
lsdb 


Member Function Documentation

static boolean openlsd.database.business.LSDExtDbDocument.initBusiness ( String  lsdbclassname  )  [static]

Initialize some default values in static mode from Business class name as argument

Parameters:
lsdbclassname 
Returns:
True if OK, else False

boolean openlsd.database.business.LSDExtDbDocument.get ( ResultSet  resultSet  ) 

Get Values from ResultSet, initialized always a new business object as attribute

Parameters:
resultSet 
Returns:
True if OK, else False

Reimplemented from openlsd.database.data.LSDDbDocument.

boolean openlsd.database.business.LSDExtDbDocument.getSimple ( ResultSet  resultSet  ) 

Get Values from ResultSet as LSDDbDocument without Business

Parameters:
resultSet 
Returns:
True if OK, else False

static String openlsd.database.business.LSDExtDbDocument.getFieldsValues ( long  lid,
long  sid,
long  did,
long  size,
Timestamp  docdate,
String  md5,
LSDBusiness  lsdb 
) [static]

Get String for Setting as Values (override)

Parameters:
lid 
sid 
did 
size 
docdate 
md5 
lsdb 
Returns:
the string as result

static LSDDbPreparedStatement openlsd.database.business.LSDExtDbDocument.setPGetValid ( LSDDbAdmin  admin  )  [static]

Create the PreparedStatement for Get all valid documents (used with setPGetValidFill)

Parameters:
admin 
Returns:
the PreparedStatement or null if an error occurs

static boolean openlsd.database.business.LSDExtDbDocument.setPGetValidFill ( LSDDbAdmin  admin,
LSDDbPreparedStatement  p_get_lsd,
long  lid,
long  sid 
) [static]

Fill the PreparedStatement for Get all valid documents from one legacy one storage

Parameters:
admin 
p_get_lsd 
lid 
sid 
Returns:
True if OK

static LSDDbPreparedStatement openlsd.database.business.LSDExtDbDocument.setPGet ( LSDDbAdmin  admin,
long  lid,
LSDBusiness  lsdb 
) [static]

Create the PreparedStatement for Get. lsdb object must contains unique index information. (override)

Parameters:
admin 
lid 
lsdb 
Returns:
the PreparedStatement or null if an error occurs

LSDDbPreparedStatement openlsd.database.business.LSDExtDbDocument.setPGet ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  did 
)

Create the PreparedStatement for Get from L S D index (override)

Parameters:
admin 
lid 
sid 
did 
Returns:
the PreparedStatement or null if an error occurs

Reimplemented from openlsd.database.data.LSDDbDocument.

static LSDDbPreparedStatement openlsd.database.business.LSDExtDbDocument.preparePGet ( LSDDbAdmin  admin  )  [static]

Create the PreparedStatement for Get from L S D index (override)

Parameters:
admin 
Returns:
the PreparedStatement or null if an error occurs

static LSDDbPreparedStatement openlsd.database.business.LSDExtDbDocument.setPGetExists ( LSDDbAdmin  admin,
long  lid,
LSDBusiness  lsdb 
) [static]

Create the PreparedStatement for Get Exists. lsdb object must contains unique index information.

Parameters:
admin 
lid 
lsdb 
Returns:
the PreparedStatement or null if an error occurs

LSDDbPreparedStatement openlsd.database.business.LSDExtDbDocument.setPUpdate ( LSDDbAdmin  admin,
long  lid,
long  size,
Timestamp  docdate,
String  md5,
LSDBusiness  lsdb 
)

Create the PreparedStatement for Update from Legacy and Business (override)

Parameters:
admin 
lid 
size 
docdate 
md5 
lsdb 
Returns:
the PreparedStatement or null if an error occurs

LSDDbPreparedStatement openlsd.database.business.LSDExtDbDocument.setPUpdate ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  did,
long  size,
Timestamp  docdate,
String  md5,
LSDBusiness  lsdb 
)

Create the PreparedStatement for Update from Legacy, Storage and Document index (override)

Parameters:
admin 
lid 
sid 
did 
size 
docdate 
md5 
lsdb 
Returns:
the PreparedStatement or null if an error occurs

int openlsd.database.business.LSDExtDbDocument.setPInsert ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  did,
long  size,
Timestamp  docdate,
String  md5,
LSDBusiness  lsdb 
)

Create the PreparedStatement for Insert (override)

Parameters:
admin 
lid 
sid 
did 
size 
docdate 
md5 
lsdb 
Returns:
the number of new line

LSDDbPreparedStatement openlsd.database.business.LSDExtDbDocument.setPDel ( LSDDbAdmin  admin,
long  lid,
LSDBusiness  lsdb 
)

Create the PreparedStatement for Insert. lsdb object must contains unique index information. (override)

Parameters:
admin 
lid 
lsdb 
Returns:
the PreparedStatement or null if an error occurs

boolean openlsd.database.business.LSDExtDbDocument.get ( LSDDbAdmin  admin,
long  lid,
LSDBusiness  lsdb 
)

Get the Document object from DB. lsdb object must contains unique index information. (override)

Parameters:
admin 
lid 
lsdb 
Returns:
True if OK, else False

boolean openlsd.database.business.LSDExtDbDocument.get ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  did 
)

Get the ExtDocument object from DB from L S D index (override)

Parameters:
admin 
lid 
sid 
did 
Returns:
True if OK, else False

Reimplemented from openlsd.database.data.LSDDbDocument.

boolean openlsd.database.business.LSDExtDbDocument.get ( LSDDbAdmin  admin,
LSDDbPreparedStatement  p_get_lsdB,
long  lid,
long  sid,
long  did 
)

Get the ExtDocument object from DB from L S D index (override)

Parameters:
admin 
p_get_lsdB 
lid 
sid 
did 
Returns:
True if OK, else False

static boolean openlsd.database.business.LSDExtDbDocument.getExists ( LSDDbAdmin  admin,
long  lid,
LSDBusiness  lsdb 
) [static]

Returns if the Document object exists in DB. lsdb object must contains unique index information.

Parameters:
admin 
lid 
lsdb 
Returns:
True if it exists, else False

boolean openlsd.database.business.LSDExtDbDocument.set ( LSDDbAdmin  admin  ) 

Update or Insert data into DB from object (override)

Parameters:
admin 
Returns:
True if OK, else False

Reimplemented from openlsd.database.data.LSDDbDocument.

boolean openlsd.database.business.LSDExtDbDocument.insert ( LSDDbAdmin  admin  ) 

Insert data into DB from object. Do not commit the result since it is intend only for findFirstIndex where update Storage will commit the result and release the lock on the row. (override)

Parameters:
admin 
Returns:
True if OK, else False

Reimplemented from openlsd.database.data.LSDDbDocument.

boolean openlsd.database.business.LSDExtDbDocument.update ( LSDDbAdmin  admin,
String  md5 
)

Update MD5 Value into BD (override)

Parameters:
admin 
md5 
Returns:
True if OK, else False

Reimplemented from openlsd.database.data.LSDDbDocument.

boolean openlsd.database.business.LSDExtDbDocument.update ( LSDDbAdmin  admin,
boolean  isCommit 
)

Update Values into BD with or without commit

Parameters:
admin 
isCommit 
Returns:
True if OK, else False

boolean openlsd.database.business.LSDExtDbDocument.updateFromLSD ( LSDDbAdmin  admin,
boolean  isCommit,
boolean  hasdate 
)

Update some Values into BD from lsd indexes (override)

Parameters:
admin 
isCommit 
hasdate 
Returns:
True if OK, else False

Reimplemented from openlsd.database.data.LSDDbDocument.

boolean openlsd.database.business.LSDExtDbDocument.eraseFromLSD ( LSDDbAdmin  admin,
boolean  isCommit 
) [protected]

Erase some Values into BD (override)

Parameters:
admin 
isCommit 
Returns:
True if OK, else False

Reimplemented from openlsd.database.data.LSDDbDocument.

boolean openlsd.database.business.LSDExtDbDocument.del ( LSDDbAdmin  admin  ) 

Del the Document object from DB and update the associated Storage in the DB (size of the document is removed). lsdb is set to null. (override)

Parameters:
admin 
Returns:
True if OK, else False

Reimplemented from openlsd.database.data.LSDDbDocument.

boolean openlsd.database.business.LSDExtDbDocument.delNoLock ( LSDDbAdmin  admin  ) 

Del the Document object from DB and update the associated Storage in the DB (size of the document is removed). Lock must be set outside. lsdb is set to null. (override)

Parameters:
admin 
Returns:
True if OK, else False

Reimplemented from openlsd.database.data.LSDDbDocument.

static boolean openlsd.database.business.LSDExtDbDocument.isExists ( LSDDbAdmin  admin,
long  lid,
long  filesize,
LSDBusiness  lsdb 
) [static]

Find if the Document id exists in Legacy. lsdb object must contains unique index information.

Parameters:
admin 
lid 
filesize 
lsdb 
Returns:
True if found, else false

static boolean openlsd.database.business.LSDExtDbDocument.alterIndex ( LSDDbAdmin  admin  )  [static]

Alter rebuild all index associated with this Table

Parameters:
admin 
Returns:
True if ok

Reimplemented from openlsd.database.data.LSDDbDocument.

String openlsd.database.business.LSDExtDbDocument.toString (  ) 

Object to String (override)

Returns:
the string that displays this object
See also:
java.lang.Object.toString()

Reimplemented from openlsd.database.data.LSDDbDocument.

String openlsd.database.business.LSDExtDbDocument.toCSV (  ) 

Object to CSV format

Returns:
the string that displays this object in CSV format

void openlsd.database.data.LSDDbDocument.assign ( long  lid,
long  sid,
long  did,
long  size 
) [inherited]

Assign values to the object

Parameters:
lid 
sid 
did 
size 

boolean openlsd.database.data.LSDDbDocument.getFromLSD ( ResultSet  resultSet  )  [inherited]

Get Values from ResultSet

Parameters:
resultSet 
Returns:
True if OK, else False

static String openlsd.database.data.LSDDbDocument.get1rstFieldsValues ( long  lid,
long  sid,
long  did,
long  size,
Timestamp  docdate,
String  md5 
) [static, inherited]

Get 1rst part of String for Setting as Values. The extend function of getFieldsValues should add the fields with first "," then all fields separated by "," and eventually surrounded with quotes when necessary, and finaly end the string with ") ".

Parameters:
lid 
sid 
did 
size 
docdate 
md5 
Returns:
the string as result

static String openlsd.database.data.LSDDbDocument.getFieldsValues ( long  lid,
long  sid,
long  did,
long  size,
Timestamp  docdate,
String  md5 
) [static, inherited]

Get String for Setting as Values

Parameters:
lid 
sid 
did 
size 
docdate 
md5 
Returns:
the string as result

static String openlsd.database.data.LSDDbDocument.getWhereCondPils ( String  id  )  [static, inherited]

Get String for Where Condition

Parameters:
id 
Returns:
the string as result

static LSDDbPreparedStatement openlsd.database.data.LSDDbDocument.setPGetCount ( LSDDbAdmin  admin,
long  lid,
Timestamp  time 
) [static, inherited]

Create the PreparedStatement for GetCount from Legacy and Time

Parameters:
admin 
lid 
time 
Returns:
LSDDbPreparedStatement

static LSDDbPreparedStatement openlsd.database.data.LSDDbDocument.setPGetCount ( LSDDbAdmin  admin,
long  lid,
Timestamp  timestart,
Timestamp  timestop 
) [static, inherited]

Create the PreparedStatement for GetCount from Legacy and Time start and stop

Parameters:
admin 
lid 
timestart 
timestop 
Returns:
LSDDbPreparedStatement

static LSDDbPreparedStatement openlsd.database.data.LSDDbDocument.setPGetCount ( LSDDbAdmin  admin,
long  lid,
long  sid 
) [static, inherited]

Create the PreparedStatement for GetCount from Legacy and Storage

Parameters:
admin 
lid 
sid 
Returns:
LSDDbPreparedStatement

static LSDDbPreparedStatement openlsd.database.data.LSDDbDocument.setPUpdate ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  did,
long  size,
Timestamp  docdate,
String  md5 
) [static, inherited]

Create the PreparedStatement for Update

Parameters:
admin 
lid 
sid 
did 
size 
docdate 
md5 
Returns:
LSDDbPreparedStatement

static int openlsd.database.data.LSDDbDocument.setPInsert ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  did,
long  size,
Timestamp  docdate,
String  md5 
) [static, inherited]

Create the PreparedStatement for Insert

Parameters:
admin 
lid 
sid 
did 
size 
docdate 
md5 
Returns:
the number of new line

static LSDDbPreparedStatement openlsd.database.data.LSDDbDocument.setPDel ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  did 
) [static, inherited]

Create the PreparedStatement for Delete

Parameters:
admin 
lid 
sid 
did 
Returns:
LSDDbPreparedStatement

boolean openlsd.database.data.LSDDbDocument.isIdsKO (  )  [inherited]

Check if the Ids (lid,sid,did) are KO or not

Returns:
True if the Ids are wrong, else False


Member Data Documentation

Business data

Business empty object initialized by initBusiness function

New allfields (override)

Reimplemented from openlsd.database.data.LSDDbDocument.

New insertfields (override)

Reimplemented from openlsd.database.data.LSDDbDocument.

Where condition in " WHERE condition " format which must returns 1 unique document.

Set for all fields except fields used in getWhereClause (override)

Reimplemented from openlsd.database.data.LSDDbDocument.

Set for all fields except fields used in getWhereClause (override)

Set values as NULL (or empty) including where clause (override)

Reimplemented from openlsd.database.data.LSDDbDocument.

String openlsd.database.business.LSDExtDbDocument.index = index1+" IDX_DOC_LIDMETIERDATE" [static]

Final Index in Table LSDExtDbDocument alter index "LSD"."IDX_DOC_LIDMETIERDATE" rebuild;

Reimplemented from openlsd.database.data.LSDDbDocument.

Legacy index

Storage index

Document index

Size of the document

Timestamp openlsd.database.data.LSDDbDocument.docdate = null [inherited]

Date for insertion

String openlsd.database.data.LSDDbDocument.md5 = null [inherited]

MD5 for file

final String openlsd.database.data.LSDDbDocument.EMPTYMD5 = "XXXXXXXXXXXXXXXX" [static, inherited]

Empty MD5 value

final String openlsd.database.data.LSDDbDocument.table = " lsddocument " [static, inherited]

information for DB manipulation: Table name

final String [] openlsd.database.data.LSDDbDocument.fields [static, inherited]

Initial value:

        {"LID","SID","DID","SIZEDOC","DOCDATE","EMPREINT"}
DB field names

final int openlsd.database.data.LSDDbDocument.rlid = 0 [static, inherited]

DB field rank

final int openlsd.database.data.LSDDbDocument.rsid = 1 [static, inherited]

DB field rank

final int openlsd.database.data.LSDDbDocument.rdid = 2 [static, inherited]

DB field rank

final int openlsd.database.data.LSDDbDocument.rsize = 3 [static, inherited]

DB field rank

final int openlsd.database.data.LSDDbDocument.rdocdate = 4 [static, inherited]

DB field rank

final int openlsd.database.data.LSDDbDocument.rmd5 = 5 [static, inherited]

DB field rank

final String openlsd.database.data.LSDDbDocument.allfields1 [static, protected, inherited]

Initial value:

        " "+fields[rlid]+","+fields[rsid]+","+
        fields[rdid]+","+fields[rsize]+","+fields[rdocdate]+","+
        fields[rmd5]+" "
DB field for all fields in select command. This version is the base.

final String openlsd.database.data.LSDDbDocument.insertfields1 [static, protected, inherited]

Initial value:

        " ("+allfields
DB field for all fields in insert command. This version is the base.

final String openlsd.database.data.LSDDbDocument.insertfields2 = ") " [static, protected, inherited]

DB field for all fields in insert command. This version is the last fields ")" only.

Initial value:

 " WHERE "+fields[rdid]+" = ? AND "+
        fields[rsid]+" = ? AND "+fields[rlid]+" = ? "
Where condition in " WHERE condition " format which must returns 1 unique document.

Initial value:

 " "+fields[rsize]+" = ?,"+
        fields[rdocdate]+" = ?,"+fields[rmd5]+" = ? "
Set for all fields except fields used in getWhereClause. This version is the base.

String openlsd.database.data.LSDDbDocument.getWhereClauseMD5 = getWhereClause+" AND "+fields[rmd5]+" = ? " [static, inherited]

Where condition in " WHERE condition " format which must returns 1 unique document and compares also MD5 value.

Initial value:

 " WHERE "+fields[rdocdate]+" is NULL AND "+
        fields[rsid]+" = ? AND "+fields[rlid]+" = ? "
Search empty document (docdate is null) in one legacy/storage

Initial value:

 fields[rsize]+" = 0,"+
        fields[rdocdate]+" = NULL,"+fields[rmd5]+" = '"+EMPTYMD5+"' "
Set values as NULL (or empty) including where clause

final String openlsd.database.data.LSDDbDocument.index1 [static, inherited]

Initial value:

 "PK_DOCUMENT"+
        " IDX_DOC_LIDSIZEDOCMD5"+" IDX_DOC_LSDATE"
Index in Table LSDDbDocument alter index "LSD"."IDX_DOC_LIDSIZEDOCMD5" rebuild; alter index "LSD"."IDX_DOC_LSDATE" rebuild; alter index "LSD"."PK_DOCUMENT" rebuild;


The documentation for this class was generated from the following file: