org.opensubsystems.inventory.persist.db
Class InventoryDatabaseSchema

java.lang.Object
  extended by org.opensubsystems.core.persist.db.DatabaseSchemaImpl
      extended by org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl
          extended by org.opensubsystems.patterns.listdata.persist.db.impl.ModifiableListDatabaseSchemaImpl
              extended by org.opensubsystems.inventory.persist.db.InventoryDatabaseSchema
All Implemented Interfaces:
org.opensubsystems.core.persist.db.DatabaseOperations, org.opensubsystems.core.persist.db.DatabaseSchema, org.opensubsystems.core.persist.db.ModifiableDatabaseSchema, org.opensubsystems.patterns.listdata.persist.db.ListDatabaseSchema
Direct Known Subclasses:
DB2InventoryDatabaseSchema, HsqlDBInventoryDatabaseSchema, MSSQLInventoryDatabaseSchema, MySQLInventoryDatabaseSchema, OracleInventoryDatabaseSchema, PostgreSQLInventoryDatabaseSchema, SapDBInventoryDatabaseSchema, SybaseInventoryDatabaseSchema

public abstract class InventoryDatabaseSchema
extends org.opensubsystems.patterns.listdata.persist.db.impl.ModifiableListDatabaseSchemaImpl

Database specific operations related to persistence of inventories.

Version:
$Id: InventoryDatabaseSchema.java,v 1.14 2007/01/12 06:19:45 bastafidli Exp $
Author:
Julian Legeny
Code reviewer:
TODO: Review this code
Code reviewed:

Field Summary
static int INVENTORY_DESCRIPTION_MAXLENGTH
          Maximal length of inventory description.
static int[] INVENTORY_MANDATORY_RETRIEVE_COLUMNSS
          Columns which always have to be retrieved from the database
static int INVENTORY_NAME_MAXLENGTH
          Maximal length of inventory name.
static java.lang.String INVENTORY_SCHEMA_NAME
          Name identifies this schema in the database.
static int INVENTORY_SCHEMA_VERSION
          Version of this schema in the database.
static int[] INVENTORY_SORT_COLUMNS
          Static variable for array of all columns codes that can be used for sorting.
 
Fields inherited from class org.opensubsystems.patterns.listdata.persist.db.impl.ModifiableListDatabaseSchemaImpl
m_mapFilterableColumns, m_mapListableTableNames, m_mapMandatoryRetrieveColumns, m_mapSortableColumns
 
Fields inherited from class org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl
m_mapModifiableTableNames
 
Fields inherited from class org.opensubsystems.core.persist.db.DatabaseSchemaImpl
DATABASE_SCHEMA_PREFIX, DATABASE_SCHEMA_PREFIX_DEFAULT, m_arrDependentSchemas, m_bIsInDomain, m_iSchemaVersion, m_strSchemaName, NL
 
Fields inherited from interface org.opensubsystems.core.persist.db.DatabaseOperations
DBOP_DELETE, DBOP_INSERT, DBOP_SELECT, DBOP_UPDATE
 
Constructor Summary
InventoryDatabaseSchema()
          Default constructor.
 
Method Summary
 void createListIndexes(java.sql.Connection cntDBConnection)
          Method creates specified LST indexes used for speeding up retrieving data into the list.
 java.lang.StringBuffer getColumns(boolean specific, int[] columns, java.lang.Object[] prefixes, java.lang.Object[] postfixes, java.lang.StringBuffer buffer)
          
 java.lang.String getDeleteInventoryById()
          Get query to delete particular inventory.
 java.lang.String getInsertInventory()
          Method returns simple insert inventory query.
abstract  java.lang.String getInsertInventoryAndFetchGeneratedValues()
          Get query that inserts a inventory to the database and fetches database generated values such as the generated id and creation timestamp
 java.lang.String getSelectInventoryById(int[] columns)
          Get query to select inventory by ID.
 java.lang.String getSelectInventoryByName(int[] columns)
          Get query to select inventory by name.
abstract  java.lang.String getUpdateInventoryAndFetchGeneratedValues()
          Get query that updates inventory in the database and fetches database generated values such as the updated modification timestamp
 void handleSQLException(java.sql.SQLException exc, java.sql.Connection dbConnection, int iOperationType, int iDataType, java.lang.Object data)
          
 
Methods inherited from class org.opensubsystems.patterns.listdata.persist.db.impl.ModifiableListDatabaseSchemaImpl
getFilterbleColumns, getMandatoryRetrieveColumns, getSelectList, getSortableColumns
 
Methods inherited from class org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl
deleteRelatedData, getModifiableTableNames
 
Methods inherited from class org.opensubsystems.core.persist.db.DatabaseSchemaImpl
getDependentSchemas, getJoinFromWhere, getName, getOwnerColumnNames, getSchemaPrefix, getVersion, isExistingIndex, isInDomain, upgrade, upgradeView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensubsystems.patterns.listdata.persist.db.ListDatabaseSchema
getJoinFromWhere, isExistingIndex
 
Methods inherited from interface org.opensubsystems.core.persist.db.DatabaseSchema
create, getDependentSchemas, getName, getVersion, isInDomain, upgrade
 

Field Detail

INVENTORY_SCHEMA_NAME

public static final java.lang.String INVENTORY_SCHEMA_NAME
Name identifies this schema in the database.

See Also:
Constant Field Values

INVENTORY_SCHEMA_VERSION

public static final int INVENTORY_SCHEMA_VERSION
Version of this schema in the database.

See Also:
Constant Field Values

INVENTORY_MANDATORY_RETRIEVE_COLUMNSS

public static final int[] INVENTORY_MANDATORY_RETRIEVE_COLUMNSS
Columns which always have to be retrieved from the database


INVENTORY_SORT_COLUMNS

public static final int[] INVENTORY_SORT_COLUMNS
Static variable for array of all columns codes that can be used for sorting.


INVENTORY_NAME_MAXLENGTH

public static final int INVENTORY_NAME_MAXLENGTH
Maximal length of inventory name.

See Also:
Constant Field Values

INVENTORY_DESCRIPTION_MAXLENGTH

public static final int INVENTORY_DESCRIPTION_MAXLENGTH
Maximal length of inventory description.

See Also:
Constant Field Values
Constructor Detail

InventoryDatabaseSchema

public InventoryDatabaseSchema()
                        throws org.opensubsystems.core.error.OSSException
Default constructor.

Throws:
org.opensubsystems.core.error.OSSException - - error occured.
Method Detail

getInsertInventoryAndFetchGeneratedValues

public abstract java.lang.String getInsertInventoryAndFetchGeneratedValues()
                                                                    throws org.opensubsystems.core.error.OSSException
Get query that inserts a inventory to the database and fetches database generated values such as the generated id and creation timestamp

Returns:
String - query for simple insert or stored procedure call
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getUpdateInventoryAndFetchGeneratedValues

public abstract java.lang.String getUpdateInventoryAndFetchGeneratedValues()
                                                                    throws org.opensubsystems.core.error.OSSException
Get query that updates inventory in the database and fetches database generated values such as the updated modification timestamp

Returns:
String - query for simple update or stored procedure call
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getInsertInventory

public java.lang.String getInsertInventory()
                                    throws org.opensubsystems.core.error.OSSException
Method returns simple insert inventory query. This method is common for all databases and can be overwritten for each specific database schema.

Returns:
String - simple insert inventory query
Throws:
org.opensubsystems.core.error.OSSException - - exception during getting query

createListIndexes

public void createListIndexes(java.sql.Connection cntDBConnection)
                       throws java.sql.SQLException,
                              org.opensubsystems.core.error.OSSException
Method creates specified LST indexes used for speeding up retrieving data into the list.

Parameters:
cntDBConnection - - valid connection to database
Throws:
java.sql.SQLException - - problem creating the database schema
org.opensubsystems.core.error.OSSException - - problem creating the database schema

getSelectInventoryById

public java.lang.String getSelectInventoryById(int[] columns)
                                        throws org.opensubsystems.core.error.OSSException
Get query to select inventory by ID.

Parameters:
columns - - columns to retrieve
Returns:
String - query
Throws:
org.opensubsystems.core.error.OSSException - - and error has occured

getSelectInventoryByName

public java.lang.String getSelectInventoryByName(int[] columns)
                                          throws org.opensubsystems.core.error.OSSException
Get query to select inventory by name.

Parameters:
columns - - list of columns to retrieve
Returns:
String - query
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getDeleteInventoryById

public java.lang.String getDeleteInventoryById()
Get query to delete particular inventory.

Returns:
String - query

getColumns

public java.lang.StringBuffer getColumns(boolean specific,
                                         int[] columns,
                                         java.lang.Object[] prefixes,
                                         java.lang.Object[] postfixes,
                                         java.lang.StringBuffer buffer)
                                  throws org.opensubsystems.core.error.OSSException

Throws:
org.opensubsystems.core.error.OSSException

handleSQLException

public void handleSQLException(java.sql.SQLException exc,
                               java.sql.Connection dbConnection,
                               int iOperationType,
                               int iDataType,
                               java.lang.Object data)
                        throws org.opensubsystems.core.error.OSSException

Specified by:
handleSQLException in interface org.opensubsystems.core.persist.db.DatabaseSchema
Overrides:
handleSQLException in class org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl
Throws:
org.opensubsystems.core.error.OSSException


Copyright © 2003 - 2006 OpenSubsystems s.r.o.