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.DateUtil;
27 import com.liferay.portal.kernel.util.GetterUtil;
28 import com.liferay.portal.kernel.util.HtmlUtil;
29 import com.liferay.portal.model.impl.BaseModelImpl;
30
31 import com.liferay.portlet.expando.model.ExpandoBridge;
32 import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
33 import com.liferay.portlet.shopping.model.ShoppingCoupon;
34 import com.liferay.portlet.shopping.model.ShoppingCouponSoap;
35
36 import java.io.Serializable;
37
38 import java.lang.reflect.Proxy;
39
40 import java.sql.Types;
41
42 import java.util.ArrayList;
43 import java.util.Date;
44 import java.util.List;
45
46
66 public class ShoppingCouponModelImpl extends BaseModelImpl {
67 public static final String TABLE_NAME = "ShoppingCoupon";
68 public static final Object[][] TABLE_COLUMNS = {
69 { "couponId", new Integer(Types.BIGINT) },
70
71
72 { "groupId", new Integer(Types.BIGINT) },
73
74
75 { "companyId", new Integer(Types.BIGINT) },
76
77
78 { "userId", new Integer(Types.BIGINT) },
79
80
81 { "userName", new Integer(Types.VARCHAR) },
82
83
84 { "createDate", new Integer(Types.TIMESTAMP) },
85
86
87 { "modifiedDate", new Integer(Types.TIMESTAMP) },
88
89
90 { "code_", new Integer(Types.VARCHAR) },
91
92
93 { "name", new Integer(Types.VARCHAR) },
94
95
96 { "description", new Integer(Types.VARCHAR) },
97
98
99 { "startDate", new Integer(Types.TIMESTAMP) },
100
101
102 { "endDate", new Integer(Types.TIMESTAMP) },
103
104
105 { "active_", new Integer(Types.BOOLEAN) },
106
107
108 { "limitCategories", new Integer(Types.VARCHAR) },
109
110
111 { "limitSkus", new Integer(Types.VARCHAR) },
112
113
114 { "minOrder", new Integer(Types.DOUBLE) },
115
116
117 { "discount", new Integer(Types.DOUBLE) },
118
119
120 { "discountType", new Integer(Types.VARCHAR) }
121 };
122 public static final String TABLE_SQL_CREATE = "create table ShoppingCoupon (couponId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,code_ VARCHAR(75) null,name VARCHAR(75) null,description STRING null,startDate DATE null,endDate DATE null,active_ BOOLEAN,limitCategories STRING null,limitSkus STRING null,minOrder DOUBLE,discount DOUBLE,discountType VARCHAR(75) null)";
123 public static final String TABLE_SQL_DROP = "drop table ShoppingCoupon";
124 public static final String DATA_SOURCE = "liferayDataSource";
125 public static final String SESSION_FACTORY = "liferaySessionFactory";
126 public static final String TX_MANAGER = "liferayTransactionManager";
127 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
128 "value.object.finder.cache.enabled.com.liferay.portlet.shopping.model.ShoppingCoupon"),
129 true);
130
131 public static ShoppingCoupon toModel(ShoppingCouponSoap soapModel) {
132 ShoppingCoupon model = new ShoppingCouponImpl();
133
134 model.setCouponId(soapModel.getCouponId());
135 model.setGroupId(soapModel.getGroupId());
136 model.setCompanyId(soapModel.getCompanyId());
137 model.setUserId(soapModel.getUserId());
138 model.setUserName(soapModel.getUserName());
139 model.setCreateDate(soapModel.getCreateDate());
140 model.setModifiedDate(soapModel.getModifiedDate());
141 model.setCode(soapModel.getCode());
142 model.setName(soapModel.getName());
143 model.setDescription(soapModel.getDescription());
144 model.setStartDate(soapModel.getStartDate());
145 model.setEndDate(soapModel.getEndDate());
146 model.setActive(soapModel.getActive());
147 model.setLimitCategories(soapModel.getLimitCategories());
148 model.setLimitSkus(soapModel.getLimitSkus());
149 model.setMinOrder(soapModel.getMinOrder());
150 model.setDiscount(soapModel.getDiscount());
151 model.setDiscountType(soapModel.getDiscountType());
152
153 return model;
154 }
155
156 public static List<ShoppingCoupon> toModels(ShoppingCouponSoap[] soapModels) {
157 List<ShoppingCoupon> models = new ArrayList<ShoppingCoupon>(soapModels.length);
158
159 for (ShoppingCouponSoap soapModel : soapModels) {
160 models.add(toModel(soapModel));
161 }
162
163 return models;
164 }
165
166 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
167 "lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingCoupon"));
168
169 public ShoppingCouponModelImpl() {
170 }
171
172 public long getPrimaryKey() {
173 return _couponId;
174 }
175
176 public void setPrimaryKey(long pk) {
177 setCouponId(pk);
178 }
179
180 public Serializable getPrimaryKeyObj() {
181 return new Long(_couponId);
182 }
183
184 public long getCouponId() {
185 return _couponId;
186 }
187
188 public void setCouponId(long couponId) {
189 if (couponId != _couponId) {
190 _couponId = couponId;
191 }
192 }
193
194 public long getGroupId() {
195 return _groupId;
196 }
197
198 public void setGroupId(long groupId) {
199 if (groupId != _groupId) {
200 _groupId = groupId;
201 }
202 }
203
204 public long getCompanyId() {
205 return _companyId;
206 }
207
208 public void setCompanyId(long companyId) {
209 if (companyId != _companyId) {
210 _companyId = companyId;
211 }
212 }
213
214 public long getUserId() {
215 return _userId;
216 }
217
218 public void setUserId(long userId) {
219 if (userId != _userId) {
220 _userId = userId;
221 }
222 }
223
224 public String getUserName() {
225 return GetterUtil.getString(_userName);
226 }
227
228 public void setUserName(String userName) {
229 if (((userName == null) && (_userName != null)) ||
230 ((userName != null) && (_userName == null)) ||
231 ((userName != null) && (_userName != null) &&
232 !userName.equals(_userName))) {
233 _userName = userName;
234 }
235 }
236
237 public Date getCreateDate() {
238 return _createDate;
239 }
240
241 public void setCreateDate(Date createDate) {
242 if (((createDate == null) && (_createDate != null)) ||
243 ((createDate != null) && (_createDate == null)) ||
244 ((createDate != null) && (_createDate != null) &&
245 !createDate.equals(_createDate))) {
246 _createDate = createDate;
247 }
248 }
249
250 public Date getModifiedDate() {
251 return _modifiedDate;
252 }
253
254 public void setModifiedDate(Date modifiedDate) {
255 if (((modifiedDate == null) && (_modifiedDate != null)) ||
256 ((modifiedDate != null) && (_modifiedDate == null)) ||
257 ((modifiedDate != null) && (_modifiedDate != null) &&
258 !modifiedDate.equals(_modifiedDate))) {
259 _modifiedDate = modifiedDate;
260 }
261 }
262
263 public String getCode() {
264 return GetterUtil.getString(_code);
265 }
266
267 public void setCode(String code) {
268 if (((code == null) && (_code != null)) ||
269 ((code != null) && (_code == null)) ||
270 ((code != null) && (_code != null) && !code.equals(_code))) {
271 _code = code;
272 }
273 }
274
275 public String getName() {
276 return GetterUtil.getString(_name);
277 }
278
279 public void setName(String name) {
280 if (((name == null) && (_name != null)) ||
281 ((name != null) && (_name == null)) ||
282 ((name != null) && (_name != null) && !name.equals(_name))) {
283 _name = name;
284 }
285 }
286
287 public String getDescription() {
288 return GetterUtil.getString(_description);
289 }
290
291 public void setDescription(String description) {
292 if (((description == null) && (_description != null)) ||
293 ((description != null) && (_description == null)) ||
294 ((description != null) && (_description != null) &&
295 !description.equals(_description))) {
296 _description = description;
297 }
298 }
299
300 public Date getStartDate() {
301 return _startDate;
302 }
303
304 public void setStartDate(Date startDate) {
305 if (((startDate == null) && (_startDate != null)) ||
306 ((startDate != null) && (_startDate == null)) ||
307 ((startDate != null) && (_startDate != null) &&
308 !startDate.equals(_startDate))) {
309 _startDate = startDate;
310 }
311 }
312
313 public Date getEndDate() {
314 return _endDate;
315 }
316
317 public void setEndDate(Date endDate) {
318 if (((endDate == null) && (_endDate != null)) ||
319 ((endDate != null) && (_endDate == null)) ||
320 ((endDate != null) && (_endDate != null) &&
321 !endDate.equals(_endDate))) {
322 _endDate = endDate;
323 }
324 }
325
326 public boolean getActive() {
327 return _active;
328 }
329
330 public boolean isActive() {
331 return _active;
332 }
333
334 public void setActive(boolean active) {
335 if (active != _active) {
336 _active = active;
337 }
338 }
339
340 public String getLimitCategories() {
341 return GetterUtil.getString(_limitCategories);
342 }
343
344 public void setLimitCategories(String limitCategories) {
345 if (((limitCategories == null) && (_limitCategories != null)) ||
346 ((limitCategories != null) && (_limitCategories == null)) ||
347 ((limitCategories != null) && (_limitCategories != null) &&
348 !limitCategories.equals(_limitCategories))) {
349 _limitCategories = limitCategories;
350 }
351 }
352
353 public String getLimitSkus() {
354 return GetterUtil.getString(_limitSkus);
355 }
356
357 public void setLimitSkus(String limitSkus) {
358 if (((limitSkus == null) && (_limitSkus != null)) ||
359 ((limitSkus != null) && (_limitSkus == null)) ||
360 ((limitSkus != null) && (_limitSkus != null) &&
361 !limitSkus.equals(_limitSkus))) {
362 _limitSkus = limitSkus;
363 }
364 }
365
366 public double getMinOrder() {
367 return _minOrder;
368 }
369
370 public void setMinOrder(double minOrder) {
371 if (minOrder != _minOrder) {
372 _minOrder = minOrder;
373 }
374 }
375
376 public double getDiscount() {
377 return _discount;
378 }
379
380 public void setDiscount(double discount) {
381 if (discount != _discount) {
382 _discount = discount;
383 }
384 }
385
386 public String getDiscountType() {
387 return GetterUtil.getString(_discountType);
388 }
389
390 public void setDiscountType(String discountType) {
391 if (((discountType == null) && (_discountType != null)) ||
392 ((discountType != null) && (_discountType == null)) ||
393 ((discountType != null) && (_discountType != null) &&
394 !discountType.equals(_discountType))) {
395 _discountType = discountType;
396 }
397 }
398
399 public ShoppingCoupon toEscapedModel() {
400 if (isEscapedModel()) {
401 return (ShoppingCoupon)this;
402 }
403 else {
404 ShoppingCoupon model = new ShoppingCouponImpl();
405
406 model.setNew(isNew());
407 model.setEscapedModel(true);
408
409 model.setCouponId(getCouponId());
410 model.setGroupId(getGroupId());
411 model.setCompanyId(getCompanyId());
412 model.setUserId(getUserId());
413 model.setUserName(HtmlUtil.escape(getUserName()));
414 model.setCreateDate(getCreateDate());
415 model.setModifiedDate(getModifiedDate());
416 model.setCode(HtmlUtil.escape(getCode()));
417 model.setName(HtmlUtil.escape(getName()));
418 model.setDescription(HtmlUtil.escape(getDescription()));
419 model.setStartDate(getStartDate());
420 model.setEndDate(getEndDate());
421 model.setActive(getActive());
422 model.setLimitCategories(HtmlUtil.escape(getLimitCategories()));
423 model.setLimitSkus(HtmlUtil.escape(getLimitSkus()));
424 model.setMinOrder(getMinOrder());
425 model.setDiscount(getDiscount());
426 model.setDiscountType(HtmlUtil.escape(getDiscountType()));
427
428 model = (ShoppingCoupon)Proxy.newProxyInstance(ShoppingCoupon.class.getClassLoader(),
429 new Class[] { ShoppingCoupon.class },
430 new ReadOnlyBeanHandler(model));
431
432 return model;
433 }
434 }
435
436 public ExpandoBridge getExpandoBridge() {
437 if (_expandoBridge == null) {
438 _expandoBridge = new ExpandoBridgeImpl(ShoppingCoupon.class.getName(),
439 getPrimaryKey());
440 }
441
442 return _expandoBridge;
443 }
444
445 public Object clone() {
446 ShoppingCouponImpl clone = new ShoppingCouponImpl();
447
448 clone.setCouponId(getCouponId());
449 clone.setGroupId(getGroupId());
450 clone.setCompanyId(getCompanyId());
451 clone.setUserId(getUserId());
452 clone.setUserName(getUserName());
453 clone.setCreateDate(getCreateDate());
454 clone.setModifiedDate(getModifiedDate());
455 clone.setCode(getCode());
456 clone.setName(getName());
457 clone.setDescription(getDescription());
458 clone.setStartDate(getStartDate());
459 clone.setEndDate(getEndDate());
460 clone.setActive(getActive());
461 clone.setLimitCategories(getLimitCategories());
462 clone.setLimitSkus(getLimitSkus());
463 clone.setMinOrder(getMinOrder());
464 clone.setDiscount(getDiscount());
465 clone.setDiscountType(getDiscountType());
466
467 return clone;
468 }
469
470 public int compareTo(Object obj) {
471 if (obj == null) {
472 return -1;
473 }
474
475 ShoppingCouponImpl shoppingCoupon = (ShoppingCouponImpl)obj;
476
477 int value = 0;
478
479 value = DateUtil.compareTo(getCreateDate(),
480 shoppingCoupon.getCreateDate());
481
482 if (value != 0) {
483 return value;
484 }
485
486 return 0;
487 }
488
489 public boolean equals(Object obj) {
490 if (obj == null) {
491 return false;
492 }
493
494 ShoppingCouponImpl shoppingCoupon = null;
495
496 try {
497 shoppingCoupon = (ShoppingCouponImpl)obj;
498 }
499 catch (ClassCastException cce) {
500 return false;
501 }
502
503 long pk = shoppingCoupon.getPrimaryKey();
504
505 if (getPrimaryKey() == pk) {
506 return true;
507 }
508 else {
509 return false;
510 }
511 }
512
513 public int hashCode() {
514 return (int)getPrimaryKey();
515 }
516
517 private long _couponId;
518 private long _groupId;
519 private long _companyId;
520 private long _userId;
521 private String _userName;
522 private Date _createDate;
523 private Date _modifiedDate;
524 private String _code;
525 private String _name;
526 private String _description;
527 private Date _startDate;
528 private Date _endDate;
529 private boolean _active;
530 private String _limitCategories;
531 private String _limitSkus;
532 private double _minOrder;
533 private double _discount;
534 private String _discountType;
535 private transient ExpandoBridge _expandoBridge;
536 }