DODS 7.2 API

com.lutris.appserver.server.sql
Class CoreDO

java.lang.Object
  extended by com.lutris.appserver.server.sql.CoreDO
All Implemented Interfaces:
Transaction, java.io.Serializable
Direct Known Subclasses:
CloneableDO

public abstract class CoreDO
extends java.lang.Object
implements Transaction, java.io.Serializable

Base class from which the data objects are derived.

Version:
$Revision: 1.14 $
Author:
Kyle Clark
See Also:
Serialized Form

Field Summary
protected  CoreDataStruct originalData
           
protected  boolean persistent
           
static boolean versioning
           
 
Constructor Summary
CoreDO()
          Public constructor.
CoreDO(java.sql.ResultSet rs)
          Public constructor.
 
Method Summary
 void addToCache()
          This method is invoked whenever an object is added to the cache.
 void deleteFromCache()
          This method is invoked whenever an object is deleted from the cache.
static void disableVersioning()
          Disable use of the version column.
abstract  void dumpData(boolean incrementVersion)
           
 void evict()
          This method is invoked whenever an object is removed from the cache.
 void executeDelete(DBConnection conn)
          Deletes this object from the database.
 void executeInsert(DBConnection conn)
          Inserts this object into the database.
 void executeLockingStatement(DBConnection conn)
           
 void executeUpdate(DBConnection conn)
          Updates the contents of this object in the database.
 void finalizeDelete(boolean success)
          Currently does nothing.
 void finalizeInsert(boolean success)
          Updates the persistent state.
 void finalizeUpdate(boolean success)
          The version number of this object is set to the next version for this object if this object was successfully updated in the database.
protected  int get_NewVersion()
          Returns this object's new version.
 ObjectId get_OId()
          Returns this object's identifier.
static java.lang.String get_OIdColumnName()
          Returns the object identifier column name.
protected  int get_Version()
          Returns this object's version.
static java.lang.String get_versionColumnName()
          Returns the version column name.
abstract  java.sql.PreparedStatement getDeleteStatement(DBConnection conn)
          Returns the statement that can be used to delete this object from the database.
abstract  java.sql.PreparedStatement getInsertStatement(DBConnection conn)
          Returns the statement that can be used to insert this object into the database.
protected  int getNewVersion()
          Deprecated. use get_NewVersion instead
 ObjectId getOId()
          Deprecated. Use get_OId()
static java.lang.String getOIdColumnName()
          Deprecated. use get_OIdColumnName()
 int getOriginalVersion()
           
abstract  java.lang.String getTableName()
          Return the name of the table whose rows represent these objects.
abstract  java.sql.PreparedStatement getUpdateStatement(DBConnection conn)
          Returns the statement that can be used to update this object in the database.
 int getVersion()
          Deprecated. Use get_Version()
static java.lang.String getVersionColumnName()
          Deprecated. use get_versionColumnName()
 boolean isPersistent()
           
 void makeInvisible()
           
 void makeVisible()
           
abstract  int objectIdentityType()
          Return the type of the identity column(s) of DOs that these objects represents.
 java.lang.Object originalData_get()
          This method is invoked whenever an object original data is needed.
 void refresh()
          This method is invoked whenever object's data needs to be loaded.
protected  void set_NewVersion(int newVersion)
          Sets this object's new version number.
protected  void set_OId(ObjectId oId)
          Sets this object's identifier.
static void set_OIdColumnName(java.lang.String _oidColumnName)
          Sets the object identifier column name.
protected  void set_Version(int version)
          Sets this object's version.
static void set_versionColumnName(java.lang.String _versionColumnName)
          Sets the version column name.
protected  void setNewVersion(int newVersion)
          Deprecated. use set_NewVersion instead
protected  void setOId(ObjectId oId)
          Deprecated. Use set_OId()
static void setOIdColumnName(java.lang.String _oidColumnName)
          Deprecated. use get_versionColumnName()
 void setPersistent(boolean persistent)
          Sets the persistent state for this object.
protected  void setVersion(int version)
          Deprecated. Use set_Version()
static void setVersionColumnName(java.lang.String _versionColumnName)
          Deprecated. use set_versionColumnName()
 void updateCache()
          This method is invoked whenever an object is inserted or updated in the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versioning

public static boolean versioning

persistent

protected boolean persistent

originalData

protected CoreDataStruct originalData
Constructor Detail

CoreDO

public CoreDO()
Public constructor.


CoreDO

public CoreDO(java.sql.ResultSet rs)
       throws java.sql.SQLException,
              ObjectIdException
Public constructor.

Parameters:
rs - a result set.
Throws:
java.sql.SQLException - if an error occurs while instantiating this object from the result set.
ObjectIdException - if the object id for this object is invalid.
Method Detail

disableVersioning

public static void disableVersioning()
Disable use of the version column.

author Jay Gunter


get_OIdColumnName

public static java.lang.String get_OIdColumnName()
Returns the object identifier column name.

Returns:
the object identifier column name.

getOIdColumnName

public static java.lang.String getOIdColumnName()
Deprecated. use get_OIdColumnName()

Returns the object identifier column name.

Returns:
the object identifier column name.

set_OIdColumnName

public static void set_OIdColumnName(java.lang.String _oidColumnName)
Sets the object identifier column name.

Parameters:
_oidColumnName - Name of object identifier column.

setOIdColumnName

public static void setOIdColumnName(java.lang.String _oidColumnName)
Deprecated. use get_versionColumnName()

Sets the object identifier column name.

Parameters:
_oidColumnName - Name of object identifier column.

get_versionColumnName

public static java.lang.String get_versionColumnName()
Returns the version column name.

Returns:
the version column name.

getVersionColumnName

public static java.lang.String getVersionColumnName()
Deprecated. use get_versionColumnName()

Returns the version column name.

Returns:
the version column name.

set_versionColumnName

public static void set_versionColumnName(java.lang.String _versionColumnName)
Sets the version column name.

Parameters:
_versionColumnName - Name of version column.

setVersionColumnName

public static void setVersionColumnName(java.lang.String _versionColumnName)
Deprecated. use set_versionColumnName()

Sets the version column name.

Parameters:
_versionColumnName - Name of version column.

getOId

public ObjectId getOId()
Deprecated. Use get_OId()

Returns:
this object's identifier.

get_OId

public ObjectId get_OId()
Returns this object's identifier.

Returns:
this object's identifier.

setOId

protected void setOId(ObjectId oId)
Deprecated. Use set_OId()

Sets this object's identifier.

Parameters:
oId - this object's identifier.

set_OId

protected void set_OId(ObjectId oId)
Sets this object's identifier.

Parameters:
oId - this object's identifier.

setVersion

protected void setVersion(int version)
Deprecated. Use set_Version()

Parameters:
version - the object's version.

set_Version

protected void set_Version(int version)
Sets this object's version.

Parameters:
version - the object's version.

getVersion

public int getVersion()
Deprecated. Use get_Version()

Returns:
this object's version.

get_Version

protected int get_Version()
Returns this object's version.

Returns:
this object's version.

setNewVersion

protected void setNewVersion(int newVersion)
Deprecated. use set_NewVersion instead

Sets this object's new version number.

Parameters:
newVersion - this object's next version.

set_NewVersion

protected void set_NewVersion(int newVersion)
Sets this object's new version number.

Parameters:
newVersion - this object's next version.

getNewVersion

protected int getNewVersion()
Deprecated. use get_NewVersion instead

Returns this object's new version.

Returns:
this object's new version.

get_NewVersion

protected int get_NewVersion()
Returns this object's new version.

Returns:
this object's new version.

isPersistent

public boolean isPersistent()
Returns:
true if this data object has been inserted into the database. Returns true if this object is persistent in the database (i.e. it has been inserted and not deleted)

setPersistent

public void setPersistent(boolean persistent)
Sets the persistent state for this object.

Parameters:
persistent - true if this object is present in persistent store.

getInsertStatement

public abstract java.sql.PreparedStatement getInsertStatement(DBConnection conn)
                                                       throws java.sql.SQLException
Returns the statement that can be used to insert this object into the database.

Parameters:
conn - the database connection.
Returns:
the statement used to insert this object into the database. null if the object cannot be inserted.
Throws:
java.sql.SQLException - If an error occurs.

getUpdateStatement

public abstract java.sql.PreparedStatement getUpdateStatement(DBConnection conn)
                                                       throws java.sql.SQLException
Returns the statement that can be used to update this object in the database.

Parameters:
conn - the database connection.
Returns:
the statement used to update this object in the database. null if the object cannot be updated.
Throws:
java.sql.SQLException - If an error occurs.

getDeleteStatement

public abstract java.sql.PreparedStatement getDeleteStatement(DBConnection conn)
                                                       throws java.sql.SQLException
Returns the statement that can be used to delete this object from the database.

Parameters:
conn - the database connection.
Returns:
the statement used to delete this object from the database. null if the object cannot be deleted.
Throws:
java.sql.SQLException - If an error occurs.

executeInsert

public void executeInsert(DBConnection conn)
                   throws java.sql.SQLException
Inserts this object into the database.

Specified by:
executeInsert in interface Transaction
Parameters:
conn - the database connection.
Throws:
java.sql.SQLException - if a database access error occurs.
DBRowUpdateException - If a version error occurs.

finalizeInsert

public void finalizeInsert(boolean success)
Updates the persistent state.

Specified by:
finalizeInsert in interface Transaction
Parameters:
success - true if the transaction succeeded and this object was successfully inserted into the database.

executeUpdate

public void executeUpdate(DBConnection conn)
                   throws java.sql.SQLException
Updates the contents of this object in the database.

Specified by:
executeUpdate in interface Transaction
Parameters:
conn - the database connection.
Throws:
java.sql.SQLException - If a database access error occurs.
DBRowUpdateException - If a version error occurs.

getTableName

public abstract java.lang.String getTableName()
Return the name of the table whose rows represent these objects. This method should be overridden by derived classes.

Returns:
the name of the table.
See Also:
executeUpdate(com.lutris.appserver.server.sql.DBConnection)

objectIdentityType

public abstract int objectIdentityType()
Return the type of the identity column(s) of DOs that these objects represents. This method should be overridden by derived classes.

Returns:
the identity type of DOs
See Also:
CommonConstants.OBJECT_IDENTITY_TYPE

finalizeUpdate

public void finalizeUpdate(boolean success)
The version number of this object is set to the next version for this object if this object was successfully updated in the database.

Specified by:
finalizeUpdate in interface Transaction
Parameters:
success - true if the transaction succeeded and this object was successfully updated in the database.
See Also:
get_NewVersion()

executeDelete

public void executeDelete(DBConnection conn)
                   throws java.sql.SQLException
Deletes this object from the database.

Specified by:
executeDelete in interface Transaction
Parameters:
conn - Database connection.
Throws:
java.sql.SQLException - If a database access error occurs.

finalizeDelete

public void finalizeDelete(boolean success)
Currently does nothing.

Specified by:
finalizeDelete in interface Transaction
Parameters:
success - true if the transaction succeeded and this object was successfully deleted from the database.

originalData_get

public java.lang.Object originalData_get()
This method is invoked whenever an object original data is needed. This method returns null and should be overwritten by subclasses.


updateCache

public void updateCache()
This method is invoked whenever an object is inserted or updated in the cache. This is empty method and should be overwritten by subclasses.


deleteFromCache

public void deleteFromCache()
This method is invoked whenever an object is deleted from the cache. This is empty method and should be overwritten by subclasses.


addToCache

public void addToCache()
This method is invoked whenever an object is added to the cache. This is empty method and should be overwritten by subclasses.


evict

public void evict()
This method is invoked whenever an object is removed from the cache. This is empty method and should be overwritten by subclasses.


refresh

public void refresh()
             throws DataObjectException
This method is invoked whenever object's data needs to be loaded. This is empty method and should be overwritten by subclasses.

Throws:
DataObjectException - If a data access error occurs.

getOriginalVersion

public int getOriginalVersion()

makeVisible

public void makeVisible()

makeInvisible

public void makeInvisible()

executeLockingStatement

public void executeLockingStatement(DBConnection conn)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

dumpData

public abstract void dumpData(boolean incrementVersion)

DODS 7.2 API