1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
13   */
14  
15  package com.liferay.portlet.shopping.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.BooleanWrapper;
20  import com.liferay.portal.kernel.util.LongWrapper;
21  import com.liferay.portal.kernel.util.MethodWrapper;
22  import com.liferay.portal.kernel.util.NullWrapper;
23  import com.liferay.portal.security.auth.HttpPrincipal;
24  import com.liferay.portal.service.http.TunnelUtil;
25  
26  import com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil;
27  
28  /**
29   * <a href="ShoppingCategoryServiceHttp.java.html"><b><i>View Source</i></b></a>
30   *
31   * <p>
32   * ServiceBuilder generated this class. Modifications in this class will be
33   * overwritten the next time is generated.
34   * </p>
35   *
36   * <p>
37   * This class provides a HTTP utility for the
38   * {@link com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil} service utility. The
39   * static methods of this class calls the same methods of the service utility.
40   * However, the signatures are different because it requires an additional
41   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
42   * </p>
43   *
44   * <p>
45   * The benefits of using the HTTP utility is that it is fast and allows for
46   * tunneling without the cost of serializing to text. The drawback is that it
47   * only works with Java.
48   * </p>
49   *
50   * <p>
51   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
52   * configure security.
53   * </p>
54   *
55   * <p>
56   * The HTTP utility is only generated for remote services.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       ShoppingCategoryServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil
63   * @generated
64   */
65  public class ShoppingCategoryServiceHttp {
66      public static com.liferay.portlet.shopping.model.ShoppingCategory addCategory(
67          HttpPrincipal httpPrincipal, long plid, long parentCategoryId,
68          java.lang.String name, java.lang.String description,
69          boolean addCommunityPermissions, boolean addGuestPermissions)
70          throws com.liferay.portal.PortalException,
71              com.liferay.portal.SystemException {
72          try {
73              Object paramObj0 = new LongWrapper(plid);
74  
75              Object paramObj1 = new LongWrapper(parentCategoryId);
76  
77              Object paramObj2 = name;
78  
79              if (name == null) {
80                  paramObj2 = new NullWrapper("java.lang.String");
81              }
82  
83              Object paramObj3 = description;
84  
85              if (description == null) {
86                  paramObj3 = new NullWrapper("java.lang.String");
87              }
88  
89              Object paramObj4 = new BooleanWrapper(addCommunityPermissions);
90  
91              Object paramObj5 = new BooleanWrapper(addGuestPermissions);
92  
93              MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
94                      "addCategory",
95                      new Object[] {
96                          paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
97                          paramObj5
98                      });
99  
100             Object returnObj = null;
101 
102             try {
103                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
104             }
105             catch (Exception e) {
106                 if (e instanceof com.liferay.portal.PortalException) {
107                     throw (com.liferay.portal.PortalException)e;
108                 }
109 
110                 if (e instanceof com.liferay.portal.SystemException) {
111                     throw (com.liferay.portal.SystemException)e;
112                 }
113 
114                 throw new com.liferay.portal.SystemException(e);
115             }
116 
117             return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
118         }
119         catch (com.liferay.portal.SystemException se) {
120             _log.error(se, se);
121 
122             throw se;
123         }
124     }
125 
126     public static com.liferay.portlet.shopping.model.ShoppingCategory addCategory(
127         HttpPrincipal httpPrincipal, long plid, long parentCategoryId,
128         java.lang.String name, java.lang.String description,
129         java.lang.String[] communityPermissions,
130         java.lang.String[] guestPermissions)
131         throws com.liferay.portal.PortalException,
132             com.liferay.portal.SystemException {
133         try {
134             Object paramObj0 = new LongWrapper(plid);
135 
136             Object paramObj1 = new LongWrapper(parentCategoryId);
137 
138             Object paramObj2 = name;
139 
140             if (name == null) {
141                 paramObj2 = new NullWrapper("java.lang.String");
142             }
143 
144             Object paramObj3 = description;
145 
146             if (description == null) {
147                 paramObj3 = new NullWrapper("java.lang.String");
148             }
149 
150             Object paramObj4 = communityPermissions;
151 
152             if (communityPermissions == null) {
153                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
154             }
155 
156             Object paramObj5 = guestPermissions;
157 
158             if (guestPermissions == null) {
159                 paramObj5 = new NullWrapper("[Ljava.lang.String;");
160             }
161 
162             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
163                     "addCategory",
164                     new Object[] {
165                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
166                         paramObj5
167                     });
168 
169             Object returnObj = null;
170 
171             try {
172                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
173             }
174             catch (Exception e) {
175                 if (e instanceof com.liferay.portal.PortalException) {
176                     throw (com.liferay.portal.PortalException)e;
177                 }
178 
179                 if (e instanceof com.liferay.portal.SystemException) {
180                     throw (com.liferay.portal.SystemException)e;
181                 }
182 
183                 throw new com.liferay.portal.SystemException(e);
184             }
185 
186             return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
187         }
188         catch (com.liferay.portal.SystemException se) {
189             _log.error(se, se);
190 
191             throw se;
192         }
193     }
194 
195     public static void deleteCategory(HttpPrincipal httpPrincipal,
196         long categoryId)
197         throws com.liferay.portal.PortalException,
198             com.liferay.portal.SystemException {
199         try {
200             Object paramObj0 = new LongWrapper(categoryId);
201 
202             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
203                     "deleteCategory", new Object[] { paramObj0 });
204 
205             try {
206                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
207             }
208             catch (Exception e) {
209                 if (e instanceof com.liferay.portal.PortalException) {
210                     throw (com.liferay.portal.PortalException)e;
211                 }
212 
213                 if (e instanceof com.liferay.portal.SystemException) {
214                     throw (com.liferay.portal.SystemException)e;
215                 }
216 
217                 throw new com.liferay.portal.SystemException(e);
218             }
219         }
220         catch (com.liferay.portal.SystemException se) {
221             _log.error(se, se);
222 
223             throw se;
224         }
225     }
226 
227     public static com.liferay.portlet.shopping.model.ShoppingCategory getCategory(
228         HttpPrincipal httpPrincipal, long categoryId)
229         throws com.liferay.portal.PortalException,
230             com.liferay.portal.SystemException {
231         try {
232             Object paramObj0 = new LongWrapper(categoryId);
233 
234             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
235                     "getCategory", new Object[] { paramObj0 });
236 
237             Object returnObj = null;
238 
239             try {
240                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
241             }
242             catch (Exception e) {
243                 if (e instanceof com.liferay.portal.PortalException) {
244                     throw (com.liferay.portal.PortalException)e;
245                 }
246 
247                 if (e instanceof com.liferay.portal.SystemException) {
248                     throw (com.liferay.portal.SystemException)e;
249                 }
250 
251                 throw new com.liferay.portal.SystemException(e);
252             }
253 
254             return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
255         }
256         catch (com.liferay.portal.SystemException se) {
257             _log.error(se, se);
258 
259             throw se;
260         }
261     }
262 
263     public static com.liferay.portlet.shopping.model.ShoppingCategory updateCategory(
264         HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
265         java.lang.String name, java.lang.String description,
266         boolean mergeWithParentCategory)
267         throws com.liferay.portal.PortalException,
268             com.liferay.portal.SystemException {
269         try {
270             Object paramObj0 = new LongWrapper(categoryId);
271 
272             Object paramObj1 = new LongWrapper(parentCategoryId);
273 
274             Object paramObj2 = name;
275 
276             if (name == null) {
277                 paramObj2 = new NullWrapper("java.lang.String");
278             }
279 
280             Object paramObj3 = description;
281 
282             if (description == null) {
283                 paramObj3 = new NullWrapper("java.lang.String");
284             }
285 
286             Object paramObj4 = new BooleanWrapper(mergeWithParentCategory);
287 
288             MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
289                     "updateCategory",
290                     new Object[] {
291                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
292                     });
293 
294             Object returnObj = null;
295 
296             try {
297                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
298             }
299             catch (Exception e) {
300                 if (e instanceof com.liferay.portal.PortalException) {
301                     throw (com.liferay.portal.PortalException)e;
302                 }
303 
304                 if (e instanceof com.liferay.portal.SystemException) {
305                     throw (com.liferay.portal.SystemException)e;
306                 }
307 
308                 throw new com.liferay.portal.SystemException(e);
309             }
310 
311             return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
312         }
313         catch (com.liferay.portal.SystemException se) {
314             _log.error(se, se);
315 
316             throw se;
317         }
318     }
319 
320     private static Log _log = LogFactoryUtil.getLog(ShoppingCategoryServiceHttp.class);
321 }