[pal-cvs 2663] [395]

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 7月 28日 (土) 03:42:00 JST


Revision: 395
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=395
Author:   takeharu
Date:     2007-07-28 03:42:00 +0900 (Sat, 28 Jul 2007)

Log Message:
-----------


Added Paths:
-----------
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/Cart.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListPage.java


-------------- next part --------------
Added: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/Cart.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/Cart.java	2007-07-27 18:40:26 UTC (rev 394)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/Cart.java	2007-07-27 18:42:00 UTC (rev 395)
@@ -0,0 +1,43 @@
+package jp.sf.pal.pompei.web.user.product;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import jp.sf.pal.pompei.exentity.ProductsDescription;
+
+/**
+ * カート情報を表すクラスです。
+ * @author takeharu
+ *
+ */
+public class Cart implements Serializable {
+
+	/**
+	 * シリアルバージョンID
+	 */
+	private static final long serialVersionUID = 1L;
+
+	private List<ProductsDescription> products;
+
+	/**
+	 * コンストラクタ
+	 */
+	public Cart() {
+		products = new ArrayList<ProductsDescription>();
+	}
+
+	public void addDescription(ProductsDescription description) {
+		products.add(description);
+	}
+
+	public List<ProductsDescription> getProducts() {
+		return products;
+	}
+
+	public void setProducts(List<ProductsDescription> products) {
+		this.products = products;
+	}
+
+}

Added: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java	2007-07-27 18:40:26 UTC (rev 394)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java	2007-07-27 18:42:00 UTC (rev 395)
@@ -0,0 +1,107 @@
+package jp.sf.pal.pompei.web.user.product;
+
+import java.util.Map;
+
+import jp.sf.pal.pompei.dxo.ProductDxo;
+import jp.sf.pal.pompei.exentity.Manufacturers;
+import jp.sf.pal.pompei.exentity.ProductsDescription;
+import jp.sf.pal.pompei.web.admin.product.service.ProductService;
+
+import org.seasar.framework.container.ExternalContext;
+import org.seasar.framework.log.Logger;
+
+public class ProductDetailsAction {
+
+	/**  */
+	private ProductDetailsPage productDetailsPage;
+	/**	 */
+	private ProductService productService;
+	/**	 */
+	private ProductDxo productDxo;
+
+	private ExternalContext externalContext;
+
+	private Logger logger = Logger.getLogger(ProductDetailsAction.class);
+
+	public Class initialize() {
+		return null;
+	}
+
+	public Class prerender() {
+		ProductsDescription description = productService.getProdcutsDescription(productDetailsPage.getProductsId());
+		productDxo.convert(description,productDetailsPage);
+
+		Manufacturers manufacturers = productService.getManufacturers(description.getProducts().getManufacturersId());
+		productDetailsPage.setManufacturersName(manufacturers.getManufacturersName());
+		return null;
+	}
+
+	/**
+	 * 商品をカートに追加します。
+	 * @return
+	 */
+	public Class doAddCart() {
+		Map map = externalContext.getSessionMap();
+
+		Cart cart = (Cart)map.get("cart");
+
+
+		if(cart==null) {
+			cart = new Cart();
+			externalContext.getSessionMap().put("cart", cart);
+		}
+
+		ProductsDescription description = productService.getProdcutsDescription(productDetailsPage.getProductsId());
+		cart.addDescription(description);
+		logger.debug("カートに追加しました");
+		return null;
+	}
+
+	/**
+	 * @return productDetailsPage
+	 */
+	public ProductDetailsPage getProductDetailsPage() {
+		return productDetailsPage;
+	}
+
+	/**
+	 * @param productDetailsPage 設定する productDetailsPage
+	 */
+	public void setProductDetailsPage(ProductDetailsPage productDetailsPage) {
+		this.productDetailsPage = productDetailsPage;
+	}
+
+	public ProductDxo getProductDxo() {
+		return productDxo;
+	}
+
+	public void setProductDxo(ProductDxo productDxo) {
+		this.productDxo = productDxo;
+	}
+
+	public ProductService getProductService() {
+		return productService;
+	}
+
+	public void setProductService(ProductService productService) {
+		this.productService = productService;
+	}
+
+	public ExternalContext getContext() {
+		return externalContext;
+	}
+
+	public void setContext(ExternalContext context) {
+		this.externalContext = context;
+	}
+
+	public Logger getLogger() {
+		return logger;
+	}
+
+	public void setLogger(Logger logger) {
+		this.logger = logger;
+	}
+
+
+}

Added: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java	2007-07-27 18:40:26 UTC (rev 394)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java	2007-07-27 18:42:00 UTC (rev 395)
@@ -0,0 +1,70 @@
+package jp.sf.pal.pompei.web.user.product;
+
+import java.math.BigDecimal;
+
+import org.seasar.teeda.extension.annotation.scope.SubapplicationScope;
+
+public class ProductDetailsPage {
+
+	private String manufacturersName;
+
+	@SubapplicationScope
+	private BigDecimal productsId;
+
+	private String productsModel;
+
+	private String productsName;
+
+	private String productsPrice;
+
+	private String title;
+
+	public String getManufacturersName() {
+		return manufacturersName;
+	}
+
+	public void setManufacturersName(String manufacturersName) {
+		this.manufacturersName = manufacturersName;
+	}
+
+	public BigDecimal getProductsId() {
+		return productsId;
+	}
+
+	public void setProductsId(BigDecimal productsId) {
+		this.productsId = productsId;
+	}
+
+	public String getProductsModel() {
+		return productsModel;
+	}
+
+	public void setProductsModel(String productsModel) {
+		this.productsModel = productsModel;
+	}
+
+	public String getProductsName() {
+		return productsName;
+	}
+
+	public void setProductsName(String productsName) {
+		this.productsName = productsName;
+	}
+
+	public String getProductsPrice() {
+		return productsPrice;
+	}
+
+	public void setProductsPrice(String productsPrice) {
+		this.productsPrice = productsPrice;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+}

Added: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java	2007-07-27 18:40:26 UTC (rev 394)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java	2007-07-27 18:42:00 UTC (rev 395)
@@ -0,0 +1,155 @@
+package jp.sf.pal.pompei.web.user.product;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import jp.sf.pal.pompei.dxo.CategoriesDxo;
+import jp.sf.pal.pompei.dxo.ProductDxo;
+import jp.sf.pal.pompei.exentity.CategoriesDescription;
+import jp.sf.pal.pompei.web.admin.product.service.CategoryService;
+import jp.sf.pal.pompei.web.admin.product.service.ProductService;
+
+public class ProductListAction {
+
+	/**
+	 *
+	 */
+	private ProductListPage productListPage;
+	/**	 */
+	private ProductService productService;
+	/**	 */
+	private ProductDxo productDxo;
+	/**	 */
+	private CategoryService categoryService;
+	/**	 */
+	private CategoriesDxo categoriesDxo;
+
+
+	public Class initialize() {
+		return null;
+	}
+
+	public Class prerender() {
+		if(productListPage.getParentId() == null) {
+			productListPage.setParentId(new BigDecimal("0"));
+		}
+
+		if(productListPage.getBreadcrumbItems() == null) {
+			productListPage.setCategoriesId(new BigDecimal("0"));
+
+			List<Map> list = new ArrayList<Map>();
+			Map<String, Object> m = new HashMap<String, Object>();
+			m.put("categoriesId",new BigDecimal("0"));
+			m.put("breadcrumb","TOP");
+			list.add(m);
+			productListPage.setBreadcrumbItems(list);
+
+		}else {
+			if(productListPage.getCategoriesId()!=null) {
+				productListPage.setParentId(productListPage.getCategoriesId());
+			}
+
+			//パンくずリストを再セット
+			List list = setBreadcrumb(productListPage.getBreadcrumbItems(),productListPage.getParentId());
+			productListPage.setBreadcrumbItems(list);
+		}
+
+		//カテゴリ一覧の取得
+		List cList = getCategoriesList();
+		productListPage.setCategoryItems(cList);
+
+		//商品一覧の取得
+		List list = productService.getProductsList(productListPage.getParentId());
+		List sList = new ArrayList();
+		productDxo.convert(list,sList);
+		productListPage.setProductItems(sList);
+
+		return null;
+	}
+
+	/**
+	 * パンくずリストを返します。
+	 * @param breadcrumbItems
+	 * @param id
+	 * @return
+	 */
+	private List<Map> setBreadcrumb(List<Map> breadcrumbItems, BigDecimal id) {
+		List<Map> list = new ArrayList<Map>();
+		for (Map m : breadcrumbItems) {
+			list.add(m);
+			if(((BigDecimal)m.get("categoriesId")).equals(id)) {
+				return list;
+			}
+		}
+		CategoriesDescription d = categoryService.getCategoriesDescription(productListPage.getCategoriesId());
+
+		Map m = new HashMap();
+		m.put("categoriesId", id);
+		m.put("breadcrumb", d.getCategoriesName());
+		list.add(m);
+		return list;
+	}
+
+	private List getCategoriesList() {
+		List list = categoryService.getSubCategoryList(productListPage.getParentId());
+		List cList = new ArrayList();
+		categoriesDxo.convert(list,cList);
+		return cList;
+	}
+
+	/**
+	 * @return productListPage
+	 */
+	public ProductListPage getProductListPage() {
+		return productListPage;
+	}
+
+	/**
+	 * @param productListPage 設定する productListPage
+	 */
+	public void setProductListPage(ProductListPage productListPage) {
+		this.productListPage = productListPage;
+	}
+
+	public CategoriesDxo getCategoriesDxo() {
+		return categoriesDxo;
+	}
+
+	public void setCategoriesDxo(CategoriesDxo categoriesDxo) {
+		this.categoriesDxo = categoriesDxo;
+	}
+
+	public CategoryService getCategoryService() {
+		return categoryService;
+	}
+
+	public void setCategoryService(CategoryService categoryService) {
+		this.categoryService = categoryService;
+	}
+
+	public ProductDxo getProductDxo() {
+		return productDxo;
+	}
+
+	public void setProductDxo(ProductDxo productDxo) {
+		this.productDxo = productDxo;
+	}
+
+	public ProductService getProductService() {
+		return productService;
+	}
+
+	public void setProductService(ProductService productService) {
+		this.productService = productService;
+	}
+
+	public Class doCart() {
+//		return
+		return null;
+	}
+
+
+}

Added: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListPage.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListPage.java	2007-07-27 18:40:26 UTC (rev 394)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListPage.java	2007-07-27 18:42:00 UTC (rev 395)
@@ -0,0 +1,177 @@
+package jp.sf.pal.pompei.web.user.product;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import jp.sf.pal.pompei.exentity.ProductsDescription;
+
+import org.seasar.teeda.extension.annotation.scope.SubapplicationScope;
+
+public class ProductListPage {
+
+	private BigDecimal categoriesId;
+
+	private String breadcrumb;
+
+	private int breadcrumbIndex;
+
+	/** 改行ポイント*/
+//	private boolean breakPoint;
+
+	@SubapplicationScope
+	private List breadcrumbItems;
+
+	private String categoriesName;
+
+	private int categoryIndex;
+
+	@SubapplicationScope
+	private List categoryItems;
+
+	@SubapplicationScope
+	private BigDecimal parentId;
+
+	private int productIndex;
+
+	private List productItems;
+
+	private BigDecimal productsId;
+
+	private String productsName;
+
+	private BigDecimal productsPrice;
+
+	private String title;
+
+	public String getBreadcrumb() {
+		return breadcrumb;
+	}
+
+	public void setBreadcrumb(String breadcrumb) {
+		this.breadcrumb = breadcrumb;
+	}
+
+	public int getBreadcrumbIndex() {
+		return breadcrumbIndex;
+	}
+
+	public void setBreadcrumbIndex(int breadcrumbIndex) {
+		this.breadcrumbIndex = breadcrumbIndex;
+	}
+
+	public List getBreadcrumbItems() {
+		return breadcrumbItems;
+	}
+
+	public void setBreadcrumbItems(List breadcrumbItems) {
+		this.breadcrumbItems = breadcrumbItems;
+	}
+
+	public String getCategoriesName() {
+		return categoriesName;
+	}
+
+	public void setCategoriesName(String categoriesName) {
+		this.categoriesName = categoriesName;
+	}
+
+	public int getCategoryIndex() {
+		return categoryIndex;
+	}
+
+	public void setCategoryIndex(int categoryIndex) {
+		this.categoryIndex = categoryIndex;
+	}
+
+	public List getCategoryItems() {
+		return categoryItems;
+	}
+
+	public void setCategoryItems(List categoryItems) {
+		this.categoryItems = categoryItems;
+	}
+
+	public BigDecimal getParentId() {
+		return parentId;
+	}
+
+	public void setParentId(BigDecimal parentId) {
+		this.parentId = parentId;
+	}
+
+	public int getProductIndex() {
+		return productIndex;
+	}
+
+	public void setProductIndex(int productIndex) {
+		this.productIndex = productIndex;
+	}
+
+	public List getProductItems() {
+		return productItems;
+	}
+
+	public void setProductItems(List productItems) {
+		this.productItems = productItems;
+	}
+
+	public String getProductsName() {
+		return productsName;
+	}
+
+	public void setProductsName(String productsName) {
+		this.productsName = productsName;
+	}
+
+	public BigDecimal getProductsPrice() {
+		return productsPrice;
+	}
+
+	public void setProductsPrice(BigDecimal productsPrice) {
+		this.productsPrice = productsPrice;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public BigDecimal getCategoriesId() {
+		return categoriesId;
+	}
+
+	public void setCategoriesId(BigDecimal categoriesId) {
+		this.categoriesId = categoriesId;
+	}
+
+	public void setDescriptionList(List list) {
+		if(list != null && list.size() > 0) {
+			this.productsName = ((ProductsDescription)list.get(0)).getProductsName();
+		}else {
+			this.productsName = "";
+		}
+	}
+
+	public boolean isBreakPoint() {
+		if(productIndex%4==0) {
+			return true;
+		}
+		return false;
+	}
+
+	public BigDecimal getProductsId() {
+		return productsId;
+	}
+
+	public void setProductsId(BigDecimal productsId) {
+		this.productsId = productsId;
+	}
+
+//	public void setBreakPoint(boolean test) {
+//		this.breakPoint = test;
+//	}
+
+}


pal-cvs メーリングリストの案内
Back to archive index