com.jwpepper.inv.pprprd
Class PepperProductSupport

java.lang.Object
  |
  +--com.imaginary.lwp.PersistenceSupport
        |
        +--com.imaginary.lwp.JDBCSupport
              |
              +--com.jwpepper.inv.ProductSupport
                    |
                    +--com.jwpepper.inv.pprprd.PepperProductSupport

public class PepperProductSupport
extends ProductSupport

Supports database storage for J.W. Pepper product business components.
Last modified $Date: 1999/10/05 15:26:49 $

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

Fields inherited from class com.jwpepper.inv.ProductSupport
CREATE, LOAD_ANNOTATIONS, LOAD_CHILDREN, REMOVE, REMOVE_ANNOTATIONS, SAVE_ANNOTATIONS, STORE
 
Constructor Summary
PepperProductSupport()
           
 
Method Summary
 void create(Transaction trans, Memento mem)
          Creates a new J.W.
 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)
          Loads a J.W.
protected  com.sun.java.util.collections.ArrayList loadStyles(Transaction trans, long oid)
          Loads all of the styles associated with this product.
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)
          Removes the product represented by the specified memento from the database.
protected  void saveStyles(Transaction trans, long oid, com.sun.java.util.collections.ArrayList styles)
          Inserts the specified styles for a product into the database.
 void store(Transaction trans, Memento mem)
          Saves the product to the database.
 
Methods inherited from class com.jwpepper.inv.ProductSupport
loadAnnotations, loadChildren, saveAnnotations
 
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
 

Constructor Detail

PepperProductSupport

public PepperProductSupport()
Method Detail

create

public void create(Transaction trans,
                   Memento mem)
            throws CreateException
Creates a new J.W. Pepper product in the database.
Parameters:
trans - the transaction for the insert
mem - the memento containing the product's state
Throws:
CreateException - an error occurred saving the product to the database
Overrides:
create in class ProductSupport

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 ProductSupport

getPrimaryTable

public java.lang.String getPrimaryTable()
Returns:
"PPR_PRODUCT"
Overrides:
getPrimaryTable in class ProductSupport

load

public void load(Transaction trans,
                 Memento mem)
          throws LoadException
Loads a J.W. Pepper product business component from the database.
Parameters:
trans - the transaction for the load operation
mem - the memento into which the state is placed
Throws:
LoadException - an error occurred loading the data from the database
Overrides:
load in class ProductSupport

loadStyles

protected com.sun.java.util.collections.ArrayList loadStyles(Transaction trans,
                                                             long oid)
                                                      throws LoadException
Loads all of the styles associated with this product.
Parameters:
trans - the transaction to use for the transaction
oid - the objectID of the product whose styles are being loaded
Throws:
LoadException - an error occurred loading the styles

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 ProductSupport

remove

public void remove(Transaction trans,
                   Memento mem)
            throws RemoveException
Removes the product represented by the specified memento from the database.
Parameters:
trans - the transaction in which the deletion occurs
mem - the memento containing the state of the product to be removed
Throws:
RemoveException - an error occurred removing the product
Overrides:
remove in class ProductSupport

saveStyles

protected void saveStyles(Transaction trans,
                          long oid,
                          com.sun.java.util.collections.ArrayList styles)
                   throws java.sql.SQLException
Inserts the specified styles for a product into the database.
Parameters:
trans - the transaction in process
oid - the objectID of the product whose styles are being saved
styles - the styles to save
Throws:
java.sql.SQLException - a database error occurred

store

public void store(Transaction trans,
                  Memento mem)
           throws StoreException
Saves the product to the database.
Parameters:
trans - the transaction to use to store to the database
mem - the memento containing the current state of the product to be saved
Throws:
StoreException - an error occurred saving the product
Overrides:
store in class ProductSupport