BEA Systems, Inc.

theory.smart.ebusiness.item
Class ItemImpl

java.lang.Object
  |
  +--theory.smart.foundation.EntityImpl
        |
        +--theory.smart.foundation.ConfigurableEntityImpl
              |
              +--theory.smart.ebusiness.item.ItemImpl
Direct Known Subclasses:
BasicBeanImpl

public class ItemImpl
extends ConfigurableEntityImpl

This represents a product or service that has a value. It is identified by a combination of the supplier, part number and, a version. Examples of a supplier are the manufacturer of a product, the publisher of a book, or the offerer of a course. This entity gets its price from the ItemPricingPolicy. Also, Items have a set of qualities, used to search and find items based on weighted qualities.

 Primary Key = theory.smart.ebusiness.item.ItemPk
 

See Also:
Item, ItemHome, ItemValue, Serialized Form

Field Summary
 java.lang.String description
           description [Item] <*>------> [String]
 java.lang.String identifier
           identifier [Item] <*>------> [String] (Primary Key)
 Price price
           price [Item] <*>------> [theory.smart.axiom.units.Price]
 com.sun.java.util.collections.LinkedList qualities
           quality (List) [Item] <*>------> [theory.smart.axiom.units.Quality] 0..*
 java.lang.String supplier
           supplier [Item] <*>------> [String] (Primary Key)
 java.lang.String version
           version [Item] <*>------> [String] (Primary Key)
 
Fields inherited from class theory.smart.foundation.EntityImpl
ctx, isDirty, isLoaded
 
Constructor Summary
ItemImpl()
           
 
Method Summary
 void addFirstQuality(Quality quality)
          Inserts the given quality at the beginning of the quality list.
 void addLastQuality(Quality quality)
          Appends the given quality to the end of the quality list.
 boolean addQualities(int index, com.sun.java.util.collections.LinkedList qualities)
          Inserts all of the qualities in the specified collection into this list, starting at the specified position.
 boolean addQualities(com.sun.java.util.collections.LinkedList qualities)
          Appends all of the qualities in the specified collection to the end of the quality list, in the order that they are returned by the specified collection's iterator.
 void addQuality(int index, Quality quality)
          Inserts the specified quality at the specified position in the quality list.
 boolean addQuality(Quality quality)
          Appends the specified quality to the end of the quality list.
 Price calculatePrice(ItemPriceCalculationPolicy policy, Quantity qty, Customer customer)
          Calculate the price of the item using the specified ItemPriceCalculationPolicy
 Price calculatePrice(Quantity qty, Customer customer)
          Calculate the price of the item using the ItemPriceCalculationPolicy.
 boolean containsQuality(Quality quality)
          Returns true if the quality list contains the specified element.
 void ejbActivate()
          ejbActivate method.
 ItemPk ejbCreate(ItemPk itemPk)
           
 java.util.Enumeration ejbFindAll()
           
 ItemPk ejbFindByPrimaryKey(ItemPk pk)
           
 void ejbLoad()
          ejbLoad method.
 void ejbPassivate()
          ejbPassivate method.
 void ejbPostCreate(ItemPk itemPk)
           
 void ejbRemove()
          ejbRemove method.
 void ejbStore()
          ejbStore method.
 ItemPriceCalculationPolicy getDefaultItemPriceCalculationPolicy()
           
 java.lang.String getDescription()
          Get the value of description
 Quality getFirstQuality()
          Returns the first quality in the quality list.
 java.lang.String getIdentifier()
           
 ItemValue getItemByValue()
          Get all of Item's attributes.
 Quality getLastQuality()
          Returns the last quality in the quality list.
 int getNumberOfQualities()
          Returns the number of qualities in the quality list.
 Price getPrice()
          Get the value of price
 com.sun.java.util.collections.LinkedList getQualities()
          Returns all of the qualities in the quality list.
 com.sun.java.util.collections.LinkedList getQualities(int fromIndex, int toIndex)
          Returns a view of the portion of the quality list between fromIndex, inclusive, and toIndex, exclusive.
 Quality getQuality(int index)
          Returns the quality at the specified position in the quality list.
 java.lang.String getSupplier()
           
 java.lang.String getVersion()
           
 int indexOfQuality(Quality quality)
          Returns the index in the quality list of the first occurrence of the specified element, or -1 if the quality list does not contain this element.
 boolean isQualitiesEmtpy()
          Returns true if the quality list contains no qualities.
 int lastIndexOfQuality(Quality quality)
          Returns the index in the quality list of the last occurrence of the specified element, or -1 if the quality list does not contain this element.
 void removeAllQualities()
          Removes all of the qualities from the quality list.
 Quality removeFirstQuality()
          Removes and returns the first quality from the quality list.
 Quality removeLastQuality()
          Removes and returns the last quality from the quality list.
 Quality removeQuality(int index)
          Removes the quality at the specified position in the quality list.
 boolean removeQuality(Quality quality)
          Removes the first occurrence of the specified quality in the quality list.
 void setDefaultItemPriceCalculationPolicy(ItemPriceCalculationPolicy policy)
          Set a default price calculation policy for a particular item instance.
 void setDescription(java.lang.String description)
          Set the value of description
 void setEntityContext(javax.ejb.EntityContext ctx)
          setEntityContext method.
 void setItemByValue(ItemValue value)
          Set all of Item's attributes to the passed in value.
 void setPrice(Price price)
          Set the value of price
 Quality setQuality(int index, Quality quality)
          Replaces the quality at the specified position in the quality list with the specified element.
 void unsetEntityContext()
          unsetEntityContext method.
 
Methods inherited from class theory.smart.foundation.ConfigurableEntityImpl
addBusinessPolicy, addProperty, ejbCreate, ejbPostCreate, getBusinessPolicy, getProperty, removeBusinessPolicy, removeProperty, setSuccessorAtClassLevel, setSuccessorAtInstanceLevel
 
Methods inherited from class theory.smart.foundation.EntityImpl
getEntityContext, isModified
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public java.lang.String version
                  version
 [Item] <*>------> [String] (Primary Key)

 

identifier

public java.lang.String identifier
                  identifier
 [Item] <*>------> [String] (Primary Key)

 

supplier

public java.lang.String supplier
                  supplier
 [Item] <*>------> [String] (Primary Key)

 

description

public java.lang.String description
                  description
 [Item] <*>------> [String] 

 

price

public Price price
                  price
 [Item] <*>------> [theory.smart.axiom.units.Price] 

 

qualities

public com.sun.java.util.collections.LinkedList qualities
                  quality (List)
 [Item] <*>------> [theory.smart.axiom.units.Quality] 
                     0..*
 
Constructor Detail

ItemImpl

public ItemImpl()
         throws javax.ejb.CreateException
Method Detail

getItemByValue

public ItemValue getItemByValue()
                         throws java.rmi.RemoteException
Get all of Item's attributes.
Returns:
ItemValue the Item value object

setItemByValue

public void setItemByValue(ItemValue value)
                    throws java.rmi.RemoteException
Set all of Item's attributes to the passed in value. Note: Primary key attributes are not set.
Parameters:
ItemValue - the Item value object

ejbCreate

public ItemPk ejbCreate(ItemPk itemPk)
                 throws javax.ejb.CreateException,
                        java.rmi.RemoteException

ejbPostCreate

public void ejbPostCreate(ItemPk itemPk)
                   throws javax.ejb.CreateException,
                          java.rmi.RemoteException

ejbLoad

public void ejbLoad()
             throws java.rmi.RemoteException
Description copied from class: EntityImpl
ejbLoad method.
Overrides:
ejbLoad in class ConfigurableEntityImpl

ejbStore

public void ejbStore()
              throws java.rmi.RemoteException
Description copied from class: EntityImpl
ejbStore method.
Overrides:
ejbStore in class ConfigurableEntityImpl

ejbRemove

public void ejbRemove()
               throws java.rmi.RemoteException,
                      javax.ejb.RemoveException
Description copied from class: EntityImpl
ejbRemove method.
Overrides:
ejbRemove in class ConfigurableEntityImpl

ejbActivate

public void ejbActivate()
                 throws java.rmi.RemoteException
Description copied from class: EntityImpl
ejbActivate method.
Overrides:
ejbActivate in class ConfigurableEntityImpl

ejbPassivate

public void ejbPassivate()
                  throws java.rmi.RemoteException
Description copied from class: EntityImpl
ejbPassivate method.
Overrides:
ejbPassivate in class ConfigurableEntityImpl

setEntityContext

public void setEntityContext(javax.ejb.EntityContext ctx)
                      throws java.rmi.RemoteException
Description copied from class: EntityImpl
setEntityContext method.
Overrides:
setEntityContext in class EntityImpl

unsetEntityContext

public void unsetEntityContext()
                        throws java.rmi.RemoteException
Description copied from class: EntityImpl
unsetEntityContext method.
Overrides:
unsetEntityContext in class EntityImpl

ejbFindByPrimaryKey

public ItemPk ejbFindByPrimaryKey(ItemPk pk)
                           throws javax.ejb.FinderException,
                                  java.rmi.RemoteException

ejbFindAll

public java.util.Enumeration ejbFindAll()
                                 throws javax.ejb.FinderException,
                                        java.rmi.RemoteException

getDescription

public java.lang.String getDescription()
                                throws java.rmi.RemoteException
Get the value of description
Returns:
description.

setDescription

public void setDescription(java.lang.String description)
                    throws java.rmi.RemoteException
Set the value of description
Parameters:
description - description to be added

getSupplier

public java.lang.String getSupplier()
                             throws java.rmi.RemoteException

getIdentifier

public java.lang.String getIdentifier()
                               throws java.rmi.RemoteException

getVersion

public java.lang.String getVersion()
                            throws java.rmi.RemoteException

getPrice

public Price getPrice()
               throws java.rmi.RemoteException
Get the value of price
Returns:
price.

setPrice

public void setPrice(Price price)
              throws java.rmi.RemoteException
Set the value of price
Parameters:
price - price to be added

addQuality

public void addQuality(int index,
                       Quality quality)
Inserts the specified quality at the specified position in the quality list. Shifts the quality currently at that position (if any) and any subsequent qualities to the right (adds one to their indices).
Parameters:
index - index at which the specified quality is to be inserted.
quality - quality to be inserted.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index > size()).

addQuality

public boolean addQuality(Quality quality)
Appends the specified quality to the end of the quality list.
Parameters:
quality - quality to be appended to the quality list.
Returns:
true (as per the general contract of Collection.add).

addQualities

public boolean addQualities(int index,
                            com.sun.java.util.collections.LinkedList qualities)
Inserts all of the qualities in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent qualities to the right (increases their indices). The new qualities will appear in the quality list in the order that they are returned by the specified collection's iterator.
Parameters:
index - index at which to insert first element from the specified collection.
qualities - qualities to be inserted into the quality list.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index > size()).

addQualities

public boolean addQualities(com.sun.java.util.collections.LinkedList qualities)
Appends all of the qualities in the specified collection to the end of the quality list, in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is the quality list, and the quality list is nonempty.)
Parameters:
qualities - qualities to be inserted into the quality list.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index > size()).

addFirstQuality

public void addFirstQuality(Quality quality)
Inserts the given quality at the beginning of the quality list.

addLastQuality

public void addLastQuality(Quality quality)
Appends the given quality to the end of the quality list. (Identical in function to the add method; included only for consistency.)

containsQuality

public boolean containsQuality(Quality quality)
Returns true if the quality list contains the specified element. More formally, returns true if and only if the quality list contains at least one quality e such that (o==null ? e==null : o.equals(e)).
Parameters:
quality - quality whose presence in the quality list is to be tested.
Returns:
true if the quality list contains the specified element.

getQuality

public Quality getQuality(int index)
Returns the quality at the specified position in the quality list.
Parameters:
index - index of quality to return.
Returns:
the quality at the specified position in the quality list.
Throws:
IndexOutOfBoundsException - if the specified index is is out of range (index < 0 || index >= size()).

getQualities

public com.sun.java.util.collections.LinkedList getQualities(int fromIndex,
                                                             int toIndex)
Returns a view of the portion of the quality list between fromIndex, inclusive, and toIndex, exclusive.
Parameters:
fromIndex - low endpoint (inclusive) of the subList.
toKey - high endpoint (exclusive) of the subList.
Returns:
a view of the specified range within the quality list.
Throws:
IndexOutOfBoundsException - endpoint index value out of range (fromIndex < 0 || toIndex > size)
java.lang.IllegalArgumentException - endpoint indices out of order (fromIndex > toIndex)

getQualities

public com.sun.java.util.collections.LinkedList getQualities()
Returns all of the qualities in the quality list.
Returns:
all of the qualities in the quality list.

getFirstQuality

public Quality getFirstQuality()
Returns the first quality in the quality list.
Returns:
the first quality in the quality list.

getLastQuality

public Quality getLastQuality()
Returns the last quality in the quality list.
Returns:
the last quality in the quality list.
Throws:
java.util.NoSuchElementException - if the quality list is empty.

getNumberOfQualities

public int getNumberOfQualities()
Returns the number of qualities in the quality list.
Returns:
the number of qualities in the quality list.

indexOfQuality

public int indexOfQuality(Quality quality)
Returns the index in the quality list of the first occurrence of the specified element, or -1 if the quality list does not contain this element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Parameters:
quality - quality to search for.
Returns:
the index in the quality list of the first occurrence of the specified element, or -1 if the quality list does not contain this element.

isQualitiesEmtpy

public boolean isQualitiesEmtpy()
Returns true if the quality list contains no qualities.

Returns:
true if the quality list contains no qualities.

lastIndexOfQuality

public int lastIndexOfQuality(Quality quality)
Returns the index in the quality list of the last occurrence of the specified element, or -1 if the quality list does not contain this element. More formally, returns the highest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Parameters:
quality - quality to search for.
Returns:
the index in the quality list of the last occurrence of the specified element, or -1 if the quality list does not contain this element.

removeAllQualities

public void removeAllQualities()
Removes all of the qualities from the quality list.

removeQuality

public Quality removeQuality(int index)
Removes the quality at the specified position in the quality list. Shifts any subsequent qualities to the left (subtracts one from their indices). Returns the quality that was removed from the quality list.
Parameters:
index - the index of the quality to removed.
Returns:
the quality previously at the specified position.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index >= size()).

removeQuality

public boolean removeQuality(Quality quality)
Removes the first occurrence of the specified quality in the quality list. If the quality list does not contain the element, it is unchanged. More formally, removes the quality with the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) (if such an quality exists).
Parameters:
quality - quality to be removed from the quality list, if present.
Returns:
true if the quality list contained the specified element.

removeFirstQuality

public Quality removeFirstQuality()
Removes and returns the first quality from the quality list.
Returns:
the first quality from the quality list.
Throws:
java.util.NoSuchElementException - if the quality list is empty.

removeLastQuality

public Quality removeLastQuality()
Removes and returns the last quality from the quality list.
Returns:
the last quality from the quality list.
Throws:
java.util.NoSuchElementException - if the quality list is empty.

setQuality

public Quality setQuality(int index,
                          Quality quality)
Replaces the quality at the specified position in the quality list with the specified element.
Parameters:
index - index of quality to replace.
quality - quality to be stored at the specified position.
Returns:
the quality previously at the specified position.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index >= size()).

calculatePrice

public Price calculatePrice(Quantity qty,
                            Customer customer)
                     throws java.rmi.RemoteException
Calculate the price of the item using the ItemPriceCalculationPolicy. The default implementation is to return the internally stored price.

calculatePrice

public Price calculatePrice(ItemPriceCalculationPolicy policy,
                            Quantity qty,
                            Customer customer)
                     throws java.rmi.RemoteException
Calculate the price of the item using the specified ItemPriceCalculationPolicy

setDefaultItemPriceCalculationPolicy

public void setDefaultItemPriceCalculationPolicy(ItemPriceCalculationPolicy policy)
                                          throws java.rmi.RemoteException
Set a default price calculation policy for a particular item instance.

getDefaultItemPriceCalculationPolicy

public ItemPriceCalculationPolicy getDefaultItemPriceCalculationPolicy()
                                                                throws java.rmi.RemoteException

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved