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