1
22
23 package com.liferay.portlet.shopping.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.impl.BaseModelImpl;
28
29 import com.liferay.portlet.expando.model.ExpandoBridge;
30 import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
31 import com.liferay.portlet.shopping.model.ShoppingItemPrice;
32 import com.liferay.portlet.shopping.model.ShoppingItemPriceSoap;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.List;
42
43
63 public class ShoppingItemPriceModelImpl extends BaseModelImpl {
64 public static final String TABLE_NAME = "ShoppingItemPrice";
65 public static final Object[][] TABLE_COLUMNS = {
66 { "itemPriceId", new Integer(Types.BIGINT) },
67
68
69 { "itemId", new Integer(Types.BIGINT) },
70
71
72 { "minQuantity", new Integer(Types.INTEGER) },
73
74
75 { "maxQuantity", new Integer(Types.INTEGER) },
76
77
78 { "price", new Integer(Types.DOUBLE) },
79
80
81 { "discount", new Integer(Types.DOUBLE) },
82
83
84 { "taxable", new Integer(Types.BOOLEAN) },
85
86
87 { "shipping", new Integer(Types.DOUBLE) },
88
89
90 { "useShippingFormula", new Integer(Types.BOOLEAN) },
91
92
93 { "status", new Integer(Types.INTEGER) }
94 };
95 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)";
96 public static final String TABLE_SQL_DROP = "drop table ShoppingItemPrice";
97 public static final String DATA_SOURCE = "liferayDataSource";
98 public static final String SESSION_FACTORY = "liferaySessionFactory";
99 public static final String TX_MANAGER = "liferayTransactionManager";
100 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
101 "value.object.finder.cache.enabled.com.liferay.portlet.shopping.model.ShoppingItemPrice"),
102 true);
103
104 public static ShoppingItemPrice toModel(ShoppingItemPriceSoap soapModel) {
105 ShoppingItemPrice model = new ShoppingItemPriceImpl();
106
107 model.setItemPriceId(soapModel.getItemPriceId());
108 model.setItemId(soapModel.getItemId());
109 model.setMinQuantity(soapModel.getMinQuantity());
110 model.setMaxQuantity(soapModel.getMaxQuantity());
111 model.setPrice(soapModel.getPrice());
112 model.setDiscount(soapModel.getDiscount());
113 model.setTaxable(soapModel.getTaxable());
114 model.setShipping(soapModel.getShipping());
115 model.setUseShippingFormula(soapModel.getUseShippingFormula());
116 model.setStatus(soapModel.getStatus());
117
118 return model;
119 }
120
121 public static List<ShoppingItemPrice> toModels(
122 ShoppingItemPriceSoap[] soapModels) {
123 List<ShoppingItemPrice> models = new ArrayList<ShoppingItemPrice>(soapModels.length);
124
125 for (ShoppingItemPriceSoap soapModel : soapModels) {
126 models.add(toModel(soapModel));
127 }
128
129 return models;
130 }
131
132 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
133 "lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingItemPrice"));
134
135 public ShoppingItemPriceModelImpl() {
136 }
137
138 public long getPrimaryKey() {
139 return _itemPriceId;
140 }
141
142 public void setPrimaryKey(long pk) {
143 setItemPriceId(pk);
144 }
145
146 public Serializable getPrimaryKeyObj() {
147 return new Long(_itemPriceId);
148 }
149
150 public long getItemPriceId() {
151 return _itemPriceId;
152 }
153
154 public void setItemPriceId(long itemPriceId) {
155 if (itemPriceId != _itemPriceId) {
156 _itemPriceId = itemPriceId;
157 }
158 }
159
160 public long getItemId() {
161 return _itemId;
162 }
163
164 public void setItemId(long itemId) {
165 if (itemId != _itemId) {
166 _itemId = itemId;
167 }
168 }
169
170 public int getMinQuantity() {
171 return _minQuantity;
172 }
173
174 public void setMinQuantity(int minQuantity) {
175 if (minQuantity != _minQuantity) {
176 _minQuantity = minQuantity;
177 }
178 }
179
180 public int getMaxQuantity() {
181 return _maxQuantity;
182 }
183
184 public void setMaxQuantity(int maxQuantity) {
185 if (maxQuantity != _maxQuantity) {
186 _maxQuantity = maxQuantity;
187 }
188 }
189
190 public double getPrice() {
191 return _price;
192 }
193
194 public void setPrice(double price) {
195 if (price != _price) {
196 _price = price;
197 }
198 }
199
200 public double getDiscount() {
201 return _discount;
202 }
203
204 public void setDiscount(double discount) {
205 if (discount != _discount) {
206 _discount = discount;
207 }
208 }
209
210 public boolean getTaxable() {
211 return _taxable;
212 }
213
214 public boolean isTaxable() {
215 return _taxable;
216 }
217
218 public void setTaxable(boolean taxable) {
219 if (taxable != _taxable) {
220 _taxable = taxable;
221 }
222 }
223
224 public double getShipping() {
225 return _shipping;
226 }
227
228 public void setShipping(double shipping) {
229 if (shipping != _shipping) {
230 _shipping = shipping;
231 }
232 }
233
234 public boolean getUseShippingFormula() {
235 return _useShippingFormula;
236 }
237
238 public boolean isUseShippingFormula() {
239 return _useShippingFormula;
240 }
241
242 public void setUseShippingFormula(boolean useShippingFormula) {
243 if (useShippingFormula != _useShippingFormula) {
244 _useShippingFormula = useShippingFormula;
245 }
246 }
247
248 public int getStatus() {
249 return _status;
250 }
251
252 public void setStatus(int status) {
253 if (status != _status) {
254 _status = status;
255 }
256 }
257
258 public ShoppingItemPrice toEscapedModel() {
259 if (isEscapedModel()) {
260 return (ShoppingItemPrice)this;
261 }
262 else {
263 ShoppingItemPrice model = new ShoppingItemPriceImpl();
264
265 model.setNew(isNew());
266 model.setEscapedModel(true);
267
268 model.setItemPriceId(getItemPriceId());
269 model.setItemId(getItemId());
270 model.setMinQuantity(getMinQuantity());
271 model.setMaxQuantity(getMaxQuantity());
272 model.setPrice(getPrice());
273 model.setDiscount(getDiscount());
274 model.setTaxable(getTaxable());
275 model.setShipping(getShipping());
276 model.setUseShippingFormula(getUseShippingFormula());
277 model.setStatus(getStatus());
278
279 model = (ShoppingItemPrice)Proxy.newProxyInstance(ShoppingItemPrice.class.getClassLoader(),
280 new Class[] { ShoppingItemPrice.class },
281 new ReadOnlyBeanHandler(model));
282
283 return model;
284 }
285 }
286
287 public ExpandoBridge getExpandoBridge() {
288 if (_expandoBridge == null) {
289 _expandoBridge = new ExpandoBridgeImpl(ShoppingItemPrice.class.getName(),
290 getPrimaryKey());
291 }
292
293 return _expandoBridge;
294 }
295
296 public Object clone() {
297 ShoppingItemPriceImpl clone = new ShoppingItemPriceImpl();
298
299 clone.setItemPriceId(getItemPriceId());
300 clone.setItemId(getItemId());
301 clone.setMinQuantity(getMinQuantity());
302 clone.setMaxQuantity(getMaxQuantity());
303 clone.setPrice(getPrice());
304 clone.setDiscount(getDiscount());
305 clone.setTaxable(getTaxable());
306 clone.setShipping(getShipping());
307 clone.setUseShippingFormula(getUseShippingFormula());
308 clone.setStatus(getStatus());
309
310 return clone;
311 }
312
313 public int compareTo(Object obj) {
314 if (obj == null) {
315 return -1;
316 }
317
318 ShoppingItemPriceImpl shoppingItemPrice = (ShoppingItemPriceImpl)obj;
319
320 int value = 0;
321
322 if (getItemId() < shoppingItemPrice.getItemId()) {
323 value = -1;
324 }
325 else if (getItemId() > shoppingItemPrice.getItemId()) {
326 value = 1;
327 }
328 else {
329 value = 0;
330 }
331
332 if (value != 0) {
333 return value;
334 }
335
336 if (getItemPriceId() < shoppingItemPrice.getItemPriceId()) {
337 value = -1;
338 }
339 else if (getItemPriceId() > shoppingItemPrice.getItemPriceId()) {
340 value = 1;
341 }
342 else {
343 value = 0;
344 }
345
346 if (value != 0) {
347 return value;
348 }
349
350 return 0;
351 }
352
353 public boolean equals(Object obj) {
354 if (obj == null) {
355 return false;
356 }
357
358 ShoppingItemPriceImpl shoppingItemPrice = null;
359
360 try {
361 shoppingItemPrice = (ShoppingItemPriceImpl)obj;
362 }
363 catch (ClassCastException cce) {
364 return false;
365 }
366
367 long pk = shoppingItemPrice.getPrimaryKey();
368
369 if (getPrimaryKey() == pk) {
370 return true;
371 }
372 else {
373 return false;
374 }
375 }
376
377 public int hashCode() {
378 return (int)getPrimaryKey();
379 }
380
381 private long _itemPriceId;
382 private long _itemId;
383 private int _minQuantity;
384 private int _maxQuantity;
385 private double _price;
386 private double _discount;
387 private boolean _taxable;
388 private double _shipping;
389 private boolean _useShippingFormula;
390 private int _status;
391 private transient ExpandoBridge _expandoBridge;
392 }