catalog.model.service.impl
Class CatalogServiceImpl

java.lang.Object
  extended bycatalog.model.service.impl.CatalogServiceImpl
All Implemented Interfaces:
CatalogService

public class CatalogServiceImpl
extends java.lang.Object
implements CatalogService

The implementation of the CatalogService.

Spring Framework is used to manage this service bean. Since this class is not dependend on Spring API, it can be used outside the Spring IOC container.

It is not used in the sample application. The CachedCatalogServiceImpl is used instead. The purpose of this class is to show you by using Spring Framework, you can use different implementations of the same interface without code changing and factory.

Author:
Derek Y. Shen
See Also:
CatalogService, CachedCatalogServiceImpl

Constructor Summary
CatalogServiceImpl()
           
 
Method Summary
 void deleteProduct(Product product)
          Delete product.
 java.util.List getAllCategories()
          Get all categories.
 java.util.List getAllProducts()
          Get all products.
 Category getCategory(java.lang.String id)
          Get category by id.
 Product getProduct(java.lang.String id)
          Get product by product id.
 Product saveProduct(Product product)
          Save the product.
 void setCatalogDao(CatalogDao newCatalogDao)
          Set the CatalogDao.
 void updateProduct(Product product)
          Update product.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CatalogServiceImpl

public CatalogServiceImpl()
Method Detail

setCatalogDao

public void setCatalogDao(CatalogDao newCatalogDao)
Set the CatalogDao.

It can be used by the Spring IOC container.

Parameters:
newCatalogDao - the CatalogDao to be set

saveProduct

public Product saveProduct(Product product)
                    throws CatalogException
Description copied from interface: CatalogService
Save the product.

Specified by:
saveProduct in interface CatalogService
Parameters:
product - the product to be saved
Returns:
the product saved
Throws:
CatalogException
See Also:
CatalogService.saveProduct(Product)

updateProduct

public void updateProduct(Product product)
                   throws CatalogException
Description copied from interface: CatalogService
Update product.

Specified by:
updateProduct in interface CatalogService
Parameters:
product - the product to be updated
Throws:
CatalogException
See Also:
CatalogService.updateProduct(Product)

deleteProduct

public void deleteProduct(Product product)
                   throws CatalogException
Description copied from interface: CatalogService
Delete product.

Specified by:
deleteProduct in interface CatalogService
Parameters:
product - the product to be deleted
Throws:
CatalogException
See Also:
CatalogService.deleteProduct(Product)

getProduct

public Product getProduct(java.lang.String id)
                   throws CatalogException
Description copied from interface: CatalogService
Get product by product id.

Specified by:
getProduct in interface CatalogService
Parameters:
id - the product id
Returns:
the product associated with the product id
Throws:
CatalogException
See Also:
CatalogService.getProduct(String)

getCategory

public Category getCategory(java.lang.String id)
                     throws CatalogException
Description copied from interface: CatalogService
Get category by id.

Specified by:
getCategory in interface CatalogService
Parameters:
id - the category id
Returns:
the category associated with the category id
Throws:
CatalogException
See Also:
CatalogService.getCategory(String)

getAllProducts

public java.util.List getAllProducts()
                              throws CatalogException
Description copied from interface: CatalogService
Get all products.

Specified by:
getAllProducts in interface CatalogService
Returns:
a list with all products
Throws:
CatalogException
See Also:
CatalogService.getAllProducts()

getAllCategories

public java.util.List getAllCategories()
                                throws CatalogException
Description copied from interface: CatalogService
Get all categories.

Specified by:
getAllCategories in interface CatalogService
Returns:
a list with all categories
Throws:
CatalogException
See Also:
CatalogService.getAllCategories()


Copyright (c) 2004 The JCatalog Project.