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.model.impl;
24  
25  import com.liferay.portal.kernel.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import java.io.Serializable;
30  
31  import java.sql.Types;
32  
33  /**
34   * <a href="ShoppingItemPriceModelImpl.java.html"><b><i>View Source</i></b></a>
35   *
36   * <p>
37   * ServiceBuilder generated this class. Modifications in this class will be overwritten
38   * the next time is generated.
39   * </p>
40   *
41   * <p>
42   * This class is a model that represents the <code>ShoppingItemPrice</code> table
43   * in the database.
44   * </p>
45   *
46   * @author Brian Wing Shun Chan
47   *
48   * @see com.liferay.portlet.shopping.service.model.ShoppingItemPrice
49   * @see com.liferay.portlet.shopping.service.model.ShoppingItemPriceModel
50   * @see com.liferay.portlet.shopping.service.model.impl.ShoppingItemPriceImpl
51   *
52   */
53  public class ShoppingItemPriceModelImpl extends BaseModelImpl {
54      public static String TABLE_NAME = "ShoppingItemPrice";
55      public static Object[][] TABLE_COLUMNS = {
56              { "itemPriceId", new Integer(Types.BIGINT) },
57              { "itemId", new Integer(Types.BIGINT) },
58              { "minQuantity", new Integer(Types.INTEGER) },
59              { "maxQuantity", new Integer(Types.INTEGER) },
60              { "price", new Integer(Types.DOUBLE) },
61              { "discount", new Integer(Types.DOUBLE) },
62              { "taxable", new Integer(Types.BOOLEAN) },
63              { "shipping", new Integer(Types.DOUBLE) },
64              { "useShippingFormula", new Integer(Types.BOOLEAN) },
65              { "status", new Integer(Types.INTEGER) }
66          };
67      public static String TABLE_SQL_CREATE = "create table ShoppingItemPrice (itemPriceId LONG not null primary key,itemId LONG,minQuantity INTEGER,maxQuantity INTEGER,price DOUBLE,discount DOUBLE,taxable BOOLEAN,shipping DOUBLE,useShippingFormula BOOLEAN,status INTEGER)";
68      public static String TABLE_SQL_DROP = "drop table ShoppingItemPrice";
69      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
70                  "xss.allow.com.liferay.portlet.shopping.model.ShoppingItemPrice"),
71              XSS_ALLOW);
72      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
73                  "lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingItemPriceModel"));
74  
75      public ShoppingItemPriceModelImpl() {
76      }
77  
78      public long getPrimaryKey() {
79          return _itemPriceId;
80      }
81  
82      public void setPrimaryKey(long pk) {
83          setItemPriceId(pk);
84      }
85  
86      public Serializable getPrimaryKeyObj() {
87          return new Long(_itemPriceId);
88      }
89  
90      public long getItemPriceId() {
91          return _itemPriceId;
92      }
93  
94      public void setItemPriceId(long itemPriceId) {
95          if (itemPriceId != _itemPriceId) {
96              _itemPriceId = itemPriceId;
97          }
98      }
99  
100     public long getItemId() {
101         return _itemId;
102     }
103 
104     public void setItemId(long itemId) {
105         if (itemId != _itemId) {
106             _itemId = itemId;
107         }
108     }
109 
110     public int getMinQuantity() {
111         return _minQuantity;
112     }
113 
114     public void setMinQuantity(int minQuantity) {
115         if (minQuantity != _minQuantity) {
116             _minQuantity = minQuantity;
117         }
118     }
119 
120     public int getMaxQuantity() {
121         return _maxQuantity;
122     }
123 
124     public void setMaxQuantity(int maxQuantity) {
125         if (maxQuantity != _maxQuantity) {
126             _maxQuantity = maxQuantity;
127         }
128     }
129 
130     public double getPrice() {
131         return _price;
132     }
133 
134     public void setPrice(double price) {
135         if (price != _price) {
136             _price = price;
137         }
138     }
139 
140     public double getDiscount() {
141         return _discount;
142     }
143 
144     public void setDiscount(double discount) {
145         if (discount != _discount) {
146             _discount = discount;
147         }
148     }
149 
150     public boolean getTaxable() {
151         return _taxable;
152     }
153 
154     public boolean isTaxable() {
155         return _taxable;
156     }
157 
158     public void setTaxable(boolean taxable) {
159         if (taxable != _taxable) {
160             _taxable = taxable;
161         }
162     }
163 
164     public double getShipping() {
165         return _shipping;
166     }
167 
168     public void setShipping(double shipping) {
169         if (shipping != _shipping) {
170             _shipping = shipping;
171         }
172     }
173 
174     public boolean getUseShippingFormula() {
175         return _useShippingFormula;
176     }
177 
178     public boolean isUseShippingFormula() {
179         return _useShippingFormula;
180     }
181 
182     public void setUseShippingFormula(boolean useShippingFormula) {
183         if (useShippingFormula != _useShippingFormula) {
184             _useShippingFormula = useShippingFormula;
185         }
186     }
187 
188     public int getStatus() {
189         return _status;
190     }
191 
192     public void setStatus(int status) {
193         if (status != _status) {
194             _status = status;
195         }
196     }
197 
198     public Object clone() {
199         ShoppingItemPriceImpl clone = new ShoppingItemPriceImpl();
200         clone.setItemPriceId(getItemPriceId());
201         clone.setItemId(getItemId());
202         clone.setMinQuantity(getMinQuantity());
203         clone.setMaxQuantity(getMaxQuantity());
204         clone.setPrice(getPrice());
205         clone.setDiscount(getDiscount());
206         clone.setTaxable(getTaxable());
207         clone.setShipping(getShipping());
208         clone.setUseShippingFormula(getUseShippingFormula());
209         clone.setStatus(getStatus());
210 
211         return clone;
212     }
213 
214     public int compareTo(Object obj) {
215         if (obj == null) {
216             return -1;
217         }
218 
219         ShoppingItemPriceImpl shoppingItemPrice = (ShoppingItemPriceImpl)obj;
220         int value = 0;
221 
222         if (getItemId() < shoppingItemPrice.getItemId()) {
223             value = -1;
224         }
225         else if (getItemId() > shoppingItemPrice.getItemId()) {
226             value = 1;
227         }
228         else {
229             value = 0;
230         }
231 
232         if (value != 0) {
233             return value;
234         }
235 
236         if (getItemPriceId() < shoppingItemPrice.getItemPriceId()) {
237             value = -1;
238         }
239         else if (getItemPriceId() > shoppingItemPrice.getItemPriceId()) {
240             value = 1;
241         }
242         else {
243             value = 0;
244         }
245 
246         if (value != 0) {
247             return value;
248         }
249 
250         return 0;
251     }
252 
253     public boolean equals(Object obj) {
254         if (obj == null) {
255             return false;
256         }
257 
258         ShoppingItemPriceImpl shoppingItemPrice = null;
259 
260         try {
261             shoppingItemPrice = (ShoppingItemPriceImpl)obj;
262         }
263         catch (ClassCastException cce) {
264             return false;
265         }
266 
267         long pk = shoppingItemPrice.getPrimaryKey();
268 
269         if (getPrimaryKey() == pk) {
270             return true;
271         }
272         else {
273             return false;
274         }
275     }
276 
277     public int hashCode() {
278         return (int)getPrimaryKey();
279     }
280 
281     private long _itemPriceId;
282     private long _itemId;
283     private int _minQuantity;
284     private int _maxQuantity;
285     private double _price;
286     private double _discount;
287     private boolean _taxable;
288     private double _shipping;
289     private boolean _useShippingFormula;
290     private int _status;
291 }