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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil;
25  
26  /**
27   * <a href="ShoppingCategoryServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       ShoppingCategoryServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil
61   * @generated
62   */
63  public class ShoppingCategoryServiceHttp {
64      public static com.liferay.portlet.shopping.model.ShoppingCategory addCategory(
65          HttpPrincipal httpPrincipal, long parentCategoryId,
66          java.lang.String name, java.lang.String description,
67          com.liferay.portal.service.ServiceContext serviceContext)
68          throws com.liferay.portal.PortalException,
69              com.liferay.portal.SystemException {
70          try {
71              MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
72                      "addCategory", _addCategoryParameterTypes0);
73  
74              MethodHandler methodHandler = new MethodHandler(methodKey,
75                      parentCategoryId, name, description, serviceContext);
76  
77              Object returnObj = null;
78  
79              try {
80                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
81              }
82              catch (Exception e) {
83                  if (e instanceof com.liferay.portal.PortalException) {
84                      throw (com.liferay.portal.PortalException)e;
85                  }
86  
87                  if (e instanceof com.liferay.portal.SystemException) {
88                      throw (com.liferay.portal.SystemException)e;
89                  }
90  
91                  throw new com.liferay.portal.SystemException(e);
92              }
93  
94              return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
95          }
96          catch (com.liferay.portal.SystemException se) {
97              _log.error(se, se);
98  
99              throw se;
100         }
101     }
102 
103     public static void deleteCategory(HttpPrincipal httpPrincipal,
104         long categoryId)
105         throws com.liferay.portal.PortalException,
106             com.liferay.portal.SystemException {
107         try {
108             MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
109                     "deleteCategory", _deleteCategoryParameterTypes1);
110 
111             MethodHandler methodHandler = new MethodHandler(methodKey,
112                     categoryId);
113 
114             try {
115                 TunnelUtil.invoke(httpPrincipal, methodHandler);
116             }
117             catch (Exception e) {
118                 if (e instanceof com.liferay.portal.PortalException) {
119                     throw (com.liferay.portal.PortalException)e;
120                 }
121 
122                 if (e instanceof com.liferay.portal.SystemException) {
123                     throw (com.liferay.portal.SystemException)e;
124                 }
125 
126                 throw new com.liferay.portal.SystemException(e);
127             }
128         }
129         catch (com.liferay.portal.SystemException se) {
130             _log.error(se, se);
131 
132             throw se;
133         }
134     }
135 
136     public static com.liferay.portlet.shopping.model.ShoppingCategory getCategory(
137         HttpPrincipal httpPrincipal, long categoryId)
138         throws com.liferay.portal.PortalException,
139             com.liferay.portal.SystemException {
140         try {
141             MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
142                     "getCategory", _getCategoryParameterTypes2);
143 
144             MethodHandler methodHandler = new MethodHandler(methodKey,
145                     categoryId);
146 
147             Object returnObj = null;
148 
149             try {
150                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
151             }
152             catch (Exception e) {
153                 if (e instanceof com.liferay.portal.PortalException) {
154                     throw (com.liferay.portal.PortalException)e;
155                 }
156 
157                 if (e instanceof com.liferay.portal.SystemException) {
158                     throw (com.liferay.portal.SystemException)e;
159                 }
160 
161                 throw new com.liferay.portal.SystemException(e);
162             }
163 
164             return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
165         }
166         catch (com.liferay.portal.SystemException se) {
167             _log.error(se, se);
168 
169             throw se;
170         }
171     }
172 
173     public static com.liferay.portlet.shopping.model.ShoppingCategory updateCategory(
174         HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
175         java.lang.String name, java.lang.String description,
176         boolean mergeWithParentCategory,
177         com.liferay.portal.service.ServiceContext serviceContext)
178         throws com.liferay.portal.PortalException,
179             com.liferay.portal.SystemException {
180         try {
181             MethodKey methodKey = new MethodKey(ShoppingCategoryServiceUtil.class.getName(),
182                     "updateCategory", _updateCategoryParameterTypes3);
183 
184             MethodHandler methodHandler = new MethodHandler(methodKey,
185                     categoryId, parentCategoryId, name, description,
186                     mergeWithParentCategory, serviceContext);
187 
188             Object returnObj = null;
189 
190             try {
191                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
192             }
193             catch (Exception e) {
194                 if (e instanceof com.liferay.portal.PortalException) {
195                     throw (com.liferay.portal.PortalException)e;
196                 }
197 
198                 if (e instanceof com.liferay.portal.SystemException) {
199                     throw (com.liferay.portal.SystemException)e;
200                 }
201 
202                 throw new com.liferay.portal.SystemException(e);
203             }
204 
205             return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
206         }
207         catch (com.liferay.portal.SystemException se) {
208             _log.error(se, se);
209 
210             throw se;
211         }
212     }
213 
214     private static Log _log = LogFactoryUtil.getLog(ShoppingCategoryServiceHttp.class);
215     private static final Class<?>[] _addCategoryParameterTypes0 = new Class[] {
216             long.class, java.lang.String.class, java.lang.String.class,
217             com.liferay.portal.service.ServiceContext.class
218         };
219     private static final Class<?>[] _deleteCategoryParameterTypes1 = new Class[] {
220             long.class
221         };
222     private static final Class<?>[] _getCategoryParameterTypes2 = new Class[] {
223             long.class
224         };
225     private static final Class<?>[] _updateCategoryParameterTypes3 = new Class[] {
226             long.class, long.class, java.lang.String.class,
227             java.lang.String.class, boolean.class,
228             com.liferay.portal.service.ServiceContext.class
229         };
230 }