svnno****@sourc*****
svnno****@sourc*****
2007年 7月 25日 (水) 05:16:29 JST
Revision: 383 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=383 Author: takeharu Date: 2007-07-25 05:16:29 +0900 (Wed, 25 Jul 2007) Log Message: ----------- changed for using Interface of Service class Modified Paths: -------------- 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/ManufacturerEditAction.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditAction.java Added Paths: ----------- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ManufacturerServiceImpl.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ProductServiceImpl.java -------------- next part -------------- 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-07-24 20:15:11 UTC (rev 382) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/CategoryEditAction.java 2007-07-24 20:16:29 UTC (rev 383) @@ -13,7 +13,7 @@ public class CategoryEditAction { - private CategoryService categoryListService; + private CategoryService categoryService; /** * dxo */ @@ -42,7 +42,7 @@ public Class initialize() { System.out.println("CategoryEditAction:initialize"); if(categoryEditPage.getMode().equals("update")) { - CategoriesDescription d = categoryListService.getCategoriesDescription(categoryEditPage.getTargetId()); + CategoriesDescription d = categoryService.getCategoriesDescription(categoryEditPage.getTargetId()); Categories c = d.getCategories(); categoryEditPage.setCategoriesName(d.getCategoriesName()); @@ -63,7 +63,6 @@ } public String doUpdate() { - System.out.println("doUpdate"); CategoriesDescription d = dxo.convert(this.categoryEditPage); @@ -85,7 +84,7 @@ c.setParentId(parentId); if(categoryEditPage.getMode().equals("insert")) { - categoryListService.addCategory(d); + categoryService.addCategory(d); }else { c.setCategoriesId(categoryEditPage.getTargetId()); c.setCategoriesImage(categoryEditPage.getCategoriesImage()); @@ -93,7 +92,7 @@ c.setLastModified(new Timestamp(new Date().getTime())); d.setCategoriesId(categoryEditPage.getTargetId()); - categoryListService.updateCategory(d); + categoryService.updateCategory(d); } categoryEditPage.setTargetId(parentId); @@ -101,12 +100,12 @@ return "CategoryList"; } - public CategoryService getCategoryListService() { - return categoryListService; + public CategoryService getCategoryService() { + return categoryService; } - public void setCategoryListService(CategoryService categoryListService) { - this.categoryListService = categoryListService; + public void setCategoryService(CategoryService categoryListService) { + this.categoryService = categoryListService; } public CategoriesDxo getDxo() { Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ManufacturerEditAction.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ManufacturerEditAction.java 2007-07-24 20:15:11 UTC (rev 382) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ManufacturerEditAction.java 2007-07-24 20:16:29 UTC (rev 383) @@ -6,6 +6,7 @@ import jp.sf.pal.pompei.exentity.Manufacturers; import jp.sf.pal.pompei.exentity.ManufacturersInfo; import jp.sf.pal.pompei.web.admin.product.service.ManufacturerService; +import jp.sf.pal.pompei.web.admin.product.service.impl.ManufacturerServiceImpl; public class ManufacturerEditAction { 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-07-24 20:15:11 UTC (rev 382) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditAction.java 2007-07-24 20:16:29 UTC (rev 383) @@ -9,7 +9,7 @@ import jp.sf.pal.pompei.exentity.Products; import jp.sf.pal.pompei.exentity.ProductsDescription; import jp.sf.pal.pompei.web.admin.product.service.ManufacturerService; -import jp.sf.pal.pompei.web.admin.product.service.ProductService; +import jp.sf.pal.pompei.web.admin.product.service.impl.ProductServiceImpl; public class ProductEditAction { @@ -19,7 +19,7 @@ /** */ private ProductEditPage productEditPage; /** */ - private ProductService productService; + private ProductServiceImpl productService; /** */ private ProductDxo productDxo; /** */ @@ -124,11 +124,11 @@ this.productEditPage = productEditPage; } - public ProductService getProductService() { + public ProductServiceImpl getProductService() { return productService; } - public void setProductService(ProductService productService) { + public void setProductService(ProductServiceImpl productService) { this.productService = productService; } Added: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ManufacturerServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ManufacturerServiceImpl.java 2007-07-24 20:15:11 UTC (rev 382) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ManufacturerServiceImpl.java 2007-07-24 20:16:29 UTC (rev 383) @@ -0,0 +1,93 @@ +package jp.sf.pal.pompei.web.admin.product.service.impl; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +import jp.sf.pal.pompei.allcommon.Entity; +import jp.sf.pal.pompei.cbean.ManufacturersCB; +import jp.sf.pal.pompei.cbean.ManufacturersInfoCB; +import jp.sf.pal.pompei.exbhv.ManufacturersBhv; +import jp.sf.pal.pompei.exbhv.ManufacturersInfoBhv; +import jp.sf.pal.pompei.exentity.Manufacturers; +import jp.sf.pal.pompei.exentity.ManufacturersInfo; +import jp.sf.pal.pompei.web.admin.product.service.ManufacturerService; + +/** + * メーカーに関する操作を管理します。 + * @author takeharu + * + */ +public class ManufacturerServiceImpl implements ManufacturerService{ + + ManufacturersBhv manufacturersBhv; + ManufacturersInfoBhv manufacturersInfoBhv; + + public void addManufactures(ManufacturersInfo info) { + Manufacturers manufacturers = info.getManufacturers(); + manufacturers.setDateAdded(new Timestamp(new Date().getTime())); + manufacturers.setLastModified(new Timestamp(new Date().getTime())); + manufacturersBhv.insert(manufacturers); + + info.setManufacturersId(manufacturers.getManufacturersId()); + manufacturersInfoBhv.insert(info); + + } + + public void deleteManufactures(BigDecimal id) { + ManufacturersInfo info = getManufactures(id); + manufacturersInfoBhv.delete(info); + + Manufacturers manufacturers = info.getManufacturers(); + manufacturersBhv.delete(manufacturers); + } + + public ManufacturersInfo getManufactures(BigDecimal id) { + ManufacturersInfoCB infoCb = new ManufacturersInfoCB(); + infoCb.setupSelect_Manufacturers(); + infoCb.query().setManufacturersId_Equal(id); + return manufacturersInfoBhv.selectEntity(infoCb); + } + + public List<Entity> getManufacturesInfoList() { + ManufacturersInfoCB infoCb = new ManufacturersInfoCB(); + infoCb.addOrderBy_PK_Asc(); + infoCb.setupSelect_Manufacturers(); + return manufacturersInfoBhv.callReadList(infoCb); + } + + public List<Manufacturers> getManufacturesList() { + ManufacturersCB cb = new ManufacturersCB(); + List<Manufacturers> list = manufacturersBhv.selectList(cb); +// List<String> nameList = new ArrayList<String>(); +// for (Manufacturers m : list) { +// nameList.add(m.getManufacturersName()); +// } + return list; + } + + public void updateManufactures(ManufacturersInfo info) { + manufacturersInfoBhv.update(info); + + Manufacturers manufacturers = info.getManufacturers(); + manufacturersBhv.update(manufacturers); + } + + public ManufacturersInfoBhv getManufacturersInfoBhv() { + return manufacturersInfoBhv; + } + + public void setManufacturersInfoBhv(ManufacturersInfoBhv infoBhv) { + this.manufacturersInfoBhv = infoBhv; + } + + public ManufacturersBhv getManufacturersBhv() { + return manufacturersBhv; + } + + public void setManufacturersBhv(ManufacturersBhv manuBhv) { + this.manufacturersBhv = manuBhv; + } + +} Added: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ProductServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ProductServiceImpl.java 2007-07-24 20:15:11 UTC (rev 382) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ProductServiceImpl.java 2007-07-24 20:16:29 UTC (rev 383) @@ -0,0 +1,118 @@ +package jp.sf.pal.pompei.web.admin.product.service.impl; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import jp.sf.pal.pompei.cbean.ProductsDescriptionCB; +import jp.sf.pal.pompei.cbean.ProductsToCategoriesCB; +import jp.sf.pal.pompei.exbhv.ProductsBhv; +import jp.sf.pal.pompei.exbhv.ProductsDescriptionBhv; +import jp.sf.pal.pompei.exbhv.ProductsToCategoriesBhv; +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.web.admin.product.service.ProductService; + +public class ProductServiceImpl implements ProductService{ + + private ProductsDescriptionBhv productsDescriptionBhv; + private ProductsBhv productsBhv; + private ProductsToCategoriesBhv productsToCategoriesBhv; + + + public void addProducts(ProductsDescription description, BigDecimal categoriesId) { + + Products products = description.getProducts(); + products.setProductsDateAdded(new Timestamp(new Date().getTime())); + products.setProductsLastModified(new Timestamp(new Date().getTime())); + productsBhv.insert(products); + + description.setProductsId(products.getProductsId()); + productsDescriptionBhv.insert(description); + + ProductsToCategories toCategories = new ProductsToCategories(); + toCategories.setCategoriesId(categoriesId); + toCategories.setProductsId(products.getProductsId()); + productsToCategoriesBhv.insert(toCategories); + + } + + 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); + } + + public ProductsDescription getProdcutsDescription(BigDecimal id) { + ProductsDescriptionCB descriptionCB = new ProductsDescriptionCB(); + descriptionCB.setupSelect_Products(); + descriptionCB.query().setLanguageId_Equal(new BigDecimal("1")); + descriptionCB.query().setProductsId_Equal(id); + return productsDescriptionBhv.selectEntity(descriptionCB); + } + + public List 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); + List<ProductsToCategories> list = productsToCategoriesBhv.selectList(categoriesCB); + + List productsList = new ArrayList(); + for (ProductsToCategories categories : list) { + productsList.add(categories.getProducts()); + } + productsBhv.loadProductsDescriptionList(productsList); + + return productsList; + } + + public void updateProducts(ProductsDescription description) { + Products products = description.getProducts(); + products.setProductsLastModified(new Timestamp(new Date().getTime())); + productsBhv.update(products); + + productsDescriptionBhv.update(description); + } + + public ProductsDescriptionBhv getProductsDescriptionBhv() { + return productsDescriptionBhv; + } + + public void setProductsDescriptionBhv(ProductsDescriptionBhv descriptionBhv) { + this.productsDescriptionBhv = descriptionBhv; + } + + public ProductsBhv getProductsBhv() { + return productsBhv; + } + + public void setProductsBhv(ProductsBhv productsBhv) { + this.productsBhv = productsBhv; + } + + public ProductsToCategoriesBhv getProductsToCategoriesBhv() { + return productsToCategoriesBhv; + } + + public void setProductsToCategoriesBhv( + ProductsToCategoriesBhv productsToCategoriesBhv) { + this.productsToCategoriesBhv = productsToCategoriesBhv; + } + +}