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