org.opensubsystems.blog.persist.db
Class BlogDatabaseSchema

java.lang.Object
  extended by org.opensubsystems.core.persist.db.DatabaseSchemaImpl
      extended by org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl
          extended by org.opensubsystems.blog.persist.db.BlogDatabaseSchema
All Implemented Interfaces:
org.opensubsystems.core.persist.db.DatabaseOperations, org.opensubsystems.core.persist.db.DatabaseSchema, org.opensubsystems.core.persist.db.ModifiableDatabaseSchema
Direct Known Subclasses:
DB2BlogDatabaseSchema, HsqlDBBlogDatabaseSchema, MSSQLBlogDatabaseSchema, MySQLBlogDatabaseSchema, OracleBlogDatabaseSchema, PostgreSQLBlogDatabaseSchema, SapDBBlogDatabaseSchema, SybaseBlogDatabaseSchema

public abstract class BlogDatabaseSchema
extends org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl

Database specific operations related to persistence of blogs and their entries.

Version:
$Id: BlogDatabaseSchema.java,v 1.19 2007/02/01 07:34:37 bastafidli Exp $
Author:
Miro Halas
Code reviewer:
Miro Halas
Code reviewed:
1.6 2006/07/13 23:43:28 jlegeny

Field Summary
static int BLOG_CAPTION_MAXLENGTH
          Maximal length of blog caption.
static java.lang.String BLOG_COLUMNS
          All columns in a blog table in the order in which they will be retrieved
static int BLOG_COMMENTS_MAXLENGTH
          Maximal length of blog comments.
static int BLOG_FOLDER_MAXLENGTH
          Maximal length of blog folder.
static java.lang.String BLOG_SCHEMA_NAME
          Name identifies this schema in the database.
static int BLOG_SCHEMA_VERSION
          Version of this schema in the database.
static java.lang.String BLOG_TABLE_NAME
          Table name where blog informations are stored.
static int BLOGENTRY_CAPTION_MAXLENGTH
          Maximal length of entry caption.
static int BLOGENTRY_COMMENTS_MAXLENGTH
          Maximal length of entry comments.
static int BLOGENTRY_IMAGEURL_MAXLENGTH
          Maximal length of entry image URL.
static java.lang.String BLOGENTRY_TABLE_NAME
          Table name where blog entry informations are stored.
static int BLOGENTRY_TARGETURL_MAXLENGTH
          Maximal length of entry target URL.
static java.lang.String ENTRY_COLUMNS
          All columns in a entry table in the order in which they will be retrieved
static java.util.Map TABLE_NAMES
          Map of table names belonging to this schema.
 
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
BlogDatabaseSchema()
          Default constructor.
 
Method Summary
 java.lang.String getDeleteBlogById()
          Get query to delete blog by id
 java.lang.String getDeleteEntryById()
          Get query to delete entry by id
 java.lang.String getInsertBlog()
          Method returns simple insert blog query.
abstract  java.lang.String getInsertBlogAndFetchGeneratedValues()
          Get query that inserts a blog to the database and fetches database generated values such as the generated id and creation timestamp
 java.lang.String getInsertEntry()
          Method returns simple insert entry query.
abstract  java.lang.String getInsertEntryAndFetchGeneratedValues()
          Get query that inserts a entry to the database and fetches database generated values such as the generated id and creation timestamp
 java.lang.String getSelectAllBlogs(java.lang.String strColumns)
          Get query to load all blogs sorted by creation date
 java.lang.String getSelectAllEntries(java.lang.String strColumns)
          Get query to load all entries sorted by date from newest to oldest.
 java.lang.String getSelectBlogByFolder(java.lang.String strColumns)
          Get query to load blog by folder
 java.lang.String getSelectBlogById(java.lang.String strColumns)
          Get query to load blog by id
 java.lang.String getSelectEntryById(java.lang.String strColumns)
          Get query to load entry by id
 java.lang.String getSelectLastEntry(java.lang.String strColumns)
          Get query to load last created entry
abstract  java.lang.String getUpdateBlogAndFetchGeneratedValues()
          Get query that updates blog in the database and fetches database generated values such as the updated modification timestamp
abstract  java.lang.String getUpdateEntryAndFetchGeneratedValues()
          Get query that updates entry 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.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.core.persist.db.DatabaseSchema
create, getDependentSchemas, getName, getVersion, isInDomain, upgrade
 

Field Detail

BLOG_SCHEMA_NAME

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

See Also:
Constant Field Values

BLOG_SCHEMA_VERSION

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

See Also:
Constant Field Values

BLOG_TABLE_NAME

public static final java.lang.String BLOG_TABLE_NAME
Table name where blog informations are stored.

See Also:
Constant Field Values

BLOG_COLUMNS

public static final java.lang.String BLOG_COLUMNS
All columns in a blog table in the order in which they will be retrieved

See Also:
Constant Field Values

BLOG_FOLDER_MAXLENGTH

public static final int BLOG_FOLDER_MAXLENGTH
Maximal length of blog folder.

See Also:
Constant Field Values

BLOG_CAPTION_MAXLENGTH

public static final int BLOG_CAPTION_MAXLENGTH
Maximal length of blog caption.

See Also:
Constant Field Values

BLOG_COMMENTS_MAXLENGTH

public static final int BLOG_COMMENTS_MAXLENGTH
Maximal length of blog comments.

See Also:
Constant Field Values

BLOGENTRY_TABLE_NAME

public static final java.lang.String BLOGENTRY_TABLE_NAME
Table name where blog entry informations are stored.

See Also:
Constant Field Values

ENTRY_COLUMNS

public static final java.lang.String ENTRY_COLUMNS
All columns in a entry table in the order in which they will be retrieved

See Also:
Constant Field Values

BLOGENTRY_CAPTION_MAXLENGTH

public static final int BLOGENTRY_CAPTION_MAXLENGTH
Maximal length of entry caption.

See Also:
Constant Field Values

BLOGENTRY_COMMENTS_MAXLENGTH

public static final int BLOGENTRY_COMMENTS_MAXLENGTH
Maximal length of entry comments.

See Also:
Constant Field Values

BLOGENTRY_IMAGEURL_MAXLENGTH

public static final int BLOGENTRY_IMAGEURL_MAXLENGTH
Maximal length of entry image URL.

See Also:
Constant Field Values

BLOGENTRY_TARGETURL_MAXLENGTH

public static final int BLOGENTRY_TARGETURL_MAXLENGTH
Maximal length of entry target URL.

See Also:
Constant Field Values

TABLE_NAMES

public static final java.util.Map TABLE_NAMES
Map of table names belonging to this schema.

Constructor Detail

BlogDatabaseSchema

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

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

getSelectBlogById

public java.lang.String getSelectBlogById(java.lang.String strColumns)
                                   throws org.opensubsystems.core.error.OSSException
Get query to load blog by id

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

getSelectBlogByFolder

public java.lang.String getSelectBlogByFolder(java.lang.String strColumns)
                                       throws org.opensubsystems.core.error.OSSException
Get query to load blog by folder

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

getSelectAllBlogs

public java.lang.String getSelectAllBlogs(java.lang.String strColumns)
                                   throws org.opensubsystems.core.error.OSSException
Get query to load all blogs sorted by creation date

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

getInsertBlogAndFetchGeneratedValues

public abstract java.lang.String getInsertBlogAndFetchGeneratedValues()
                                                               throws org.opensubsystems.core.error.OSSException
Get query that inserts a blog 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

getUpdateBlogAndFetchGeneratedValues

public abstract java.lang.String getUpdateBlogAndFetchGeneratedValues()
                                                               throws org.opensubsystems.core.error.OSSException
Get query that updates blog 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

getInsertBlog

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

Returns:
String - simple insert blog query
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getDeleteBlogById

public java.lang.String getDeleteBlogById()
Get query to delete blog by id

Returns:
String - query

getSelectEntryById

public java.lang.String getSelectEntryById(java.lang.String strColumns)
                                    throws org.opensubsystems.core.error.OSSException
Get query to load entry by id

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

getSelectAllEntries

public java.lang.String getSelectAllEntries(java.lang.String strColumns)
                                     throws org.opensubsystems.core.error.OSSException
Get query to load all entries sorted by date from newest to oldest.

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

getSelectLastEntry

public java.lang.String getSelectLastEntry(java.lang.String strColumns)
                                    throws org.opensubsystems.core.error.OSSException
Get query to load last created entry

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

getInsertEntryAndFetchGeneratedValues

public abstract java.lang.String getInsertEntryAndFetchGeneratedValues()
                                                                throws org.opensubsystems.core.error.OSSException
Get query that inserts a entry 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

getUpdateEntryAndFetchGeneratedValues

public abstract java.lang.String getUpdateEntryAndFetchGeneratedValues()
                                                                throws org.opensubsystems.core.error.OSSException
Get query that updates entry 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

getInsertEntry

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

Returns:
String - simple insert entry query
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getDeleteEntryById

public java.lang.String getDeleteEntryById()
Get query to delete entry by id

Returns:
String - query

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 - 2007 OpenSubsystems s.r.o.