001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.shopping.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.impl.BaseModelImpl;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.portlet.shopping.model.ShoppingItemPrice;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: /**
037: * <a href="ShoppingItemPriceModelImpl.java.html"><b><i>View Source</i></b></a>
038: *
039: * <p>
040: * ServiceBuilder generated this class. Modifications in this class will be
041: * overwritten the next time is generated.
042: * </p>
043: *
044: * <p>
045: * This class is a model that represents the <code>ShoppingItemPrice</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portlet.shopping.service.model.ShoppingItemPrice
052: * @see com.liferay.portlet.shopping.service.model.ShoppingItemPriceModel
053: * @see com.liferay.portlet.shopping.service.model.impl.ShoppingItemPriceImpl
054: *
055: */
056: public class ShoppingItemPriceModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "ShoppingItemPrice";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "itemPriceId", new Integer(Types.BIGINT) },
060:
061: { "itemId", new Integer(Types.BIGINT) },
062:
063: { "minQuantity", new Integer(Types.INTEGER) },
064:
065: { "maxQuantity", new Integer(Types.INTEGER) },
066:
067: { "price", new Integer(Types.DOUBLE) },
068:
069: { "discount", new Integer(Types.DOUBLE) },
070:
071: { "taxable", new Integer(Types.BOOLEAN) },
072:
073: { "shipping", new Integer(Types.DOUBLE) },
074:
075: { "useShippingFormula", new Integer(Types.BOOLEAN) },
076:
077: { "status", new Integer(Types.INTEGER) } };
078: public static final 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)";
079: public static final String TABLE_SQL_DROP = "drop table ShoppingItemPrice";
080: public static final boolean CACHE_ENABLED = GetterUtil
081: .getBoolean(
082: PropsUtil
083: .get("value.object.finder.cache.enabled.com.liferay.portlet.shopping.model.ShoppingItemPrice"),
084: true);
085: public static final long LOCK_EXPIRATION_TIME = GetterUtil
086: .getLong(PropsUtil
087: .get("lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingItemPrice"));
088:
089: public ShoppingItemPriceModelImpl() {
090: }
091:
092: public long getPrimaryKey() {
093: return _itemPriceId;
094: }
095:
096: public void setPrimaryKey(long pk) {
097: setItemPriceId(pk);
098: }
099:
100: public Serializable getPrimaryKeyObj() {
101: return new Long(_itemPriceId);
102: }
103:
104: public long getItemPriceId() {
105: return _itemPriceId;
106: }
107:
108: public void setItemPriceId(long itemPriceId) {
109: if (itemPriceId != _itemPriceId) {
110: _itemPriceId = itemPriceId;
111: }
112: }
113:
114: public long getItemId() {
115: return _itemId;
116: }
117:
118: public void setItemId(long itemId) {
119: if (itemId != _itemId) {
120: _itemId = itemId;
121: }
122: }
123:
124: public int getMinQuantity() {
125: return _minQuantity;
126: }
127:
128: public void setMinQuantity(int minQuantity) {
129: if (minQuantity != _minQuantity) {
130: _minQuantity = minQuantity;
131: }
132: }
133:
134: public int getMaxQuantity() {
135: return _maxQuantity;
136: }
137:
138: public void setMaxQuantity(int maxQuantity) {
139: if (maxQuantity != _maxQuantity) {
140: _maxQuantity = maxQuantity;
141: }
142: }
143:
144: public double getPrice() {
145: return _price;
146: }
147:
148: public void setPrice(double price) {
149: if (price != _price) {
150: _price = price;
151: }
152: }
153:
154: public double getDiscount() {
155: return _discount;
156: }
157:
158: public void setDiscount(double discount) {
159: if (discount != _discount) {
160: _discount = discount;
161: }
162: }
163:
164: public boolean getTaxable() {
165: return _taxable;
166: }
167:
168: public boolean isTaxable() {
169: return _taxable;
170: }
171:
172: public void setTaxable(boolean taxable) {
173: if (taxable != _taxable) {
174: _taxable = taxable;
175: }
176: }
177:
178: public double getShipping() {
179: return _shipping;
180: }
181:
182: public void setShipping(double shipping) {
183: if (shipping != _shipping) {
184: _shipping = shipping;
185: }
186: }
187:
188: public boolean getUseShippingFormula() {
189: return _useShippingFormula;
190: }
191:
192: public boolean isUseShippingFormula() {
193: return _useShippingFormula;
194: }
195:
196: public void setUseShippingFormula(boolean useShippingFormula) {
197: if (useShippingFormula != _useShippingFormula) {
198: _useShippingFormula = useShippingFormula;
199: }
200: }
201:
202: public int getStatus() {
203: return _status;
204: }
205:
206: public void setStatus(int status) {
207: if (status != _status) {
208: _status = status;
209: }
210: }
211:
212: public ShoppingItemPrice toEscapedModel() {
213: if (isEscapedModel()) {
214: return (ShoppingItemPrice) this ;
215: } else {
216: ShoppingItemPrice model = new ShoppingItemPriceImpl();
217:
218: model.setEscapedModel(true);
219:
220: model.setItemPriceId(getItemPriceId());
221: model.setItemId(getItemId());
222: model.setMinQuantity(getMinQuantity());
223: model.setMaxQuantity(getMaxQuantity());
224: model.setPrice(getPrice());
225: model.setDiscount(getDiscount());
226: model.setTaxable(getTaxable());
227: model.setShipping(getShipping());
228: model.setUseShippingFormula(getUseShippingFormula());
229: model.setStatus(getStatus());
230:
231: model = (ShoppingItemPrice) Proxy.newProxyInstance(
232: ShoppingItemPrice.class.getClassLoader(),
233: new Class[] { ShoppingItemPrice.class },
234: new ReadOnlyBeanHandler(model));
235:
236: return model;
237: }
238: }
239:
240: public Object clone() {
241: ShoppingItemPriceImpl clone = new ShoppingItemPriceImpl();
242:
243: clone.setItemPriceId(getItemPriceId());
244: clone.setItemId(getItemId());
245: clone.setMinQuantity(getMinQuantity());
246: clone.setMaxQuantity(getMaxQuantity());
247: clone.setPrice(getPrice());
248: clone.setDiscount(getDiscount());
249: clone.setTaxable(getTaxable());
250: clone.setShipping(getShipping());
251: clone.setUseShippingFormula(getUseShippingFormula());
252: clone.setStatus(getStatus());
253:
254: return clone;
255: }
256:
257: public int compareTo(Object obj) {
258: if (obj == null) {
259: return -1;
260: }
261:
262: ShoppingItemPriceImpl shoppingItemPrice = (ShoppingItemPriceImpl) obj;
263:
264: int value = 0;
265:
266: if (getItemId() < shoppingItemPrice.getItemId()) {
267: value = -1;
268: } else if (getItemId() > shoppingItemPrice.getItemId()) {
269: value = 1;
270: } else {
271: value = 0;
272: }
273:
274: if (value != 0) {
275: return value;
276: }
277:
278: if (getItemPriceId() < shoppingItemPrice.getItemPriceId()) {
279: value = -1;
280: } else if (getItemPriceId() > shoppingItemPrice
281: .getItemPriceId()) {
282: value = 1;
283: } else {
284: value = 0;
285: }
286:
287: if (value != 0) {
288: return value;
289: }
290:
291: return 0;
292: }
293:
294: public boolean equals(Object obj) {
295: if (obj == null) {
296: return false;
297: }
298:
299: ShoppingItemPriceImpl shoppingItemPrice = null;
300:
301: try {
302: shoppingItemPrice = (ShoppingItemPriceImpl) obj;
303: } catch (ClassCastException cce) {
304: return false;
305: }
306:
307: long pk = shoppingItemPrice.getPrimaryKey();
308:
309: if (getPrimaryKey() == pk) {
310: return true;
311: } else {
312: return false;
313: }
314: }
315:
316: public int hashCode() {
317: return (int) getPrimaryKey();
318: }
319:
320: private long _itemPriceId;
321: private long _itemId;
322: private int _minQuantity;
323: private int _maxQuantity;
324: private double _price;
325: private double _discount;
326: private boolean _taxable;
327: private double _shipping;
328: private boolean _useShippingFormula;
329: private int _status;
330: }
|