Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.acs.damsel.srvr.db
Class MidAssetDB  view MidAssetDB download MidAssetDB.java

java.lang.Object
  extended byorg.acs.damsel.srvr.db.MidAssetDB

public class MidAssetDB
extends java.lang.Object

Title: Mid-level SQL query and statement generation

Description: This singleton class contains the mid level methods for the AssetDB class. Methods include: the basic constructor, query, insert, and delete.

Version:
1.0

Field Summary
private static MidAssetDB instance
           
private static org.apache.log4j.Logger log
           
private  LowAssetDB lowAssetDB
           
 
Constructor Summary
private MidAssetDB()
           
 
Method Summary
 void addAssetToCollection(java.lang.String fileName, java.lang.String collectionName)
          This method adds a record to the AssetsCollectionsTable so that an asset that has previously been deleted is now restored and can be found using search and browse.
 Table advancedQuery(org.acs.damsel.srvr.search.AdvancedSearchParams params)
          Method constructs and exectutes a search query for advanced search based on the contents of the AdvancedSearchParams object passed in.
 Table andQuery(java.util.Vector resultNames, java.util.Vector tableNames, java.util.Vector columnNames, java.util.Vector columnValues)
          A wrapper around the generic query method that performs a general query with the WHERE statements connected with ANDs.
 Table browseQuery(java.lang.String browseChar, java.lang.String tag, java.lang.String collectionSelect)
          browseQuery This method is specifically designed to accomodate the browseByKeyField method.
 int delete(java.lang.String tableName, java.util.Vector columnNames, java.util.Vector columnValues)
          A middle tier method for performing generic deletes.
 Table findOrphanedAssets()
          This method finds all assets that have been removed from every collection and so they do not have a collection home thus become orphaned
 int insert(java.lang.String tableName, java.util.Vector columnNames, java.util.Vector columnValues)
          A middle tier method for peforming generic inserts.
static MidAssetDB instance()
          The instance() method is used instead of a constructor to get a handle on the MidAssetDB object.
 Table orQuery(java.util.Vector resultNames, java.util.Vector tableNames, java.util.Vector columnNames, java.util.Vector columnValues)
          A wrapper around the generic query method that performs a general query with the WHERE statements connected with ORs.
private  Table query(java.util.Vector resultNames, java.util.Vector tableNames, java.util.Vector columnNames, java.util.Vector columnValues, boolean isOrQuery)
           
 Table simpleSearchQuery(java.lang.String keyword, java.lang.String tag, java.lang.String collectionSelect)
          A method for performing a simple search.
 int update(java.lang.String tableName, java.util.Vector updateColumnNames, java.util.Vector updateColumnValues, java.util.Vector whereColumnNames, java.util.Vector whereColumnValues)
          A generic method for constructing SQL UPDATE statements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lowAssetDB

private LowAssetDB lowAssetDB

instance

private static MidAssetDB instance

log

private static org.apache.log4j.Logger log
Constructor Detail

MidAssetDB

private MidAssetDB()
            throws java.sql.SQLException
Method Detail

instance

public static MidAssetDB instance()
                           throws java.sql.SQLException
The instance() method is used instead of a constructor to get a handle on the MidAssetDB object. If the MidAssetDB object has not yet been initialized, then it is initialized using the default constructor.


query

private Table query(java.util.Vector resultNames,
                    java.util.Vector tableNames,
                    java.util.Vector columnNames,
                    java.util.Vector columnValues,
                    boolean isOrQuery)
             throws java.sql.SQLException

andQuery

public Table andQuery(java.util.Vector resultNames,
                      java.util.Vector tableNames,
                      java.util.Vector columnNames,
                      java.util.Vector columnValues)
               throws java.sql.SQLException
A wrapper around the generic query method that performs a general query with the WHERE statements connected with ANDs. See the documentation for query for more information.


orQuery

public Table orQuery(java.util.Vector resultNames,
                     java.util.Vector tableNames,
                     java.util.Vector columnNames,
                     java.util.Vector columnValues)
              throws java.sql.SQLException
A wrapper around the generic query method that performs a general query with the WHERE statements connected with ORs. See the documentation for query for more information.


browseQuery

public Table browseQuery(java.lang.String browseChar,
                         java.lang.String tag,
                         java.lang.String collectionSelect)
                  throws java.sql.SQLException
browseQuery This method is specifically designed to accomodate the browseByKeyField method. The reason we were not able to use the other queries is because this query needs both AND and OR statements within the WHERE clause.


simpleSearchQuery

public Table simpleSearchQuery(java.lang.String keyword,
                               java.lang.String tag,
                               java.lang.String collectionSelect)
                        throws java.sql.SQLException
A method for performing a simple search.


advancedQuery

public Table advancedQuery(org.acs.damsel.srvr.search.AdvancedSearchParams params)
                    throws java.sql.SQLException
Method constructs and exectutes a search query for advanced search based on the contents of the AdvancedSearchParams object passed in.


insert

public int insert(java.lang.String tableName,
                  java.util.Vector columnNames,
                  java.util.Vector columnValues)
           throws java.sql.SQLException
A middle tier method for peforming generic inserts. Note that one insert must be performed for each row that is to be inserted. Essentially, the information is turned into a SQL statement of the form INSERT INTO tableName(columnNames(1), columnNames(2), ..., columnNames(n)) VALUES(columnValues(1), columnValues(2), ..., columnValues(n));


delete

public int delete(java.lang.String tableName,
                  java.util.Vector columnNames,
                  java.util.Vector columnValues)
           throws java.sql.SQLException
A middle tier method for performing generic deletes. Note that until cascading is implemented, a reference may need to be deleted from multiple tables in order to completely remove it from the database. Essentially, the information is turned into a SQL statement of the form DELETE FROM tableName WHERE tableName.columnNames(1) = columnValues(1) AND tableName.columnNames(2) = columnValues(2) ... AND tableName.columnNames(n) = columnValues(n);


update

public int update(java.lang.String tableName,
                  java.util.Vector updateColumnNames,
                  java.util.Vector updateColumnValues,
                  java.util.Vector whereColumnNames,
                  java.util.Vector whereColumnValues)
           throws java.sql.SQLException
A generic method for constructing SQL UPDATE statements. Generally, the arguments are turned into a statement of the form: UPDATE tableName SET updateColumnName(1) = updateColumnValue(1), updateColumnName(2) = updateColumnValue(2), ... updateColumnName(n) = updateColumnValue(n) WHERE whereColumnName(1) = whereColumnValue(1) AND whereColumnName(2) = whereColumnValue(2) ... AND whereColumnName(m) = whereColumnValue(m);


findOrphanedAssets

public Table findOrphanedAssets()
                         throws java.sql.SQLException
This method finds all assets that have been removed from every collection and so they do not have a collection home thus become orphaned


addAssetToCollection

public void addAssetToCollection(java.lang.String fileName,
                                 java.lang.String collectionName)
                          throws java.sql.SQLException
This method adds a record to the AssetsCollectionsTable so that an asset that has previously been deleted is now restored and can be found using search and browse.