1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.shopping.service.base;
24  
25  import com.liferay.portal.SystemException;
26  import com.liferay.portal.kernel.dao.DynamicQueryInitializer;
27  
28  import com.liferay.portlet.shopping.model.ShoppingItem;
29  import com.liferay.portlet.shopping.model.impl.ShoppingItemImpl;
30  import com.liferay.portlet.shopping.service.ShoppingItemLocalService;
31  import com.liferay.portlet.shopping.service.persistence.ShoppingItemUtil;
32  
33  import java.util.List;
34  
35  /**
36   * <a href="ShoppingItemLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
37   *
38   * @author Brian Wing Shun Chan
39   *
40   */
41  public abstract class ShoppingItemLocalServiceBaseImpl
42      implements ShoppingItemLocalService {
43      public ShoppingItem addShoppingItem(ShoppingItem model)
44          throws SystemException {
45          ShoppingItem shoppingItem = new ShoppingItemImpl();
46          shoppingItem.setNew(true);
47          shoppingItem.setItemId(model.getItemId());
48          shoppingItem.setCompanyId(model.getCompanyId());
49          shoppingItem.setUserId(model.getUserId());
50          shoppingItem.setUserName(model.getUserName());
51          shoppingItem.setCreateDate(model.getCreateDate());
52          shoppingItem.setModifiedDate(model.getModifiedDate());
53          shoppingItem.setCategoryId(model.getCategoryId());
54          shoppingItem.setSku(model.getSku());
55          shoppingItem.setName(model.getName());
56          shoppingItem.setDescription(model.getDescription());
57          shoppingItem.setProperties(model.getProperties());
58          shoppingItem.setFields(model.getFields());
59          shoppingItem.setFieldsQuantities(model.getFieldsQuantities());
60          shoppingItem.setMinQuantity(model.getMinQuantity());
61          shoppingItem.setMaxQuantity(model.getMaxQuantity());
62          shoppingItem.setPrice(model.getPrice());
63          shoppingItem.setDiscount(model.getDiscount());
64          shoppingItem.setTaxable(model.getTaxable());
65          shoppingItem.setShipping(model.getShipping());
66          shoppingItem.setUseShippingFormula(model.getUseShippingFormula());
67          shoppingItem.setRequiresShipping(model.getRequiresShipping());
68          shoppingItem.setStockQuantity(model.getStockQuantity());
69          shoppingItem.setFeatured(model.getFeatured());
70          shoppingItem.setSale(model.getSale());
71          shoppingItem.setSmallImage(model.getSmallImage());
72          shoppingItem.setSmallImageId(model.getSmallImageId());
73          shoppingItem.setSmallImageURL(model.getSmallImageURL());
74          shoppingItem.setMediumImage(model.getMediumImage());
75          shoppingItem.setMediumImageId(model.getMediumImageId());
76          shoppingItem.setMediumImageURL(model.getMediumImageURL());
77          shoppingItem.setLargeImage(model.getLargeImage());
78          shoppingItem.setLargeImageId(model.getLargeImageId());
79          shoppingItem.setLargeImageURL(model.getLargeImageURL());
80  
81          return ShoppingItemUtil.update(shoppingItem);
82      }
83  
84      public List dynamicQuery(DynamicQueryInitializer queryInitializer)
85          throws SystemException {
86          return ShoppingItemUtil.findWithDynamicQuery(queryInitializer);
87      }
88  
89      public List dynamicQuery(DynamicQueryInitializer queryInitializer,
90          int begin, int end) throws SystemException {
91          return ShoppingItemUtil.findWithDynamicQuery(queryInitializer, begin,
92              end);
93      }
94  
95      public ShoppingItem updateShoppingItem(ShoppingItem model)
96          throws SystemException {
97          ShoppingItem shoppingItem = new ShoppingItemImpl();
98          shoppingItem.setNew(false);
99          shoppingItem.setItemId(model.getItemId());
100         shoppingItem.setCompanyId(model.getCompanyId());
101         shoppingItem.setUserId(model.getUserId());
102         shoppingItem.setUserName(model.getUserName());
103         shoppingItem.setCreateDate(model.getCreateDate());
104         shoppingItem.setModifiedDate(model.getModifiedDate());
105         shoppingItem.setCategoryId(model.getCategoryId());
106         shoppingItem.setSku(model.getSku());
107         shoppingItem.setName(model.getName());
108         shoppingItem.setDescription(model.getDescription());
109         shoppingItem.setProperties(model.getProperties());
110         shoppingItem.setFields(model.getFields());
111         shoppingItem.setFieldsQuantities(model.getFieldsQuantities());
112         shoppingItem.setMinQuantity(model.getMinQuantity());
113         shoppingItem.setMaxQuantity(model.getMaxQuantity());
114         shoppingItem.setPrice(model.getPrice());
115         shoppingItem.setDiscount(model.getDiscount());
116         shoppingItem.setTaxable(model.getTaxable());
117         shoppingItem.setShipping(model.getShipping());
118         shoppingItem.setUseShippingFormula(model.getUseShippingFormula());
119         shoppingItem.setRequiresShipping(model.getRequiresShipping());
120         shoppingItem.setStockQuantity(model.getStockQuantity());
121         shoppingItem.setFeatured(model.getFeatured());
122         shoppingItem.setSale(model.getSale());
123         shoppingItem.setSmallImage(model.getSmallImage());
124         shoppingItem.setSmallImageId(model.getSmallImageId());
125         shoppingItem.setSmallImageURL(model.getSmallImageURL());
126         shoppingItem.setMediumImage(model.getMediumImage());
127         shoppingItem.setMediumImageId(model.getMediumImageId());
128         shoppingItem.setMediumImageURL(model.getMediumImageURL());
129         shoppingItem.setLargeImage(model.getLargeImage());
130         shoppingItem.setLargeImageId(model.getLargeImageId());
131         shoppingItem.setLargeImageURL(model.getLargeImageURL());
132 
133         return ShoppingItemUtil.update(shoppingItem);
134     }
135 }