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