svnno****@sourc*****
svnno****@sourc*****
2008年 3月 30日 (日) 07:18:32 JST
Revision: 870 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=870 Author: shinsuke Date: 2008-03-30 07:18:32 +0900 (Sun, 30 Mar 2008) Log Message: ----------- replaced with pompei-db. Removed Paths: ------------- pompei/portlets/pompei-core/trunk/dbflute/ pompei/portlets/pompei-core/trunk/mydbflute/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/allcommon/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsbhv/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsdao/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/bsentity/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/cbean/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/dao/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/dto/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exbhv/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exdao/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/helper/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/logic/ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CardTypeService.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CartService.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CategoryService.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CustomerService.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/DeliveryMethodSerivce.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/LanguageService.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/ManufacturerService.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/OrderService.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/PaymentMethodService.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/TaxService.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CardTypeServiceImpl.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CartServiceImpl.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CategoryServiceImpl.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CustomerServiceImpl.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/DeliveryMethodServiceImpl.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/LanguageServiceImpl.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/ManufacturerServiceImpl.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/OrderServiceImpl.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/PaymentMethodServiceImpl.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/service/impl/TaxServiceImpl.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/validator/ -------------- next part -------------- Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CardTypeService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CardTypeService.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CardTypeService.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,12 +0,0 @@ -package jp.sf.pal.pompei.service; - -import java.io.Serializable; -import java.util.List; - -import jp.sf.pal.pompei.exentity.CardTypeDescription; - -public interface CardTypeService extends Serializable { - - public abstract List<CardTypeDescription> getCardTypeDescriptionList(); - -} \ No newline at end of file Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CartService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CartService.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CartService.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,25 +0,0 @@ -package jp.sf.pal.pompei.service; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import jp.sf.pal.pompei.exentity.CustomerBasket; - -public interface CartService extends Serializable { - - public abstract CustomerBasket getCustomerBasket(BigDecimal customerId, - BigDecimal productId); - - public abstract List<CustomerBasket> getCustomerBasketList( - BigDecimal customerId); - - public abstract void addCustomerBasket(CustomerBasket customerBaskets); - - public abstract void updateCustomerBasket(CustomerBasket customerBasket); - - public abstract void deleteCustomerBasket(BigDecimal customerBasketId); - - public abstract void cleanupCustomerBasket(BigDecimal customerId); - -} \ No newline at end of file Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CategoryService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CategoryService.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CategoryService.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,35 +0,0 @@ -package jp.sf.pal.pompei.service; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import jp.sf.pal.pompei.exentity.CategoryDescription; - -public interface CategoryService extends Serializable { - - public List<CategoryDescription> getSubCategoryDescriptionList(BigDecimal id); - - public List<CategoryDescription> getSubCategoryDescriptionList( - BigDecimal id, BigDecimal languagesId); - - public CategoryDescription getCategoryDescription(BigDecimal categoryId); - - public CategoryDescription getCategoryDescription(BigDecimal categoryId, - BigDecimal languageId); - - /** - * カテゴリを追加します。 - */ - public void addCategoryDescription(CategoryDescription d); - - public boolean hasChildCategory(BigDecimal id); - - /** */ - public void deleteCategory(BigDecimal id); - - public void updateCategoryDescription(CategoryDescription d); - - public List<CategoryDescription> getCategoryDescriptionBreadcrumb( - BigDecimal categoryId); -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CustomerService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CustomerService.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/CustomerService.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,41 +0,0 @@ -package jp.sf.pal.pompei.service; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -import jp.sf.pal.common.CommonException; -import jp.sf.pal.pompei.exentity.AddressBook; -import jp.sf.pal.pompei.exentity.Customer; -import jp.sf.pal.pompei.exentity.Zone; - -public interface CustomerService extends Serializable { - - public List<Customer> getCustomerList(); - - public Customer getCustomer(BigDecimal customersId); - - public void deleteCustomer(BigDecimal customersId); - - public AddressBook getAddressBook(BigDecimal addressBookId); - - public AddressBook getDefaultAddressBook(BigDecimal customerId); - - public void addAddressBook(AddressBook addressBook); - - public void deleteAddressBook(AddressBook addressBook); - - public List<AddressBook> getAddressBookList(BigDecimal customerId); - - public void addCustomer(Customer customers, AddressBook addressBook); - - public void addCustomer(Map<String, String> userInfo, Customer customers, - AddressBook addressBook) throws CommonException; - - public Zone getZone(BigDecimal zoneId); - - public Customer getCustomerByPortalId(String portalId); - - public void updateCustomer(Customer customer, AddressBook addressBook); -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/DeliveryMethodSerivce.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/DeliveryMethodSerivce.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/DeliveryMethodSerivce.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,24 +0,0 @@ -package jp.sf.pal.pompei.service; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import jp.sf.pal.pompei.exentity.DeliveryMethodDescription; - -public interface DeliveryMethodSerivce extends Serializable { - - public abstract List<DeliveryMethodDescription> getDeliveryMethodDescriptionList(); - - public abstract DeliveryMethodDescription getDeliveryMethodDescription( - BigDecimal deliveryMethodId); - - public abstract void addDeliveryMethodDescription( - DeliveryMethodDescription d); - - public abstract void deleteDeliveryMethod(BigDecimal id); - - public abstract void updateDeliveryMethodDescription( - DeliveryMethodDescription d); - -} \ No newline at end of file Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/LanguageService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/LanguageService.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/LanguageService.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,13 +0,0 @@ -package jp.sf.pal.pompei.service; - -import java.io.Serializable; - -import jp.sf.pal.pompei.exentity.Language; - -public interface LanguageService extends Serializable { - - public abstract Language getDefaultLanguage(); - - public abstract Language getCurrentLanguage(); - -} \ No newline at end of file Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/ManufacturerService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/ManufacturerService.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/ManufacturerService.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,35 +0,0 @@ -package jp.sf.pal.pompei.service; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import jp.sf.pal.pompei.exentity.Manufacturer; -import jp.sf.pal.pompei.exentity.ManufacturerDescription; - -/** - * メーカーに関する操作を管理します。 - * @author takeharu - * - */ -public interface ManufacturerService extends Serializable { - - public void addManufactureDescription(ManufacturerDescription info); - - public void deleteManufacture(BigDecimal id); - - public ManufacturerDescription getManufactureDescription(BigDecimal id); - - public ManufacturerDescription getManufactureDescription(BigDecimal id, - BigDecimal languageId); - - public List<ManufacturerDescription> getManufactureDescriptionList(); - - public List<ManufacturerDescription> getManufactureDescriptionList( - BigDecimal languagesId); - - public List<Manufacturer> getManufacturerList(); - - public void updateManufactureDescription(ManufacturerDescription info); - -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/OrderService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/OrderService.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/OrderService.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,65 +0,0 @@ -package jp.sf.pal.pompei.service; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import jp.sf.pal.common.CommonException; -import jp.sf.pal.pompei.allcommon.cbean.PagingResultBean; -import jp.sf.pal.pompei.exentity.AddressBook; -import jp.sf.pal.pompei.exentity.Currency; -import jp.sf.pal.pompei.exentity.Customer; -import jp.sf.pal.pompei.exentity.DeliveryMethod; -import jp.sf.pal.pompei.exentity.OrderCardInfo; -import jp.sf.pal.pompei.exentity.OrderForm; -import jp.sf.pal.pompei.exentity.OrderNotification; -import jp.sf.pal.pompei.exentity.OrderProduct; -import jp.sf.pal.pompei.exentity.OrderStatus; -import jp.sf.pal.pompei.exentity.OrderStatusDescription; -import jp.sf.pal.pompei.exentity.PaymentMethod; -import jp.sf.pal.pompei.pager.OrderFormPager; - -public interface OrderService extends Serializable { - - public void updateOrderForm(OrderForm orderForm, OrderCardInfo orderCardInfo); - - public void deleteOrderForm(OrderForm orderForm); - - public OrderForm getOrderForm(BigDecimal orderFormId); - - public List<OrderForm> getOrderFormList(); - - public PagingResultBean<OrderForm> getOrderFormListByPager( - OrderFormPager orderFormPager); - - public String addOrderForm(Customer customer, - List<BigDecimal> customerBasketIdList, - AddressBook customerAddressBook, AddressBook deliveryAddressBook, - AddressBook billingAddressBook, PaymentMethod paymentMethod, - DeliveryMethod deliveryMethod, OrderCardInfo orderCardInfo, - Currency currency, BigDecimal subTotalPrice, BigDecimal tax, - BigDecimal deliveryPrice, BigDecimal paymentFee, - BigDecimal totalPrice) throws CommonException; - - public Currency getCurrency(BigDecimal currencyId); - - public OrderStatus getOrderStatus(BigDecimal orderStatusId); - - public List<OrderStatusDescription> getOrderStatusDescriptionList( - BigDecimal languageId); - - public int getOrderFormCountByOrderStatus(BigDecimal orderStatusId); - - public OrderCardInfo getOrderCardInfo(BigDecimal orderCardInfoId); - - public List<OrderProduct> getOrderProductListByOrderFormId( - BigDecimal orderFormId); - - public List<OrderNotification> getOrderNotificationListByOrderFormId( - BigDecimal orderFormId); - - public void sendOrderNotifications(BigDecimal orderFormId, - BigDecimal[] orderNotificationIds) throws CommonException; - - public OrderNotification getOrderNotification(BigDecimal orderNotificationId); -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/PaymentMethodService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/PaymentMethodService.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/PaymentMethodService.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,15 +0,0 @@ -package jp.sf.pal.pompei.service; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import jp.sf.pal.pompei.exentity.PaymentMethodDescription; - -public interface PaymentMethodService extends Serializable { - - public abstract List<PaymentMethodDescription> getPaymentMethodDescriptionList(); - - public abstract PaymentMethodDescription getPaymentMethodDescription( - BigDecimal paymentMethodId); -} \ No newline at end of file Deleted: 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 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/ProductService.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,43 +0,0 @@ -package jp.sf.pal.pompei.service; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import jp.sf.pal.common.CommonException; -import jp.sf.pal.pompei.allcommon.cbean.PagingResultBean; -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.pager.ProductPager; - -public interface ProductService extends Serializable { - - public void addProductDescription(ProductDescription description, - BigDecimal categoryId) throws CommonException; - - public void deleteProduct(BigDecimal productsId); - - public Product getProdcut(BigDecimal id); - - public ProductDescription getProdcutDescription(BigDecimal id); - - public ProductDescription getProdcutDescription(BigDecimal id, - BigDecimal languagesId); - - public List<Product> getProductList(BigDecimal categoryId); - - public PagingResultBean<Product> getProductListByPager( - ProductPager productPager); - - public void updateProductDescription(ProductDescription description) - throws CommonException; - - public Manufacturer getManufacturer(BigDecimal manufacturersId); - - public ProductImage getProductImageByProductIdAndType(BigDecimal productId, - BigDecimal type); - - public PagingResultBean<Product> getTopProductList(String type, int num); -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/TaxService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/TaxService.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/TaxService.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,16 +0,0 @@ -package jp.sf.pal.pompei.service; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import jp.sf.pal.pompei.exentity.TaxClass; -import jp.sf.pal.pompei.exentity.TaxRate; - -public interface TaxService extends Serializable { - - public abstract TaxRate getTaxRateByZoneId(BigDecimal zoneId); - - public abstract List<TaxClass> getTaxClassList(); - -} \ No newline at end of file Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CardTypeServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CardTypeServiceImpl.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CardTypeServiceImpl.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,43 +0,0 @@ -package jp.sf.pal.pompei.service.impl; - -import java.util.List; - -import jp.sf.pal.pompei.cbean.CardTypeDescriptionCB; -import jp.sf.pal.pompei.exbhv.CardTypeDescriptionBhv; -import jp.sf.pal.pompei.exentity.CardTypeDescription; -import jp.sf.pal.pompei.service.CardTypeService; - -public class CardTypeServiceImpl implements CardTypeService { - /** - * - */ - private static final long serialVersionUID = -5687055982449308486L; - - private transient CardTypeDescriptionBhv cardTypeDescriptionBhv; - - /* (non-Javadoc) - * @see jp.sf.pal.pompei.service.impl.CardTypeService#getCardTypeDescriptionList() - */ - public List<CardTypeDescription> getCardTypeDescriptionList() { - CardTypeDescriptionCB cb = new CardTypeDescriptionCB(); - cb.setupSelect_CardType(); - //TODO needed? - // cb.setupSelect_Language(); - return getCardTypeDescriptionBhv().selectList(cb); - } - - /** - * @return cardTypeDescriptionBhv - */ - public CardTypeDescriptionBhv getCardTypeDescriptionBhv() { - return cardTypeDescriptionBhv; - } - - /** - * @param cardTypeDescriptionBhv 設定する cardTypeDescriptionBhv - */ - public void setCardTypeDescriptionBhv( - CardTypeDescriptionBhv cardTypeDescriptionBhv) { - this.cardTypeDescriptionBhv = cardTypeDescriptionBhv; - } -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CartServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CartServiceImpl.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CartServiceImpl.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,93 +0,0 @@ -package jp.sf.pal.pompei.service.impl; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.sql.Timestamp; -import java.util.Calendar; -import java.util.List; - -import jp.sf.pal.pompei.cbean.CustomerBasketCB; -import jp.sf.pal.pompei.exbhv.CustomerBasketBhv; -import jp.sf.pal.pompei.exentity.CustomerBasket; -import jp.sf.pal.pompei.service.CartService; - -public class CartServiceImpl implements Serializable, CartService { - - /** - * - */ - private static final long serialVersionUID = 2138228904280920698L; - - private transient CustomerBasketBhv customerBasketBhv; - - /** - * @return customersBasketBhv - */ - public CustomerBasketBhv getCustomerBasketBhv() { - return customerBasketBhv; - } - - /** - * @param customersBasketBhv 設定する customersBasketBhv - */ - public void setCustomerBasketBhv(CustomerBasketBhv customersBasketBhv) { - this.customerBasketBhv = customersBasketBhv; - } - - /* (non-Javadoc) - * @see jp.sf.pal.pompei.service.impl.CartService#getCustomerBasket(java.math.BigDecimal, java.math.BigDecimal) - */ - public CustomerBasket getCustomerBasket(BigDecimal customersId, - BigDecimal productsId) { - CustomerBasketCB cb = new CustomerBasketCB(); - cb.setupSelect_Customer(); - cb.setupSelect_Product(); - cb.query().setCustomerId_Equal(customersId); - cb.query().setProductId_Equal(productsId); - return getCustomerBasketBhv().selectEntity(cb); - } - - public void addCustomerBasket(CustomerBasket customersBasket) { - getCustomerBasketBhv().insert(customersBasket); - } - - public void deleteCustomerBasket(BigDecimal customersBasketId) { - CustomerBasketCB cb = new CustomerBasketCB(); - cb.query().setCustomerBasketId_Equal(customersBasketId); - CustomerBasket basket = getCustomerBasketBhv().selectEntity(cb); - if (basket != null) { - getCustomerBasketBhv().delete(basket); - } else { - // TODO throw exception - } - } - - public void updateCustomerBasket(CustomerBasket customersBasket) { - getCustomerBasketBhv().update(customersBasket); - } - - public void cleanupCustomerBasket(BigDecimal customersId) { - // TODO set expire time - Calendar yesterday = Calendar.getInstance(); - yesterday.add(Calendar.DATE, -1); - - CustomerBasketCB cb = new CustomerBasketCB(); - cb.query().setCustomerId_Equal(customersId); - cb.query().setDateAdded_LessEqual( - new Timestamp(yesterday.getTimeInMillis())); - List<CustomerBasket> customersBasketList = getCustomerBasketBhv() - .selectList(cb); - if (customersBasketList.size() > 0) { - getCustomerBasketBhv().deleteList(customersBasketList); - } - } - - public List<CustomerBasket> getCustomerBasketList(BigDecimal customersId) { - CustomerBasketCB cb = new CustomerBasketCB(); - // TODO needed? - cb.setupSelect_Customer(); - cb.setupSelect_Product(); - cb.query().setCustomerId_Equal(customersId); - return getCustomerBasketBhv().selectList(cb); - } -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CategoryServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CategoryServiceImpl.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CategoryServiceImpl.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,176 +0,0 @@ -package jp.sf.pal.pompei.service.impl; - -import java.math.BigDecimal; -import java.sql.Timestamp; -import java.util.Date; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import jp.sf.pal.pompei.PompeiConstants; -import jp.sf.pal.pompei.cbean.CategoryCB; -import jp.sf.pal.pompei.cbean.CategoryDescriptionCB; -import jp.sf.pal.pompei.exbhv.CategoryBhv; -import jp.sf.pal.pompei.exbhv.CategoryDescriptionBhv; -import jp.sf.pal.pompei.exentity.Category; -import jp.sf.pal.pompei.exentity.CategoryDescription; -import jp.sf.pal.pompei.service.CategoryService; -import jp.sf.pal.pompei.service.LanguageService; - -public class CategoryServiceImpl implements CategoryService { - - /** - * - */ - private static final long serialVersionUID = -2643120545206245285L; - - private LanguageService languageService; - - private transient CategoryBhv categoryBhv; - - private transient CategoryDescriptionBhv categoryDescriptionBhv; - - public List<CategoryDescription> getCategoryDescriptionBreadcrumb( - BigDecimal categoryId) { - List<CategoryDescription> cdList = new LinkedList<CategoryDescription>(); - while (categoryId != null) { - CategoryDescription cd = getCategoryDescription(categoryId); - if (cd != null) { - categoryId = cd.getCategory().getParentId(); - cdList.add(0, cd); - } else { - categoryId = null; - } - } - return cdList; - } - - public CategoryDescription getCategoryDescription(BigDecimal categoryId) { - CategoryDescription cd = getCategoryDescription(categoryId, - getLanguageService().getCurrentLanguage().getLanguageId()); - if (cd != null) { - return cd; - } - // language fallback - return getCategoryDescription(categoryId, getLanguageService() - .getDefaultLanguage().getLanguageId()); - } - - public CategoryDescription getCategoryDescription(BigDecimal categoriesId, - BigDecimal languagesId) { - CategoryDescriptionCB cb = new CategoryDescriptionCB(); - cb.setupSelect_Category(); - cb.query().setLanguageId_Equal(languagesId); - cb.query().setCategoryId_Equal(categoriesId); - - CategoryDescription d = this.categoryDescriptionBhv.selectEntity(cb); - - return d; - } - - public List<CategoryDescription> getSubCategoryDescriptionList( - BigDecimal id, BigDecimal languagesId) { - CategoryDescriptionCB cb = new CategoryDescriptionCB(); - cb.setupSelect_Category(); - cb.query().setLanguageId_Equal(languagesId); - cb.query().queryCategory().setParentId_Equal(id); - cb.query().queryCategory().addOrderBy_SortOrder_Asc(); - - List<CategoryDescription> list = categoryDescriptionBhv.selectList(cb); - return list; - } - - public List<CategoryDescription> getSubCategoryDescriptionList(BigDecimal id) { - //TODO fallback - return getSubCategoryDescriptionList(id, getLanguageService() - .getCurrentLanguage().getLanguageId()); - } - - /** - * カテゴリを追加します。 - */ - public void addCategoryDescription(CategoryDescription d) { - Category c = d.getCategory(); - c.setDateAdded(new Timestamp(new Date().getTime())); - c.setLastModified(new Timestamp(new Date().getTime())); - - categoryBhv.insert(c); - - d.setCategoryId(c.getCategoryId()); - d.setLanguageId(new BigDecimal("1")); - - categoryDescriptionBhv.insert(d); - } - - public boolean hasChildCategory(BigDecimal id) { - CategoryCB cb = new CategoryCB(); - cb.query().setParentId_Equal(id); - - int cnt = categoryBhv.selectCount(cb); - - return cnt > 0; - } - - /** - * - */ - public void deleteCategory(BigDecimal id) { - // delete CategoryDescription - CategoryDescriptionCB cb = new CategoryDescriptionCB(); - cb.query().setCategoryId_Equal(id); - List<CategoryDescription> list = categoryDescriptionBhv.selectList(cb); - for (Iterator<CategoryDescription> itr = list.iterator(); itr.hasNext();) { - categoryDescriptionBhv.delete(itr.next()); - } - // delete Category - CategoryCB cb2 = new CategoryCB(); - cb2.query().setCategoryId_Equal(id); - Category c = categoryBhv.selectEntity(cb2); - categoryBhv.delete(c); - } - - public void updateCategoryDescription(CategoryDescription d) { - Category c = d.getCategory(); - // c.setDateAdded(new Timestamp(new Date().getTime())); - c.setLastModified(new Timestamp(new Date().getTime())); - - categoryBhv.update(c); - - d.setCategoryId(c.getCategoryId()); - d.setLanguageId(new BigDecimal("1")); - - categoryDescriptionBhv.update(d); - } - - /** - * @return languageService - */ - public LanguageService getLanguageService() { - return languageService; - } - - /** - * @param languageService 設定する languageService - */ - public void setLanguageService(LanguageService languageService) { - this.languageService = languageService; - } - - public CategoryBhv getCategoryBhv() { - return categoryBhv; - } - - public void setCategoryBhv(CategoryBhv categoriesBhv) { - this.categoryBhv = categoriesBhv; - } - - public CategoryDescriptionBhv getCategoryDescriptionBhv() { - return categoryDescriptionBhv; - } - - public void setCategoryDescriptionBhv( - CategoryDescriptionBhv categoriesDescriptionBhv) { - this.categoryDescriptionBhv = categoriesDescriptionBhv; - } - -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CustomerServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CustomerServiceImpl.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/CustomerServiceImpl.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,538 +0,0 @@ -package jp.sf.pal.pompei.service.impl; - -import java.io.StringWriter; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Properties; -import java.util.StringTokenizer; - -import javax.faces.context.FacesContext; -import javax.mail.Message; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; - -import jp.sf.pal.common.CommonException; -import jp.sf.pal.pompei.PompeiConstants; -import jp.sf.pal.pompei.cbean.AddressBookCB; -import jp.sf.pal.pompei.cbean.CustomerBasketAttributeCB; -import jp.sf.pal.pompei.cbean.CustomerBasketCB; -import jp.sf.pal.pompei.cbean.CustomerCB; -import jp.sf.pal.pompei.cbean.ZoneCB; -import jp.sf.pal.pompei.exbhv.AddressBookBhv; -import jp.sf.pal.pompei.exbhv.CustomerBasketAttributeBhv; -import jp.sf.pal.pompei.exbhv.CustomerBasketBhv; -import jp.sf.pal.pompei.exbhv.CustomerBhv; -import jp.sf.pal.pompei.exbhv.ZoneBhv; -import jp.sf.pal.pompei.exentity.AddressBook; -import jp.sf.pal.pompei.exentity.Customer; -import jp.sf.pal.pompei.exentity.CustomerBasket; -import jp.sf.pal.pompei.exentity.CustomerBasketAttribute; -import jp.sf.pal.pompei.exentity.Zone; -import jp.sf.pal.pompei.service.CustomerService; -import jp.sf.pal.pompei.util.SystemUtil; -import jp.sf.pal.pompei.util.UserRegistrationUtil; -import jp.sf.pal.pompei.util.VelocityUtil; - -import org.apache.jetspeed.JetspeedActions; -import org.apache.jetspeed.PortalReservedParameters; -import org.apache.jetspeed.administration.AdministrationEmailException; -import org.apache.jetspeed.locator.JetspeedTemplateLocator; -import org.apache.jetspeed.locator.LocatorDescriptor; -import org.apache.jetspeed.locator.TemplateDescriptor; -import org.apache.jetspeed.locator.TemplateLocatorException; -import org.apache.jetspeed.om.common.SecurityConstraint; -import org.apache.jetspeed.om.folder.Folder; -import org.apache.jetspeed.page.PageManager; -import org.apache.jetspeed.request.RequestContext; -import org.apache.jetspeed.security.User; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; - -public class CustomerServiceImpl implements CustomerService { - - /** - * - */ - private static final long serialVersionUID = -5106715434338567436L; - - private static final String PATH_SEPARATOR = "/"; - - private transient CustomerBhv customerBhv; - - private transient AddressBookBhv addressBookBhv; - - private transient ZoneBhv zoneBhv; - - private transient CustomerBasketBhv customerBasketBhv; - - private transient CustomerBasketAttributeBhv customerBasketAttributeBhv; - - public void updateCustomer(Customer customer, AddressBook addressBook) { - getCustomerBhv().update(customer); - - if (addressBook != null) { - getAddressBookBhv().update(addressBook); - } - } - - public List<Customer> getCustomerList() { - CustomerCB cb = new CustomerCB(); - List<Customer> customersList = customerBhv.selectList(cb); - return customersList; - } - - public Customer getCustomer(BigDecimal customersId) { - CustomerCB cb = new CustomerCB(); - cb.query().setCustomerId_Equal(customersId); - Customer customers = customerBhv.selectEntity(cb); - return customers; - } - - public Customer getCustomerByPortalId(String portalId) { - CustomerCB cb = new CustomerCB(); - // cb.setupSelect_CustomerInfoAsOne(); - cb.query().setPortalId_Equal(portalId); - List<Customer> customers = customerBhv.selectList(cb); - if(customers.isEmpty()){ - return null; - } - return customers.get(0); - } - - public void deleteCustomer(BigDecimal customerId) { - Customer customer = getCustomer(customerId); - - // address book - AddressBookCB addressBookCB = new AddressBookCB(); - addressBookCB.query().setCustomerId_Equal(customer.getCustomerId()); - List<AddressBook> addressBookList = addressBookBhv - .selectList(addressBookCB); - if (addressBookList != null && !addressBookList.isEmpty()) { - addressBookBhv.deleteList(addressBookList); - } - - // customer basket - CustomerBasketCB customerBasketCB = new CustomerBasketCB(); - customerBasketCB.query().setCustomerId_Equal(customer.getCustomerId()); - List<CustomerBasket> customerBasketList = getCustomerBasketBhv() - .selectList(customerBasketCB); - if (customerBasketList != null && !customerBasketList.isEmpty()) { - getCustomerBasketBhv().deleteList(customerBasketList); - } - - // customer basket attribute - CustomerBasketAttributeCB customerBasketAttributeCB = new CustomerBasketAttributeCB(); - customerBasketAttributeCB.query().setCustomerId_Equal( - customer.getCustomerId()); - List<CustomerBasketAttribute> customerBasketAttributeList = getCustomerBasketAttributeBhv() - .selectList(customerBasketAttributeCB); - if (customerBasketAttributeList != null - && !customerBasketAttributeList.isEmpty()) { - getCustomerBasketAttributeBhv().deleteList( - customerBasketAttributeList); - } - - customerBhv.delete(customer); - } - - public AddressBook getAddressBook(BigDecimal addressBookId) { - AddressBookCB cb = new AddressBookCB(); - cb.setupSelect_Customer(); - //TODO needed? - cb.setupSelect_Country(); - // needed(for tax) - cb.setupSelect_Zone(); - cb.setupSelect_Language(); - cb.query().setAddressBookId_Equal(addressBookId); - return getAddressBookBhv().selectEntity(cb); - } - - public AddressBook getDefaultAddressBook(BigDecimal customerId) { - AddressBookCB cb = new AddressBookCB(); - //TODO needed? - cb.setupSelect_Customer(); - //TODO needed? - cb.setupSelect_Country(); - // needed(for tax) - cb.setupSelect_Zone(); - //TODO needed? - cb.setupSelect_Language(); - - cb.query().setCustomerId_Equal(customerId); - for (AddressBook ab : getAddressBookBhv().selectList(cb)) { - if (PompeiConstants.TRUE_BIGDECIMAL.equals(ab.getDefaultAddress())) { - return ab; - } - } - return null; - - } - - public void addCustomer(Customer customer, AddressBook addressBook) { - //TODO check portalid - getCustomerBhv().insert(customer); - addressBook.setCustomerId(customer.getCustomerId()); - getAddressBookBhv().insert(addressBook); - } - - public void addCustomer(Map<String, String> userInfo, Customer customer, - AddressBook addressBook) throws CommonException { - - String password = userInfo.remove(PompeiConstants.USER_PASSWORD); - String verifyPassword = userInfo - .remove(PompeiConstants.USER_VERIFY_PASSWORD); - if (!UserRegistrationUtil - .getBoolean(PompeiConstants.FORCE_GENERATED_PASSWORD)) { - if (password == null || password.equals("")) { - throw new CommonException("error.lacking.password", - "The password is null."); - } - } - - if (UserRegistrationUtil - .getBoolean(PompeiConstants.FORCE_USE_EMAIL_AS_USERNAME)) { - // force user.name to be same as email - userInfo.put(PompeiConstants.USER_NAME, userInfo - .get(PompeiConstants.USER_BUSINESS_INFO_ONLINE_EMAIL)); - } - - boolean userIdExistsFlag = true; - try { - SystemUtil.getUserManager().getUser( - userInfo.get(PompeiConstants.USER_NAME)); - } catch (org.apache.jetspeed.security.SecurityException e) { - userIdExistsFlag = false; - } - - if (userIdExistsFlag) { - throw new CommonException("error.userid_already_exists", - "The user id already exists."); - } - - if (UserRegistrationUtil.getBoolean(PompeiConstants.FORCE_UNIQUE_EMAIL)) { - boolean emailExistsFlag = true; - User user = null; - try { - user = SystemUtil - .getPortalAdministration() - .lookupUserFromEmail( - userInfo - .get(PompeiConstants.USER_BUSINESS_INFO_ONLINE_EMAIL)); - } catch (AdministrationEmailException e) { - emailExistsFlag = false; - } - if ((emailExistsFlag) || (user != null)) { - throw new CommonException("error.email_already_exists", - "The email already exists."); - } - - } - - if (UserRegistrationUtil - .getBoolean(PompeiConstants.FORCE_GENERATED_PASSWORD)) { - try { - password = SystemUtil.getPortalAdministration() - .generatePassword(); - } catch (Exception e) { - throw new CommonException("error.failed_to_generate_password", - "Could not create password.", e); - } - } else { - if (verifyPassword == null || !verifyPassword.equals(password)) { - throw new CommonException("error.two_passwords_do_not_match", - "Two passwords do not match."); - } - } - - String userName = userInfo.get(PompeiConstants.USER_NAME); - Customer c=getCustomerByPortalId(userName); - if(c!=null){ - deleteCustomer(c.getCustomerId()); - } - - try { - SystemUtil.getPortalAdministration().registerUser( - userName, - password, - UserRegistrationUtil.getStringList(PompeiConstants.ROLES), - UserRegistrationUtil.getStringList(PompeiConstants.GROUPS), - userInfo, // note use of only - // PLT.D values here. - UserRegistrationUtil.getStringMap(PompeiConstants.RULES), - PompeiConstants.DEFAULT_USER_TEMPLATE_FOLDER); // TODO default template path - } catch (Exception e) { - cancelToAddCustomer(userInfo, customer, addressBook); - throw new CommonException("error.failed_to_add", - "Could not register a user.", e); - } - - // set security constraint - String userhome = Folder.USER_FOLDER + userName; - try { - PageManager pageManager = SystemUtil.getPageManager(); - SecurityConstraint sc = pageManager.newPageSecurityConstraint(); - sc.setUsers(parseCSVList(userName)); - List<String> permissions = new ArrayList<String>(); - permissions.add(JetspeedActions.VIEW); - permissions.add(JetspeedActions.EDIT); - permissions.add(JetspeedActions.HELP); - sc.setPermissions(permissions); - Folder userFolder = pageManager.getFolder(userhome); - - if (userFolder.getSecurityConstraints() == null) { - userFolder.setSecurityConstraints(pageManager - .newSecurityConstraints()); - } - userFolder.getSecurityConstraints().getSecurityConstraints() - .add(sc); - - pageManager.updateFolder(userFolder); - pageManager.reset(); - } catch (Exception e) { - cancelToAddCustomer(userInfo, customer, addressBook); - throw new CommonException("could.not.access.folder", - "Could not access a folder: " + userhome, e); - } - - // set portal id - customer.setPortalId(userName); - - try { - // create customer - getCustomerBhv().insert(customer); - addressBook.setCustomerId(customer.getCustomerId()); - getAddressBookBhv().insert(addressBook); - } catch (Exception e) { - cancelToAddCustomer(userInfo, customer, addressBook); - throw new CommonException("could.not.insert.customer.data", - "Could not insert customer data. ", e); - } - - if (UserRegistrationUtil.getBoolean(PompeiConstants.SEND_MAIL)) { - if (password != null) { - userInfo.put("password", password); - } - - try { - // template - // String templ = getTemplatePath(FacesContext - // .getCurrentInstance()); - // - // if (templ == null) { - // cancelToAddCustomer(userInfo, customer, addressBook); - // throw new CommonException( - // "error.registration_completed_but_could_not_find_template", - // "Email template is not available."); - // } - // SystemUtil - // .getPortalAdministration() - // .sendEmail( - // (PortletConfig) FacesContext - // .getCurrentInstance() - // .getExternalContext().getRequestMap() - // .get("javax.portlet.PortletConfig"), - // userInfo - // .get(PompeiConstants.USER_BUSINESS_INFO_ONLINE_EMAIL), - // emailSubject, templ, userInfo); - //TODO move user-signup.vm to init-param - sendSignupMail(userInfo, userInfo - .get(PompeiConstants.USER_BUSINESS_INFO_ONLINE_EMAIL), - SystemUtil.getAdministratorEmail(), "user-signup.vm"); - } catch (Exception e) { - cancelToAddCustomer(userInfo, customer, addressBook); - throw new CommonException( - "error.registration_completed_but_could_not_send", - "Could not send a registration mail.", e); - } - } - - } - - private void sendSignupMail(Map<String, String> userInfo, String to, - String from, String templateName) throws Exception { - // set velocity context - VelocityContext context = new VelocityContext(); - context.put("map", userInfo); - - VelocityUtil.init(); - StringWriter sw = new StringWriter(); - String templatePath = SystemUtil - .getSignupNotificationTemplatePath(templateName); - // TODO i18n: encoding - Template template = VelocityUtil.getTemplate(templatePath, "UTF-8"); - - template.merge(context, sw); - - String content = sw.toString(); - if (content == null) { - throw new CommonException("signup.content.is.null"); - } - int index = content.indexOf("\n"); - String subject = null; - String body = null; - if (index != -1) { - subject = content.substring(0, index); - body = content.substring(index); - } else { - // TODO should throw exception? - subject = content; - body = content; - } - - Properties props = System.getProperties(); - // set smtp server - props.put("mail.smtp.host", SystemUtil.getSmtpHost()); - Session session = Session.getDefaultInstance(props, null); - MimeMessage mimeMessage = new MimeMessage(session); - mimeMessage.setFrom(new InternetAddress(from)); - mimeMessage.setRecipients(Message.RecipientType.TO, to); - //TODO i18n: encoding - mimeMessage.setSubject(subject, "iso-2022-jp"); - //TODO i18n: encoding - mimeMessage.setText(body, "iso-2022-jp"); - mimeMessage.setHeader("Content-Type", "text/plain"); - mimeMessage.setSentDate(new Date()); - - Transport.send(mimeMessage); - - } - - protected void cancelToAddCustomer(Map<String, String> userInfo, - Customer customer, AddressBook addressBook) { - try { - getAddressBookBhv().delete(addressBook); - } catch (Exception e) { - } - - try { - getCustomerBhv().delete(customer); - } catch (Exception e) { - } - - try { - String userhome = Folder.USER_FOLDER - + userInfo.get(PompeiConstants.USER_NAME); - PageManager pageManager = SystemUtil.getPageManager(); - Folder folder = pageManager.getFolder(userhome); - pageManager.removeFolder(folder); - } catch (Exception e) { - } - - try { - SystemUtil.getUserManager().removeUser( - userInfo.get(PompeiConstants.USER_NAME)); - } catch (Exception e) { - } - } - - private List<String> parseCSVList(String csv) { - List<String> csvList = new ArrayList<String>(); - if (csv != null) { - if (csv.indexOf(',') != -1) { - StringTokenizer csvTokens = new StringTokenizer(csv, ","); - while (csvTokens.hasMoreTokens()) { - csvList.add(csvTokens.nextToken().trim()); - } - } else { - csvList.add(csv); - } - } - return csvList; - } - - public Zone getZone(BigDecimal zoneId) { - ZoneCB cb = new ZoneCB(); - cb.setupSelect_Country(); - cb.query().setZoneId_Equal(zoneId); - return getZoneBhv().selectEntity(cb); - } - - public void addAddressBook(AddressBook addressBook) { - getAddressBookBhv().insert(addressBook); - } - - public void updateCustomer(Customer customers) { - customerBhv.update(customers); - } - - public List<AddressBook> getAddressBookList(BigDecimal customersId) { - AddressBookCB cb = new AddressBookCB(); - //TODO needed? - // cb.setupSelect_Customer(); - //TODO needed? - // cb.setupSelect_Zone(); - //TODO needed? - // cb.setupSelect_Countries(); - cb.query().setCustomerId_Equal(customersId); - return getAddressBookBhv().selectList(cb); - } - - public void deleteAddressBook(AddressBook addressBook) { - getAddressBookBhv().delete(addressBook); - } - - public AddressBookBhv getAddressBookBhv() { - return addressBookBhv; - } - - public void setAddressBookBhv(AddressBookBhv addressBookBhv) { - this.addressBookBhv = addressBookBhv; - } - - public CustomerBhv getCustomerBhv() { - return customerBhv; - } - - public void setCustomerBhv(CustomerBhv customersBhv) { - this.customerBhv = customersBhv; - } - - /** - * @return zonesBhv - */ - public ZoneBhv getZoneBhv() { - return zoneBhv; - } - - /** - * @param zonesBhv 設定する zonesBhv - */ - public void setZoneBhv(ZoneBhv zonesBhv) { - this.zoneBhv = zonesBhv; - } - - /** - * @return customerBasketBhv - */ - public CustomerBasketBhv getCustomerBasketBhv() { - return customerBasketBhv; - } - - /** - * @param customerBasketBhv 設定する customerBasketBhv - */ - public void setCustomerBasketBhv(CustomerBasketBhv customerBasketBhv) { - this.customerBasketBhv = customerBasketBhv; - } - - /** - * @return customerBasketAttributeBhv - */ - public CustomerBasketAttributeBhv getCustomerBasketAttributeBhv() { - return customerBasketAttributeBhv; - } - - /** - * @param customerBasketAttributeBhv 設定する customerBasketAttributeBhv - */ - public void setCustomerBasketAttributeBhv( - CustomerBasketAttributeBhv customerBasketAttributeBhv) { - this.customerBasketAttributeBhv = customerBasketAttributeBhv; - } -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/DeliveryMethodServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/DeliveryMethodServiceImpl.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/DeliveryMethodServiceImpl.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,129 +0,0 @@ -package jp.sf.pal.pompei.service.impl; - -import java.math.BigDecimal; -import java.sql.Timestamp; -import java.util.Date; -import java.util.List; - -import jp.sf.pal.pompei.cbean.DeliveryMethodCB; -import jp.sf.pal.pompei.cbean.DeliveryMethodDescriptionCB; -import jp.sf.pal.pompei.exbhv.DeliveryMethodBhv; -import jp.sf.pal.pompei.exbhv.DeliveryMethodDescriptionBhv; -import jp.sf.pal.pompei.exentity.DeliveryMethod; -import jp.sf.pal.pompei.exentity.DeliveryMethodDescription; -import jp.sf.pal.pompei.service.DeliveryMethodSerivce; - -public class DeliveryMethodServiceImpl implements DeliveryMethodSerivce { - /** - * - */ - private static final long serialVersionUID = 5301108480977315517L; - - private transient DeliveryMethodBhv deliveryMethodBhv; - - private transient DeliveryMethodDescriptionBhv deliveryMethodDescriptionBhv; - - /** - * @return deliveryMethodBhv - */ - public DeliveryMethodBhv getDeliveryMethodBhv() { - return deliveryMethodBhv; - } - - /** - * @param deliveryMethodBhv 設定する deliveryMethodBhv - */ - public void setDeliveryMethodBhv(DeliveryMethodBhv deliveryMethodBhv) { - this.deliveryMethodBhv = deliveryMethodBhv; - } - - /** - * @return deliveryMethodDescriptionBhv - */ - public DeliveryMethodDescriptionBhv getDeliveryMethodDescriptionBhv() { - return deliveryMethodDescriptionBhv; - } - - /** - * @param deliveryMethodDescriptionBhv 設定する deliveryMethodDescriptionBhv - */ - public void setDeliveryMethodDescriptionBhv( - DeliveryMethodDescriptionBhv deliveryMethodDescriptionBhv) { - this.deliveryMethodDescriptionBhv = deliveryMethodDescriptionBhv; - } - - /* (non-Javadoc) - * @see jp.sf.pal.pompei.service.impl.DeliveryMethodSerivce#getDeliveryMethodList() - */ - public List<DeliveryMethodDescription> getDeliveryMethodDescriptionList() { - DeliveryMethodDescriptionCB cb = new DeliveryMethodDescriptionCB(); - cb.setupSelect_DeliveryMethod(); - cb.query().setLanguageId_Equal(new BigDecimal("1")); - cb.query().queryDeliveryMethod().addOrderBy_SortOrder_Asc(); - - List<DeliveryMethodDescription> list = getDeliveryMethodDescriptionBhv() - .selectList(cb); - return list; - } - - /* (non-Javadoc) - * @see jp.sf.pal.pompei.service.impl.DeliveryMethodSerivce#getDeliveryMethodDescription(java.math.BigDecimal) - */ - public DeliveryMethodDescription getDeliveryMethodDescription( - BigDecimal deliveryMethodId) { - DeliveryMethodDescriptionCB cb = new DeliveryMethodDescriptionCB(); - cb.setupSelect_DeliveryMethod(); - cb.query().setLanguageId_Equal(new BigDecimal("1")); - cb.query().setDeliveryMethodId_Equal(deliveryMethodId); - - DeliveryMethodDescription d = getDeliveryMethodDescriptionBhv() - .selectEntity(cb); - return d; - } - - /* (non-Javadoc) - * @see jp.sf.pal.pompei.service.impl.DeliveryMethodSerivce#addDeliveryMethod(jp.sf.pal.pompei.exentity.DeliveryMethodDescription) - */ - public void addDeliveryMethodDescription(DeliveryMethodDescription d) { - DeliveryMethod dm = d.getDeliveryMethod(); - dm.setDateAdded(new Timestamp(new Date().getTime())); - dm.setLastModified(new Timestamp(new Date().getTime())); - - getDeliveryMethodBhv().insert(dm); - - d.setDeliveryMethodId(dm.getDeliveryMethodId()); - d.setLanguageId(new BigDecimal("1")); - - getDeliveryMethodDescriptionBhv().insert(d); - } - - /* (non-Javadoc) - * @see jp.sf.pal.pompei.service.impl.DeliveryMethodSerivce#deleteDeliveryMethod(java.math.BigDecimal) - */ - public void deleteDeliveryMethod(BigDecimal id) { - DeliveryMethodDescriptionCB cb = new DeliveryMethodDescriptionCB(); - cb.query().setDeliveryMethodId_Equal(id); - DeliveryMethodDescription d = deliveryMethodDescriptionBhv - .selectEntity(cb); - deliveryMethodDescriptionBhv.delete(d); - DeliveryMethodCB cb2 = new DeliveryMethodCB(); - cb2.query().setDeliveryMethodId_Equal(id); - DeliveryMethod c = deliveryMethodBhv.selectEntity(cb2); - deliveryMethodBhv.delete(c); - } - - /* (non-Javadoc) - * @see jp.sf.pal.pompei.service.impl.DeliveryMethodSerivce#updateDeliveryMethod(jp.sf.pal.pompei.exentity.DeliveryMethodDescription) - */ - public void updateDeliveryMethodDescription(DeliveryMethodDescription d) { - DeliveryMethod c = d.getDeliveryMethod(); - c.setLastModified(new Timestamp(new Date().getTime())); - - deliveryMethodBhv.update(c); - - d.setDeliveryMethodId(c.getDeliveryMethodId()); - d.setLanguageId(new BigDecimal("1")); - - deliveryMethodDescriptionBhv.update(d); - } -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/LanguageServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/LanguageServiceImpl.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/LanguageServiceImpl.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,96 +0,0 @@ -package jp.sf.pal.pompei.service.impl; - -import java.math.BigDecimal; -import java.util.Locale; - -import javax.faces.component.UIViewRoot; -import javax.faces.context.FacesContext; - -import jp.sf.pal.pompei.cbean.LanguageCB; -import jp.sf.pal.pompei.exbhv.LanguageBhv; -import jp.sf.pal.pompei.exentity.Language; -import jp.sf.pal.pompei.service.LanguageService; - -import org.seasar.framework.util.StringUtil; - -public class LanguageServiceImpl implements LanguageService { - /** - * - */ - private static final long serialVersionUID = -4897568594823098906L; - - private transient LanguageBhv languageBhv; - - private Language currentLanguage; - - private Language defaultLanguage; - - /** - * @return languagesBhv - */ - public LanguageBhv getLanguageBhv() { - return languageBhv; - } - - /** - * @param languagesBhv 設定する languagesBhv - */ - public void setLanguageBhv(LanguageBhv languagesBhv) { - this.languageBhv = languagesBhv; - } - - /* (non-Javadoc) - * @see jp.sf.pal.pompei.service.impl.LanguageService#getCurrentLanguage() - */ - public Language getCurrentLanguage() { - if (currentLanguage == null) { - Locale locale = Locale.ENGLISH; - // get locale - FacesContext facesContext = FacesContext.getCurrentInstance(); - if (facesContext != null) { - UIViewRoot viewRoot = facesContext.getViewRoot(); - if (viewRoot != null) { - locale = viewRoot.getLocale(); - } - } - // language+country - if (!StringUtil.isEmpty(locale.getCountry())) { - LanguageCB cb = new LanguageCB(); - cb.query().setLocaleName_Equal( - locale.getLanguage() + "_" + locale.getCountry()); - currentLanguage = getLanguageBhv().selectEntity(cb); - } - if (currentLanguage == null) { - // language - LanguageCB cb = new LanguageCB(); - cb.query().setLocaleName_Equal(locale.getLanguage()); - currentLanguage = getLanguageBhv().selectEntity(cb); - } - if (currentLanguage == null) { - // default 1 - LanguageCB cb = new LanguageCB(); - cb.query().setLanguageId_Equal(new BigDecimal(1)); - currentLanguage = getLanguageBhv().selectEntity(cb); - } - if (currentLanguage == null) { - throw new IllegalStateException( - "Could not find a language information in DB."); - } - } - return currentLanguage; - } - - public Language getDefaultLanguage() { - if (defaultLanguage == null) { - LanguageCB cb = new LanguageCB(); - cb.query().setLanguageId_Equal(new BigDecimal(1)); - defaultLanguage = getLanguageBhv().selectEntity(cb); - if (defaultLanguage == null) { - throw new IllegalStateException( - "Could not find a language information in DB."); - } - } - return defaultLanguage; - } - -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/ManufacturerServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/ManufacturerServiceImpl.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/ManufacturerServiceImpl.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,138 +0,0 @@ -package jp.sf.pal.pompei.service.impl; - -import java.math.BigDecimal; -import java.sql.Timestamp; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import jp.sf.pal.pompei.cbean.ManufacturerCB; -import jp.sf.pal.pompei.cbean.ManufacturerDescriptionCB; -import jp.sf.pal.pompei.exbhv.ManufacturerBhv; -import jp.sf.pal.pompei.exbhv.ManufacturerDescriptionBhv; -import jp.sf.pal.pompei.exentity.Manufacturer; -import jp.sf.pal.pompei.exentity.ManufacturerDescription; -import jp.sf.pal.pompei.service.LanguageService; -import jp.sf.pal.pompei.service.ManufacturerService; - -/** - * メーカーに関する操作を管理します。 - * @author takeharu - * - */ -public class ManufacturerServiceImpl implements ManufacturerService { - - /** - * - */ - private static final long serialVersionUID = -6815449303231732191L; - - private LanguageService languageService; - - private transient ManufacturerBhv manufacturerBhv; - - private transient ManufacturerDescriptionBhv manufacturerDescriptionBhv; - - /** - * @return languageService - */ - public LanguageService getLanguageService() { - return languageService; - } - - /** - * @param languageService 設定する languageService - */ - public void setLanguageService(LanguageService languageService) { - this.languageService = languageService; - } - - public void addManufactureDescription(ManufacturerDescription info) { - Manufacturer manufacturers = info.getManufacturer(); - manufacturers.setDateAdded(new Timestamp(new Date().getTime())); - manufacturers.setLastModified(new Timestamp(new Date().getTime())); - manufacturerBhv.insert(manufacturers); - - info.setManufacturerId(manufacturers.getManufacturerId()); - manufacturerDescriptionBhv.insert(info); - - } - - public void deleteManufacture(BigDecimal id) { - ManufacturerDescriptionCB cb = new ManufacturerDescriptionCB(); - cb.query().setManufacturerId_Equal(id); - List<ManufacturerDescription> entities = manufacturerDescriptionBhv - .selectList(cb); - for (Iterator<ManufacturerDescription> itr = entities.iterator(); itr - .hasNext();) { - manufacturerDescriptionBhv.delete(itr.next()); - } - - ManufacturerCB cb2 = new ManufacturerCB(); - cb2.query().setManufacturerId_Equal(id); - Manufacturer manufacturers = manufacturerBhv.selectEntity(cb2); - manufacturerBhv.delete(manufacturers); - } - - public ManufacturerDescription getManufactureDescription(BigDecimal id) { - return getManufactureDescription(id, getLanguageService() - .getCurrentLanguage().getLanguageId()); - } - - public ManufacturerDescription getManufactureDescription(BigDecimal id, - BigDecimal languagesId) { - ManufacturerDescriptionCB cb = new ManufacturerDescriptionCB(); - cb.setupSelect_Manufacturer(); - cb.query().setManufacturerId_Equal(id); - cb.query().setLanguageId_Equal(languagesId); - return manufacturerDescriptionBhv.selectEntity(cb); - } - - public List<ManufacturerDescription> getManufactureDescriptionList() { - return getManufactureDescriptionList(getLanguageService() - .getCurrentLanguage().getLanguageId()); - } - - public List<ManufacturerDescription> getManufactureDescriptionList( - BigDecimal languagesId) { - ManufacturerDescriptionCB cb = new ManufacturerDescriptionCB(); - cb.addOrderBy_PK_Asc(); - cb.setupSelect_Manufacturer(); - cb.query().setLanguageId_Equal(languagesId); - return manufacturerDescriptionBhv.selectList(cb); - } - - public List<Manufacturer> getManufacturerList() { - ManufacturerCB cb = new ManufacturerCB(); - List<Manufacturer> list = manufacturerBhv.selectList(cb); - // List<String> nameList = new ArrayList<String>(); - // for (Manufacturer m : list) { - // nameList.add(m.getManufacturerName()); - // } - return list; - } - - public void updateManufactureDescription(ManufacturerDescription info) { - manufacturerDescriptionBhv.update(info); - - Manufacturer manufacturers = info.getManufacturer(); - manufacturerBhv.update(manufacturers); - } - - public ManufacturerDescriptionBhv getManufacturerDescriptionBhv() { - return manufacturerDescriptionBhv; - } - - public void setManufacturerDescriptionBhv(ManufacturerDescriptionBhv infoBhv) { - this.manufacturerDescriptionBhv = infoBhv; - } - - public ManufacturerBhv getManufacturerBhv() { - return manufacturerBhv; - } - - public void setManufacturerBhv(ManufacturerBhv manuBhv) { - this.manufacturerBhv = manuBhv; - } - -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/OrderServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/OrderServiceImpl.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/OrderServiceImpl.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,911 +0,0 @@ -package jp.sf.pal.pompei.service.impl; - -import java.io.StringWriter; -import java.math.BigDecimal; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Properties; - -import javax.mail.Message; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; - -import jp.sf.pal.common.CommonException; -import jp.sf.pal.pompei.PompeiConstants; -import jp.sf.pal.pompei.allcommon.cbean.PagingResultBean; -import jp.sf.pal.pompei.cbean.CurrencyCB; -import jp.sf.pal.pompei.cbean.CustomerBasketCB; -import jp.sf.pal.pompei.cbean.OrderCardInfoCB; -import jp.sf.pal.pompei.cbean.OrderCommentCB; -import jp.sf.pal.pompei.cbean.OrderFormCB; -import jp.sf.pal.pompei.cbean.OrderNotificationCB; -import jp.sf.pal.pompei.cbean.OrderProductAttributeCB; -import jp.sf.pal.pompei.cbean.OrderProductCB; -import jp.sf.pal.pompei.cbean.OrderProductDownloadCB; -import jp.sf.pal.pompei.cbean.OrderStatusCB; -import jp.sf.pal.pompei.cbean.OrderStatusDescriptionCB; -import jp.sf.pal.pompei.cbean.OrderStatusHistoryCB; -import jp.sf.pal.pompei.cbean.ProductDescriptionCB; -import jp.sf.pal.pompei.dxo.OrderFormDxo; -import jp.sf.pal.pompei.dxo.ProductDxo; -import jp.sf.pal.pompei.entity.notification.order.Order; -import jp.sf.pal.pompei.exbhv.CurrencyBhv; -import jp.sf.pal.pompei.exbhv.CustomerBasketBhv; -import jp.sf.pal.pompei.exbhv.OrderCardInfoBhv; -import jp.sf.pal.pompei.exbhv.OrderCommentBhv; -import jp.sf.pal.pompei.exbhv.OrderFormBhv; -import jp.sf.pal.pompei.exbhv.OrderNotificationBhv; -import jp.sf.pal.pompei.exbhv.OrderProductAttributeBhv; -import jp.sf.pal.pompei.exbhv.OrderProductBhv; -import jp.sf.pal.pompei.exbhv.OrderProductDownloadBhv; -import jp.sf.pal.pompei.exbhv.OrderStatusBhv; -import jp.sf.pal.pompei.exbhv.OrderStatusDescriptionBhv; -import jp.sf.pal.pompei.exbhv.OrderStatusHistoryBhv; -import jp.sf.pal.pompei.exbhv.ProductBhv; -import jp.sf.pal.pompei.exbhv.ProductDescriptionBhv; -import jp.sf.pal.pompei.exentity.AddressBook; -import jp.sf.pal.pompei.exentity.Currency; -import jp.sf.pal.pompei.exentity.Customer; -import jp.sf.pal.pompei.exentity.CustomerBasket; -import jp.sf.pal.pompei.exentity.DeliveryMethod; -import jp.sf.pal.pompei.exentity.OrderCardInfo; -import jp.sf.pal.pompei.exentity.OrderComment; -import jp.sf.pal.pompei.exentity.OrderForm; -import jp.sf.pal.pompei.exentity.OrderNotification; -import jp.sf.pal.pompei.exentity.OrderProduct; -import jp.sf.pal.pompei.exentity.OrderProductAttribute; -import jp.sf.pal.pompei.exentity.OrderProductDownload; -import jp.sf.pal.pompei.exentity.OrderStatus; -import jp.sf.pal.pompei.exentity.OrderStatusDescription; -import jp.sf.pal.pompei.exentity.OrderStatusHistory; -import jp.sf.pal.pompei.exentity.PaymentMethod; -import jp.sf.pal.pompei.exentity.Product; -import jp.sf.pal.pompei.exentity.ProductDescription; -import jp.sf.pal.pompei.pager.OrderFormPager; -import jp.sf.pal.pompei.service.LanguageService; -import jp.sf.pal.pompei.service.OrderService; -import jp.sf.pal.pompei.util.SystemUtil; -import jp.sf.pal.pompei.util.VelocityUtil; - -import org.apache.commons.lang.StringUtils; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.seasar.framework.log.Logger; - -public class OrderServiceImpl implements OrderService { - - /** - * - */ - private static final long serialVersionUID = -6452405711117279851L; - - /** - * Logger for this class - */ - private static final Logger logger = Logger - .getLogger(OrderServiceImpl.class); - - private transient OrderFormBhv orderFormBhv; - - private transient CurrencyBhv currencyBhv; - - private transient OrderCardInfoBhv orderCardInfoBhv; - - private transient CustomerBasketBhv customerBasketBhv; - - private transient OrderProductBhv orderProductBhv; - - private transient ProductBhv productBhv; - - private transient ProductDescriptionBhv productDescriptionBhv; - - private transient OrderStatusDescriptionBhv orderStatusDescriptionBhv; - - private transient OrderStatusBhv orderStatusBhv; - - private transient OrderStatusHistoryBhv orderStatusHistoryBhv; - - private transient OrderProductAttributeBhv orderProductAttributeBhv; - - private transient OrderProductDownloadBhv orderProductDownloadBhv; - - private transient OrderCommentBhv orderCommentBhv; - - private transient OrderNotificationBhv orderNotificationBhv; - - private OrderFormDxo orderFormDxo; - - private LanguageService languageService; - - private ProductDxo productDxo; - - public void sendOrderNotifications(BigDecimal orderFormId, - BigDecimal[] orderNotificationIds) throws CommonException { - if (orderFormId == null) { - throw new CommonException("orderFormId.is.null.in.notification"); - } - OrderForm orderForm = getOrderForm(orderFormId); - if (orderForm == null) { - throw new CommonException( - "could.not.find.orderformid.in.notification"); - } - List<String> errors = new ArrayList<String>(); - for (BigDecimal orderNotificationId : orderNotificationIds) { - OrderNotification orderNotification = getOrderNotification(orderNotificationId); - if (orderNotification != null) { - String to = orderNotification.getEmailAddress(); - if (to == null || "".equals(to)) { - to = orderForm.getCustomerEmailAddress(); - } - try { - sendOrderNotification(orderForm, to, SystemUtil - .getAdministratorEmail(), orderNotification - .getTemplateName()); - } catch (Exception e) { - logger.log("EPC0004", new Object[] {}, e); - errors.add(orderNotification.getTemplateName() + "(" + to - + ")"); - } - } - } - if (!errors.isEmpty()) { - String templates = StringUtils.join(errors.toArray(), ", "); - throw new CommonException("failed.to.send.some.order.notification", - new String[] { templates }); - } - } - - private ProductDescription getProdcutDescription(BigDecimal id) { - return getProdcutDescription(id, getLanguageService() - .getCurrentLanguage().getLanguageId()); - } - - private ProductDescription getProdcutDescription(BigDecimal id, - BigDecimal languagesId) { - ProductDescriptionCB cb = new ProductDescriptionCB(); - cb.setupSelect_Product(); - - cb.query().setLanguageId_Equal(languagesId); - cb.query().setProductId_Equal(id); - return productDescriptionBhv.selectEntity(cb); - } - - private void sendOrderNotification(OrderForm orderForm, String to, - String from, String templateName) throws CommonException { - try { - Order order = getOrderFormDxo().convert(orderForm); - List<OrderProduct> orderProductList = getOrderProductListByOrderFormId(orderForm - .getOrderFormId()); - for (OrderProduct orderProduct : orderProductList) { - //TODO i18n: pass language id - ProductDescription productDescription = getProdcutDescription(orderProduct - .getProductId()); - jp.sf.pal.pompei.entity.notification.order.Product product = new jp.sf.pal.pompei.entity.notification.order.Product(); - getProductDxo().convert(productDescription, product); - getProductDxo().convert(productDescription.getProduct(), - product); - getProductDxo().convert(orderProduct, product); - order.addProduct(product); - } - - // set velocity context - VelocityContext context = new VelocityContext(); - context.put("order", order); - - VelocityUtil.init(); - StringWriter sw = new StringWriter(); - String templatePath = SystemUtil - .getOrderNotificationTemplatePath(templateName); - // TODO i18n: encoding - Template template = VelocityUtil.getTemplate(templatePath, "UTF-8"); - - template.merge(context, sw); - - String content = sw.toString(); - if (content == null) { - throw new CommonException("notification.content.is.null"); - } - int index = content.indexOf("\n"); - String subject = null; - String body = null; - if (index != -1) { - subject = content.substring(0, index); - body = content.substring(index); - } else { - // TODO should throw exception? - subject = content; - body = content; - } - - Properties props = System.getProperties(); - // set smtp server - props.put("mail.smtp.host", SystemUtil.getSmtpHost()); - Session session = Session.getDefaultInstance(props, null); - MimeMessage mimeMessage = new MimeMessage(session); - mimeMessage.setFrom(new InternetAddress(from)); - mimeMessage.setRecipients(Message.RecipientType.TO, to); - //TODO i18n: encoding - mimeMessage.setSubject(subject, "iso-2022-jp"); - //TODO i18n: encoding - mimeMessage.setText(body, "iso-2022-jp"); - mimeMessage.setHeader("Content-Type", "text/plain"); - mimeMessage.setSentDate(new Date()); - - Transport.send(mimeMessage); - } catch (Exception e) { - throw new CommonException("faild.to.send.order.notification", e); - } - - } - - public OrderNotification getOrderNotification(BigDecimal orderNotificationId) { - OrderNotificationCB cb = new OrderNotificationCB(); - //TODO needed? - cb.setupSelect_OrderStatus(); - cb.query().setOrderNotificationId_Equal(orderNotificationId); - return getOrderNotificationBhv().selectEntity(cb); - } - - public void deleteOrderForm(OrderForm orderForm) { - BigDecimal orderFormId = orderForm.getOrderFormId(); - - // order status history - OrderStatusHistoryCB cb1 = new OrderStatusHistoryCB(); - cb1.query().setOrderFormId_Equal(orderFormId); - List<OrderStatusHistory> list1 = getOrderStatusHistoryBhv().selectList( - cb1); - if (list1 != null && list1.size() > 0) { - getOrderStatusHistoryBhv().deleteList(list1); - } - - //TODO revert quantity? - - // order product - OrderProductCB cb2 = new OrderProductCB(); - cb2.query().setOrderFormId_Equal(orderFormId); - List<OrderProduct> list2 = getOrderProductBhv().selectList(cb2); - if (list2 != null && list2.size() > 0) { - getOrderProductBhv().deleteList(list2); - } - - // order product attribute - OrderProductAttributeCB cb3 = new OrderProductAttributeCB(); - cb3.query().setOrderFormId_Equal(orderFormId); - List<OrderProductAttribute> list3 = getOrderProductAttributeBhv() - .selectList(cb3); - if (list3 != null && list3.size() > 0) { - getOrderProductAttributeBhv().deleteList(list3); - } - - // order product download - OrderProductDownloadCB cb4 = new OrderProductDownloadCB(); - cb4.query().setOrderFormId_Equal(orderFormId); - List<OrderProductDownload> list4 = getOrderProductDownloadBhv() - .selectList(cb4); - if (list4 != null && list4.size() > 0) { - getOrderProductDownloadBhv().deleteList(list4); - } - - // order comment - OrderCommentCB cb5 = new OrderCommentCB(); - cb5.query().setOrderFormId_Equal(orderFormId); - OrderComment orderComment = getOrderCommentBhv().selectEntity(cb5); - if (orderComment != null) { - getOrderCommentBhv().delete(orderComment); - } - - // delete - getOrderFormBhv().delete(orderForm); - } - - public void updateOrderForm(OrderForm orderForm, OrderCardInfo orderCardInfo) { - Date now = new Date(); - // set last modified - orderForm.setLastModified(new Timestamp(now.getTime())); - - if (orderForm.getOrderStatusId() != null) { - OrderStatus orderStatus = getOrderStatus(orderForm - .getOrderStatusId()); - // set finished date - if (PompeiConstants.FINISHED_ORDER_STATUS_TYPE.equals(orderStatus - .getType())) { - orderForm.setFinishedDate(new Timestamp(now.getTime())); - } else { - // TODO is it correct? - orderForm.setFinishedDate(null); - } - } else { - // TODO exception? - } - - // update order form - getOrderFormBhv().update(orderForm); - - // update card info - if (orderCardInfo != null) { - getOrderCardInfoBhv().update(orderCardInfo); - } - - // update order status - if (orderForm.isUpdatedOrderStatus()) { - OrderStatusHistory orderStatusHistory = new OrderStatusHistory(); - orderStatusHistory.setOrderFormId(orderForm.getOrderFormId()); - orderStatusHistory.setOrderStatusId(orderForm.getOrderStatusId()); - orderStatusHistory.setDateAdded(new Timestamp(now.getTime())); - //TODO check email notifiacation - orderStatusHistory - .setCustomerNotified(PompeiConstants.FALSE_BIGDECIMAL); - // TODO comment - orderStatusHistory.setComment(""); - getOrderStatusHistoryBhv().insert(orderStatusHistory); - - //TODO email notification - } - } - - public List<OrderProduct> getOrderProductListByOrderFormId( - BigDecimal orderFormId) { - OrderProductCB cb = new OrderProductCB(); - cb.setupSelect_Product(); - // cb.setupSelect_OrderForm(); - cb.query().setOrderFormId_Equal(orderFormId); - return getOrderProductBhv().selectList(cb); - } - - public OrderCardInfo getOrderCardInfo(BigDecimal orderCardInfoId) { - OrderCardInfoCB cb = new OrderCardInfoCB(); - cb.query().setOrderCardInfoId_Equal(orderCardInfoId); - return getOrderCardInfoBhv().selectEntity(cb); - } - - public int getOrderFormCountByOrderStatus(BigDecimal orderStatusId) { - OrderFormCB cb = new OrderFormCB(); - cb.query().setOrderStatusId_Equal(orderStatusId); - return getOrderFormBhv().selectCount(cb); - } - - public OrderStatus getOrderStatus(BigDecimal orderStatusId) { - OrderStatusCB cb = new OrderStatusCB(); - cb.query().setOrderStatusId_Equal(orderStatusId); - return getOrderStatusBhv().selectEntity(cb); - } - - public List<OrderStatusDescription> getOrderStatusDescriptionList( - BigDecimal languageId) { - OrderStatusDescriptionCB cb = new OrderStatusDescriptionCB(); - cb.setupSelect_OrderStatus(); - //TODO needed? - // cb.setupSelect_Language(); - cb.query().setLanguageId_Equal(languageId); - return getOrderStatusDescriptionBhv().selectList(cb); - } - - public List<OrderForm> getOrderFormList() { - OrderFormCB cb = new OrderFormCB(); - cb.setupSelect_OrderStatus(); - return orderFormBhv.selectList(cb); - } - - public PagingResultBean<OrderForm> getOrderFormListByPager( - OrderFormPager orderFormPager) { - OrderFormCB cb = new OrderFormCB(); - - // pager - cb.fetchFirst(orderFormPager.getPageSize()); - cb.fetchPage(orderFormPager.getCurrentPageNumber()); - - // setup - cb.setupSelect_OrderStatus(); - // TODO needed? - //cb.setupSelect_Currency(); - // TODO needed? - //cb.setupSelect_Customer(); - // TODO needed? - //cb.setupSelect_DeliveryMethod(); - // TODO needed? - //cb.setupSelect_OrderCommentAsOne(); - // TODO needed? - //cb.setupSelect_PaymentMethod(); - - // condition - if (orderFormPager.getOrderStatusId() != null) { - cb.query() - .setOrderStatusId_Equal(orderFormPager.getOrderStatusId()); - } - - // order - if (PompeiConstants.ORDER_STATUS_ASC_ORDER.equals(orderFormPager - .getSortOrder())) { - cb.query().addOrderBy_OrderStatusId_Asc(); - } else if (PompeiConstants.ORDER_STATUS_DESC_ORDER - .equals(orderFormPager.getSortOrder())) { - cb.query().addOrderBy_OrderStatusId_Desc(); - } else if (PompeiConstants.ORDER_FORM_NUMBER_ASC_ORDER - .equals(orderFormPager.getSortOrder())) { - cb.query().addOrderBy_OrderFormNumber_Asc(); - } else if (PompeiConstants.ORDER_FORM_NUMBER_DESC_ORDER - .equals(orderFormPager.getSortOrder())) { - cb.query().addOrderBy_OrderFormNumber_Desc(); - } else if (PompeiConstants.TOTAL_PRICE_ASC_ORDER.equals(orderFormPager - .getSortOrder())) { - cb.query().addOrderBy_TotalPrice_Asc(); - } else if (PompeiConstants.TOTAL_PRICE_DESC_ORDER.equals(orderFormPager - .getSortOrder())) { - cb.query().addOrderBy_TotalPrice_Desc(); - } else if (PompeiConstants.CUSTOMER_NAME_ASC_ORDER - .equals(orderFormPager.getSortOrder())) { - cb.query().addOrderBy_CustomerLastname_Asc(); - cb.query().addOrderBy_CustomerFirstname_Asc(); - } else if (PompeiConstants.CUSTOMER_NAME_DESC_ORDER - .equals(orderFormPager.getSortOrder())) { - cb.query().addOrderBy_CustomerLastname_Desc(); - cb.query().addOrderBy_CustomerFirstname_Desc(); - } else if (PompeiConstants.CUSTOMER_STATE_ASC_ORDER - .equals(orderFormPager.getSortOrder())) { - cb.query().addOrderBy_CustomerState_Asc(); - } else if (PompeiConstants.CUSTOMER_STATE_DESC_ORDER - .equals(orderFormPager.getSortOrder())) { - cb.query().addOrderBy_CustomerState_Desc(); - } else if (PompeiConstants.PURCHASED_DATE_ASC_ORDER - .equals(orderFormPager.getSortOrder())) { - cb.query().addOrderBy_PurchasedDate_Asc(); - } else if (PompeiConstants.PURCHASED_DATE_DESC_ORDER - .equals(orderFormPager.getSortOrder())) { - cb.query().addOrderBy_PurchasedDate_Desc(); - } else if (PompeiConstants.LAST_MODIFIED_ASC_ORDER - .equals(orderFormPager.getSortOrder())) { - cb.query().addOrderBy_LastModified_Asc(); - } else if (PompeiConstants.LAST_MODIFIED_DESC_ORDER - .equals(orderFormPager.getSortOrder())) { - cb.query().addOrderBy_LastModified_Desc(); - } - - return getOrderFormBhv().selectPage(cb); - } - - public OrderForm getOrderForm(BigDecimal orderFormId) { - OrderFormCB cb = new OrderFormCB(); - // TODO needed? - // cb.setupSelect_Currency(); - // TODO needed? - // cb.setupSelect_Customer(); - // TODO needed? - // cb.setupSelect_DeliveryMethod(); - // TODO needed? - // cb.setupSelect_OrderCommentAsOne(); - cb.setupSelect_OrderStatus(); - // TODO needed? - // cb.setupSelect_PaymentMethod(); - cb.query().setOrderFormId_Equal(orderFormId); - return orderFormBhv.selectEntity(cb); - } - - public String addOrderForm(Customer customer, - List<BigDecimal> customerBasketIdList, - AddressBook customerAddressBook, AddressBook deliveryAddressBook, - AddressBook billingAddressBook, PaymentMethod paymentMethod, - DeliveryMethod deliveryMethod, OrderCardInfo orderCardInfo, - Currency currency, BigDecimal subTotalPrice, BigDecimal tax, - BigDecimal deliveryPrice, BigDecimal paymentFee, - BigDecimal totalPrice) throws CommonException { - String orderFormNumber = null; - if (customer == null || customerBasketIdList == null - || customerAddressBook == null || deliveryAddressBook == null - || billingAddressBook == null || paymentMethod == null - || deliveryMethod == null || currency == null - || totalPrice == null) { - throw new CommonException("invaild.order.parameters", - "Some parameters are null."); - } - - if (customerBasketIdList.isEmpty()) { - throw new CommonException("cart.is.empty", "The basket is empty."); - } - - Date now = new Date(); - OrderForm orderForm = new OrderForm(); - orderForm.setOrderFormNumber(Long.toString(now.getTime())); - getOrderFormDxo().convertToCustomerAddressBook(customerAddressBook, - orderForm); - getOrderFormDxo().convertToDeliveryAddressBook(deliveryAddressBook, - orderForm); - getOrderFormDxo().convertToBillingAddressBook(billingAddressBook, - orderForm); - getOrderFormDxo().convertToCustomer(customer, orderForm); - // payment method - orderForm.setPaymentMethodId(paymentMethod.getPaymentMethodId()); - orderForm.setPaymentMethodCode(paymentMethod.getCode()); - // card info - if (PompeiConstants.CREDITCARD_PAYMENT_METHOD.equals(paymentMethod - .getCode())) { - //TODO insert card info - if (orderCardInfo == null) { - throw new CommonException("card.info.is.null", - "A card info is null."); - } - getOrderCardInfoBhv().insert(orderCardInfo); - orderForm.setOrderCardInfoId(orderCardInfo.getOrderCardInfoId()); - } - // delivery method - orderForm.setDeliveryMethodId(deliveryMethod.getDeliveryMethodId()); - orderForm.setDeliveryMethodCode(deliveryMethod.getCode()); - // time - orderForm.setLastModified(new Timestamp(now.getTime())); - orderForm.setPurchasedDate(new Timestamp(now.getTime())); - // order status - orderForm.setOrderStatusId(PompeiConstants.DEFAULT_ORDER_STATUS); - // currency - orderForm.setCurrencyId(currency.getCurrencyId()); - orderForm.setCurrencyCode(currency.getCode()); - // price - orderForm.setSubTotalPrice(subTotalPrice); - orderForm.setTax(tax); - orderForm.setDeliveryPrice(deliveryPrice); - orderForm.setPaymentFee(paymentFee); - orderForm.setTotalPrice(totalPrice); - - getOrderFormBhv().insert(orderForm); - - // update orderFormNumber - orderFormNumber = orderForm.getOrderFormNumber() - + orderForm.getOrderFormId().toString(); - orderForm.setOrderFormNumber(orderFormNumber); - getOrderFormBhv().update(orderForm); - - // customer basket - for (BigDecimal customerBasketId : customerBasketIdList) { - //TODO - CustomerBasketCB cb = new CustomerBasketCB(); - cb.setupSelect_Product(); - cb.setupSelect_Customer(); - cb.query().setCustomerBasketId_Equal(customerBasketId); - CustomerBasket customerBasket = getCustomerBasketBhv() - .selectEntity(cb); - if (customerBasket == null) { - throw new CommonException("could.not.find.cart.info", - "Could not find a customer basket:" - + customerBasketId.toString()); - } - if (customerBasket.getCustomer() == null - || customerBasket.getProduct() == null) { - throw new CommonException("invalid.cart.state", - "Could not find a customer or product in the basket:" - + customerBasket.getCustomer() + "," - + customerBasket.getProduct()); - } - // check customer info - if (!customer.getCustomerId().equals( - customerBasket.getCustomer().getCustomerId())) { - throw new CommonException("invalid.customer.info.in.cart", - "Invalid customer info:" + customer.getCustomerId()); - } - - OrderProduct orderProduct = new OrderProduct(); - getOrderFormDxo() - .convert(customerBasket.getProduct(), orderProduct); - orderProduct.setOrderFormId(orderForm.getOrderFormId()); - // TODO bargain price - orderProduct.setFinalPrice(customerBasket.getFinalPrice()); - //TODO tax - orderProduct.setTax(new BigDecimal(0)); - orderProduct.setQuantity(customerBasket.getQuantity()); - - //TODO sync? - Product product = customerBasket.getProduct(); - if (product.getQuantity() != null) { - BigDecimal quantity = product.getQuantity().subtract( - customerBasket.getQuantity()); - if (quantity.intValue() < 0) { - throw new CommonException("prodocut.is.shortage", - "The product is a shortage." - + customer.getCustomerId()); - } - product.setQuantity(quantity); - getProductBhv().update(product); - } - - getOrderProductBhv().insert(orderProduct); - - // delete customerBasket - getCustomerBasketBhv().delete(customerBasket); - } - - // send mail - OrderStatus orderStatus = getOrderStatus(orderForm.getOrderStatusId()); - if (orderStatus != null - && PompeiConstants.NEW_ORDER_STATUS_TYPE.equals(orderStatus - .getType())) { - OrderNotificationCB cb = new OrderNotificationCB(); - cb.setupSelect_OrderStatus(); - cb.query().queryOrderStatus().setOrderStatusId_Equal( - orderStatus.getOrderStatusId()); - List<OrderNotification> orderNotificationList = getOrderNotificationBhv() - .selectList(cb); - if (orderNotificationList != null - && !orderNotificationList.isEmpty()) { - BigDecimal[] orderNotificationIds = new BigDecimal[orderNotificationList - .size()]; - int count = 0; - for (OrderNotification orderNotification : orderNotificationList) { - orderNotificationIds[count] = orderNotification - .getOrderNotificationId(); - count++; - } - try { - sendOrderNotifications(orderForm.getOrderFormId(), - orderNotificationIds); - } catch (Exception e) { - // TODO should throw it to page? - logger.log("EPC0005", new Object[] {}, e); - } - } - } - - return orderFormNumber; - } - - public Currency getCurrency(BigDecimal currencyId) { - CurrencyCB cb = new CurrencyCB(); - cb.query().setCurrencyId_Equal(currencyId); - return getCurrencyBhv().selectEntity(cb); - } - - public List<OrderNotification> getOrderNotificationListByOrderFormId( - BigDecimal orderFormId) { - OrderForm of = getOrderForm(orderFormId); - if (of == null) { - return new ArrayList<OrderNotification>(); - } - - OrderNotificationCB cb = new OrderNotificationCB(); - //TODO needed? - cb.setupSelect_OrderStatus(); - cb.query().queryOrderStatus().setOrderStatusId_Equal( - of.getOrderStatusId()); - - return getOrderNotificationBhv().selectList(cb); - } - - public OrderFormBhv getOrderFormBhv() { - return orderFormBhv; - } - - public void setOrderFormBhv(OrderFormBhv ordersBhv) { - this.orderFormBhv = ordersBhv; - } - - /** - * @return currencyBhv - */ - public CurrencyBhv getCurrencyBhv() { - return currencyBhv; - } - - /** - * @param currencyBhv 設定する currencyBhv - */ - public void setCurrencyBhv(CurrencyBhv currencyBhv) { - this.currencyBhv = currencyBhv; - } - - /** - * @return orderFormDxo - */ - public OrderFormDxo getOrderFormDxo() { - return orderFormDxo; - } - - /** - * @param orderFormDxo 設定する orderFormDxo - */ - public void setOrderFormDxo(OrderFormDxo orderFormDxo) { - this.orderFormDxo = orderFormDxo; - } - - /** - * @return orderCardInfoBhv - */ - public OrderCardInfoBhv getOrderCardInfoBhv() { - return orderCardInfoBhv; - } - - /** - * @param orderCardInfoBhv 設定する orderCardInfoBhv - */ - public void setOrderCardInfoBhv(OrderCardInfoBhv orderCardInfoBhv) { - this.orderCardInfoBhv = orderCardInfoBhv; - } - - /** - * @return customerBasketBhv - */ - public CustomerBasketBhv getCustomerBasketBhv() { - return customerBasketBhv; - } - - /** - * @param customerBasketBhv 設定する customerBasketBhv - */ - public void setCustomerBasketBhv(CustomerBasketBhv customerBasketBhv) { - this.customerBasketBhv = customerBasketBhv; - } - - /** - * @return orderProductBhv - */ - public OrderProductBhv getOrderProductBhv() { - return orderProductBhv; - } - - /** - * @param orderProductBhv 設定する orderProductBhv - */ - public void setOrderProductBhv(OrderProductBhv orderProductBhv) { - this.orderProductBhv = orderProductBhv; - } - - /** - * @return productBhv - */ - public ProductBhv getProductBhv() { - return productBhv; - } - - /** - * @param productBhv 設定する productBhv - */ - public void setProductBhv(ProductBhv productBhv) { - this.productBhv = productBhv; - } - - /** - * @return orderStatusDescriptionBhv - */ - public OrderStatusDescriptionBhv getOrderStatusDescriptionBhv() { - return orderStatusDescriptionBhv; - } - - /** - * @param orderStatusDescriptionBhv 設定する orderStatusDescriptionBhv - */ - public void setOrderStatusDescriptionBhv( - OrderStatusDescriptionBhv orderStatusDescriptionBhv) { - this.orderStatusDescriptionBhv = orderStatusDescriptionBhv; - } - - /** - * @return orderStatusHistoryBhv - */ - public OrderStatusHistoryBhv getOrderStatusHistoryBhv() { - return orderStatusHistoryBhv; - } - - /** - * @param orderStatusHistoryBhv 設定する orderStatusHistoryBhv - */ - public void setOrderStatusHistoryBhv( - OrderStatusHistoryBhv orderStatusHistoryBhv) { - this.orderStatusHistoryBhv = orderStatusHistoryBhv; - } - - /** - * @return orderProductAttributeBhv - */ - public OrderProductAttributeBhv getOrderProductAttributeBhv() { - return orderProductAttributeBhv; - } - - /** - * @param orderProductAttributeBhv 設定する orderProductAttributeBhv - */ - public void setOrderProductAttributeBhv( - OrderProductAttributeBhv orderProductAttributeBhv) { - this.orderProductAttributeBhv = orderProductAttributeBhv; - } - - /** - * @return orderProductDownloadBhv - */ - public OrderProductDownloadBhv getOrderProductDownloadBhv() { - return orderProductDownloadBhv; - } - - /** - * @param orderProductDownloadBhv 設定する orderProductDownloadBhv - */ - public void setOrderProductDownloadBhv( - OrderProductDownloadBhv orderProductDownloadBhv) { - this.orderProductDownloadBhv = orderProductDownloadBhv; - } - - /** - * @return orderCommentBhv - */ - public OrderCommentBhv getOrderCommentBhv() { - return orderCommentBhv; - } - - /** - * @param orderCommentBhv 設定する orderCommentBhv - */ - public void setOrderCommentBhv(OrderCommentBhv orderCommentBhv) { - this.orderCommentBhv = orderCommentBhv; - } - - /** - * @return orderStatusBhv - */ - public OrderStatusBhv getOrderStatusBhv() { - return orderStatusBhv; - } - - /** - * @param orderStatusBhv 設定する orderStatusBhv - */ - public void setOrderStatusBhv(OrderStatusBhv orderStatusBhv) { - this.orderStatusBhv = orderStatusBhv; - } - - /** - * @return the orderNotificationBhv - */ - public OrderNotificationBhv getOrderNotificationBhv() { - return orderNotificationBhv; - } - - /** - * @param orderNotificationBhv the orderNotificationBhv to set - */ - public void setOrderNotificationBhv( - OrderNotificationBhv orderNotificationBhv) { - this.orderNotificationBhv = orderNotificationBhv; - } - - /** - * @return the productDescriptionBhv - */ - public ProductDescriptionBhv getProductDescriptionBhv() { - return productDescriptionBhv; - } - - /** - * @param productDescriptionBhv the productDescriptionBhv to set - */ - public void setProductDescriptionBhv( - ProductDescriptionBhv productDescriptionBhv) { - this.productDescriptionBhv = productDescriptionBhv; - } - - /** - * @return the languageService - */ - public LanguageService getLanguageService() { - return languageService; - } - - /** - * @param languageService the languageService to set - */ - public void setLanguageService(LanguageService languageService) { - this.languageService = languageService; - } - - /** - * @return the productDxo - */ - public ProductDxo getProductDxo() { - return productDxo; - } - - /** - * @param productDxo the productDxo to set - */ - public void setProductDxo(ProductDxo productDxo) { - this.productDxo = productDxo; - } - -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/PaymentMethodServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/PaymentMethodServiceImpl.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/PaymentMethodServiceImpl.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,72 +0,0 @@ -package jp.sf.pal.pompei.service.impl; - -import java.math.BigDecimal; -import java.util.List; - -import jp.sf.pal.pompei.cbean.PaymentMethodDescriptionCB; -import jp.sf.pal.pompei.exbhv.PaymentMethodBhv; -import jp.sf.pal.pompei.exbhv.PaymentMethodDescriptionBhv; -import jp.sf.pal.pompei.exentity.PaymentMethodDescription; -import jp.sf.pal.pompei.service.PaymentMethodService; - -public class PaymentMethodServiceImpl implements PaymentMethodService { - /** - * - */ - private static final long serialVersionUID = 8750885593336801203L; - - private transient PaymentMethodBhv paymentMethodBhv; - - private transient PaymentMethodDescriptionBhv paymentMethodDescriptionBhv; - - /* (non-Javadoc) - * @see jp.sf.pal.pompei.service.impl.PaymentMethodService#getPaymentMethodDescriptionList() - */ - public List<PaymentMethodDescription> getPaymentMethodDescriptionList() { - PaymentMethodDescriptionCB cb = new PaymentMethodDescriptionCB(); - cb.setupSelect_PaymentMethod(); - //TODO needed? - //cb.setupSelect_Language(); - return getPaymentMethodDescriptionBhv().selectList(cb); - } - - public PaymentMethodDescription getPaymentMethodDescription( - BigDecimal paymentMethodId) { - PaymentMethodDescriptionCB cb = new PaymentMethodDescriptionCB(); - cb.setupSelect_PaymentMethod(); - //TODO needed? - //cb.setupSelect_Language(); - cb.query().setPaymentMethodId_Equal(paymentMethodId); - return getPaymentMethodDescriptionBhv().selectEntity(cb); - } - - /** - * @return paymentMethodBhv - */ - public PaymentMethodBhv getPaymentMethodBhv() { - return paymentMethodBhv; - } - - /** - * @param paymentMethodBhv 設定する paymentMethodBhv - */ - public void setPaymentMethodBhv(PaymentMethodBhv paymentMethodBhv) { - this.paymentMethodBhv = paymentMethodBhv; - } - - /** - * @return paymentMethodDescriptionBhv - */ - public PaymentMethodDescriptionBhv getPaymentMethodDescriptionBhv() { - return paymentMethodDescriptionBhv; - } - - /** - * @param paymentMethodDescriptionBhv 設定する paymentMethodDescriptionBhv - */ - public void setPaymentMethodDescriptionBhv( - PaymentMethodDescriptionBhv paymentMethodDescriptionBhv) { - this.paymentMethodDescriptionBhv = paymentMethodDescriptionBhv; - } - -} Deleted: 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 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/ProductServiceImpl.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,463 +0,0 @@ -package jp.sf.pal.pompei.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.common.CommonException; -import jp.sf.pal.pompei.PompeiConstants; -import jp.sf.pal.pompei.allcommon.cbean.PagingResultBean; -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.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.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.pager.ProductPager; -import jp.sf.pal.pompei.service.LanguageService; -import jp.sf.pal.pompei.service.ProductService; -import jp.sf.pal.pompei.util.UploadedFileUtil; - -public class ProductServiceImpl implements ProductService { - - /** - * - */ - private static final long serialVersionUID = -2593237297401857885L; - - private LanguageService languageService; - - private transient ProductBhv productBhv; - - private transient ManufacturerBhv manufacturerBhv; - - private transient CustomerBasketAttributeBhv customerBasketAttributeBhv; - - private transient CustomerBasketBhv customerBasketBhv; - - private transient ProductAttributeBhv productAttributeBhv; - - private transient ProductDescriptionBhv productDescriptionBhv; - - private transient ProductNotificationBhv productNotificationBhv; - - private transient ProductToCategoryBhv productToCategoryBhv; - - private transient ProductImageBhv productImageBhv; - - private transient ReviewBhv reviewBhv; - - private transient BargainBhv bargainBhv; - - /** - * @return languageService - */ - public LanguageService getLanguageService() { - return languageService; - } - - /** - * @param languageService 設定する languageService - */ - public void setLanguageService(LanguageService languageService) { - this.languageService = languageService; - } - - 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 description - productDescription.setProductId(product.getProductId()); - productDescriptionBhv.insert(productDescription); - - // product to category - ProductToCategory productToCategory = new ProductToCategory(); - productToCategory.setCategoryId(categoryId); - productToCategory.setProductId(product.getProductId()); - productToCategoryBhv.insert(productToCategory); - - // 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); - } - } - } - } - - public void deleteProduct(BigDecimal productsId) { - - 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); - getProductBhv().loadProductDescriptionList(productsList); - getProductBhv().loadProductNotificationList(productsList); - getProductBhv().loadProductToCategoryList(productsList); - 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()); - } - if (!p.getCustomerBasketList().isEmpty()) { - getCustomerBasketBhv().deleteList(p.getCustomerBasketList()); - } - if (!p.getProductAttributeList().isEmpty()) { - getProductAttributeBhv() - .deleteList(p.getProductAttributeList()); - } - if (!p.getProductDescriptionList().isEmpty()) { - getProductDescriptionBhv().deleteList( - p.getProductDescriptionList()); - } - if (!p.getProductNotificationList().isEmpty()) { - getProductNotificationBhv().deleteList( - p.getProductNotificationList()); - } - if (!p.getProductToCategoryList().isEmpty()) { - getProductToCategoryBhv().deleteList( - p.getProductToCategoryList()); - } - if (!p.getReviewList().isEmpty()) { - getReviewBhv().deleteList(p.getReviewList()); - } - if (!p.getBargainList().isEmpty()) { - getBargainBhv().deleteList(p.getBargainList()); - } - productBhv.delegateDelete(p); - } - - //TODO remove image - } - - public ProductDescription getProdcutDescription(BigDecimal id) { - return getProdcutDescription(id, getLanguageService() - .getCurrentLanguage().getLanguageId()); - } - - public ProductDescription getProdcutDescription(BigDecimal id, - BigDecimal languagesId) { - ProductDescriptionCB cb = new ProductDescriptionCB(); - cb.setupSelect_Product(); - - cb.query().setLanguageId_Equal(languagesId); - cb.query().setProductId_Equal(id); - return productDescriptionBhv.selectEntity(cb); - } - - public PagingResultBean<Product> getProductListByPager( - ProductPager productPager) { - ProductCB cb = new ProductCB(); - - // pager - cb.fetchFirst(productPager.getPageSize()); - cb.fetchPage(productPager.getCurrentPageNumber()); - - // setup - cb.setupSelect_Manufacturer(); - //TODO needed? - // cb.setupSelect_TaxClass(); - - // query - // categoryId - if (productPager.getCategoryId() != null) { - ProductToCategoryCB subCb = new ProductToCategoryCB(); - subCb.query().setCategoryId_Equal(productPager.getCategoryId()); - cb.query().setProductId_ExistsSubQuery_ProductToCategoryList( - subCb.query()); - } - // order - if (productPager.getOrderMode() != null) { - if (PompeiConstants.CHEAP_ORDER.equals(productPager.getOrderMode())) { - cb.query().addOrderBy_Price_Asc(); - } else if (PompeiConstants.EXPENSIVE_ORDER.equals(productPager - .getOrderMode())) { - cb.query().addOrderBy_Price_Desc(); - } else if (PompeiConstants.ORDERED_ORDER.equals(productPager - .getOrderMode())) { - cb.query().addOrderBy_Ordered_Desc(); - } else if (PompeiConstants.NEW_ARRIVAL_ORDER.equals(productPager - .getOrderMode())) { - cb.query().addOrderBy_DateAdded_Desc(); - } - } - - PagingResultBean<Product> productList = getProductBhv().selectPage(cb); - //TODO there may be better method.. - getProductBhv().loadProductDescriptionList(productList); - return productList; - } - - public List<Product> getProductList(BigDecimal categoryId) { - //TODO rewrite - ProductToCategoryCB cb = new ProductToCategoryCB(); - cb.setupSelect_Product().withManufacturer(); - cb.query().setCategoryId_Equal(categoryId); - List<ProductToCategory> list = productToCategoryBhv.selectList(cb); - - List<Product> productsList = new ArrayList<Product>(); - for (ProductToCategory categories : list) { - productsList.add(categories.getProduct()); - } - //TODO there may be better method.. - productBhv.loadProductDescriptionList(productsList); - - return productsList; - } - - public void updateProductDescription(ProductDescription productDescription) - throws CommonException { - Product product = productDescription.getProduct(); - product.setLastModified(new Timestamp(new Date().getTime())); - - 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); - } - } - } - - getProductBhv().update(product); - - 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 PagingResultBean<Product> getTopProductList(String type, int num) { - ProductCB cb = new ProductCB(); - - // pager - cb.fetchFirst(num); - cb.fetchPage(1); - - // setup - cb.setupSelect_Manufacturer(); - - if (PompeiConstants.RATING.equals(type)) { - cb.query().addOrderBy_Rating_Desc(); - } else if (PompeiConstants.ORDERED.equals(type)) { - cb.query().addOrderBy_Ordered_Desc(); - } else if (PompeiConstants.REVIEDED.equals(type)) { - cb.query().addOrderBy_Reviewed_Desc(); - } - - PagingResultBean<Product> productList = getProductBhv().selectPage(cb); - //TODO there may be better method.. - getProductBhv().loadProductDescriptionList(productList); - return productList; - } - - public ProductDescriptionBhv getProductDescriptionBhv() { - return productDescriptionBhv; - } - - public void setProductDescriptionBhv(ProductDescriptionBhv descriptionBhv) { - this.productDescriptionBhv = descriptionBhv; - } - - public ProductBhv getProductBhv() { - return productBhv; - } - - public void setProductBhv(ProductBhv productsBhv) { - this.productBhv = productsBhv; - } - - public ProductToCategoryBhv getProductToCategoryBhv() { - return productToCategoryBhv; - } - - public void setProductToCategoryBhv( - ProductToCategoryBhv productsToCategoriesBhv) { - this.productToCategoryBhv = productsToCategoriesBhv; - } - - /** - * @return customersBasketAttributesBhv - */ - public CustomerBasketAttributeBhv getCustomerBasketAttributeBhv() { - return customerBasketAttributeBhv; - } - - /** - * @param customersBasketAttributesBhv 設定する customersBasketAttributesBhv - */ - public void setCustomerBasketAttributeBhv( - CustomerBasketAttributeBhv customersBasketAttributesBhv) { - this.customerBasketAttributeBhv = customersBasketAttributesBhv; - } - - /** - * @return customersBasketBhv - */ - public CustomerBasketBhv getCustomerBasketBhv() { - return customerBasketBhv; - } - - /** - * @param customersBasketBhv 設定する customersBasketBhv - */ - public void setCustomerBasketBhv(CustomerBasketBhv customersBasketBhv) { - this.customerBasketBhv = customersBasketBhv; - } - - /** - * @return productsAttributesBhv - */ - public ProductAttributeBhv getProductAttributeBhv() { - return productAttributeBhv; - } - - /** - * @param productsAttributesBhv 設定する productsAttributesBhv - */ - public void setProductAttributeBhv(ProductAttributeBhv productsAttributesBhv) { - this.productAttributeBhv = productsAttributesBhv; - } - - /** - * @return productsNotificationsBhv - */ - public ProductNotificationBhv getProductNotificationBhv() { - return productNotificationBhv; - } - - /** - * @param productsNotificationsBhv 設定する productsNotificationsBhv - */ - public void setProductNotificationBhv( - ProductNotificationBhv productsNotificationsBhv) { - this.productNotificationBhv = productsNotificationsBhv; - } - - /** - * @return reviewsBhv - */ - public ReviewBhv getReviewBhv() { - return reviewBhv; - } - - /** - * @param reviewsBhv 設定する reviewsBhv - */ - public void setReviewBhv(ReviewBhv reviewsBhv) { - this.reviewBhv = reviewsBhv; - } - - /** - * @return specialsBhv - */ - public BargainBhv getBargainBhv() { - return bargainBhv; - } - - /** - * @param specialsBhv 設定する specialsBhv - */ - public void setBargainBhv(BargainBhv specialsBhv) { - this.bargainBhv = specialsBhv; - } - - public Manufacturer getManufacturer(BigDecimal manufacturersId) { - ManufacturerCB manufacturersCB = new ManufacturerCB(); - manufacturersCB.query().setManufacturerId_Equal(manufacturersId); - - return manufacturerBhv.selectEntity(manufacturersCB); - } - - public ManufacturerBhv getManufacturerBhv() { - return manufacturerBhv; - } - - public void setManufacturerBhv(ManufacturerBhv manufacturersBhv) { - this.manufacturerBhv = manufacturersBhv; - } - - public Product getProdcut(BigDecimal id) { - ProductCB cb = new ProductCB(); - cb.query().setProductId_Equal(id); - return productBhv.selectEntity(cb); - } - - /** - * @return productImageBhv - */ - public ProductImageBhv getProductImageBhv() { - return productImageBhv; - } - - /** - * @param productImageBhv 設定する productImageBhv - */ - public void setProductImageBhv(ProductImageBhv productImageBhv) { - this.productImageBhv = productImageBhv; - } - -} Deleted: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/TaxServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/TaxServiceImpl.java 2008-03-29 22:13:00 UTC (rev 869) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/TaxServiceImpl.java 2008-03-29 22:18:32 UTC (rev 870) @@ -1,68 +0,0 @@ -package jp.sf.pal.pompei.service.impl; - -import java.math.BigDecimal; -import java.util.List; - -import jp.sf.pal.pompei.cbean.TaxClassCB; -import jp.sf.pal.pompei.cbean.TaxRateCB; -import jp.sf.pal.pompei.exbhv.TaxClassBhv; -import jp.sf.pal.pompei.exbhv.TaxRateBhv; -import jp.sf.pal.pompei.exentity.TaxClass; -import jp.sf.pal.pompei.exentity.TaxRate; -import jp.sf.pal.pompei.service.TaxService; - -public class TaxServiceImpl implements TaxService { - - /** - * - */ - private static final long serialVersionUID = -601580607276944509L; - - private transient TaxClassBhv taxClassBhv; - - private transient TaxRateBhv taxRateBhv; - - /* (non-Javadoc) - * @see jp.sf.pal.pompei.service.impl.TaxService#getTaxRateByZoneId(java.math.BigDecimal) - */ - public TaxRate getTaxRateByZoneId(BigDecimal zoneId) { - TaxRateCB cb = new TaxRateCB(); - cb.setupSelect_TaxClass(); - cb.query().setZoneId_Equal(zoneId); - return getTaxRateBhv().selectEntity(cb); - } - - public List<TaxClass> getTaxClassList() { - TaxClassCB cb = new TaxClassCB(); - return getTaxClassBhv().selectList(cb); - } - - /** - * @return taxClassBhv - */ - public TaxClassBhv getTaxClassBhv() { - return taxClassBhv; - } - - /** - * @param taxClassBhv 設定する taxClassBhv - */ - public void setTaxClassBhv(TaxClassBhv taxClassBhv) { - this.taxClassBhv = taxClassBhv; - } - - /** - * @return taxRatesBhv - */ - public TaxRateBhv getTaxRateBhv() { - return taxRateBhv; - } - - /** - * @param taxRatesBhv 設定する taxRatesBhv - */ - public void setTaxRateBhv(TaxRateBhv taxRatesBhv) { - this.taxRateBhv = taxRatesBhv; - } - -}