[pal-cvs 2797] [541] updated admin pages for products.

svnno****@sourc***** svnno****@sourc*****
2007年 9月 6日 (木) 12:47:37 JST


Revision: 541
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=541
Author:   shinsuke
Date:     2007-09-06 12:47:37 +0900 (Thu, 06 Sep 2007)

Log Message:
-----------
updated admin pages for products. use contstants.

Modified Paths:
--------------
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/dxo/ManufacturersDxo.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/dxo/ProductDxo.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/ProductService.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/ProductServiceImpl.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/CategoryEditAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/CategoryListAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditPage.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListPage.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/resources/jp/sf/pal/pompei/web/label.properties
    pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productEdit.html
    pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productList.html


-------------- next part --------------
Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -26,4 +26,10 @@
     public static final String UPDATE_MODE = "update";
 
     public static final String DELETE_MODE = "delete";
+
+    public static final String TOP_CATEGORY = "top";
+
+    public static final String CATEGORIES_ID = "categoriesId";
+
+    public static final String BREADCRUMB = "breadcrumb";
 }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/dxo/ManufacturersDxo.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/dxo/ManufacturersDxo.java	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/dxo/ManufacturersDxo.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -4,13 +4,12 @@
 import java.util.List;
 import java.util.Map;
 
-import org.seasar.extension.dxo.annotation.ConversionRule;
-
-import jp.sf.pal.pompei.allcommon.Entity;
 import jp.sf.pal.pompei.exentity.Manufacturers;
 import jp.sf.pal.pompei.exentity.ManufacturersInfo;
 import jp.sf.pal.pompei.web.admin.product.ManufacturerEditPage;
 
+import org.seasar.extension.dxo.annotation.ConversionRule;
+
 public interface ManufacturersDxo extends Serializable {
 
     @ConversionRule("manufacturersId : manufacturersId"
@@ -33,6 +32,6 @@
     void convert(ManufacturerEditPage manufacturerEditPage, Manufacturers entity);
 
     @ConversionRule("value : manufacturersId" + ",label : manufacturersName")
-    void convertCombo(List<Entity> manufacturers, List<Map> list);
+    void convertCombo(List<Manufacturers> manufacturers, List<Map<String, String>> list);
 
 }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/dxo/ProductDxo.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/dxo/ProductDxo.java	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/dxo/ProductDxo.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -22,18 +22,18 @@
             + ",productsImage : productsImage"
             + ",productsPrice : productsPrice"
             + ",productsStatus : productsStatus"
+            + ",productsDescriptionList : productsDescriptionList"
             + ",manufacturersName : manufacturers.manufacturersName"
-            + ",productsDateAdded : productsDateAdded"
-            + ",descriptionList : productsDescriptionList")
+            + ",productsDateAdded : productsDateAdded")
     void convert(List<Products> list, List<Map<String, Object>> list2);
 
-    @ConversionRule("productsId : productsId"
-            + ",productsModel : products.productsModel"
-            + ",productsImage : products.productsImage"
-            + ",productsPrice : products.productsPrice"
-            + ",productsStatus : products.productsStatus"
-            + ",manufacturersId : products.manufacturersId"
-            + ",productsName : productsName")
+    //    @ConversionRule("productsId : productsId"
+    //            + ",productsModel : products.productsModel"
+    //            + ",productsImage : products.productsImage"
+    //            + ",productsPrice : products.productsPrice"
+    //            + ",productsStatus : products.productsStatus"
+    //            + ",manufacturersId : products.manufacturersId"
+    //            + ",productsName : productsName")
     void convert(ProductsDescription description,
             ProductEditPage productEditPage);
 

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/ProductService.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/ProductService.java	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/ProductService.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -6,6 +6,7 @@
 
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.pompei.exentity.Manufacturers;
+import jp.sf.pal.pompei.exentity.Products;
 import jp.sf.pal.pompei.exentity.ProductsDescription;
 
 public interface ProductService extends Serializable {
@@ -17,10 +18,13 @@
 
     public ProductsDescription getProdcutsDescription(BigDecimal id);
 
-    public List getProductsList();
+    public ProductsDescription getProdcutsDescription(BigDecimal id,
+            BigDecimal languagesId);
 
-    public List getProductsList(BigDecimal categoriesId);
+    public List<Products> getProductsList();
 
+    public List<Products> getProductsList(BigDecimal categoriesId);
+
     public void updateProducts(ProductsDescription description)
             throws CommonException;
 

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/ProductServiceImpl.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/ProductServiceImpl.java	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/ProductServiceImpl.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -8,16 +8,24 @@
 
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.pompei.cbean.ManufacturersCB;
+import jp.sf.pal.pompei.cbean.ProductsCB;
 import jp.sf.pal.pompei.cbean.ProductsDescriptionCB;
 import jp.sf.pal.pompei.cbean.ProductsToCategoriesCB;
+import jp.sf.pal.pompei.exbhv.CustomersBasketAttributesBhv;
+import jp.sf.pal.pompei.exbhv.CustomersBasketBhv;
 import jp.sf.pal.pompei.exbhv.ManufacturersBhv;
+import jp.sf.pal.pompei.exbhv.ProductsAttributesBhv;
 import jp.sf.pal.pompei.exbhv.ProductsBhv;
 import jp.sf.pal.pompei.exbhv.ProductsDescriptionBhv;
+import jp.sf.pal.pompei.exbhv.ProductsNotificationsBhv;
 import jp.sf.pal.pompei.exbhv.ProductsToCategoriesBhv;
+import jp.sf.pal.pompei.exbhv.ReviewsBhv;
+import jp.sf.pal.pompei.exbhv.SpecialsBhv;
 import jp.sf.pal.pompei.exentity.Manufacturers;
 import jp.sf.pal.pompei.exentity.Products;
 import jp.sf.pal.pompei.exentity.ProductsDescription;
 import jp.sf.pal.pompei.exentity.ProductsToCategories;
+import jp.sf.pal.pompei.service.LanguageService;
 import jp.sf.pal.pompei.service.ProductService;
 import jp.sf.pal.pompei.util.UploadedFileUtil;
 
@@ -28,14 +36,42 @@
      */
     private static final long serialVersionUID = -2593237297401857885L;
 
-    private ProductsDescriptionBhv productsDescriptionBhv;
+    private LanguageService languageService;
 
     private ProductsBhv productsBhv;
 
+    private ManufacturersBhv manufacturersBhv;
+
+    private CustomersBasketAttributesBhv customersBasketAttributesBhv;
+
+    private CustomersBasketBhv customersBasketBhv;
+
+    private ProductsAttributesBhv productsAttributesBhv;
+
+    private ProductsDescriptionBhv productsDescriptionBhv;
+
+    private ProductsNotificationsBhv productsNotificationsBhv;
+
     private ProductsToCategoriesBhv productsToCategoriesBhv;
 
-    private ManufacturersBhv manufacturersBhv;
+    private ReviewsBhv reviewsBhv;
 
+    private SpecialsBhv specialsBhv;
+
+    /**
+     * @return languageService
+     */
+    public LanguageService getLanguageService() {
+        return languageService;
+    }
+
+    /**
+     * @param languageService 設定する languageService
+     */
+    public void setLanguageService(LanguageService languageService) {
+        this.languageService = languageService;
+    }
+
     public void addProducts(ProductsDescription description,
             BigDecimal categoriesId) throws CommonException {
 
@@ -61,47 +97,87 @@
     }
 
     public void deleteProducts(BigDecimal productsId) {
-        ProductsDescription description = getProdcutsDescription(productsId);
-        Products products = description.getProducts();
-        List<Products> list = new ArrayList<Products>();
-        list.add(products);
-        productsBhv.loadProductsToCategoriesList(list);
 
-        List<ProductsToCategories> toCategoriesList = products
-                .getProductsToCategoriesList();
-        productsToCategoriesBhv.delegateDeleteList(toCategoriesList);
-        productsDescriptionBhv.delete(description);
-        productsBhv.delegateDelete(products);
+        ProductsCB cb = new ProductsCB();
+        cb.query().setProductsId_Equal(productsId);
+        List<Products> productsList = getProductsBhv().selectList(cb);
+        getProductsBhv().loadCustomersBasketAttributesList(productsList);
+        getProductsBhv().loadCustomersBasketList(productsList);
+        getProductsBhv().loadProductsAttributesList(productsList);
+        getProductsBhv().loadProductsDescriptionList(productsList);
+        getProductsBhv().loadProductsNotificationsList(productsList);
+        getProductsBhv().loadProductsToCategoriesList(productsList);
+        getProductsBhv().loadReviewsList(productsList);
+        getProductsBhv().loadSpecialsList(productsList);
+        for (Products p : productsList) {
+            if (!p.getCustomersBasketAttributesList().isEmpty()) {
+                getCustomersBasketAttributesBhv().deleteList(
+                        p.getCustomersBasketAttributesList());
+            }
+            if (!p.getCustomersBasketList().isEmpty()) {
+                getCustomersBasketBhv().deleteList(p.getCustomersBasketList());
+            }
+            if (!p.getProductsAttributesList().isEmpty()) {
+                getProductsAttributesBhv().deleteList(
+                        p.getProductsAttributesList());
+            }
+            if (!p.getProductsDescriptionList().isEmpty()) {
+                getProductsDescriptionBhv().deleteList(
+                        p.getProductsDescriptionList());
+            }
+            if (!p.getProductsNotificationsList().isEmpty()) {
+                getProductsNotificationsBhv().deleteList(
+                        p.getProductsNotificationsList());
+            }
+            if (!p.getProductsToCategoriesList().isEmpty()) {
+                getProductsToCategoriesBhv().deleteList(
+                        p.getProductsToCategoriesList());
+            }
+            if (!p.getReviewsList().isEmpty()) {
+                getReviewsBhv().deleteList(p.getReviewsList());
+            }
+            if (!p.getSpecialsList().isEmpty()) {
+                getSpecialsBhv().deleteList(p.getSpecialsList());
+            }
+            productsBhv.delegateDelete(p);
+        }
 
         //TODO remove image
     }
 
     public ProductsDescription getProdcutsDescription(BigDecimal id) {
-        ProductsDescriptionCB descriptionCB = new ProductsDescriptionCB();
-        descriptionCB.setupSelect_Products();
+        return getProdcutsDescription(id, getLanguageService()
+                .getCurrentLanguage().getLanguagesId());
+    }
 
-        descriptionCB.query().setLanguageId_Equal(new BigDecimal("1"));
-        descriptionCB.query().setProductsId_Equal(id);
-        return productsDescriptionBhv.selectEntity(descriptionCB);
+    public ProductsDescription getProdcutsDescription(BigDecimal id,
+            BigDecimal languagesId) {
+        ProductsDescriptionCB cb = new ProductsDescriptionCB();
+        cb.setupSelect_Products();
+
+        cb.query().setLanguageId_Equal(languagesId);
+        cb.query().setProductsId_Equal(id);
+        return productsDescriptionBhv.selectEntity(cb);
     }
 
-    public List getProductsList() {
+    public List<Products> getProductsList() {
         // TODO 自動生成されたメソッド・スタブ
         return null;
     }
 
-    public List getProductsList(BigDecimal categoriesId) {
-        ProductsToCategoriesCB categoriesCB = new ProductsToCategoriesCB();
-        categoriesCB.setupSelect_Products();
-        categoriesCB.setupSelect_Products().withManufacturers();
-        categoriesCB.query().setCategoriesId_Equal(categoriesId);
+    public List<Products> getProductsList(BigDecimal categoriesId) {
+        ProductsToCategoriesCB cb = new ProductsToCategoriesCB();
+        cb.setupSelect_Products();
+        cb.setupSelect_Products().withManufacturers();
+        cb.query().setCategoriesId_Equal(categoriesId);
         List<ProductsToCategories> list = productsToCategoriesBhv
-                .selectList(categoriesCB);
+                .selectList(cb);
 
-        List productsList = new ArrayList();
+        List<Products> productsList = new ArrayList<Products>();
         for (ProductsToCategories categories : list) {
             productsList.add(categories.getProducts());
         }
+        //TODO there is better method..
         productsBhv.loadProductsDescriptionList(productsList);
 
         return productsList;
@@ -148,6 +224,93 @@
         this.productsToCategoriesBhv = productsToCategoriesBhv;
     }
 
+    /**
+     * @return customersBasketAttributesBhv
+     */
+    public CustomersBasketAttributesBhv getCustomersBasketAttributesBhv() {
+        return customersBasketAttributesBhv;
+    }
+
+    /**
+     * @param customersBasketAttributesBhv 設定する customersBasketAttributesBhv
+     */
+    public void setCustomersBasketAttributesBhv(
+            CustomersBasketAttributesBhv customersBasketAttributesBhv) {
+        this.customersBasketAttributesBhv = customersBasketAttributesBhv;
+    }
+
+    /**
+     * @return customersBasketBhv
+     */
+    public CustomersBasketBhv getCustomersBasketBhv() {
+        return customersBasketBhv;
+    }
+
+    /**
+     * @param customersBasketBhv 設定する customersBasketBhv
+     */
+    public void setCustomersBasketBhv(CustomersBasketBhv customersBasketBhv) {
+        this.customersBasketBhv = customersBasketBhv;
+    }
+
+    /**
+     * @return productsAttributesBhv
+     */
+    public ProductsAttributesBhv getProductsAttributesBhv() {
+        return productsAttributesBhv;
+    }
+
+    /**
+     * @param productsAttributesBhv 設定する productsAttributesBhv
+     */
+    public void setProductsAttributesBhv(
+            ProductsAttributesBhv productsAttributesBhv) {
+        this.productsAttributesBhv = productsAttributesBhv;
+    }
+
+    /**
+     * @return productsNotificationsBhv
+     */
+    public ProductsNotificationsBhv getProductsNotificationsBhv() {
+        return productsNotificationsBhv;
+    }
+
+    /**
+     * @param productsNotificationsBhv 設定する productsNotificationsBhv
+     */
+    public void setProductsNotificationsBhv(
+            ProductsNotificationsBhv productsNotificationsBhv) {
+        this.productsNotificationsBhv = productsNotificationsBhv;
+    }
+
+    /**
+     * @return reviewsBhv
+     */
+    public ReviewsBhv getReviewsBhv() {
+        return reviewsBhv;
+    }
+
+    /**
+     * @param reviewsBhv 設定する reviewsBhv
+     */
+    public void setReviewsBhv(ReviewsBhv reviewsBhv) {
+        this.reviewsBhv = reviewsBhv;
+    }
+
+    /**
+     * @return specialsBhv
+     */
+    public SpecialsBhv getSpecialsBhv() {
+        return specialsBhv;
+    }
+
+    /**
+     * @param specialsBhv 設定する specialsBhv
+     */
+    public void setSpecialsBhv(SpecialsBhv specialsBhv) {
+        this.specialsBhv = specialsBhv;
+    }
+
     public Manufacturers getManufacturers(BigDecimal manufacturersId) {
         ManufacturersCB manufacturersCB = new ManufacturersCB();
         manufacturersCB.query().setManufacturersId_Equal(manufacturersId);

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/CategoryEditAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/CategoryEditAction.java	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/CategoryEditAction.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -97,7 +97,7 @@
         int index = list.size() - 1;
 
         Map<String, Object> m = list.get(index);
-        BigDecimal parentId = (BigDecimal) m.get("categoriesId");
+        BigDecimal parentId = (BigDecimal) m.get(PompeiConstants.CATEGORIES_ID);
 
         if (categoryEditPage.getMode().equals(PompeiConstants.INSERT_MODE)) {
             // insert

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/CategoryListAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/CategoryListAction.java	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/CategoryListAction.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -8,6 +8,7 @@
 import java.util.Map;
 
 import jp.sf.pal.common.util.FacesMessageUtil;
+import jp.sf.pal.pompei.PompeiConstants;
 import jp.sf.pal.pompei.dxo.CategoriesDxo;
 import jp.sf.pal.pompei.exentity.CategoriesDescription;
 import jp.sf.pal.pompei.service.CategoryService;
@@ -67,8 +68,8 @@
 
             List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
             Map<String, Object> m = new HashMap<String, Object>();
-            m.put("categoriesId", new BigDecimal("0"));
-            m.put("breadcrumb", "TOP");
+            m.put(PompeiConstants.CATEGORIES_ID, new BigDecimal("0"));
+            m.put(PompeiConstants.BREADCRUMB, "TOP");
             list.add(m);
             categoryListPage.setBreadcrumbItems(list);
 
@@ -147,7 +148,7 @@
         List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
         for (Map<String, Object> m : breadcrumbItems) {
             list.add(m);
-            if (((BigDecimal) m.get("categoriesId")).equals(id)) {
+            if (((BigDecimal) m.get(PompeiConstants.CATEGORIES_ID)).equals(id)) {
                 return list;
             }
         }
@@ -156,8 +157,8 @@
                 .getCategoriesDescription(categoryListPage.getCategoriesId());
 
         Map<String, Object> m = new HashMap<String, Object>();
-        m.put("categoriesId", id);
-        m.put("breadcrumb", d.getCategoriesName());
+        m.put(PompeiConstants.CATEGORIES_ID, id);
+        m.put(PompeiConstants.BREADCRUMB, d.getCategoriesName());
         list.add(m);
         return list;
     }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditAction.java	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditAction.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -4,14 +4,17 @@
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.common.util.FacesMessageUtil;
 import jp.sf.pal.pompei.PompeiConstants;
 import jp.sf.pal.pompei.dxo.ManufacturersDxo;
 import jp.sf.pal.pompei.dxo.ProductDxo;
+import jp.sf.pal.pompei.exentity.Manufacturers;
 import jp.sf.pal.pompei.exentity.Products;
 import jp.sf.pal.pompei.exentity.ProductsDescription;
+import jp.sf.pal.pompei.service.LanguageService;
 import jp.sf.pal.pompei.service.ManufacturerService;
 import jp.sf.pal.pompei.service.impl.ProductServiceImpl;
 
@@ -28,6 +31,8 @@
     /**	 */
     private ProductServiceImpl productService;
 
+    private LanguageService languageService;
+
     /**	 */
     private ProductDxo productDxo;
 
@@ -47,26 +52,29 @@
 
     public Class<?> initialize() {
 
-        List mList = getManufacturerList();
+        List<Map<String, String>> mList = getManufacturerList();
         productEditPage.setManufacturersIdItems(mList);
+        //TODO tax
 
         return null;
     }
 
-    private List getManufacturerList() {
-        List mList = manufacturerService.getManufacturesList();
-        List list = new ArrayList();
+    private List<Map<String, String>> getManufacturerList() {
+        List<Manufacturers> mList = manufacturerService.getManufacturesList();
+        List<Map<String, String>> list = new ArrayList<Map<String, String>>();
         manufacturersDxo.convertCombo(mList, list);
         return list;
     }
 
     public Class<?> prerender() {
         if (isUpdate()) {
+            // update
             ProductsDescription description = productService
                     .getProdcutsDescription(productEditPage.getProductsId());
             productDxo.convert(description, productEditPage);
-
         } else {
+            //insert
+            // TODO needs to use TakeOver
             productEditPage.setMode(PompeiConstants.INSERT_MODE);
             productEditPage.setProductsName("");
             productEditPage.setProductsModel("");
@@ -85,26 +93,30 @@
 
     public Class<?> doUpdate() {
         if (isInsert()) {
+            // insert
             ProductsDescription description = productDxo
                     .convert(productEditPage);
             Products products = productDxo.convertProducts(productEditPage);
-            products.setProductsTaxClassId(new BigDecimal("0"));
 
             description.setProducts(products);
-            description.setLanguageId(new BigDecimal("1"));
+            description.setLanguageId(getLanguageService().getDefaultLanguage()
+                    .getLanguagesId());
             description.setProductsImageFile(productEditPage
                     .getProductsImageFile());
 
             try {
                 productService.addProducts(description, productEditPage
                         .getParentId());
+                //TODO put message
             } catch (CommonException e) {
                 FacesMessageUtil.addErrorMessage(e.getMessageId());
             }
 
         } else if (isUpdate()) {
             ProductsDescription description = productService
-                    .getProdcutsDescription(productEditPage.getProductsId());
+                    .getProdcutsDescription(productEditPage.getProductsId(),
+                            getLanguageService().getDefaultLanguage()
+                                    .getLanguagesId());
             productDxo.convertPageToDescription(productEditPage, description);
 
             Products products = description.getProducts();
@@ -114,6 +126,7 @@
                     .getProductsImageFile());
             try {
                 productService.updateProducts(description);
+                //TODO put message
             } catch (CommonException e) {
                 FacesMessageUtil.addErrorMessage(e.getMessageId());
             }
@@ -157,6 +170,20 @@
         this.productService = productService;
     }
 
+    /**
+     * @return languageService
+     */
+    public LanguageService getLanguageService() {
+        return languageService;
+    }
+
+    /**
+     * @param languageService 設定する languageService
+     */
+    public void setLanguageService(LanguageService languageService) {
+        this.languageService = languageService;
+    }
+
     public ManufacturersDxo getManufacturersDxo() {
         return manufacturersDxo;
     }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditPage.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditPage.java	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditPage.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -3,6 +3,7 @@
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
 
 import jp.sf.pal.jsf.custom.fileupload.UploadedFile;
 
@@ -26,10 +27,10 @@
     private int breadcrumbIndex;
 
     @SubapplicationScope
-    private List breadcrumbItems;
+    private List<Map<String, Object>> breadcrumbItems;
 
     @SubapplicationScope
-    private List manufacturersIdItems;
+    private List<Map<String, String>> manufacturersIdItems;
 
     private BigDecimal manufacturersId;
 
@@ -53,7 +54,7 @@
 
     private BigDecimal productsStatus;
 
-    private String productsTaxClass;
+    private BigDecimal productsTaxClassId;
 
     private BigDecimal productsWeight;
 
@@ -77,19 +78,20 @@
         this.breadcrumbIndex = breadcrumbIndex;
     }
 
-    public List getBreadcrumbItems() {
+    public List<Map<String, Object>> getBreadcrumbItems() {
         return breadcrumbItems;
     }
 
-    public void setBreadcrumbItems(List breadcrumbItems) {
+    public void setBreadcrumbItems(List<Map<String, Object>> breadcrumbItems) {
         this.breadcrumbItems = breadcrumbItems;
     }
 
-    public List getManufacturersIdItems() {
+    public List<Map<String, String>> getManufacturersIdItems() {
         return manufacturersIdItems;
     }
 
-    public void setManufacturersIdItems(List manufacturerItems) {
+    public void setManufacturersIdItems(
+            List<Map<String, String>> manufacturerItems) {
         this.manufacturersIdItems = manufacturerItems;
     }
 
@@ -171,12 +173,12 @@
         this.productsStatus = productsStatus;
     }
 
-    public String getProductsTaxClass() {
-        return productsTaxClass;
+    public BigDecimal getProductsTaxClassId() {
+        return productsTaxClassId;
     }
 
-    public void setProductsTaxClass(String productsTaxClass) {
-        this.productsTaxClass = productsTaxClass;
+    public void setProductsTaxClassId(BigDecimal productsTaxClassId) {
+        this.productsTaxClassId = productsTaxClassId;
     }
 
     public BigDecimal getProductsWeight() {

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListAction.java	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListAction.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -8,10 +8,13 @@
 import java.util.Map;
 
 import jp.sf.pal.common.util.FacesMessageUtil;
+import jp.sf.pal.pompei.PompeiConstants;
 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.exentity.Products;
 import jp.sf.pal.pompei.service.CategoryService;
+import jp.sf.pal.pompei.service.LanguageService;
 import jp.sf.pal.pompei.service.ProductService;
 
 public class ProductListAction implements Serializable {
@@ -32,17 +35,32 @@
     /**	 */
     private CategoryService categoryService;
 
+    private LanguageService languageService;
+
     /**	 */
     private CategoriesDxo categoriesDxo;
 
-    public Class initialize() {
+    public Class<?> initialize() {
         return null;
     }
 
-    public Class prerender() {
+    public Class<?> doDelete() {
+        productService.deleteProducts(productListPage.getProductsId());
+        //TODO put message
+        return null;
+    }
 
-        if (productListPage.isDelete()) {
-            productService.deleteProducts(productListPage.getProductsId());
+    private boolean isDelete() {
+        return getProductListPage().getMode() != null
+                && getProductListPage().getMode().equals(
+                        PompeiConstants.DELETE_MODE);
+    }
+
+    public Class<?> prerender() {
+
+        // delete
+        if (isDelete()) {
+            doDelete();
         }
 
         if (productListPage.getParentId() == null) {
@@ -52,10 +70,12 @@
         if (productListPage.getBreadcrumbItems() == null) {
             productListPage.setCategoriesId(new BigDecimal("0"));
 
-            List<Map> list = new ArrayList<Map>();
+            List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
             Map<String, Object> m = new HashMap<String, Object>();
-            m.put("categoriesId", new BigDecimal("0"));
-            m.put("breadcrumb", "TOP");
+            m.put(PompeiConstants.CATEGORIES_ID, new BigDecimal("0"));
+            m.put(PompeiConstants.BREADCRUMB, getProductListPage()
+                    .getLabelHelper().getLabelValue(
+                            PompeiConstants.TOP_CATEGORY));
             list.add(m);
             productListPage.setBreadcrumbItems(list);
 
@@ -65,19 +85,19 @@
             }
 
             //パンくずリストを再セット
-            List list = setBreadcrumb(productListPage.getBreadcrumbItems(),
-                    productListPage.getParentId());
+            List<Map<String, Object>> list = setBreadcrumb(productListPage
+                    .getBreadcrumbItems(), productListPage.getParentId());
             productListPage.setBreadcrumbItems(list);
         }
 
         //カテゴリ一覧の取得
-        List cList = getCategoriesList();
+        List<Map<String, Object>> cList = getCategoriesList();
         productListPage.setCategoryItems(cList);
 
         //商品一覧の取得
-        List list = productService.getProductsList(productListPage
+        List<Products> list = productService.getProductsList(productListPage
                 .getParentId());
-        List sList = new ArrayList();
+        List<Map<String, Object>> sList = new ArrayList<Map<String, Object>>();
         productDxo.convert(list, sList);
         productListPage.setProductsItems(sList);
 
@@ -86,10 +106,11 @@
         return null;
     }
 
-    private List getCategoriesList() {
-        List list = categoryService.getSubCategoryList(productListPage
-                .getParentId());
-        List cList = new ArrayList();
+    private List<Map<String, Object>> getCategoriesList() {
+        List<CategoriesDescription> list = categoryService.getSubCategoryList(
+                productListPage.getParentId(), getLanguageService()
+                        .getDefaultLanguage().getLanguagesId());
+        List<Map<String, Object>> cList = new ArrayList<Map<String, Object>>();
         categoriesDxo.convert(list, cList);
         return cList;
     }
@@ -130,6 +151,20 @@
         this.categoryService = categoryListService;
     }
 
+    /**
+     * @return languageService
+     */
+    public LanguageService getLanguageService() {
+        return languageService;
+    }
+
+    /**
+     * @param languageService 設定する languageService
+     */
+    public void setLanguageService(LanguageService languageService) {
+        this.languageService = languageService;
+    }
+
     public CategoriesDxo getCategoriesDxo() {
         return categoriesDxo;
     }
@@ -144,20 +179,22 @@
      * @param id
      * @return
      */
-    private List<Map> setBreadcrumb(List<Map> breadcrumbItems, BigDecimal id) {
-        List<Map> list = new ArrayList<Map>();
-        for (Map m : breadcrumbItems) {
+    private List<Map<String, Object>> setBreadcrumb(
+            List<Map<String, Object>> breadcrumbItems, BigDecimal id) {
+        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+        for (Map<String, Object> m : breadcrumbItems) {
             list.add(m);
-            if (((BigDecimal) m.get("categoriesId")).equals(id)) {
+            if (((BigDecimal) m.get(PompeiConstants.CATEGORIES_ID)).equals(id)) {
                 return list;
             }
         }
-        CategoriesDescription d = categoryService
-                .getCategoriesDescription(productListPage.getCategoriesId());
+        CategoriesDescription d = categoryService.getCategoriesDescription(
+                productListPage.getCategoriesId(), getLanguageService()
+                        .getDefaultLanguage().getLanguagesId());
 
-        Map m = new HashMap();
-        m.put("categoriesId", id);
-        m.put("breadcrumb", d.getCategoriesName());
+        Map<String, Object> m = new HashMap<String, Object>();
+        m.put(PompeiConstants.CATEGORIES_ID, id);
+        m.put(PompeiConstants.BREADCRUMB, d.getCategoriesName());
         list.add(m);
         return list;
     }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListPage.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListPage.java	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListPage.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -2,12 +2,14 @@
 
 import java.io.Serializable;
 import java.math.BigDecimal;
-import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import jp.sf.pal.pompei.exentity.ProductsDescription;
+import jp.sf.pal.pompei.service.LanguageService;
 
 import org.seasar.teeda.extension.annotation.scope.SubapplicationScope;
+import org.seasar.teeda.extension.util.LabelHelper;
 
 public class ProductListPage implements Serializable {
 
@@ -16,12 +18,12 @@
      */
     private static final long serialVersionUID = 8764946022463732579L;
 
+    private String mode;
+
     private int rowIndex;
 
     private BigDecimal targetId;
 
-    private boolean delete;
-
     @SubapplicationScope
     private BigDecimal parentId;
 
@@ -30,14 +32,14 @@
     private int breadcrumbIndex;
 
     @SubapplicationScope
-    private List breadcrumbItems;
+    private List<Map<String, Object>> breadcrumbItems;
 
     private int categoryIndex;
 
     private BigDecimal categoriesId;
 
     @SubapplicationScope
-    private List categoryItems;
+    private List<Map<String, Object>> categoryItems;
 
     private String categoriesName;
 
@@ -49,7 +51,7 @@
 
     private int productsIndex;
 
-    private List productsItems;
+    private List<Map<String, Object>> productsItems;
 
     private BigDecimal productsId;
 
@@ -59,12 +61,30 @@
 
     private BigDecimal productsPrice;
 
-    private String productsStatus;
+    private BigDecimal productsStatus;
 
     private String sortOrder;
 
     private String title;
 
+    private LabelHelper labelHelper;
+
+    private LanguageService languageService;
+
+    /**
+     * @return mode
+     */
+    public String getMode() {
+        return mode;
+    }
+
+    /**
+     * @param mode 設定する mode
+     */
+    public void setMode(String mode) {
+        this.mode = mode;
+    }
+
     public String getBreadcrumb() {
         return breadcrumb;
     }
@@ -81,11 +101,11 @@
         this.breadcrumbIndex = breadcrumbIndex;
     }
 
-    public List getBreadcrumbItems() {
+    public List<Map<String, Object>> getBreadcrumbItems() {
         return breadcrumbItems;
     }
 
-    public void setBreadcrumbItems(List breadcrumbItems) {
+    public void setBreadcrumbItems(List<Map<String, Object>> breadcrumbItems) {
         this.breadcrumbItems = breadcrumbItems;
     }
 
@@ -97,11 +117,11 @@
         this.categoryIndex = categoryIndex;
     }
 
-    public List getCategoryItems() {
+    public List<Map<String, Object>> getCategoryItems() {
         return categoryItems;
     }
 
-    public void setCategoryItems(List categoryItems) {
+    public void setCategoryItems(List<Map<String, Object>> categoryItems) {
         this.categoryItems = categoryItems;
     }
 
@@ -137,11 +157,11 @@
         this.productsIndex = productsIndex;
     }
 
-    public List getProductsItems() {
+    public List<Map<String, Object>> getProductsItems() {
         return productsItems;
     }
 
-    public void setProductsItems(List productsItems) {
+    public void setProductsItems(List<Map<String, Object>> productsItems) {
         this.productsItems = productsItems;
     }
 
@@ -169,11 +189,11 @@
         this.productsPrice = productsPrice;
     }
 
-    public String getProductsStatus() {
+    public BigDecimal getProductsStatus() {
         return productsStatus;
     }
 
-    public void setProductsStatus(String productsStatus) {
+    public void setProductsStatus(BigDecimal productsStatus) {
         this.productsStatus = productsStatus;
     }
 
@@ -233,19 +253,19 @@
         this.categoriesName = categoriesName;
     }
 
-    public List getDescriptionList() {
-        return new ArrayList();
-    }
+    //    public List getDescriptionList() {
+    //        return new ArrayList();
+    //    }
+    //
+    //    public void setDescriptionList(List list) {
+    //        if (list != null && list.size() > 0) {
+    //            this.productsName = ((ProductsDescription) list.get(0))
+    //                    .getProductsName();
+    //        } else {
+    //            this.productsName = "";
+    //        }
+    //    }
 
-    public void setDescriptionList(List list) {
-        if (list != null && list.size() > 0) {
-            this.productsName = ((ProductsDescription) list.get(0))
-                    .getProductsName();
-        } else {
-            this.productsName = "";
-        }
-    }
-
     public BigDecimal getProductsId() {
         return productsId;
     }
@@ -254,12 +274,48 @@
         this.productsId = productsId;
     }
 
-    public boolean isDelete() {
-        return delete;
+    /**
+     * @return labelHelper
+     */
+    public LabelHelper getLabelHelper() {
+        return labelHelper;
     }
 
-    public void setDelete(boolean delete) {
-        this.delete = delete;
+    /**
+     * @param labelHelper 設定する labelHelper
+     */
+    public void setLabelHelper(LabelHelper labelHelper) {
+        this.labelHelper = labelHelper;
     }
 
+    /**
+     * @return languageService
+     */
+    public LanguageService getLanguageService() {
+        return languageService;
+    }
+
+    /**
+     * @param languageService 設定する languageService
+     */
+    public void setLanguageService(LanguageService languageService) {
+        this.languageService = languageService;
+    }
+
+    public String getProductsDefaultName() {
+        if (productsItems != null && productsIndex < productsItems.size()) {
+            List<ProductsDescription> list = (List<ProductsDescription>) productsItems
+                    .get(productsIndex).get("productsDescriptionList");
+            if (list != null) {
+                for (ProductsDescription pd : list) {
+                    BigDecimal languagesId = getLanguageService()
+                            .getDefaultLanguage().getLanguagesId();
+                    if (pd.getLanguageId().equals(languagesId)) {
+                        return pd.getProductsName();
+                    }
+                }
+            }
+        }
+        return "-";
+    }
 }

Modified: 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-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java	2007-09-06 03:47:37 UTC (rev 541)
@@ -7,6 +7,7 @@
 import java.util.List;
 import java.util.Map;
 
+import jp.sf.pal.pompei.PompeiConstants;
 import jp.sf.pal.pompei.dxo.CategoriesDxo;
 import jp.sf.pal.pompei.dxo.ProductDxo;
 import jp.sf.pal.pompei.exentity.CategoriesDescription;
@@ -51,8 +52,8 @@
 
             List<Map> list = new ArrayList<Map>();
             Map<String, Object> m = new HashMap<String, Object>();
-            m.put("categoriesId", new BigDecimal("0"));
-            m.put("breadcrumb", "TOP");
+            m.put(PompeiConstants.CATEGORIES_ID, new BigDecimal("0"));
+            m.put(PompeiConstants.BREADCRUMB, "TOP");
             list.add(m);
             productListPage.setBreadcrumbItems(list);
 
@@ -91,7 +92,7 @@
         List<Map> list = new ArrayList<Map>();
         for (Map m : breadcrumbItems) {
             list.add(m);
-            if (((BigDecimal) m.get("categoriesId")).equals(id)) {
+            if (((BigDecimal) m.get(PompeiConstants.CATEGORIES_ID)).equals(id)) {
                 return list;
             }
         }
@@ -99,8 +100,8 @@
                 .getCategoriesDescription(productListPage.getCategoriesId());
 
         Map m = new HashMap();
-        m.put("categoriesId", id);
-        m.put("breadcrumb", d.getCategoriesName());
+        m.put(PompeiConstants.CATEGORIES_ID, id);
+        m.put(PompeiConstants.BREADCRUMB, d.getCategoriesName());
         list.add(m);
         return list;
     }

Modified: pompei/portlets/pompei-core/trunk/src/main/resources/jp/sf/pal/pompei/web/label.properties
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/resources/jp/sf/pal/pompei/web/label.properties	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/resources/jp/sf/pal/pompei/web/label.properties	2007-09-06 03:47:37 UTC (rev 541)
@@ -1,3 +1,5 @@
 insert=\u767b\u9332\u3059\u308b
 update=\u66f4\u65b0\u3059\u308b
-delete=\u524a\u9664\u3059\u308b
\ No newline at end of file
+delete=\u524a\u9664\u3059\u308b
+
+top=\u30c8\u30c3\u30d7
\ No newline at end of file

Modified: pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productEdit.html
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productEdit.html	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productEdit.html	2007-09-06 03:47:37 UTC (rev 541)
@@ -49,7 +49,7 @@
 	</tr>
 	<tr style="dummy" height="20px">
 		<th>税種別ID</th>
-		<td><input id="productsTaxClass" /></td>
+		<td><input id="productsTaxClassId" /></td>
 	</tr>
 </table>
 <input type="submit" id="doUpdate" value="登録する" />

Modified: pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productList.html
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productList.html	2007-09-05 13:56:19 UTC (rev 540)
+++ pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productList.html	2007-09-06 03:47:37 UTC (rev 541)
@@ -8,7 +8,6 @@
 <body>
 
 <form id="form" method="post">
-<input type="hidden" id="rowIndex" />
 <input type="hidden" id="parentId" />
 <div>
     <span id="allMessages" fatalClass="portlet-msg-error" errorClass="portlet-msg-error" warnClass="portlet-msg-alert" infoClass="portlet-msg-info"></span>
@@ -41,7 +40,7 @@
 		<tr style="dummy">
 			<!--<td><span id="productsIndex">1</span></td>-->
 			<td><span id="productsId">0</span></td>
-			<td><span id="productsName">表示できず</span></td>
+			<td><span id="productsDefaultName">表示できず</span></td>
 			<td><span id="productsImage">画像</span></td>
 			<td><span id="productsModel">MX-XXX</span></td>
 			<td><span id="productsPrice">30,000</span></td>
@@ -49,8 +48,8 @@
 			<td><span id="manufacturersName">アディダス</span></td>
 			<td><span id="productsDateAdded">2007/07/12</span></td>
 			<td>
-				<a id="goProductEdit" href="./productEdit.html?parentId=0&productsId=0&mode=update">編集</a>
-				<a id="goProductDelete" href="./productList.html?parentId=0&productsId=0" onClick="this.href=this.href+'&delete=true'">削除</a>
+				<a id="goProductEdit" href="./productEdit.html?parentId=0&productsId=0&fixed_mode=update">編集</a>
+				<a id="goProductDelete" href="./productList.html?parentId=0&productsId=0&fixed_mode=delete" onClick="if(confirm('削除します。よろしいですか?')){return true;}else{return false;}">削除</a>
 			</td>
 		</tr>
 	</tbody>


pal-cvs メーリングリストの案内