com.jwpepper.inv
Class ProductImpl

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--com.imaginary.lwp.BaseEntity
                          |
                          +--com.jwpepper.inv.ProductImpl
Direct Known Subclasses:
PepperProductImpl

public class ProductImpl
extends BaseEntity
implements Product

Implements the business logic associated with the J.W. Pepper product business component.
Last modified $Date: 1999/10/04 15:31:31 $

Version:
$Revision
Author:
Neophytos Iacovou (iacovou@ancept.com), George Reese (george@ancept.com)
See Also:
Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
ProductImpl()
          Empty constructor for instantiating a new ProductImpl instance.
 
Method Summary
 void addAnnotation(Identifier id, java.lang.String aud, AnnotationReference ann)
          Adds an annotation of the specified audience type to the list of annotations that describe this product.
 void addChild(Identifier id, Product prd)
          Adds a product as a child of this product.
 com.sun.java.util.collections.Iterator annotations()
          Provides a complete list of all annotations describing this product.
protected  void cascadeRemove(Identifier id)
          Notifies all parts of a product that this product has been removed.
 com.sun.java.util.collections.Iterator children()
          Provides all of the children of this product.
 void create(Identifier id, ManufacturerReference mfg, java.lang.String mfgcode, java.lang.String nom, double prix)
          Initializes a newly created product within the context of a new transaction that marks the product for creation into the data store.
 void create(Identifier id, ManufacturerReference mfg, java.lang.String mfgcode, java.lang.String nom, double prix, ProductReference prnt)
          Initializes a newly created product within the context of a new transaction that marks the product for creation into the data store.
 AnnotationReference getAnnotation(java.lang.String aud, java.util.Locale loc)
          Provides the annotation for the specified audience type and translated for the specified locale.
 ManufacturerReference getManufacturer()
          Provides a reference to the manufacturer of this product.
 java.lang.String getManufacturerCode()
          Provides the manufacturer's identifier that uniquely identifies this product for the manufacturer.
 java.lang.String getName(java.util.Locale loc)
          Provides the name of this product translated for the specified locale.
 ProductReference getParent()
          Provides the parent of this product.
 double getPrice()
          Provide the base price for this product.
 boolean isInStock()
          Determines if this product is currently in stock.
protected  void load(Memento mem)
          Loads the state of this product from the specified memento.
 void removeAnnotation(Identifier id, AnnotationReference ann)
          Removes the specified annotation from the list of annotations describing this product.
 void removeChild(Identifier id, Product prd)
          Removes the specified child from the list of this product's children.
 void removeParent(Identifier id, Product prd)
          Sets the parent to null is the specified product is the current parent.
protected  void store(Memento mem)
          Stores the current state of this product into the specified memento for storage in a data store.
 
Methods inherited from class com.imaginary.lwp.BaseEntity
create, getLastUpdateID, getLastUpdateTime, getObjectID, getReference, load, reload, remove, save, store
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProductImpl

public ProductImpl()
            throws PersistenceException,
                   java.rmi.RemoteException
Empty constructor for instantiating a new ProductImpl instance. This constructor should be the only constructor for this class.
Throws:
PersistenceException - LWP was unable to assign a persistence handler
java.rmi.RemoteException - RMI was unable to export this object
Method Detail

addAnnotation

public void addAnnotation(Identifier id,
                          java.lang.String aud,
                          AnnotationReference ann)
                   throws PersistenceException
Adds an annotation of the specified audience type to the list of annotations that describe this product.
Specified by:
addAnnotation in interface Product
Parameters:
id - the client identifier for the transaction
aud - the audience type that describes who should see the annotation
ann - the annotation to be added
Throws:
PersistenceException - an error occurred in the transaction

addChild

public void addChild(Identifier id,
                     Product prd)
              throws IllegalProductRelationException,
                     PersistenceException,
                     java.rmi.RemoteException
Adds a product as a child of this product. Children are used by catalogs to build entries of related items.
Specified by:
addChild in interface Product
Parameters:
id - the client identifier for the transaction
prd - the child product
Throws:
com.jwpepper.prd.IllegalProductRelationException - an attempt was made to add a child to a product that has a parent
PersistenceException - an error occurred in the transaction
java.rmi.RemoteException - a network error occurred

annotations

public com.sun.java.util.collections.Iterator annotations()
Provides a complete list of all annotations describing this product.
Specified by:
annotations in interface Product
Returns:
this product's annotations

cascadeRemove

protected void cascadeRemove(Identifier id)
                      throws RemoveException
Notifies all parts of a product that this product has been removed. LWP calls this as part of a remove() transaction automatically to provide the business object with the opportunity to clean itself up. This method specifically triggers the folllowing:
Parameters:
id - the client identifier for the transaction
Throws:
RemoveException - an error occurred notifying the parts of the product of the removal.

children

public com.sun.java.util.collections.Iterator children()
Provides all of the children of this product.
Specified by:
children in interface Product
Returns:
the product's children

create

public void create(Identifier id,
                   ManufacturerReference mfg,
                   java.lang.String mfgcode,
                   java.lang.String nom,
                   double prix)
            throws CreateException,
                   java.rmi.RemoteException
Initializes a newly created product within the context of a new transaction that marks the product for creation into the data store.
Specified by:
create in interface Product
Parameters:
id - the client identifier for the transaction
mfg - the manufacturer of the product
mfgcode - the manufacturer's product identifier
nom - the name of the product for the default locale
prix - the price of the product
Throws:
CreateException - an error occurred creating the product
java.rmi.RemoteException - a network error occurred

create

public void create(Identifier id,
                   ManufacturerReference mfg,
                   java.lang.String mfgcode,
                   java.lang.String nom,
                   double prix,
                   ProductReference prnt)
            throws CreateException,
                   java.rmi.RemoteException
Initializes a newly created product within the context of a new transaction that marks the product for creation into the data store.
Specified by:
create in interface Product
Parameters:
id - the client identifier for the transaction
mfg - the manufacturer of the product
mfgcode - the manufacturer's product identifier
nom - the name of the product for the default locale
prix - the price of the product
prnt - the parent of this product
Throws:
CreateException - an error occurred creating the product
java.rmi.RemoteException - a network error occurred

getAnnotation

public AnnotationReference getAnnotation(java.lang.String aud,
                                         java.util.Locale loc)
Provides the annotation for the specified audience type and translated for the specified locale. If no translation exists for that locale, provide a default translation. If no annotation exists for the desired type, it returns a default annotation.
Specified by:
getAnnotation in interface Product
Parameters:
aud - the audience type desired
loc - the locale of the desired translation
Returns:
a reference to the desired annotation.

getManufacturer

public ManufacturerReference getManufacturer()
Provides a reference to the manufacturer of this product.
Specified by:
getManufacturer in interface Product
Returns:
the manufacturer of this product

getManufacturerCode

public java.lang.String getManufacturerCode()
Provides the manufacturer's identifier that uniquely identifies this product for the manufacturer.
Specified by:
getManufacturerCode in interface Product
Returns:
the manufacturer code

getName

public java.lang.String getName(java.util.Locale loc)
Provides the name of this product translated for the specified locale. If no such translation exists, one is provided from the default locale.
Specified by:
getName in interface Product
Parameters:
loc - the locale of the desired translation
Returns:
the product name

getParent

public ProductReference getParent()
Provides the parent of this product.
Specified by:
getParent in interface Product
Returns:
the parent product for this product

getPrice

public double getPrice()
Provide the base price for this product. This business component is currently unaware of any other pricing concepts.
Specified by:
getPrice in interface Product
Returns:
the product price

isInStock

public boolean isInStock()
Determines if this product is currently in stock.
Specified by:
isInStock in interface Product
Returns:
true if the product is in stock

load

protected void load(Memento mem)
             throws LoadException
Loads the state of this product from the specified memento.
Parameters:
mem - the memento containing the current state of the product
Throws:
LoadException - an error occurred loading data
Overrides:
load in class BaseEntity

removeAnnotation

public void removeAnnotation(Identifier id,
                             AnnotationReference ann)
                      throws PersistenceException
Removes the specified annotation from the list of annotations describing this product. It in turn notifies the annotation to remove this product from its list of associated products.
Specified by:
removeAnnotation in interface Product
Parameters:
id - the client identifier for this transaction
ann - the annotation to be removed
Throws:
PersistenceException - an error occurred during the transaction

removeChild

public void removeChild(Identifier id,
                        Product prd)
                 throws PersistenceException,
                        java.rmi.RemoteException
Removes the specified child from the list of this product's children.
Specified by:
removeChild in interface Product
Parameters:
id - the client identifier for this transaction
prd - the product to be removed
Throws:
com.imaginary.lwp.PeersistenceException - an error occurred in the transaction
java.rmi.RemoteException - a network error occurred

removeParent

public void removeParent(Identifier id,
                         Product prd)
                  throws PersistenceException,
                         java.rmi.RemoteException
Sets the parent to null is the specified product is the current parent.
Specified by:
removeParent in interface Product
Parameters:
id - the client identifier for this transaction
prd - the product to be removed as parent
Throws:
PersistenceException - an error occurred during the transaction
java.rmi.RemoteException - a network error occurred

store

protected void store(Memento mem)
              throws StoreException
Stores the current state of this product into the specified memento for storage in a data store.
Parameters:
mem - the memento into which the state is stored
Throws:
StoreException - an error occurred storing the product's state in the memento
Overrides:
store in class BaseEntity