⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webstorepojo.java

📁 基于Struts的网络商店源码。使用Hibernate技术
💻 JAVA
字号:
package com.sush.webstore.store.domain.facade;

import java.util.List;
import java.util.Set;

import com.sush.webstore.store.data.dao.*;
import com.sush.webstore.store.data.dao.hibernate.*;
import com.sush.webstore.store.domain.*;
import com.sush.webstore.store.domain.beans.Address;
import com.sush.webstore.store.domain.beans.Cart;
import com.sush.webstore.store.domain.beans.Catalog;
import com.sush.webstore.store.domain.beans.Category;
import com.sush.webstore.store.domain.beans.CreditCard;
import com.sush.webstore.store.domain.beans.Image;
import com.sush.webstore.store.domain.beans.Item;
import com.sush.webstore.store.domain.beans.Order;
import com.sush.webstore.store.domain.beans.Product;
import com.sush.webstore.store.domain.beans.UserAccount;

public class WebStorePOJO implements IWebStoreFacade {

	private IUserAccountDAO accountDAO;

	private ICatalogDAO catalogDAO;

	private ICategoryDAO categoryDAO;

	private IItemDAO itemDAO;

	private IOrderDAO orderDAO;

	private IProductDAO productDAO;

	public WebStorePOJO() {
		init();
	}

	/*
	 * @param catalog @return
	 */
	public boolean addCatalog(ICatalog catalog) {

		return catalogDAO.addCatalog(catalog);
	}

	/*
	 * @param catalog @return
	 */
	public boolean addCategory(ICatalog catalog, ICategory category) {

		return catalogDAO.addCategory(catalog, category);
	}

	/*
	 * @param product @param item @return
	 */
	public boolean addItem(IProduct product, IItem item) {

		return productDAO.addItem(product, item);
	}

	/*
	 * @param order @return
	 */
	public boolean addOrder(IOrder order) {

		return orderDAO.addOrder(order);
	}

	/*
	 * @param category @param product @return
	 */
	public boolean addProduct(ICategory category, IProduct product) {

		return categoryDAO.addProduct(category, product);
	}

	/*
	 * @param category @param subCategory @return
	 */
	public boolean addSubCategory(ICategory category, ICategory subCategory) {

		return categoryDAO.addSubCategory(category, subCategory);
	}

	/*
	 * @param account @return
	 */
	public boolean addUserAccount(IUserAccount account) {

		return accountDAO.addUserAccount(account);
	}

	/*
	 * @return
	 */
	public IAddress createAddress() {

		return new Address();
	}

	/*
	 * @return
	 */
	public ICart createCart() {

		return new Cart();
	}

	/*
	 * @return
	 */
	public ICatalog createCatalog() {

		return new Catalog();
	}

	/*
	 * @return
	 */
	public ICategory createCategory() {

		return new Category();
	}

	/*
	 * @return
	 */
	public ICreditCard createCreditCard() {

		return new CreditCard();
	}

	/*
	 * @return
	 */
	public IImage createImage() {

		return new Image();
	}

	/*
	 * @return
	 */
	public IItem createItem() {

		return new Item();
	}

	/*
	 * @return
	 */
	public IOrder createOrder() {

		return new Order();
	}

	/*
	 * @return
	 */
	public IProduct createProduct() {

		return new Product();
	}
	
	/*
	 * @return
	 */
	public IUserAccount createUserAccount() {

		return new UserAccount();
	}

	/**
	 * @return the accountDAO
	 */
	public IUserAccountDAO getAccountDAO() {
		return accountDAO;
	}

	/*
	 * @param id @return
	 */
	public ICatalog getCatalog(long id) {

		return catalogDAO.getCatalog(id);
	}

	/**
	 * @return the catalogDAO
	 */
	public ICatalogDAO getCatalogDAO() {
		return catalogDAO;
	}

	/*
	 * @return
	 */
	public List<ICatalog> getCatalogs() {

		return catalogDAO.getCatalogs();
	}

	/*
	 * @param catalog @return
	 */
	public Set<ICategory> getCategories(ICatalog catalog) {

		return catalogDAO.getCategories(catalog);
	}

	/*
	 * @param id @return
	 */
	public ICategory getCategory(long id) {

		return categoryDAO.getCategory(id);
	}

	/**
	 * @return the categoryDAO
	 */
	public ICategoryDAO getCategoryDAO() {
		return categoryDAO;
	}

	/*
	 * @param id @return
	 */
	public IItem getItem(long id) {

		return itemDAO.getItem(id);
	}

	/**
	 * @return the itemDAO
	 */
	public IItemDAO getItemDAO() {
		return itemDAO;
	}

	/*
	 * @param product @return
	 */
	public Set<IItem> getItems(IProduct product) {

		return productDAO.getItems(product);
	}

	public Integer getItemsCount(IProduct product) {
		
		return productDAO.getItemsCount(product);
	}

	/*
	 * @param id @return
	 */
	public IOrder getOrder(long id) {

		return orderDAO.getOrder(id);
	}

	/**
	 * @return the orderDAO
	 */
	public IOrderDAO getOrderDAO() {
		return orderDAO;
	}

	/*
	 * @param userName @return
	 */
	public Set<IOrder> getOrders(String userName) {

		return orderDAO.getOrders(userName);
	}

	/*
	 * @param id @return
	 */
	public IProduct getProduct(long id) {

		return productDAO.getProduct(id);
	}

	/**
	 * @return the productDAO
	 */
	public IProductDAO getProductDAO() {
		return productDAO;
	}

	/*
	 * @param category @return
	 */
	public Set<IProduct> getProducts(ICategory category) {

		return categoryDAO.getProducts(category);
	}

	/*
	 * @param category @return
	 */
	public Set<ICategory> getSubCategories(ICategory category) {

		return categoryDAO.getSubCategories(category);
	}

	/*
	 * @param id @return
	 */
	public IUserAccount getUserAccount(long id) {

		return accountDAO.getUserAccount(id);
	}

	/*
	 * @param userName @return
	 */
	public IUserAccount getUserAccount(String userName) {

		return accountDAO.getUserAccount(userName);
	}

	/*
	 * @param userName @param pwd @return
	 */
	public IUserAccount getUserAccount(String userName, String pwd) {

		return accountDAO.getUserAccount(userName, pwd);
	}

	/*
	 * @param product @return
	 */
	public boolean hasDisplayableItem(IProduct product) {

		return productDAO.hasDisplayableItem(product);
	}

	/*
	 * @param category @return
	 */
	public boolean hasProducts(ICategory category) {

		return categoryDAO.hasProducts(category);
	}

	/*
	 * @param category @return
	 */
	public boolean hasSubCategories(ICategory category) {

		return categoryDAO.hasSubCategories(category);
	}

	private void init() {

		accountDAO = new UserAccountDAO();
		catalogDAO = new CatalogDAO();
		categoryDAO = new CategoryDAO();
		itemDAO = new ItemDAO();
		orderDAO = new OrderDAO();
		productDAO = new ProductDAO();
	}

	/*
	 * @param catalog @return
	 */
	public boolean removeCatalog(ICatalog catalog) {

		return catalogDAO.removeCatalog(catalog);
	}

	/*
	 * @param catalog @return
	 */
	public boolean removeCategory(ICatalog catalog, ICategory category) {

		return catalogDAO.removeCategory(catalog, category);
	}

	/*
	 * @param product @return
	 */
	public boolean removeItem(IProduct product, IItem item) {

		return productDAO.removeItem(product, item);
	}

	/*
	 * @param category @return
	 */
	public boolean removeProduct(ICategory category, IProduct product) {

		return categoryDAO.removeProduct(category, product);
	}

	/*
	 * @param account @return
	 */
	public boolean removeUserAccount(IUserAccount account) {

		return accountDAO.removeUserAccount(account);
	}

	/**
	 * @param accountDAO
	 *            the accountDAO to set
	 */
	public void setAccountDAO(IUserAccountDAO accountDAO) {
		this.accountDAO = accountDAO;
	}

	/**
	 * @param catalogDAO
	 *            the catalogDAO to set
	 */
	public void setCatalogDAO(ICatalogDAO catalogDAO) {
		this.catalogDAO = catalogDAO;
	}

	/**
	 * @param categoryDAO
	 *            the categoryDAO to set
	 */
	public void setCategoryDAO(ICategoryDAO categoryDAO) {
		this.categoryDAO = categoryDAO;
	}

	/**
	 * @param itemDAO
	 *            the itemDAO to set
	 */
	public void setItemDAO(IItemDAO itemDAO) {
		this.itemDAO = itemDAO;
	}

	/**
	 * @param orderDAO
	 *            the orderDAO to set
	 */
	public void setOrderDAO(IOrderDAO orderDAO) {
		this.orderDAO = orderDAO;
	}

	/**
	 * @param productDAO
	 *            the productDAO to set
	 */
	public void setProductDAO(IProductDAO productDAO) {
		this.productDAO = productDAO;
	}

	/*
	 * @param catalog @return
	 */
	public boolean updateCatalog(ICatalog catalog) {

		return catalogDAO.updateCatalog(catalog);
	}

	/*
	 * @param category @return
	 */
	public boolean updateCategory(ICategory category) {

		return categoryDAO.updateCategory(category);
	}

	/*
	 * @param product @return
	 */
	public boolean updateItem(IItem item) {

		return itemDAO.updateItem(item);
	}

	/*
	 * @param product @return
	 */
	public boolean updateProduct(IProduct product) {

		return productDAO.updateProduct(product);
	}

	/*
	 * @param account @return
	 */
	public boolean updateUserAccount(IUserAccount account) {

		return accountDAO.updateUserAccount(account);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -