FileDocCategorySizeDatePackage
CategoryAction.javaAPI DocJBoss 4.2.12069Fri Jul 13 20:55:42 BST 2007xpetstore.web.webwork.action.category

CategoryAction

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

Fields Summary
private xpetstore.domain.Category
_category
private String
_categoryId
Constructors Summary
Methods Summary
protected java.lang.StringdoExecute()

see
webwork.action.ActionSupport#doExecute()


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

           
        
         
    
        Session s = getHibernateSession(  );

        try
        {
            _category = ( Category ) s.load( Category.class, _categoryId );

            /*
             * Since category.product is lazy loaded,
             * traverse the collection to load all the product to display
             */
            Iterator it = _category.getProducts(  ).iterator(  );

            while ( it.hasNext(  ) )
            {
                Product p = ( Product ) it.next(  );
                p.getName(  );
            }

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

return
Category

        return _category;
    
public java.lang.StringgetCategoryId()

return
String

        return _categoryId;
    
public voidsetCategory(xpetstore.domain.Category category)
Sets the category.

param
category The category to set

        _category = category;
    
public voidsetCategoryId(java.lang.String categoryId)
Sets the categoryId.

param
categoryId The categoryId to set

        _categoryId = categoryId;