[pal-cvs 2849] [594] updated db.

svnno****@sourc***** svnno****@sourc*****
2007年 9月 29日 (土) 08:38:42 JST


Revision: 594
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=594
Author:   shinsuke
Date:     2007-09-29 08:38:41 +0900 (Sat, 29 Sep 2007)

Log Message:
-----------
updated db. implemented product image.

Modified Paths:
--------------
    pompei/portlets/pompei-core/trunk/dbflute/schema/project-schema-pompei.xml
    pompei/portlets/pompei-core/trunk/src/main/config/pompei.clay
    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/bsbhv/BsProductImageBhv.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsdao/BsProductImageDao.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsentity/BsProductImage.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsentity/dbmeta/ProductImageDbm.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/exentity/ProductImage.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/util/UploadedFileUtil.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/ProductListPage.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
    pompei/portlets/pompei-core/trunk/src/main/resources/jp/sf/pal/pompei/web/admin/product/label.properties
    pompei/portlets/pompei-core/trunk/src/main/webapp/WEB-INF/db/create_table.sql
    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
    pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productDetails.html
    pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productList.html

Added Paths:
-----------
    pompei/portlets/pompei-core/trunk/src/main/webapp/images/product/

Removed Paths:
-------------
    pompei/portlets/pompei-core/trunk/src/main/webapp/images/products/


-------------- next part --------------
Modified: pompei/portlets/pompei-core/trunk/dbflute/schema/project-schema-pompei.xml
===================================================================
--- pompei/portlets/pompei-core/trunk/dbflute/schema/project-schema-pompei.xml	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/dbflute/schema/project-schema-pompei.xml	2007-09-28 23:38:41 UTC (rev 594)
@@ -801,9 +801,11 @@
         </foreign-key>
     </table>
     <table name="PRODUCT_IMAGE" schema="APP" type="TABLE">
+        <column autoIncrement="true" dbType="BIGINT"
+            default="GENERATED_BY_DEFAULT"
+            javaType="java.math.BigDecimal" name="PRODUCT_IMAGE_ID"
+            primaryKey="true" required="true" type="BIGINT"/>
         <column dbType="BIGINT" javaType="java.math.BigDecimal"
-            name="PRODUCT_IMAGE_ID" primaryKey="true" required="true" type="BIGINT"/>
-        <column dbType="BIGINT" javaType="java.math.BigDecimal"
             name="PRODUCT_ID" required="true" type="BIGINT"/>
         <column dbType="VARCHAR" javaType="String" name="IMAGE_NAME"
             required="true" size="32" type="VARCHAR"/>

Modified: pompei/portlets/pompei-core/trunk/src/main/config/pompei.clay
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/config/pompei.clay	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/config/pompei.clay	2007-09-28 23:38:41 UTC (rev 594)
@@ -4276,7 +4276,7 @@
 <table-description></table-description>
 <table-figure-bounds height="102" width="270" x="2682" y="2747"/>
 <column-list>
-<column alias="" auto-increment="false" column-size="0" decimal-digits="0" default-value="" mandatory="true" name="PRODUCT_IMAGE_ID" remarks="" uid="c0fc8e:11548c89038:-7fb9">
+<column alias="" auto-increment="true" column-size="0" decimal-digits="0" default-value="" mandatory="true" name="PRODUCT_IMAGE_ID" remarks="" uid="c0fc8e:11548c89038:-7fb9">
 <column-description></column-description>
 <data-type jdbc-type="-5" name="BIGINT" selected-variant-pattern="BIGINT">
 <variant type-name-pattern="BIGINT"/>

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-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -9,8 +9,10 @@
 
     public static final String GIF = ".gif";
 
-    public static final String PRODUCTS_IMAGE_DIRECTORY_NAME = "products";
+    public static final String IMAGE_DIRECTORY_NAME = "images";
 
+    public static final String PRODUCT_IMAGE_DIRECTORY_NAME = "product";
+
     public static final String PRODUCT_LIST_URL = "productListUrl";
 
     public static final String CART_URL = "cartUrl";
@@ -80,4 +82,12 @@
     public static final String THUMBNAIL_DISPLAY = "thumbnail";
 
     public static final String LIST_DISPLAY = "list";
+
+    public static final BigDecimal THUMBNAIL_IMAGE_TYPE = new BigDecimal(1);
+
+    public static final BigDecimal DETAILS_IMAGE_TYPE = new BigDecimal(2);
+
+    public static final String THUMBNAIL_IMAGE_URL = "thumbnailImageUrl";
+
+    public static final String DETAILS_IMAGE_URL = "detailsImageUrl";
 }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsbhv/BsProductImageBhv.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsbhv/BsProductImageBhv.java	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsbhv/BsProductImageBhv.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -40,7 +40,7 @@
  *     
  * 
  * [identity]
- *     
+ *     productImageId
  * 
  * [update-date]
  *     
@@ -750,6 +750,30 @@
     // ===================================================================================
     //                                                                      Various Insert
     //                                                                      ==============
+      
+    /* (non-javadoc) 
+     * Copy-insert.
+     * 
+     * @param primaryKey Primary-keys. (NotNull)
+     * @return Inserted count.
+     * @exception jp.sf.pal.pompei.allcommon.exception.RecordHasAlreadyBeenDeletedException
+     */
+    public int copyInsertByPKValueAfterSelect(java.math.BigDecimal productImageId) {
+        ProductImage entity = new ProductImage();
+        entity.setProductImageId(productImageId);
+        final ProductImageCB cb = newMyConditionBean();
+        cb.acceptPrimaryKeyMapString(getDBMeta().extractPrimaryKeyMapString(entity));
+        final ProductImage currentEntity = selectEntityWithDeletedCheck(cb);
+        return delegateInsert(currentEntity);
+    }
+    
+    /**
+     * Filter 'copy-insert' entity.
+     * 
+     * @param productImage Entity. (NotNull)
+     */
+    protected void filterCopyInsertEntity(ProductImage productImage) {
+    }
   
     // ===================================================================================
     //                                                                           Hierarchy

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsdao/BsProductImageDao.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsdao/BsProductImageDao.java	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsdao/BsProductImageDao.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -23,7 +23,7 @@
  *     
  * 
  * [identity]
- *     
+ *     productImageId
  * 
  * [update-date]
  *     

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsentity/BsProductImage.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsentity/BsProductImage.java	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsentity/BsProductImage.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -26,7 +26,7 @@
  *     
  * 
  * [identity]
- *     
+ *     productImageId
  * 
  * [update-date]
  *     
@@ -47,6 +47,9 @@
     /** TABLE-Annotation for S2Dao. The value is PRODUCT_IMAGE. */
     public static final String TABLE = "PRODUCT_IMAGE";
 
+    
+    /** ID-Annotation */
+    public static final String productImageId_ID = "identity";
 
     // ===================================================================================
     //                                                                           Attribute
@@ -54,7 +57,7 @@
     /** Entity modified properties. (for S2Dao) */
     protected EntityModifiedProperties _modifiedProperties = newEntityModifiedProperties();
 
-    /** The value of productImageId. PK : BIGINT : NotNull */
+    /** The value of productImageId. PK : INC : BIGINT : NotNull : Default=[GENERATED_BY_DEFAULT] */
     protected java.math.BigDecimal _productImageId;
 
     /** The value of productId. BIGINT : NotNull : FK to PRODUCT */
@@ -131,12 +134,12 @@
     //                                                                            Accessor
     //                                                                            ========
 
-    /** Column Annotation for S2Dao. PK : BIGINT : NotNull */
+    /** Column Annotation for S2Dao. PK : INC : BIGINT : NotNull : Default=[GENERATED_BY_DEFAULT] */
     public static final String productImageId_COLUMN = "PRODUCT_IMAGE_ID";
 
     /**
      * Get the value of productImageId. <br />
-     * {PK : BIGINT : NotNull}
+     * {PK : INC : BIGINT : NotNull : Default=[GENERATED_BY_DEFAULT]}
      * 
      * @return The value of productImageId. (Nullable)
      */
@@ -146,7 +149,7 @@
 
     /**
      * Set the value of productImageId. <br />
-     * {PK : BIGINT : NotNull}
+     * {PK : INC : BIGINT : NotNull : Default=[GENERATED_BY_DEFAULT]}
      * 
      * @param productImageId The value of productImageId. (Nullable)
      */

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsentity/dbmeta/ProductImageDbm.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsentity/dbmeta/ProductImageDbm.java	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsentity/dbmeta/ProductImageDbm.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -28,7 +28,7 @@
  *     
  * 
  * [identity]
- *     
+ *     productImageId
  * 
  * [update-date]
  *     
@@ -93,7 +93,7 @@
     // -----------------------------------------------------
     //                                        Column DB-Name
     //                                        --------------
-    /** Db-name of PRODUCT_IMAGE_ID. PK : BIGINT : NotNull */
+    /** Db-name of PRODUCT_IMAGE_ID. PK : INC : BIGINT : NotNull : Default=[GENERATED_BY_DEFAULT] */
     public static final String DB_NAME_PRODUCT_IMAGE_ID = "PRODUCT_IMAGE_ID";
     /** Db-name of PRODUCT_ID. BIGINT : NotNull : FK to PRODUCT */
     public static final String DB_NAME_PRODUCT_ID = "PRODUCT_ID";
@@ -114,7 +114,7 @@
     // -----------------------------------------------------
     //                       Column Prop-Name(JavaBeansRule)
     //                       -------------------------------
-    /** Prop-name(JavaBeansRule) of productImageId. PK : BIGINT : NotNull */
+    /** Prop-name(JavaBeansRule) of productImageId. PK : INC : BIGINT : NotNull : Default=[GENERATED_BY_DEFAULT] */
     public static final String PROPERTY_NAME_productImageId = "productImageId";
     /** Prop-name(JavaBeansRule) of productId. BIGINT : NotNull : FK to PRODUCT */
     public static final String PROPERTY_NAME_productId = "productId";
@@ -126,7 +126,7 @@
     // -----------------------------------------------------
     //                                  Column Cap-Prop-Name
     //                                  --------------------
-    /** Cap-prop-name of productImageId. PK : BIGINT : NotNull */
+    /** Cap-prop-name of productImageId. PK : INC : BIGINT : NotNull : Default=[GENERATED_BY_DEFAULT] */
     public static final String CAP_PROP_NAME_ProductImageId = "ProductImageId";
     /** Cap-prop-name of productId. BIGINT : NotNull : FK to PRODUCT */
     public static final String CAP_PROP_NAME_ProductId = "ProductId";
@@ -147,7 +147,7 @@
     // -----------------------------------------------------
     //                                Column Uncap-Prop-Name
     //                                ----------------------
-    /** Uncap-prop-name of productImageId. PK : BIGINT : NotNull */
+    /** Uncap-prop-name of productImageId. PK : INC : BIGINT : NotNull : Default=[GENERATED_BY_DEFAULT] */
     public static final String UNCAP_PROP_NAME_productImageId = "productImageId";
     /** Uncap-prop-name of productId. BIGINT : NotNull : FK to PRODUCT */
     public static final String UNCAP_PROP_NAME_productId = "productId";

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-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/dxo/ProductDxo.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -18,6 +18,7 @@
     Product convertProduct(ProductEditPage productEditPage);
 
     @ConversionRule("productId : productId"
+            + ",code : code"
             + ",model : model"
             + ",price : price"
             + ",status : status"

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ProductImage.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ProductImage.java	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ProductImage.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -1,5 +1,6 @@
 package jp.sf.pal.pompei.exentity;
 
+import jp.sf.pal.jsf.custom.fileupload.UploadedFile;
 
 /**
  * The entity of PRODUCT_IMAGE.
@@ -10,4 +11,20 @@
 
     /** Serial version UID. (Default) */
     private static final long serialVersionUID = 1L;
+
+    private UploadedFile imageFile;
+
+    /**
+     * @return imageFile
+     */
+    public UploadedFile getImageFile() {
+        return imageFile;
+    }
+
+    /**
+     * @param imageFile 設定する imageFile
+     */
+    public void setImageFile(UploadedFile imageFile) {
+        this.imageFile = imageFile;
+    }
 }

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-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/ProductService.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -8,6 +8,7 @@
 import jp.sf.pal.pompei.exentity.Manufacturer;
 import jp.sf.pal.pompei.exentity.Product;
 import jp.sf.pal.pompei.exentity.ProductDescription;
+import jp.sf.pal.pompei.exentity.ProductImage;
 
 public interface ProductService extends Serializable {
 
@@ -32,4 +33,6 @@
 
     public Manufacturer getManufacturer(BigDecimal manufacturersId);
 
+    public ProductImage getProductImageByProductIdAndType(BigDecimal productId,
+            BigDecimal type);
 }

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-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/ProductServiceImpl.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -10,20 +10,23 @@
 import jp.sf.pal.pompei.cbean.ManufacturerCB;
 import jp.sf.pal.pompei.cbean.ProductCB;
 import jp.sf.pal.pompei.cbean.ProductDescriptionCB;
+import jp.sf.pal.pompei.cbean.ProductImageCB;
 import jp.sf.pal.pompei.cbean.ProductToCategoryCB;
+import jp.sf.pal.pompei.exbhv.BargainBhv;
 import jp.sf.pal.pompei.exbhv.CustomerBasketAttributeBhv;
 import jp.sf.pal.pompei.exbhv.CustomerBasketBhv;
 import jp.sf.pal.pompei.exbhv.ManufacturerBhv;
 import jp.sf.pal.pompei.exbhv.ProductAttributeBhv;
-import jp.sf.pal.pompei.exbhv.ProductNotificationBhv;
 import jp.sf.pal.pompei.exbhv.ProductBhv;
 import jp.sf.pal.pompei.exbhv.ProductDescriptionBhv;
+import jp.sf.pal.pompei.exbhv.ProductImageBhv;
+import jp.sf.pal.pompei.exbhv.ProductNotificationBhv;
 import jp.sf.pal.pompei.exbhv.ProductToCategoryBhv;
 import jp.sf.pal.pompei.exbhv.ReviewBhv;
-import jp.sf.pal.pompei.exbhv.BargainBhv;
 import jp.sf.pal.pompei.exentity.Manufacturer;
 import jp.sf.pal.pompei.exentity.Product;
 import jp.sf.pal.pompei.exentity.ProductDescription;
+import jp.sf.pal.pompei.exentity.ProductImage;
 import jp.sf.pal.pompei.exentity.ProductToCategory;
 import jp.sf.pal.pompei.service.LanguageService;
 import jp.sf.pal.pompei.service.ProductService;
@@ -54,6 +57,8 @@
 
     private transient ProductToCategoryBhv productToCategoryBhv;
 
+    private transient ProductImageBhv productImageBhv;
+
     private transient ReviewBhv reviewBhv;
 
     private transient BargainBhv bargainBhv;
@@ -72,27 +77,37 @@
         this.languageService = languageService;
     }
 
-    public void addProductDescription(ProductDescription description,
-            BigDecimal categoriesId) throws CommonException {
+    public void addProductDescription(ProductDescription productDescription,
+            BigDecimal categoryId) throws CommonException {
+        // product
+        Product product = productDescription.getProduct();
+        product.setDateAdded(new Timestamp(new Date().getTime()));
+        product.setLastModified(new Timestamp(new Date().getTime()));
+        productBhv.insert(product);
 
-        Product products = description.getProduct();
-        products.setDateAdded(new Timestamp(new Date().getTime()));
-        products.setLastModified(new Timestamp(new Date().getTime()));
-        productBhv.insert(products);
+        // product description
+        productDescription.setProductId(product.getProductId());
+        productDescriptionBhv.insert(productDescription);
 
-        description.setProductId(products.getProductId());
-        productDescriptionBhv.insert(description);
+        // product to category
+        ProductToCategory productToCategory = new ProductToCategory();
+        productToCategory.setCategoryId(categoryId);
+        productToCategory.setProductId(product.getProductId());
+        productToCategoryBhv.insert(productToCategory);
 
-        ProductToCategory toCategories = new ProductToCategory();
-        toCategories.setCategoryId(categoriesId);
-        toCategories.setProductId(products.getProductId());
-        productToCategoryBhv.insert(toCategories);
-
-        if (description.getImageFile() != null) {
-            String filename = UploadedFileUtil.storeProduct(products
-                    .getProductId(), description.getImageFile());
-            //            products.setImage(filename);
-            productBhv.update(products);
+        // product image
+        if (product.getProductImageList() != null) {
+            for (ProductImage productImage : product.getProductImageList()) {
+                if (productImage.getImageFile() != null) {
+                    // store file
+                    String filename = UploadedFileUtil.storeProductImageFile(
+                            product.getProductId(), productImage.getType(),
+                            productImage.getImageFile());
+                    productImage.setProductId(product.getProductId());
+                    productImage.setImageName(filename);
+                    getProductImageBhv().insert(productImage);
+                }
+            }
         }
     }
 
@@ -101,6 +116,7 @@
         ProductCB cb = new ProductCB();
         cb.query().setProductId_Equal(productsId);
         List<Product> productsList = getProductBhv().selectList(cb);
+        getProductBhv().loadProductImageList(productsList);
         getProductBhv().loadCustomerBasketAttributeList(productsList);
         getProductBhv().loadCustomerBasketList(productsList);
         getProductBhv().loadProductAttributeList(productsList);
@@ -110,6 +126,9 @@
         getProductBhv().loadReviewList(productsList);
         getProductBhv().loadBargainList(productsList);
         for (Product p : productsList) {
+            if (!p.getProductImageList().isEmpty()) {
+                getProductImageBhv().deleteList(p.getProductImageList());
+            }
             if (!p.getCustomerBasketAttributeList().isEmpty()) {
                 getCustomerBasketAttributeBhv().deleteList(
                         p.getCustomerBasketAttributeList());
@@ -165,10 +184,10 @@
         return null;
     }
 
-    public List<Product> getProductList(BigDecimal categoriesId) {
+    public List<Product> getProductList(BigDecimal categoryId) {
         ProductToCategoryCB cb = new ProductToCategoryCB();
         cb.setupSelect_Product().withManufacturer();
-        cb.query().setCategoryId_Equal(categoriesId);
+        cb.query().setCategoryId_Equal(categoryId);
         List<ProductToCategory> list = productToCategoryBhv.selectList(cb);
 
         List<Product> productsList = new ArrayList<Product>();
@@ -181,22 +200,54 @@
         return productsList;
     }
 
-    public void updateProductDescription(ProductDescription description)
+    public void updateProductDescription(ProductDescription productDescription)
             throws CommonException {
-        Product products = description.getProduct();
-        products.setLastModified(new Timestamp(new Date().getTime()));
+        Product product = productDescription.getProduct();
+        product.setLastModified(new Timestamp(new Date().getTime()));
 
-        if (description.getImageFile() != null) {
-            String filename = UploadedFileUtil.storeProduct(products
-                    .getProductId(), description.getImageFile());
-            //            products.setImage(filename);
+        if (product.getProductImageList() != null) {
+            for (ProductImage productImage : product.getProductImageList()) {
+                ProductImage entity = getProductImageByProductIdAndType(product
+                        .getProductId(), productImage.getType());
+                if (entity != null) {
+                    // update
+                    //  remove old file?
+                    UploadedFileUtil.removeProductImageFile(entity
+                            .getImageName());
+                    // store file
+                    String filename = UploadedFileUtil.storeProductImageFile(
+                            entity.getProductId(), entity.getType(),
+                            productImage.getImageFile());
+                    entity.setImageName(filename);
+                    getProductImageBhv().update(entity);
+                } else {
+                    // new
+                    // store file
+                    String filename = UploadedFileUtil.storeProductImageFile(
+                            product.getProductId(), productImage.getType(),
+                            productImage.getImageFile());
+                    productImage.setProductId(product.getProductId());
+                    productImage.setImageName(filename);
+                    getProductImageBhv().insert(productImage);
+                }
+            }
         }
 
-        productBhv.update(products);
+        getProductBhv().update(product);
 
-        productDescriptionBhv.update(description);
+        getProductDescriptionBhv().update(productDescription);
     }
 
+    public ProductImage getProductImageByProductIdAndType(BigDecimal productId,
+            BigDecimal type) {
+        ProductImageCB cb = new ProductImageCB();
+        //TODO needed?
+        //        cb.setupSelect_Product();
+        cb.query().setProductId_Equal(productId);
+        cb.query().setType_Equal(type);
+        return getProductImageBhv().selectEntity(cb);
+    }
+
     public ProductDescriptionBhv getProductDescriptionBhv() {
         return productDescriptionBhv;
     }
@@ -329,4 +380,18 @@
         return productBhv.selectEntity(cb);
     }
 
+    /**
+     * @return productImageBhv
+     */
+    public ProductImageBhv getProductImageBhv() {
+        return productImageBhv;
+    }
+
+    /**
+     * @param productImageBhv 設定する productImageBhv
+     */
+    public void setProductImageBhv(ProductImageBhv productImageBhv) {
+        this.productImageBhv = productImageBhv;
+    }
+
 }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UploadedFileUtil.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UploadedFileUtil.java	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UploadedFileUtil.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -32,6 +32,7 @@
     }
 
     protected static String getAbsoluteImagePath() throws CommonException {
+        // TODO check performance
         Object context = FacesContext.getCurrentInstance().getExternalContext()
                 .getContext();
         try {
@@ -39,7 +40,8 @@
             Method method = cls.getMethod("getRealPath",
                     new Class[] { String.class });
             //TODO get a target directory from portlet.xml
-            return (String) method.invoke(context, new Object[] { "/images" });
+            return (String) method.invoke(context, new Object[] { "/"
+                    + PompeiConstants.IMAGE_DIRECTORY_NAME });
 
         } catch (Exception e) {
             throw new CommonException("could.not.retrive.image.path",
@@ -47,31 +49,50 @@
         }
     }
 
-    public static String storeProduct(BigDecimal id, UploadedFile uploadedFile)
-            throws CommonException {
+    public static String storeProductImageFile(BigDecimal productId,
+            BigDecimal type, UploadedFile uploadedFile) throws CommonException {
         String name = uploadedFile.getName();
         String ext = getExtension(name);
         if (ext == null) {
             throw new CommonException("unsupported.file.format",
                     "Unsupported file format.");
         }
-        StringBuffer filepath = new StringBuffer(getAbsoluteImagePath());
-        filepath.append(
-                File.separator + PompeiConstants.PRODUCTS_IMAGE_DIRECTORY_NAME
-                        + File.separator).append(id.toString()).append(ext);
-        File outputFile = new File(filepath.toString());
+        String filename = productId.toString() + type.toString() + ext;
+
+        File outputFile = new File(getProdocutImageDirectoryPath() + filename);
         try {
             StreamUtil.drain(uploadedFile.getInputStream(),
                     new FileOutputStream(outputFile));
-            return "/" + PompeiConstants.PRODUCTS_IMAGE_DIRECTORY_NAME + "/"
-                    + id.toString() + ext;
+            return filename;
         } catch (FileNotFoundException e) {
             throw new CommonException("could.not.save.uploaded.file",
-                    "Could not find " + filepath.toString(), e);
+                    "Could not find " + outputFile.getAbsolutePath(), e);
         } catch (IOException e) {
             throw new CommonException("could.not.save.uploaded.file",
-                    "I/O error: " + filepath.toString(), e);
+                    "I/O error: " + outputFile.getAbsolutePath(), e);
         }
+    }
 
+    public static String getProdocutImageDirectoryPath() throws CommonException {
+        return getAbsoluteImagePath() + File.separator
+                + PompeiConstants.PRODUCT_IMAGE_DIRECTORY_NAME + File.separator;
     }
+
+    public static void removeProductImageFile(String filename)
+            throws CommonException {
+        // TODO check exceptions more?
+        File imageFile = new File(getProdocutImageDirectoryPath() + filename);
+        if (imageFile.isFile()) {
+            imageFile.delete();
+        }
+    }
+
+    public static String getProductImageUrl(String filename) {
+        return FacesContext.getCurrentInstance().getExternalContext()
+                .getRequestContextPath()
+                + "/"
+                + PompeiConstants.IMAGE_DIRECTORY_NAME
+                + "/"
+                + PompeiConstants.PRODUCT_IMAGE_DIRECTORY_NAME + "/" + filename;
+    }
 }

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-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditAction.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -2,6 +2,7 @@
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -14,6 +15,7 @@
 import jp.sf.pal.pompei.exentity.Manufacturer;
 import jp.sf.pal.pompei.exentity.Product;
 import jp.sf.pal.pompei.exentity.ProductDescription;
+import jp.sf.pal.pompei.exentity.ProductImage;
 import jp.sf.pal.pompei.exentity.TaxClass;
 import jp.sf.pal.pompei.service.LanguageService;
 import jp.sf.pal.pompei.service.ManufacturerService;
@@ -53,12 +55,6 @@
 
     public Class<?> initialize() {
 
-        List<Map<String, String>> mList = getManufacturerIdList();
-        productEditPage.setManufacturerIdItems(mList);
-        // tax
-        List<Map<String, String>> tcList = getTaxClassIdList();
-        productEditPage.setTaxClassIdItems(tcList);
-
         return null;
     }
 
@@ -76,7 +72,30 @@
         return list;
     }
 
+    private List<Map<String, String>> getStatusList() {
+        List<Map<String, String>> list = new ArrayList<Map<String, String>>();
+        Map<String, String> map1 = new HashMap<String, String>();
+        map1.put("label", getProductEditPage().getLabelHelper().getLabelValue(
+                "enabled"));
+        map1.put("value", PompeiConstants.TRUE_BIGDECIMAL.toString());
+        list.add(map1);
+        Map<String, String> map2 = new HashMap<String, String>();
+        map2.put("label", getProductEditPage().getLabelHelper().getLabelValue(
+                "disabled"));
+        map2.put("value", PompeiConstants.FALSE_BIGDECIMAL.toString());
+        list.add(map2);
+        return list;
+    }
+
     public Class<?> prerender() {
+        //TODO initialize
+        // manufacturer
+        getProductEditPage().setManufacturerIdItems(getManufacturerIdList());
+        // tax
+        getProductEditPage().setTaxClassIdItems(getTaxClassIdList());
+        // status
+        getProductEditPage().setStatusItems(getStatusList());
+
         if (isUpdate()) {
             // update
             ProductDescription description = productService
@@ -84,17 +103,6 @@
                             getLanguageService().getDefaultLanguage()
                                     .getLanguageId());
             productDxo.convert(description, productEditPage);
-        } else {
-            //insert
-            //            productEditPage.setMode(PompeiConstants.INSERT_MODE);
-            //            productEditPage.setName("");
-            //            productEditPage.setModel("");
-            //            productEditPage.setImage("");
-            //            BigDecimal zero = new BigDecimal("0");
-            //            productEditPage.setPrice(zero);
-            //            productEditPage.setQuantity(zero);
-            //            productEditPage.setStatus(zero);
-            //            productEditPage.setWeight(zero);
         }
 
         // render faces messages
@@ -104,38 +112,65 @@
 
     @TakeOver(type = TakeOverType.INCLUDE, properties = "mode,productId")
     public Class<?> doUpdate() {
+
         if (isInsert()) {
             // insert
-            ProductDescription description = productDxo
-                    .convert(productEditPage);
-            Product products = productDxo.convertProduct(productEditPage);
+            ProductDescription pd = productDxo.convert(productEditPage);
+            Product product = productDxo.convertProduct(productEditPage);
 
-            description.setProduct(products);
-            description.setLanguageId(getLanguageService().getDefaultLanguage()
+            pd.setProduct(product);
+            pd.setLanguageId(getLanguageService().getDefaultLanguage()
                     .getLanguageId());
-            description.setImageFile(productEditPage.getImageFile());
 
+            List<ProductImage> productImageList = new ArrayList<ProductImage>();
+            if (getProductEditPage().getImageFile() != null) {
+                ProductImage productImage = new ProductImage();
+                productImage.setImageFile(getProductEditPage().getImageFile());
+                productImage.setType(PompeiConstants.DETAILS_IMAGE_TYPE);
+                productImageList.add(productImage);
+            }
+            if (getProductEditPage().getThumbnailFile() != null) {
+                ProductImage productImage = new ProductImage();
+                productImage.setImageFile(getProductEditPage().getThumbnailFile());
+                productImage.setType(PompeiConstants.THUMBNAIL_IMAGE_TYPE);
+                productImageList.add(productImage);
+            }
+            product.setProductImageList(productImageList);
+
             try {
-                productService.addProductDescription(description,
-                        productEditPage.getParentId());
+                productService.addProductDescription(pd, productEditPage
+                        .getParentId());
                 FacesMessageUtil.addInfoMessage("added.product");
             } catch (CommonException e) {
                 FacesMessageUtil.addErrorMessage(e.getMessageId());
             }
 
         } else if (isUpdate()) {
-            ProductDescription description = productService
-                    .getProdcutsDescription(productEditPage.getProductId(),
-                            getLanguageService().getDefaultLanguage()
-                                    .getLanguageId());
-            productDxo.convertPageToDescription(productEditPage, description);
+            ProductDescription pd = getProductService().getProdcutsDescription(
+                    getProductEditPage().getProductId(),
+                    getLanguageService().getDefaultLanguage().getLanguageId());
+            getProductDxo().convertPageToDescription(getProductEditPage(), pd);
 
-            Product products = description.getProduct();
-            productDxo.convertPageToProduct(productEditPage, products);
+            Product product = pd.getProduct();
+            getProductDxo().convertPageToProduct(getProductEditPage(), product);
 
-            description.setImageFile(productEditPage.getImageFile());
+            List<ProductImage> productImageList = new ArrayList<ProductImage>();
+            if (getProductEditPage().getImageFile() != null) {
+                ProductImage productImage = new ProductImage();
+                productImage.setImageFile(getProductEditPage().getImageFile());
+                productImage.setType(PompeiConstants.DETAILS_IMAGE_TYPE);
+                productImageList.add(productImage);
+            }
+            if (getProductEditPage().getThumbnailFile() != null) {
+                ProductImage productImage = new ProductImage();
+                productImage.setImageFile(getProductEditPage().getThumbnailFile());
+                productImage.setType(PompeiConstants.THUMBNAIL_IMAGE_TYPE);
+                productImageList.add(productImage);
+            }
+            product.setProductImageList(productImageList);
+
             try {
-                productService.updateProductDescription(description);
+                productService.updateProductDescription(pd);
                 FacesMessageUtil.addInfoMessage("updated.product");
             } catch (CommonException e) {
                 FacesMessageUtil.addErrorMessage(e.getMessageId());

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-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditPage.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -7,8 +7,10 @@
 
 import jp.sf.pal.jsf.custom.fileupload.UploadedFile;
 
+import org.seasar.teeda.extension.annotation.convert.BigDecimalConverter;
 import org.seasar.teeda.extension.annotation.scope.SubapplicationScope;
 import org.seasar.teeda.extension.annotation.validator.Required;
+import org.seasar.teeda.extension.util.LabelHelper;
 
 public class ProductEditPage implements Serializable {
 
@@ -17,10 +19,6 @@
      */
     private static final long serialVersionUID = 2187705411622892857L;
 
-    public static final String productsName_TRequiredValidator = null;
-
-    public static final String productsModel_TRequiredValidator = null;
-
     private String breadcrumb;
 
     private int breadcrumbIndex;
@@ -30,6 +28,8 @@
 
     private List<Map<String, String>> manufacturerIdItems;
 
+    private List<Map<String, String>> statusItems;
+
     @Required
     private BigDecimal manufacturerId;
 
@@ -39,11 +39,11 @@
 
     private BigDecimal productId;
 
-    private String image;
+    private String imageName;
 
     private UploadedFile imageFile;
 
-    private String thumbnail;
+    private String thumbnailName;
 
     private UploadedFile thumbnailFile;
 
@@ -52,12 +52,15 @@
     @Required
     private String name;
 
+    //TODO i18n
+    @BigDecimalConverter(pattern = "###,###")
     @Required
     private BigDecimal price;
 
     @Required
     private BigDecimal quantity;
 
+    @Required
     private BigDecimal status;
 
     private List<Map<String, String>> taxClassIdItems;
@@ -69,6 +72,26 @@
 
     private BigDecimal targetId;
 
+    private String code;
+
+    private String size;
+
+    private BigDecimal ordered;
+
+    private BigDecimal reviewed;
+
+    private BigDecimal rating;
+
+    private String title;
+
+    private String url;
+
+    private BigDecimal viewed;
+
+    private String description;
+
+    private LabelHelper labelHelper;
+
     public String getBreadcrumb() {
         return breadcrumb;
     }
@@ -118,12 +141,12 @@
         this.parentId = parentId;
     }
 
-    public String getImage() {
-        return image;
+    public String getImageName() {
+        return imageName;
     }
 
-    public void setImage(String productsImage) {
-        this.image = productsImage;
+    public void setImageName(String productsImage) {
+        this.imageName = productsImage;
     }
 
     /**
@@ -223,15 +246,15 @@
     /**
      * @return thumbnail
      */
-    public String getThumbnail() {
-        return thumbnail;
+    public String getThumbnailName() {
+        return thumbnailName;
     }
 
     /**
      * @param thumbnail 設定する thumbnail
      */
-    public void setThumbnail(String thumbnail) {
-        this.thumbnail = thumbnail;
+    public void setThumbnailName(String thumbnail) {
+        this.thumbnailName = thumbnail;
     }
 
     /**
@@ -262,4 +285,158 @@
         this.taxClassIdItems = taxClassIdItems;
     }
 
+    /**
+     * @return statusItems
+     */
+    public List<Map<String, String>> getStatusItems() {
+        return statusItems;
+    }
+
+    /**
+     * @param statusItems 設定する statusItems
+     */
+    public void setStatusItems(List<Map<String, String>> statusItems) {
+        this.statusItems = statusItems;
+    }
+
+    /**
+     * @return code
+     */
+    public String getCode() {
+        return code;
+    }
+
+    /**
+     * @param code 設定する code
+     */
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    /**
+     * @return size
+     */
+    public String getSize() {
+        return size;
+    }
+
+    /**
+     * @param size 設定する size
+     */
+    public void setSize(String size) {
+        this.size = size;
+    }
+
+    /**
+     * @return ordered
+     */
+    public BigDecimal getOrdered() {
+        return ordered;
+    }
+
+    /**
+     * @param ordered 設定する ordered
+     */
+    public void setOrdered(BigDecimal ordered) {
+        this.ordered = ordered;
+    }
+
+    /**
+     * @return reviewed
+     */
+    public BigDecimal getReviewed() {
+        return reviewed;
+    }
+
+    /**
+     * @param reviewed 設定する reviewed
+     */
+    public void setReviewed(BigDecimal reviewed) {
+        this.reviewed = reviewed;
+    }
+
+    /**
+     * @return rating
+     */
+    public BigDecimal getRating() {
+        return rating;
+    }
+
+    /**
+     * @param rating 設定する rating
+     */
+    public void setRating(BigDecimal rating) {
+        this.rating = rating;
+    }
+
+    /**
+     * @return title
+     */
+    public String getTitle() {
+        return title;
+    }
+
+    /**
+     * @param title 設定する title
+     */
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    /**
+     * @return url
+     */
+    public String getUrl() {
+        return url;
+    }
+
+    /**
+     * @param url 設定する url
+     */
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    /**
+     * @return viewed
+     */
+    public BigDecimal getViewed() {
+        return viewed;
+    }
+
+    /**
+     * @param viewed 設定する viewed
+     */
+    public void setViewed(BigDecimal viewed) {
+        this.viewed = viewed;
+    }
+
+    /**
+     * @return description
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * @param description 設定する description
+     */
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * @return labelHelper
+     */
+    public LabelHelper getLabelHelper() {
+        return labelHelper;
+    }
+
+    /**
+     * @param labelHelper 設定する labelHelper
+     */
+    public void setLabelHelper(LabelHelper labelHelper) {
+        this.labelHelper = labelHelper;
+    }
+
 }

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-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListPage.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -2,6 +2,7 @@
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -9,6 +10,7 @@
 import jp.sf.pal.pompei.exentity.ProductDescription;
 import jp.sf.pal.pompei.service.LanguageService;
 
+import org.seasar.teeda.extension.annotation.convert.BigDecimalConverter;
 import org.seasar.teeda.extension.annotation.convert.DateTimeConverter;
 import org.seasar.teeda.extension.annotation.scope.SubapplicationScope;
 import org.seasar.teeda.extension.util.LabelHelper;
@@ -45,9 +47,9 @@
 
     private String manufacturerName;
 
-    // TODO date format
+    // TODO i18n
     @DateTimeConverter(pattern = "yyyy/MM/dd")
-    private String dateAdded;
+    private Date dateAdded;
 
     private int productIndex;
 
@@ -57,13 +59,15 @@
 
     private String model;
 
+    //TODO i18n
+    @BigDecimalConverter(pattern = "###,###")
     private BigDecimal price;
 
     private BigDecimal status;
 
     private String sortOrder;
 
-    private String title;
+    private String code;
 
     private LabelHelper labelHelper;
 
@@ -131,11 +135,11 @@
         this.manufacturerName = manufacturersName;
     }
 
-    public String getDateAdded() {
+    public Date getDateAdded() {
         return dateAdded;
     }
 
-    public void setDateAdded(String productsDateAdded) {
+    public void setDateAdded(Date productsDateAdded) {
         this.dateAdded = productsDateAdded;
     }
 
@@ -187,12 +191,12 @@
         this.sortOrder = sortOrder;
     }
 
-    public String getTitle() {
-        return title;
+    public String getCode() {
+        return code;
     }
 
-    public void setTitle(String title) {
-        this.title = title;
+    public void setCode(String title) {
+        this.code = title;
     }
 
     public BigDecimal getParentId() {
@@ -294,4 +298,11 @@
         }
         return "-";
     }
+
+    public String getStatusStr() {
+        if (PompeiConstants.TRUE_BIGDECIMAL.equals(getStatus())) {
+            return getLabelHelper().getLabelValue("enabled");
+        }
+        return getLabelHelper().getLabelValue("disabled");
+    }
 }

Modified: 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-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -8,15 +8,18 @@
 import javax.faces.context.FacesContext;
 
 import jp.sf.pal.common.util.FacesMessageUtil;
+import jp.sf.pal.pompei.PompeiConstants;
 import jp.sf.pal.pompei.dxo.ProductDxo;
 import jp.sf.pal.pompei.exentity.Customer;
 import jp.sf.pal.pompei.exentity.CustomerBasket;
 import jp.sf.pal.pompei.exentity.Manufacturer;
 import jp.sf.pal.pompei.exentity.Product;
 import jp.sf.pal.pompei.exentity.ProductDescription;
+import jp.sf.pal.pompei.exentity.ProductImage;
 import jp.sf.pal.pompei.service.CartService;
 import jp.sf.pal.pompei.service.CustomerService;
 import jp.sf.pal.pompei.service.ProductService;
+import jp.sf.pal.pompei.util.UploadedFileUtil;
 
 public class ProductDetailsAction implements Serializable {
 
@@ -70,6 +73,19 @@
                 .getProduct().getManufacturerId());
         productDetailsPage.setManufacturersName(manufacturers.getName());
 
+        // details image
+        ProductImage productImage = getProductService()
+                .getProductImageByProductIdAndType(
+                        productDetailsPage.getProductId(),
+                        PompeiConstants.DETAILS_IMAGE_TYPE);
+        if (productImage != null) {
+            getProductDetailsPage().setDetailsImageUrl(
+                    UploadedFileUtil.getProductImageUrl(productImage
+                            .getImageName()));
+        } else {
+            getProductDetailsPage().setDetailsImageUrl("");
+        }
+
         // render faces messages
         FacesMessageUtil.renderMessages();
         return null;

Modified: 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-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -3,6 +3,8 @@
 import java.io.Serializable;
 import java.math.BigDecimal;
 
+import jp.sf.pal.pompei.PompeiConstants;
+
 import org.seasar.teeda.extension.annotation.convert.BigDecimalConverter;
 
 public class ProductDetailsPage implements Serializable {
@@ -34,6 +36,8 @@
 
     private String size;
 
+    private String detailsImageUrl;
+
     private boolean user;
 
     private boolean login;
@@ -211,4 +215,21 @@
         this.login = login;
     }
 
+    public String getDetailsImageSrc() {
+        return getDetailsImageUrl();
+    }
+
+    /**
+     * @return detailsImageUrl
+     */
+    public String getDetailsImageUrl() {
+        return detailsImageUrl;
+    }
+
+    /**
+     * @param detailsImageUrl 設定する detailsImageUrl
+     */
+    public void setDetailsImageUrl(String detailsImageUrl) {
+        this.detailsImageUrl = detailsImageUrl;
+    }
 }

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-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -10,9 +10,11 @@
 import jp.sf.pal.pompei.dxo.CategoryDxo;
 import jp.sf.pal.pompei.dxo.ProductDxo;
 import jp.sf.pal.pompei.exentity.Product;
+import jp.sf.pal.pompei.exentity.ProductImage;
 import jp.sf.pal.pompei.service.CategoryService;
 import jp.sf.pal.pompei.service.ProductService;
 import jp.sf.pal.pompei.util.SessionUtil;
+import jp.sf.pal.pompei.util.UploadedFileUtil;
 
 import org.seasar.teeda.extension.util.LabelHelper;
 
@@ -52,15 +54,19 @@
                 .getFromApplicationScope(PompeiConstants.CURRENT_CATEGORY_ID);
         if (currentCategoryId == null) {
             currentCategoryId = PompeiConstants.ROOT_CATEGORY_ID;
-            //TODO should put it to session
+            //TODO should put it to session?
         }
 
         //商品一覧の取得
-        List<Product> list = productService.getProductList(currentCategoryId);
+        List<Product> list = getProductService().getProductList(
+                currentCategoryId);
         List<Map<String, Object>> sList = new ArrayList<Map<String, Object>>();
-        productDxo.convert(list, sList);
-        productListPage.setProductItems(sList);
+        getProductDxo().convert(list, sList);
+        getProductListPage().setProductItems(sList);
 
+        // load thumbnail
+        loadThumbnail(sList);
+
         // default display mode
         if (getProductListPage().getDisplayMode() == null) {
             getProductListPage().setDisplayMode(
@@ -69,6 +75,26 @@
         return null;
     }
 
+    private void loadThumbnail(List<Map<String, Object>> productList) {
+        for (Map<String, Object> map : productList) {
+            BigDecimal productId = (BigDecimal) map.get("productId");
+            if (productId != null) {
+                ProductImage productImage = getProductService()
+                        .getProductImageByProductIdAndType(productId,
+                                PompeiConstants.THUMBNAIL_IMAGE_TYPE);
+                if (productImage != null) {
+                    map.put(PompeiConstants.THUMBNAIL_IMAGE_URL,
+                            UploadedFileUtil.getProductImageUrl(productImage
+                                    .getImageName()));
+                } else {
+                    // TODO set default image path
+                    map.put(PompeiConstants.THUMBNAIL_IMAGE_URL, "");
+                }
+
+            }
+        }
+    }
+
     /**
      * @return productListPage
      */

Modified: 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-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListPage.java	2007-09-28 23:38:41 UTC (rev 594)
@@ -57,13 +57,6 @@
         this.price = productsPrice;
     }
 
-    public boolean isBreakPoint() {
-        if (productIndex % 4 == 0) {
-            return true;
-        }
-        return false;
-    }
-
     public BigDecimal getProductId() {
         return productId;
     }
@@ -92,7 +85,8 @@
 
     public String getProductName() {
         //TODO
-        if (productItems != null && productIndex < productItems.size()) {
+        if (getProductItems() != null
+                && getProductIndex() < getProductItems().size()) {
             List<ProductDescription> list = (List<ProductDescription>) productItems
                     .get(productIndex).get(
                             PompeiConstants.PRODUCT_DESCRIPTION_LIST);
@@ -130,4 +124,12 @@
         return PompeiConstants.LIST_DISPLAY.equals(getDisplayMode());
     }
 
+    public String getThumbnailSrc() {
+        if (getProductItems() != null
+                && getProductIndex() < getProductItems().size()) {
+            return (String) getProductItems().get(getProductIndex()).get(
+                    PompeiConstants.THUMBNAIL_IMAGE_URL);
+        }
+        return "";
+    }
 }

Modified: pompei/portlets/pompei-core/trunk/src/main/resources/jp/sf/pal/pompei/web/admin/product/label.properties
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/resources/jp/sf/pal/pompei/web/admin/product/label.properties	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/resources/jp/sf/pal/pompei/web/admin/product/label.properties	2007-09-28 23:38:41 UTC (rev 594)
@@ -4,3 +4,6 @@
 manufacturerEdit.title=\u30e1\u30fc\u30ab\u30fc\u767b\u9332\u30fb\u7de8\u96c6
 productList.title=\u5546\u54c1\u8a2d\u5b9a
 productEdit.title=\u5546\u54c1\u767b\u9332\u30fb\u7de8\u96c6
+
+enabled=\u6709\u52b9
+disabled=\u7121\u52b9

Modified: pompei/portlets/pompei-core/trunk/src/main/webapp/WEB-INF/db/create_table.sql
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/webapp/WEB-INF/db/create_table.sql	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/webapp/WEB-INF/db/create_table.sql	2007-09-28 23:38:41 UTC (rev 594)
@@ -478,7 +478,7 @@
 );
 
 CREATE TABLE PRODUCT_IMAGE (
-       PRODUCT_IMAGE_ID BIGINT NOT NULL
+       PRODUCT_IMAGE_ID BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 100, INCREMENT BY 1)
      , PRODUCT_ID BIGINT NOT NULL
      , IMAGE_NAME VARCHAR(32) NOT NULL
      , TYPE INTEGER NOT NULL

Copied: pompei/portlets/pompei-core/trunk/src/main/webapp/images/product (from rev 581, pompei/portlets/pompei-core/trunk/src/main/webapp/images/products)

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-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productEdit.html	2007-09-28 23:38:41 UTC (rev 594)
@@ -17,33 +17,42 @@
 <input type="hidden" id="parentId" />
 <input type="hidden" id="productId" />
 <table border="1">
-	<tr style="dummy" height="20px">
-		<th>商品名</th><td><input id="name" /></td>
-	</tr>
 	<tr style="dummy" height="20px">
-		<th>イメージ</th><td><input id="image" type="hidden"/>
-		<pal:inputFileUpload id="imageFile" value="#{admin_product_productEditPage.imageFile}"></pal:inputFileUpload></td>
+		<th>商品コード</th><td><input id="code" /></td>
 	</tr>
 	<tr style="dummy" height="20px">
-		<th>サムネイル</th><td><input id="thumbnail" type="hidden"/>
-		<pal:inputFileUpload id="thumbnailFile" value="#{admin_product_productEditPage.thumbnailFile}"></pal:inputFileUpload></td>
+		<th>型番</th><td><input id="model" /></td>
 	</tr>
 	<tr style="dummy" height="20px">
-		<th>型番</th><td><input id="model" /></td>
+		<th>在庫数</th><td><input id="quantity" /></td>
 	</tr>
 	<tr style="dummy" height="20px">
-		<th>数量</th><td><input id="quantity" /></td>
-	</tr>
-	<tr style="dummy" height="20px">
 		<th>価格</th><td><input id="price" /></td>
 	</tr>
+	<tr style="dummy" height="20px">
+		<th>重量</th><td><input id="weight" /></td>
+	</tr>
+	<tr style="dummy" height="20px">
+		<th>サイズ</th><td><input id="size" /></td>
+	</tr>
 	<tr style="dummy" height="20px">
-		<th>重量</th><td><input id="weight" /></td>
+		<th>ステータス</th>
+		<td>
+			<select id="status">
+				<option value="0"></option>
+			</select>
+		</td>
 	</tr>
+	<tr style="dummy" height="20px">
+		<th>総注文数</th><td><input id="ordered" /></td>
+	</tr>
+	<tr style="dummy" height="20px">
+		<th>総レビュー数</th><td><input id="reviewed" /></td>
+	</tr>
+	<tr style="dummy" height="20px">
+		<th>評価値</th><td><input id="rating" /></td>
+	</tr>
 	<tr style="dummy" height="20px">
-		<th>ステータス</th><td><input id="status" /></td>
-	</tr>
-	<tr style="dummy" height="20px">
 		<th>メーカー</th>
 		<td>
 			<select id="manufacturerId">
@@ -58,6 +67,32 @@
 			</select>
 		</td>
 	</tr>
+	<tr style="dummy" height="20px">
+		<th>イメージ</th><td><input id="imageName" type="hidden"/>
+		<pal:inputFileUpload id="imageFile" value="#{admin_product_productEditPage.imageFile}"></pal:inputFileUpload></td>
+	</tr>
+	<tr style="dummy" height="20px">
+		<th>サムネイル</th><td><input id="thumbnailName" type="hidden"/>
+		<pal:inputFileUpload id="thumbnailFile" value="#{admin_product_productEditPage.thumbnailFile}"></pal:inputFileUpload></td>
+	</tr>
+	<tr style="dummy" height="20px">
+		<th>商品名</th><td><input id="name" /></td>
+	</tr>
+	<tr style="dummy" height="20px">
+		<th>キャッチコピー</th><td><input id="title" /></td>
+	</tr>
+	<tr style="dummy" height="20px">
+		<th>メーカーのURL</th><td><input id="url" /></td>
+	</tr>
+	<tr style="dummy" height="20px">
+		<th>総表示数</th><td><input id="viewed" /></td>
+	</tr>
+	<tr style="dummy" height="20px">
+		<th colspan="2">説明文</th>
+	</tr>
+	<tr style="dummy">
+		<td colspan="2"><textarea id="description" cols="60" rows="20"/></td>
+	</tr>
 </table>
 <input type="submit" id="doUpdate" value="登録する" />
 <input type="button" id="jumpProductList" 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-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productList.html	2007-09-28 23:38:41 UTC (rev 594)
@@ -16,20 +16,19 @@
 	&gt;&nbsp;<a id="goSubCategory-a" href="./productList.html?categoryId=0"><span id="breadcrumb"></span></a>
 </div>
 <br/>
-<br/>
 <div id="categoryItems">
-<a id="goSubCategory-b" href="./productList.html?categoryId=1"><span id="name">スニーカー</span></a>&amp;nbsp;&amp;nbsp;
+<a id="goSubCategory-b" href="./productList.html?categoryId=1"><span id="name">スニーカー</span></a>&nbsp;
 </div>
-<hr/>
+<hr style="border-top: 1px dashed #999999;height: 1px;color: #ffffff;" size="1" noshade="noshade"/>
 <table border="1">
 	<thead>
 		<tr style="dummy" height="20px">
 			<!--<th><label>NO</label></th>-->
-			<th><label>商品ID</label></th>
+			<th><label>商品コード</label></th>
 			<th><label>商品名</label></th>
 			<th><label>型番</label></th>
 			<th><label>価格</label></th>
-			<th><label>ステータス</label></th>
+			<th><label>状態</label></th>
 			<th><label>メーカー</label></th>
 			<th><label>追加日</label></th>
 			<th>&nbsp;</th>
@@ -38,11 +37,11 @@
 	<tbody id="productItems">
 		<tr style="dummy">
 			<!--<td><span id="productsIndex">1</span></td>-->
-			<td><span id="productId">0</span></td>
+			<td><span id="code">0</span></td>
 			<td><span id="defaultName">表示できず</span></td>
 			<td><span id="model">MX-XXX</span></td>
 			<td><span id="price">30,000</span></td>
-			<td><span id="status">取扱中</span></td>
+			<td><span id="statusStr">取扱中</span></td>
 			<td><span id="manufacturerName">アディダス</span></td>
 			<td><span id="dateAdded">2007/07/12</span></td>
 			<td>

Modified: pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productDetails.html
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productDetails.html	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productDetails.html	2007-09-28 23:38:41 UTC (rev 594)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja" xmlns:te="http://www.seasar.org/teeda/extension">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title id="title-head">商品詳細画面</title>
@@ -11,7 +11,7 @@
 <input id="productId" type="hidden" />
 <table style="width: 100%;">
   <tr>
-    <td width="300"><img id="productImage" src="" alt="画像" /></td>
+    <td width="300"><img id="detailsImage" src="" alt="画像" /></td>
     <td align="left">
       <div><span id="title">タイトル</span></div>
       <hr style="border-top: 1px dashed #999999;height: 1px;color: #ffffff;" size="1" noshade="noshade"/>
@@ -57,7 +57,7 @@
 <hr style="border-top: 1px dashed #999999;height: 1px;color: #ffffff;" size="1" noshade="noshade"/>
 <div>
 <h2 style="color:#CC6600;">詳細情報</h2>
-<span id="description">説明</span>
+<span id="description" te:escape="false">説明</span>
 </div>
 <hr style="border-top: 1px dashed #999999;height: 1px;color: #ffffff;" size="1" noshade="noshade"/>
 <input type="submit" id="jumpProductList" value="一覧に戻る" />

Modified: pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productList.html
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productList.html	2007-09-28 08:01:43 UTC (rev 593)
+++ pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productList.html	2007-09-28 23:38:41 UTC (rev 594)
@@ -19,7 +19,7 @@
 	<div id="productItems">
 		<div style="float:left;width:240px">
 			<a id="goProductDetails" href="productDetails.html?&productId=1">
-			<img src="" alt="画像" border="0"/><br/>
+			<img id="thumbnail" src="" alt="画像" border="0"/><br/>
 			<span id="productName">AAAAAAA</span></a><br/>
 			<b style="color: #990000;"><span id="price">価格</span>円</b>
 		</div>


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