FileDocCategorySizeDatePackage
ProductAction.javaAPI DocJBoss 4.2.12025Fri Jul 13 20:55:40 BST 2007xpetstore.web.webwork.action.product

ProductAction

public class ProductAction extends xpetstore.web.webwork.action.BaseAction
author
Herve Tchepannou
webwork.action
name="product" success="product.vm"

Fields Summary
private xpetstore.domain.Product
_product
private String
_productId
Constructors Summary
Methods Summary
protected java.lang.StringdoExecute()

see
webwork.action.ActionSupport#doExecute()


    //~ Methods ----------------------------------------------------------------

           
        
         
    
        Session s = getHibernateSession(  );

        try
        {
            _product = ( Product ) s.load( Product.class, _productId );

            /*
             * Since product.item is lazy loaded,
             * traverse the collection to load all the product to display
             */
            Iterator it = _product.getItems(  ).iterator(  );

            while ( it.hasNext(  ) )
            {
                Item i = ( Item ) it.next(  );
                i.getDescription(  );
            }

            return SUCCESS;
        }
        finally
        {
            s.close(  );
        }
    
public xpetstore.domain.ProductgetProduct()

return
Product

        return _product;
    
public java.lang.StringgetProductId()

return
String

        return _productId;
    
public voidsetProduct(xpetstore.domain.Product product)
Sets the product.

param
product The product to set

        _product = product;
    
public voidsetProductId(java.lang.String productId)
Sets the productId.

param
productId The productId to set

        _productId = productId;