1
22
23 package com.liferay.portlet.shopping.service.impl;
24
25 import com.liferay.portal.PortalException;
26 import com.liferay.portal.SystemException;
27 import com.liferay.portal.kernel.security.permission.ActionKeys;
28 import com.liferay.portal.service.impl.PrincipalBean;
29 import com.liferay.portal.service.permission.PortletPermissionUtil;
30 import com.liferay.portal.util.PortletKeys;
31 import com.liferay.portlet.shopping.model.ShoppingCoupon;
32 import com.liferay.portlet.shopping.service.ShoppingCouponLocalServiceUtil;
33 import com.liferay.portlet.shopping.service.ShoppingCouponService;
34
35 import java.util.List;
36
37
43 public class ShoppingCouponServiceImpl
44 extends PrincipalBean implements ShoppingCouponService {
45
46 public ShoppingCoupon addCoupon(
47 long plid, String code, boolean autoCode, String name,
48 String description, int startDateMonth, int startDateDay,
49 int startDateYear, int startDateHour, int startDateMinute,
50 int endDateMonth, int endDateDay, int endDateYear, int endDateHour,
51 int endDateMinute, boolean neverExpire, boolean active,
52 String limitCategories, String limitSkus, double minOrder,
53 double discount, String discountType)
54 throws PortalException, SystemException {
55
56 PortletPermissionUtil.check(
57 getPermissionChecker(), plid, PortletKeys.SHOPPING,
58 ActionKeys.MANAGE_COUPONS);
59
60 return ShoppingCouponLocalServiceUtil.addCoupon(
61 getUserId(), plid, code, autoCode, name, description,
62 startDateMonth, startDateDay, startDateYear, startDateHour,
63 startDateMinute, endDateMonth, endDateDay, endDateYear, endDateHour,
64 endDateMinute, neverExpire, active, limitCategories, limitSkus,
65 minOrder, discount, discountType);
66 }
67
68 public void deleteCoupon(long plid, long couponId)
69 throws PortalException, SystemException {
70
71 PortletPermissionUtil.check(
72 getPermissionChecker(), plid, PortletKeys.SHOPPING,
73 ActionKeys.MANAGE_COUPONS);
74
75 ShoppingCouponLocalServiceUtil.deleteCoupon(couponId);
76 }
77
78 public ShoppingCoupon getCoupon(long plid, long couponId)
79 throws PortalException, SystemException {
80
81 PortletPermissionUtil.check(
82 getPermissionChecker(), plid, PortletKeys.SHOPPING,
83 ActionKeys.MANAGE_COUPONS);
84
85 return ShoppingCouponLocalServiceUtil.getCoupon(couponId);
86 }
87
88 public List search(
89 long plid, long companyId, String code, boolean active,
90 String discountType, boolean andOperator, int begin, int end)
91 throws PortalException, SystemException {
92
93 PortletPermissionUtil.check(
94 getPermissionChecker(), plid, PortletKeys.SHOPPING,
95 ActionKeys.MANAGE_COUPONS);
96
97 return ShoppingCouponLocalServiceUtil.search(
98 plid, companyId, code, active, discountType, andOperator, begin,
99 end);
100 }
101
102 public ShoppingCoupon updateCoupon(
103 long plid, long couponId, String name, String description,
104 int startDateMonth, int startDateDay, int startDateYear,
105 int startDateHour, int startDateMinute, int endDateMonth,
106 int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
107 boolean neverExpire, boolean active, String limitCategories,
108 String limitSkus, double minOrder, double discount,
109 String discountType)
110 throws PortalException, SystemException {
111
112 PortletPermissionUtil.check(
113 getPermissionChecker(), plid, PortletKeys.SHOPPING,
114 ActionKeys.MANAGE_COUPONS);
115
116 return ShoppingCouponLocalServiceUtil.updateCoupon(
117 getUserId(), couponId, name, description, startDateMonth,
118 startDateDay, startDateYear, startDateHour, startDateMinute,
119 endDateMonth, endDateDay, endDateYear, endDateHour, endDateMinute,
120 neverExpire, active, limitCategories, limitSkus, minOrder, discount,
121 discountType);
122 }
123
124 }