001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.shopping.service.impl;
022:
023: import com.liferay.portal.PortalException;
024: import com.liferay.portal.SystemException;
025: import com.liferay.portal.kernel.security.permission.ActionKeys;
026: import com.liferay.portal.service.permission.PortletPermissionUtil;
027: import com.liferay.portal.util.PortletKeys;
028: import com.liferay.portlet.shopping.model.ShoppingCoupon;
029: import com.liferay.portlet.shopping.service.base.ShoppingCouponServiceBaseImpl;
030:
031: import java.util.List;
032:
033: /**
034: * <a href="ShoppingCouponServiceImpl.java.html"><b><i>View Source</i></b></a>
035: *
036: * @author Brian Wing Shun Chan
037: *
038: */
039: public class ShoppingCouponServiceImpl extends
040: ShoppingCouponServiceBaseImpl {
041:
042: public ShoppingCoupon addCoupon(long plid, String code,
043: boolean autoCode, String name, String description,
044: int startDateMonth, int startDateDay, int startDateYear,
045: int startDateHour, int startDateMinute, int endDateMonth,
046: int endDateDay, int endDateYear, int endDateHour,
047: int endDateMinute, boolean neverExpire, boolean active,
048: String limitCategories, String limitSkus, double minOrder,
049: double discount, String discountType)
050: throws PortalException, SystemException {
051:
052: PortletPermissionUtil.check(getPermissionChecker(), plid,
053: PortletKeys.SHOPPING, ActionKeys.MANAGE_COUPONS);
054:
055: return shoppingCouponLocalService.addCoupon(getUserId(), plid,
056: code, autoCode, name, description, startDateMonth,
057: startDateDay, startDateYear, startDateHour,
058: startDateMinute, endDateMonth, endDateDay, endDateYear,
059: endDateHour, endDateMinute, neverExpire, active,
060: limitCategories, limitSkus, minOrder, discount,
061: discountType);
062: }
063:
064: public void deleteCoupon(long plid, long couponId)
065: throws PortalException, SystemException {
066:
067: PortletPermissionUtil.check(getPermissionChecker(), plid,
068: PortletKeys.SHOPPING, ActionKeys.MANAGE_COUPONS);
069:
070: shoppingCouponLocalService.deleteCoupon(couponId);
071: }
072:
073: public ShoppingCoupon getCoupon(long plid, long couponId)
074: throws PortalException, SystemException {
075:
076: PortletPermissionUtil.check(getPermissionChecker(), plid,
077: PortletKeys.SHOPPING, ActionKeys.MANAGE_COUPONS);
078:
079: return shoppingCouponLocalService.getCoupon(couponId);
080: }
081:
082: public List search(long plid, long companyId, String code,
083: boolean active, String discountType, boolean andOperator,
084: int begin, int end) throws PortalException, SystemException {
085:
086: PortletPermissionUtil.check(getPermissionChecker(), plid,
087: PortletKeys.SHOPPING, ActionKeys.MANAGE_COUPONS);
088:
089: return shoppingCouponLocalService.search(plid, companyId, code,
090: active, discountType, andOperator, begin, end);
091: }
092:
093: public ShoppingCoupon updateCoupon(long plid, long couponId,
094: String name, String description, int startDateMonth,
095: int startDateDay, int startDateYear, int startDateHour,
096: int startDateMinute, int endDateMonth, int endDateDay,
097: int endDateYear, int endDateHour, int endDateMinute,
098: boolean neverExpire, boolean active,
099: String limitCategories, String limitSkus, double minOrder,
100: double discount, String discountType)
101: throws PortalException, SystemException {
102:
103: PortletPermissionUtil.check(getPermissionChecker(), plid,
104: PortletKeys.SHOPPING, ActionKeys.MANAGE_COUPONS);
105:
106: return shoppingCouponLocalService.updateCoupon(getUserId(),
107: couponId, name, description, startDateMonth,
108: startDateDay, startDateYear, startDateHour,
109: startDateMinute, endDateMonth, endDateDay, endDateYear,
110: endDateHour, endDateMinute, neverExpire, active,
111: limitCategories, limitSkus, minOrder, discount,
112: discountType);
113: }
114:
115: }
|