001
014
015 package com.liferay.portlet.shopping.service.http;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.MethodHandler;
020 import com.liferay.portal.kernel.util.MethodKey;
021 import com.liferay.portal.security.auth.HttpPrincipal;
022 import com.liferay.portal.service.http.TunnelUtil;
023
024 import com.liferay.portlet.shopping.service.ShoppingCouponServiceUtil;
025
026
056 public class ShoppingCouponServiceHttp {
057 public static com.liferay.portlet.shopping.model.ShoppingCoupon addCoupon(
058 HttpPrincipal httpPrincipal, java.lang.String code, boolean autoCode,
059 java.lang.String name, java.lang.String description,
060 int startDateMonth, int startDateDay, int startDateYear,
061 int startDateHour, int startDateMinute, int endDateMonth,
062 int endDateDay, int endDateYear, int endDateHour, int endDateMinute,
063 boolean neverExpire, boolean active, java.lang.String limitCategories,
064 java.lang.String limitSkus, double minOrder, double discount,
065 java.lang.String discountType,
066 com.liferay.portal.service.ServiceContext serviceContext)
067 throws com.liferay.portal.kernel.exception.PortalException,
068 com.liferay.portal.kernel.exception.SystemException {
069 try {
070 MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
071 "addCoupon", java.lang.String.class, boolean.class,
072 java.lang.String.class, java.lang.String.class, int.class,
073 int.class, int.class, int.class, int.class, int.class,
074 int.class, int.class, int.class, int.class, boolean.class,
075 boolean.class, java.lang.String.class,
076 java.lang.String.class, double.class, double.class,
077 java.lang.String.class,
078 com.liferay.portal.service.ServiceContext.class);
079
080 MethodHandler methodHandler = new MethodHandler(methodKey, code,
081 autoCode, name, description, startDateMonth, startDateDay,
082 startDateYear, startDateHour, startDateMinute,
083 endDateMonth, endDateDay, endDateYear, endDateHour,
084 endDateMinute, neverExpire, active, limitCategories,
085 limitSkus, minOrder, discount, discountType, serviceContext);
086
087 Object returnObj = null;
088
089 try {
090 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
091 }
092 catch (Exception e) {
093 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
094 throw (com.liferay.portal.kernel.exception.PortalException)e;
095 }
096
097 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
098 throw (com.liferay.portal.kernel.exception.SystemException)e;
099 }
100
101 throw new com.liferay.portal.kernel.exception.SystemException(e);
102 }
103
104 return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
105 }
106 catch (com.liferay.portal.kernel.exception.SystemException se) {
107 _log.error(se, se);
108
109 throw se;
110 }
111 }
112
113 public static void deleteCoupon(HttpPrincipal httpPrincipal, long groupId,
114 long couponId)
115 throws com.liferay.portal.kernel.exception.PortalException,
116 com.liferay.portal.kernel.exception.SystemException {
117 try {
118 MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
119 "deleteCoupon", long.class, long.class);
120
121 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
122 couponId);
123
124 try {
125 TunnelUtil.invoke(httpPrincipal, methodHandler);
126 }
127 catch (Exception e) {
128 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
129 throw (com.liferay.portal.kernel.exception.PortalException)e;
130 }
131
132 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
133 throw (com.liferay.portal.kernel.exception.SystemException)e;
134 }
135
136 throw new com.liferay.portal.kernel.exception.SystemException(e);
137 }
138 }
139 catch (com.liferay.portal.kernel.exception.SystemException se) {
140 _log.error(se, se);
141
142 throw se;
143 }
144 }
145
146 public static com.liferay.portlet.shopping.model.ShoppingCoupon getCoupon(
147 HttpPrincipal httpPrincipal, long groupId, long couponId)
148 throws com.liferay.portal.kernel.exception.PortalException,
149 com.liferay.portal.kernel.exception.SystemException {
150 try {
151 MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
152 "getCoupon", long.class, long.class);
153
154 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
155 couponId);
156
157 Object returnObj = null;
158
159 try {
160 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
161 }
162 catch (Exception e) {
163 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
164 throw (com.liferay.portal.kernel.exception.PortalException)e;
165 }
166
167 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
168 throw (com.liferay.portal.kernel.exception.SystemException)e;
169 }
170
171 throw new com.liferay.portal.kernel.exception.SystemException(e);
172 }
173
174 return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
175 }
176 catch (com.liferay.portal.kernel.exception.SystemException se) {
177 _log.error(se, se);
178
179 throw se;
180 }
181 }
182
183 public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> search(
184 HttpPrincipal httpPrincipal, long groupId, long companyId,
185 java.lang.String code, boolean active, java.lang.String discountType,
186 boolean andOperator, int start, int end)
187 throws com.liferay.portal.kernel.exception.PortalException,
188 com.liferay.portal.kernel.exception.SystemException {
189 try {
190 MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
191 "search", long.class, long.class, java.lang.String.class,
192 boolean.class, java.lang.String.class, boolean.class,
193 int.class, int.class);
194
195 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
196 companyId, code, active, discountType, andOperator, start,
197 end);
198
199 Object returnObj = null;
200
201 try {
202 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
203 }
204 catch (Exception e) {
205 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
206 throw (com.liferay.portal.kernel.exception.PortalException)e;
207 }
208
209 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
210 throw (com.liferay.portal.kernel.exception.SystemException)e;
211 }
212
213 throw new com.liferay.portal.kernel.exception.SystemException(e);
214 }
215
216 return (java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon>)returnObj;
217 }
218 catch (com.liferay.portal.kernel.exception.SystemException se) {
219 _log.error(se, se);
220
221 throw se;
222 }
223 }
224
225 public static com.liferay.portlet.shopping.model.ShoppingCoupon updateCoupon(
226 HttpPrincipal httpPrincipal, long couponId, java.lang.String name,
227 java.lang.String description, int startDateMonth, int startDateDay,
228 int startDateYear, int startDateHour, int startDateMinute,
229 int endDateMonth, int endDateDay, int endDateYear, int endDateHour,
230 int endDateMinute, boolean neverExpire, boolean active,
231 java.lang.String limitCategories, java.lang.String limitSkus,
232 double minOrder, double discount, java.lang.String discountType,
233 com.liferay.portal.service.ServiceContext serviceContext)
234 throws com.liferay.portal.kernel.exception.PortalException,
235 com.liferay.portal.kernel.exception.SystemException {
236 try {
237 MethodKey methodKey = new MethodKey(ShoppingCouponServiceUtil.class.getName(),
238 "updateCoupon", long.class, java.lang.String.class,
239 java.lang.String.class, int.class, int.class, int.class,
240 int.class, int.class, int.class, int.class, int.class,
241 int.class, int.class, boolean.class, boolean.class,
242 java.lang.String.class, java.lang.String.class,
243 double.class, double.class, java.lang.String.class,
244 com.liferay.portal.service.ServiceContext.class);
245
246 MethodHandler methodHandler = new MethodHandler(methodKey,
247 couponId, name, description, startDateMonth, startDateDay,
248 startDateYear, startDateHour, startDateMinute,
249 endDateMonth, endDateDay, endDateYear, endDateHour,
250 endDateMinute, neverExpire, active, limitCategories,
251 limitSkus, minOrder, discount, discountType, serviceContext);
252
253 Object returnObj = null;
254
255 try {
256 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
257 }
258 catch (Exception e) {
259 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
260 throw (com.liferay.portal.kernel.exception.PortalException)e;
261 }
262
263 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
264 throw (com.liferay.portal.kernel.exception.SystemException)e;
265 }
266
267 throw new com.liferay.portal.kernel.exception.SystemException(e);
268 }
269
270 return (com.liferay.portlet.shopping.model.ShoppingCoupon)returnObj;
271 }
272 catch (com.liferay.portal.kernel.exception.SystemException se) {
273 _log.error(se, se);
274
275 throw se;
276 }
277 }
278
279 private static Log _log = LogFactoryUtil.getLog(ShoppingCouponServiceHttp.class);
280 }