svnno****@sourc*****
svnno****@sourc*****
2007年 7月 25日 (水) 05:26:31 JST
Revision: 388 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=388 Author: takeharu Date: 2007-07-25 05:26:30 +0900 (Wed, 25 Jul 2007) Log Message: ----------- changed for using Interface of Service class Removed Paths: ------------- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/CategoryService.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ManufacturerService.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ProductService.java -------------- next part -------------- Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/CategoryService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/CategoryService.java 2007-07-24 20:21:14 UTC (rev 387) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/CategoryService.java 2007-07-24 20:26:30 UTC (rev 388) @@ -1,141 +0,0 @@ -package jp.sf.pal.pompei.web.admin.product.service; - -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.CategoriesCB; -import jp.sf.pal.pompei.cbean.CategoriesDescriptionCB; -import jp.sf.pal.pompei.dto.CategoryDto; -import jp.sf.pal.pompei.exbhv.CategoriesBhv; -import jp.sf.pal.pompei.exbhv.CategoriesDescriptionBhv; -import jp.sf.pal.pompei.exentity.Categories; -import jp.sf.pal.pompei.exentity.CategoriesDescription; - -public class CategoryService { - - private CategoriesBhv categoriesBhv; - private CategoriesDescriptionBhv categoriesDescriptionBhv; - public List getCategoryList() { - return getCategoryListStub(); - } - - - private List getCategoryListStub() { - List list = new ArrayList(); - for(int i=0;i<10;i++) { - list.add(new CategoryDto(i+1,new Integer(i).toString(),"商品"+1, "hoge.jpg")); - } - return list; - } - - - public List getSubCategoryList(BigDecimal id) { - CategoriesDescriptionCB cb = new CategoriesDescriptionCB(); -// CategoriesCB cb = new CategoriesCB(); -// cb.query().set_Equal(new BigDecimal(id)); - cb.setupSelect_Categories(); - cb.query().setLanguageId_Equal(new BigDecimal("1")); - cb.query().queryCategories().setParentId_Equal(id); - cb.query().queryCategories().addOrderBy_SortOrder_Asc(); - - List list = categoriesDescriptionBhv.selectList(cb); - // categoriesBhv. -// List list = new ArrayList(); -// for(int i=0;i<5;i++) { -// list.add(new CategoryDto(i+1,new Integer(i).toString(),"サブ商品"+1, "hoge.jpg")); -// } - return list; - } - - - public CategoriesBhv getCategoriesBhv() { - return categoriesBhv; - } - - - public void setCategoriesBhv(CategoriesBhv categoriesBhv) { - this.categoriesBhv = categoriesBhv; - } - - - public CategoriesDescriptionBhv getCategoriesDescriptionBhv() { - return categoriesDescriptionBhv; - } - - - public void setCategoriesDescriptionBhv( - CategoriesDescriptionBhv categoriesDescriptionBhv) { - this.categoriesDescriptionBhv = categoriesDescriptionBhv; - } - - - public CategoriesDescription getCategoriesDescription(BigDecimal categoriesId) { - CategoriesDescriptionCB cb = new CategoriesDescriptionCB(); - cb.setupSelect_Categories(); - cb.query().setLanguageId_Equal(new BigDecimal("1")); - cb.query().setCategoriesId_Equal(categoriesId); - - CategoriesDescription d = this.categoriesDescriptionBhv.selectEntity(cb); - - return d; - } - - - /** - * カテゴリを追加します。 - */ - public void addCategory(CategoriesDescription d) { - Categories c = d.getCategories(); - c.setDateAdded(new Timestamp(new Date().getTime())); - c.setLastModified(new Timestamp(new Date().getTime())); - - categoriesBhv.insert(c); - - d.setCategoriesId(c.getCategoriesId()); - d.setLanguageId(new BigDecimal("1")); - - categoriesDescriptionBhv.insert(d); - } - - - public boolean hasChild(BigDecimal id) { - CategoriesCB cb = new CategoriesCB(); - cb.query().setParentId_Equal(id); - - int cnt = categoriesBhv.selectCount(cb); - - return cnt > 0; - } - - /** - * - */ - public void deleteCategories(BigDecimal id) { - CategoriesDescriptionCB cb = new CategoriesDescriptionCB(); - cb.query().setCategoriesId_Equal(id); - CategoriesDescription d = categoriesDescriptionBhv.selectEntity(cb); - categoriesDescriptionBhv.delete(d); - CategoriesCB cb2 = new CategoriesCB(); - cb2.query().setCategoriesId_Equal(id); - Categories c = categoriesBhv.selectEntity(cb2); - categoriesBhv.delete(c); - } - - - public void updateCategory(CategoriesDescription d) { - Categories c = d.getCategories(); -// c.setDateAdded(new Timestamp(new Date().getTime())); - c.setLastModified(new Timestamp(new Date().getTime())); - - categoriesBhv.update(c); - - d.setCategoriesId(c.getCategoriesId()); - d.setLanguageId(new BigDecimal("1")); - - categoriesDescriptionBhv.update(d); - } - -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ManufacturerService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ManufacturerService.java 2007-07-24 20:21:14 UTC (rev 387) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ManufacturerService.java 2007-07-24 20:26:30 UTC (rev 388) @@ -1,92 +0,0 @@ -package jp.sf.pal.pompei.web.admin.product.service; - -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; - -/** - * メーカーに関する操作を管理します。 - * @author takeharu - * - */ -public class 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; - } - -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ProductService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ProductService.java 2007-07-24 20:21:14 UTC (rev 387) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ProductService.java 2007-07-24 20:26:30 UTC (rev 388) @@ -1,117 +0,0 @@ -package jp.sf.pal.pompei.web.admin.product.service; - -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; - -public class 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; - } - -}