openlsd.database.business
Class LSDBusiness

java.lang.Object
  extended by openlsd.database.business.LSDBusiness
Direct Known Subclasses:
LSDBusinessImpl, LSDBusinessImpl, LSDBusinessImpl

public abstract class LSDBusiness
extends java.lang.Object

Abstract Business Class that must be implemented to fit the needs of the target business.

Author:
Frederic BREGIER LGPL 2007
See Also:
to see an example of basic Implementation.
, to see an extended example of Implementation.

Field Summary
static java.lang.String allFieldsExt
          Must Be Extended in Implementation:
Values to add to allfields (replace select *)
protected static java.lang.String[] fieldsext
          Must Be Extended in Implementation:
Extended fields for Business
static java.lang.String getFieldsSetAllExt
          Must Be Extended in Implementation:
Set for all fields
static java.lang.String getFieldsSetExt
          Must Be Extended in Implementation:
Set for all fields except fields used in getWhereClause
static java.lang.String getFieldsSetExtNULL
          Must Be Extended in Implementation:
Set values as NULL (or empty) including where clause
static java.lang.String getWhereClause
          Must Be Extended in Implementation:
Where condition in " condition " format which will be added to " WHERE Legacy = ?
 
Constructor Summary
LSDBusiness()
          Must Be Extended in Implementation:
Default empty constructor
LSDBusiness(int[] ranks, java.lang.String[] args)
          Must Be Extended in Implementation:
Constructor from 1 int[] for rank and 1 String[] for value
LSDBusiness(LSDBusiness lsdb)
          Must Be Extended in Implementation:
Constructor from another LSDBusiness (same type)
 
Method Summary
abstract  void clear()
          Clear all data in the object
abstract  LSDBusiness clone()
          Clone the current object but only copy values
abstract  java.lang.String doc_hintBusiness()
          Returns the hint for DOC on Business Index
abstract  boolean equals(LSDBusiness other)
          Comparison of two LSDBusiness object on primary key (Business Index)
abstract  java.lang.String getAllFieldsExt()
          Values to add to allfields (replace select *)
abstract  java.lang.String getFieldsExt(int number)
          Extended fields for Business
abstract  java.lang.String getFieldsSetAllExt()
          Set for all fields
abstract  java.lang.String getFieldsSetExt()
          Set for all fields except fields used in getWhereClause
abstract  java.lang.String getFieldsSetExtNULL()
          Set values as NULL (or empty) including where clause
abstract  java.lang.String getFieldsValues()
          Set Values for Insert command
abstract  boolean getFromResultSet(java.sql.ResultSet resultSet)
          Set internal value from ResultSet
abstract  java.lang.String getWhereClause()
          Where condition in " condition " format which will be added to " WHERE Legacy = ?
static LSDBusiness newBusiness()
          Create an empty LSDBusiness according to the registering implementation
abstract  boolean setFromLSDBusiness(LSDBusiness lsdb)
          Set the currect object to the values from the object as parameter
abstract  void setFromString(java.lang.String line)
          Fill the object from the String for function that gets information of Business index from one line from a file
abstract  boolean setFromStringArray(int[] ranks, java.lang.String[] args)
          Set from 1 int[] for rank and 1 String[] for value
abstract  int setFromStrings(int curargs, java.lang.String[] args)
          Fill the object from the String for Import function (an array containing from curargs position a set of values from one line with blank character as separator)
abstract  int setToPrepStmtGetFieldsSetAllExt(int startrank, LSDDbPreparedStatement preparedStatement)
          Set the value into the prepareStatement from Object for the set in GetFieldsSetAllExt
abstract  int setToPrepStmtGetFieldsSetExt(int startrank, LSDDbPreparedStatement preparedStatement)
          Set the value into the prepareStatement from Object for the set in GetFieldsSetExt
abstract  int setToPrepStmtGetWhereClause(int startrank, LSDDbPreparedStatement preparedStatement)
          Set the value into the prepareStatement from Object for the Where Condition in getWhereClause
abstract  java.lang.String toCSV()
          Object to CSV.
abstract  java.lang.String toString()
          Object to String
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fieldsext

protected static final java.lang.String[] fieldsext
Must Be Extended in Implementation:
Extended fields for Business


allFieldsExt

public static final java.lang.String allFieldsExt
Must Be Extended in Implementation:
Values to add to allfields (replace select *)

See Also:
Constant Field Values

getWhereClause

public static java.lang.String getWhereClause
Must Be Extended in Implementation:
Where condition in " condition " format which will be added to " WHERE Legacy = ? AND condition " and that must returns 1 unique document.


getFieldsSetExt

public static java.lang.String getFieldsSetExt
Must Be Extended in Implementation:
Set for all fields except fields used in getWhereClause


getFieldsSetAllExt

public static java.lang.String getFieldsSetAllExt
Must Be Extended in Implementation:
Set for all fields


getFieldsSetExtNULL

public static java.lang.String getFieldsSetExtNULL
Must Be Extended in Implementation:
Set values as NULL (or empty) including where clause

Constructor Detail

LSDBusiness

public LSDBusiness()
Must Be Extended in Implementation:
Default empty constructor


LSDBusiness

public LSDBusiness(LSDBusiness lsdb)
Must Be Extended in Implementation:
Constructor from another LSDBusiness (same type)

Parameters:
lsdb -

LSDBusiness

public LSDBusiness(int[] ranks,
                   java.lang.String[] args)
Must Be Extended in Implementation:
Constructor from 1 int[] for rank and 1 String[] for value

Parameters:
ranks -
args -
Method Detail

getFieldsExt

public abstract java.lang.String getFieldsExt(int number)
Extended fields for Business

Parameters:
number -
Returns:
The Extended fields for Business

getAllFieldsExt

public abstract java.lang.String getAllFieldsExt()
Values to add to allfields (replace select *)

Returns:
Values to add to allfields (replace select *)

getWhereClause

public abstract java.lang.String getWhereClause()
Where condition in " condition " format which will be added to " WHERE Legacy = ? AND condition " and that must returns 1 unique document.

Returns:
Where condition

getFieldsSetExt

public abstract java.lang.String getFieldsSetExt()
Set for all fields except fields used in getWhereClause

Returns:
Set for all fields except fields used in getWhereClause

getFieldsSetAllExt

public abstract java.lang.String getFieldsSetAllExt()
Set for all fields

Returns:
Set for all fields

getFieldsSetExtNULL

public abstract java.lang.String getFieldsSetExtNULL()
Set values as NULL (or empty) including where clause

Returns:
Set values as NULL (or empty) including where clause

doc_hintBusiness

public abstract java.lang.String doc_hintBusiness()
Returns the hint for DOC on Business Index

Returns:
the String containing the hint to set after SELECT command based on getWhereClauseBusiness

setFromLSDBusiness

public abstract boolean setFromLSDBusiness(LSDBusiness lsdb)
Set the currect object to the values from the object as parameter

Parameters:
lsdb -
Returns:
True if OK, else False

setFromStringArray

public abstract boolean setFromStringArray(int[] ranks,
                                           java.lang.String[] args)
Set from 1 int[] for rank and 1 String[] for value

Parameters:
ranks -
args -
Returns:
True if OK, else False

getFromResultSet

public abstract boolean getFromResultSet(java.sql.ResultSet resultSet)
Set internal value from ResultSet

Parameters:
resultSet -
Returns:
True if OK, else False

getFieldsValues

public abstract java.lang.String getFieldsValues()
Set Values for Insert command

Returns:
the String for Insert command Value part

setToPrepStmtGetWhereClause

public abstract int setToPrepStmtGetWhereClause(int startrank,
                                                LSDDbPreparedStatement preparedStatement)
Set the value into the prepareStatement from Object for the Where Condition in getWhereClause

Parameters:
startrank - The value to start from in the preparedStatement.setXXX call
preparedStatement -
Returns:
the next startrank or 0 if KO

setToPrepStmtGetFieldsSetExt

public abstract int setToPrepStmtGetFieldsSetExt(int startrank,
                                                 LSDDbPreparedStatement preparedStatement)
Set the value into the prepareStatement from Object for the set in GetFieldsSetExt

Parameters:
startrank - The value to start from in the preparedStatement.setXXX call
preparedStatement -
Returns:
the next startrank or 0 if KO

setToPrepStmtGetFieldsSetAllExt

public abstract int setToPrepStmtGetFieldsSetAllExt(int startrank,
                                                    LSDDbPreparedStatement preparedStatement)
Set the value into the prepareStatement from Object for the set in GetFieldsSetAllExt

Parameters:
startrank - The value to start from in the preparedStatement.setXXX call
preparedStatement -
Returns:
the next startrank or 0 if KO

clear

public abstract void clear()
Clear all data in the object


equals

public abstract boolean equals(LSDBusiness other)
Comparison of two LSDBusiness object on primary key (Business Index)

Parameters:
other -
Returns:
True if Business index are the same, else False

clone

public abstract LSDBusiness clone()
Clone the current object but only copy values

Overrides:
clone in class java.lang.Object
Returns:
The clone object

newBusiness

public static LSDBusiness newBusiness()
Create an empty LSDBusiness according to the registering implementation

Returns:
an empty LSDBusiness

setFromString

public abstract void setFromString(java.lang.String line)
Fill the object from the String for function that gets information of Business index from one line from a file

Parameters:
line -

setFromStrings

public abstract int setFromStrings(int curargs,
                                   java.lang.String[] args)
Fill the object from the String for Import function (an array containing from curargs position a set of values from one line with blank character as separator)

Parameters:
args -
curargs -
Returns:
The next args rank to read

toString

public abstract java.lang.String toString()
Object to String

Overrides:
toString in class java.lang.Object
Returns:
the string that displays this object
See Also:
Object.toString()

toCSV

public abstract java.lang.String toCSV()
Object to CSV. This method is intend for helping the database replication in case of ML support, so it should export all information of the Document in order to allow the corresponding insert or delete operation on duplicated database.

Returns:
the string that displays this object as CSV
See Also:
Object.toString()