com.ibm.websphere.samples.plantsbywebsphereejb
Class CatalogBean

java.lang.Object
  extended by com.ibm.websphere.samples.plantsbywebsphereejb.CatalogBean
All Implemented Interfaces:
java.io.Serializable, javax.ejb.EnterpriseBean, javax.ejb.SessionBean

public class CatalogBean
extends java.lang.Object
implements javax.ejb.SessionBean

CatalogBean is the implementation class for the Catalog stateless session EJB. CatalogBean implements each of the business methods in the Catalog EJB remote interface and each of the EJB lifecycle methods in the javax.ejb.SessionBean interface.

See Also:
Catalog, CatalogHome, Serialized Form

Constructor Summary
CatalogBean()
           
 
Method Summary
 boolean addItem(StoreItem item)
          Add an inventory item.
 boolean deleteItem(java.lang.String inventoryID)
          Delete an inventory item.
 void ejbActivate()
          ejbActivate Session EJB lifecycle callback method.
 void ejbCreate()
          ejbCreate Session EJB lifecycle callback method.
 void ejbPassivate()
          ejbPassivate Session EJB lifecycle callback method.
 void ejbRemove()
          ejbRemove Session EJB lifecycle callback method.
 StoreItem getItem(java.lang.String inventoryID)
          Get the Inventory item for the given ID.
 byte[] getItemImageBytes(java.lang.String inventoryID)
          Get the image for the inventory item.
 java.util.Vector getItems()
          Get all inventory items.
 java.util.Vector getItemsByCategory(int category)
          Get all inventory items for the given category.
 java.util.Vector getItemsLikeName(java.lang.String name)
          Get inventory items that contain a given String within their names.
 void setItemCategory(java.lang.String inventoryID, int category)
          Set the inventory item's category.
 void setItemCost(java.lang.String inventoryID, float cost)
          Set the inventory item's cost.
 void setItemDescription(java.lang.String inventoryID, java.lang.String desc)
          Set the inventory item's description.
 void setItemHeading(java.lang.String inventoryID, java.lang.String heading)
          Set the inventory item's heading.
 void setItemImageBytes(java.lang.String inventoryID, byte[] imgbytes)
          Set the image for the inventory item.
 void setItemImageFileName(java.lang.String inventoryID, java.lang.String imageName)
          Set the inventory item's image file name.
 void setItemName(java.lang.String inventoryID, java.lang.String name)
          Set the inventory item's name.
 void setItemNotes(java.lang.String inventoryID, java.lang.String notes)
          Set the inventory item's notes.
 void setItemPkginfo(java.lang.String inventoryID, java.lang.String pkginfo)
          Set the inventory item's package information.
 void setItemPrice(java.lang.String inventoryID, float price)
          Set the inventory item's price.
 void setItemPrivacy(java.lang.String inventoryID, boolean isPublic)
          Set the inventory item's access availability.
 void setItemQuantity(java.lang.String inventoryID, int quantity)
          Set the inventory item's quantity.
 void setSessionContext(javax.ejb.SessionContext ctx)
          setSessionContext Session EJB lifecycle callback method to set the EJB sessionContext for this EJB.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CatalogBean

public CatalogBean()
Method Detail

getItems

public java.util.Vector getItems()
Get all inventory items.

Returns:
Vector of StoreItems.

getItemsByCategory

public java.util.Vector getItemsByCategory(int category)
Get all inventory items for the given category.

Parameters:
category - of items desired.
Returns:
Vector of StoreItems.

getItemsLikeName

public java.util.Vector getItemsLikeName(java.lang.String name)
Get inventory items that contain a given String within their names.

Parameters:
name - String to search names for.
Returns:
A Vector of StoreItems that match.

getItem

public StoreItem getItem(java.lang.String inventoryID)
Get the Inventory item for the given ID.

Parameters:
inventoryID - - ID of the Inventory item desired.
Returns:
StoreItem

addItem

public boolean addItem(StoreItem item)
Add an inventory item.

Parameters:
item - The StoreItem to add.
Returns:
True, if item added.

deleteItem

public boolean deleteItem(java.lang.String inventoryID)
Delete an inventory item.

Parameters:
inventoryID - The ID of the inventory item to delete.
Returns:
True, if item deleted.

setItemName

public void setItemName(java.lang.String inventoryID,
                        java.lang.String name)
Set the inventory item's name.

Parameters:
inventoryID - The inventory item's ID.
name - The inventory item's new name.

setItemHeading

public void setItemHeading(java.lang.String inventoryID,
                           java.lang.String heading)
Set the inventory item's heading.

Parameters:
inventoryID - The inventory item's ID.
heading - The inventory item's new heading.

setItemDescription

public void setItemDescription(java.lang.String inventoryID,
                               java.lang.String desc)
Set the inventory item's description.

Parameters:
inventoryID - The inventory item's ID.
desc - The inventory item's new description.

setItemPkginfo

public void setItemPkginfo(java.lang.String inventoryID,
                           java.lang.String pkginfo)
Set the inventory item's package information.

Parameters:
inventoryID - The inventory item's ID.
pkginfo - The inventory item's new package information.

setItemCategory

public void setItemCategory(java.lang.String inventoryID,
                            int category)
Set the inventory item's category.

Parameters:
inventoryID - The inventory item's ID.
category - The inventory item's new category.

setItemImageFileName

public void setItemImageFileName(java.lang.String inventoryID,
                                 java.lang.String imageName)
Set the inventory item's image file name.

Parameters:
inventoryID - The inventory item's ID.
imageName - The inventory item's new image file name.

getItemImageBytes

public byte[] getItemImageBytes(java.lang.String inventoryID)
Get the image for the inventory item.

Parameters:
inventoryID - The id of the inventory item wanted.
Returns:
Buffer containing the image.

setItemImageBytes

public void setItemImageBytes(java.lang.String inventoryID,
                              byte[] imgbytes)
Set the image for the inventory item.

Parameters:
inventoryID - The id of the inventory item wanted.
imgbytes - Buffer containing the image.

setItemPrice

public void setItemPrice(java.lang.String inventoryID,
                         float price)
Set the inventory item's price.

Parameters:
inventoryID - The inventory item's ID.
price - The inventory item's new price.

setItemCost

public void setItemCost(java.lang.String inventoryID,
                        float cost)
Set the inventory item's cost.

Parameters:
inventoryID - The inventory item's ID.
cost - The inventory item's new cost.

setItemQuantity

public void setItemQuantity(java.lang.String inventoryID,
                            int quantity)
Set the inventory item's quantity.

Parameters:
inventoryID - The inventory item's ID.
quantity - The inventory item's new quantity.

setItemNotes

public void setItemNotes(java.lang.String inventoryID,
                         java.lang.String notes)
Set the inventory item's notes.

Parameters:
inventoryID - The inventory item's ID.
notes - The inventory item's new notes.

setItemPrivacy

public void setItemPrivacy(java.lang.String inventoryID,
                           boolean isPublic)
Set the inventory item's access availability.

Parameters:
inventoryID - The inventory item's ID.
isPublic - True, if this item can be viewed by the public.

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
ejbCreate Session EJB lifecycle callback method. This method is empty for Stateless EJB. This method corresponds to the create method in the home interface.

Throws:
javax.ejb.CreateException

ejbRemove

public void ejbRemove()
ejbRemove Session EJB lifecycle callback method. This method is empty for Stateless EJB. Called just before the end of life for this object.

Specified by:
ejbRemove in interface javax.ejb.SessionBean

ejbActivate

public void ejbActivate()
ejbActivate Session EJB lifecycle callback method. This method is empty for Stateless EJB.

Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbPassivate

public void ejbPassivate()
ejbPassivate Session EJB lifecycle callback method. This method is empty for Stateless EJB. Called when the instance is passivated from its "active" state, and releases.

Specified by:
ejbPassivate in interface javax.ejb.SessionBean

setSessionContext

public void setSessionContext(javax.ejb.SessionContext ctx)
setSessionContext Session EJB lifecycle callback method to set the EJB sessionContext for this EJB.

Specified by:
setSessionContext in interface javax.ejb.SessionBean
Parameters:
ctx - javax.ejb.SessionContext The context for this session EJB.