1
14
15 package com.liferay.portlet.shopping.model.impl;
16
17 import com.liferay.portal.kernel.util.CalendarUtil;
18 import com.liferay.portlet.shopping.model.ShoppingCoupon;
19
20 import java.util.Date;
21
22
27 public class ShoppingCouponImpl
28 extends ShoppingCouponModelImpl implements ShoppingCoupon {
29
30 public ShoppingCouponImpl() {
31 }
32
33 public boolean hasValidDateRange() {
34 if (hasValidStartDate() && hasValidEndDate()) {
35 return true;
36 }
37 else {
38 return false;
39 }
40 }
41
42 public boolean hasValidEndDate() {
43 if (getEndDate() != null) {
44 Date now = new Date();
45
46 if (now.after(getEndDate())) {
47 return false;
48 }
49 }
50
51 return true;
52 }
53
54 public boolean hasValidStartDate() {
55 Date now = new Date();
56
57 if (CalendarUtil.beforeByDay(now, getStartDate())) {
58 return false;
59 }
60 else {
61 return true;
62 }
63 }
64
65 }