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