com.jwpepper.inv
Class ProductSupport

java.lang.Object
  |
  +--com.imaginary.lwp.PersistenceSupport
        |
        +--com.imaginary.lwp.JDBCSupport
              |
              +--com.jwpepper.inv.ProductSupport
Direct Known Subclasses:
PepperProductSupport

public class ProductSupport
extends JDBCSupport

Provides database access for persistence operations related to the product business component. For the initial release of the catalog system, the product class is really abstract, with the concrete class being the PepperProduct class. As a result, this class only performs SQL INSERT, DELETE, and UPDATE operations.
Last modified $Date: 1999/10/05 15:26:44 $

Version:
$Revision: 1.2 $
Author:
George Reese (george@ancept.com)

Field Summary
static java.lang.String CREATE
          The SQL INSERT statement.
static java.lang.String LOAD_ANNOTATIONS
          SQL statement for loading annotations
static java.lang.String LOAD_CHILDREN
          SQL statement for loading children.
static java.lang.String REMOVE
          The SQL DELETE statement.
static java.lang.String REMOVE_ANNOTATIONS
          The SQL to remove annotations for a product.
static java.lang.String SAVE_ANNOTATIONS
          The SQL to save annotations for a product.
static java.lang.String STORE
          The SQL UPDATE statement.
 
Constructor Summary
ProductSupport()
           
 
Method Summary
 void create(Transaction trans, Memento mem)
          Creates the product represented by the specified memento in the database.
 JDBCJoin getJoin(java.lang.String tbl)
          Joins the MANUFACTURER table to the PRODUCT table for searches.
 java.lang.String getPrimaryTable()
           
 void load(Transaction trans, Memento mem)
          This method is left empty since the Product class is not currently used as a concrete class.
protected  com.sun.java.util.collections.HashMap loadAnnotations(Transaction trans, long oid)
          Loads all annotations associated with the named product.
protected  com.imaginary.util.DistributedList loadChildren(Transaction trans, long oid)
           
protected  java.lang.String mapField(java.lang.String fld)
          Maps the fields used in a search to actual database fields.
 void remove(Transaction trans, Memento mem)
          Deletes the product represented by the data in the specified memento from the database.
protected  void saveAnnotations(Transaction trans, long oid, com.sun.java.util.collections.HashMap ann)
          Saves the annotations associated with the product.
 void store(Transaction trans, Memento mem)
          Stores the product whose state is contained in the specified memento into the database.
 
Methods inherited from class com.imaginary.lwp.JDBCSupport
find, getFindSQL, getReference
 
Methods inherited from class com.imaginary.lwp.PersistenceSupport
generateID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CREATE

public static final java.lang.String CREATE
The SQL INSERT statement.

LOAD_ANNOTATIONS

public static final java.lang.String LOAD_ANNOTATIONS
SQL statement for loading annotations

LOAD_CHILDREN

public static final java.lang.String LOAD_CHILDREN
SQL statement for loading children.

REMOVE

public static final java.lang.String REMOVE
The SQL DELETE statement.

REMOVE_ANNOTATIONS

public static final java.lang.String REMOVE_ANNOTATIONS
The SQL to remove annotations for a product.

SAVE_ANNOTATIONS

public static final java.lang.String SAVE_ANNOTATIONS
The SQL to save annotations for a product.

STORE

public static final java.lang.String STORE
The SQL UPDATE statement.
Constructor Detail

ProductSupport

public ProductSupport()
Method Detail

create

public void create(Transaction trans,
                   Memento mem)
            throws CreateException
Creates the product represented by the specified memento in the database.
Parameters:
trans - the transaction object
mem - the memento containing the state of the product to be saved
Throws:
CreateException - failed to save the object to the database
Overrides:
create in class PersistenceSupport

getJoin

public JDBCJoin getJoin(java.lang.String tbl)
Joins the MANUFACTURER table to the PRODUCT table for searches.
Parameters:
tbl - the MANUFACTURER table
Returns:
a join object
Overrides:
getJoin in class JDBCSupport

getPrimaryTable

public java.lang.String getPrimaryTable()
Returns:
"PRODUCT"
Overrides:
getPrimaryTable in class JDBCSupport

load

public void load(Transaction trans,
                 Memento mem)
          throws LoadException
This method is left empty since the Product class is not currently used as a concrete class.
Parameters:
trans - unused
mem - unused
Throws:
LoadException - always thrown
Overrides:
load in class PersistenceSupport

loadAnnotations

protected com.sun.java.util.collections.HashMap loadAnnotations(Transaction trans,
                                                                long oid)
                                                         throws LoadException
Loads all annotations associated with the named product.
Parameters:
trans - the transaction to use for the load
oid - the objectID of the product whose annotations are to be loaded
Throws:
LoadException - an error occurred loading the annotations

loadChildren

protected com.imaginary.util.DistributedList loadChildren(Transaction trans,
                                                          long oid)
                                                   throws LoadException

mapField

protected java.lang.String mapField(java.lang.String fld)
                             throws FindException
Maps the fields used in a search to actual database fields.
Parameters:
fld - the search field
Returns:
the database column
Throws:
FindException - the desired field does not exist
Overrides:
mapField in class JDBCSupport

remove

public void remove(Transaction trans,
                   Memento mem)
            throws RemoveException
Deletes the product represented by the data in the specified memento from the database.
Parameters:
trans - the transaction object
mem - the memento containing the product state
Throws:
RemoveException - an error occurred deleting the object from the data store
Overrides:
remove in class PersistenceSupport

saveAnnotations

protected void saveAnnotations(Transaction trans,
                               long oid,
                               com.sun.java.util.collections.HashMap ann)
                        throws java.sql.SQLException
Saves the annotations associated with the product.
Parameters:
trans - the transaction in which the save should occur
oid - the objectID of the product whose annotations are being saved
Throws:
java.sql.SQLException - a database error occurred

store

public void store(Transaction trans,
                  Memento mem)
           throws StoreException
Stores the product whose state is contained in the specified memento into the database.
Parameters:
trans - the transaction object
mem - the memento containing the product's state
Throws:
StoreException - an error occurred storing the product
Overrides:
store in class PersistenceSupport