1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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.softwarecatalog.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.LongWrapper;
28  import com.liferay.portal.kernel.util.MethodWrapper;
29  import com.liferay.portal.kernel.util.NullWrapper;
30  import com.liferay.portal.security.auth.HttpPrincipal;
31  import com.liferay.portal.service.http.TunnelUtil;
32  
33  import com.liferay.portlet.softwarecatalog.service.SCProductEntryServiceUtil;
34  
35  /**
36   * <a href="SCProductEntryServiceHttp.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be
40   * overwritten the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class provides a HTTP utility for the
45   * {@link com.liferay.portlet.softwarecatalog.service.SCProductEntryServiceUtil} service utility. The
46   * static methods of this class calls the same methods of the service utility.
47   * However, the signatures are different because it requires an additional
48   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
49   * </p>
50   *
51   * <p>
52   * The benefits of using the HTTP utility is that it is fast and allows for
53   * tunneling without the cost of serializing to text. The drawback is that it
54   * only works with Java.
55   * </p>
56   *
57   * <p>
58   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
59   * configure security.
60   * </p>
61   *
62   * <p>
63   * The HTTP utility is only generated for remote services.
64   * </p>
65   *
66   * @author    Brian Wing Shun Chan
67   * @see       SCProductEntryServiceSoap
68   * @see       com.liferay.portal.security.auth.HttpPrincipal
69   * @see       com.liferay.portlet.softwarecatalog.service.SCProductEntryServiceUtil
70   * @generated
71   */
72  public class SCProductEntryServiceHttp {
73      public static com.liferay.portlet.softwarecatalog.model.SCProductEntry addProductEntry(
74          HttpPrincipal httpPrincipal, java.lang.String name,
75          java.lang.String type, java.lang.String tags,
76          java.lang.String shortDescription, java.lang.String longDescription,
77          java.lang.String pageURL, java.lang.String author,
78          java.lang.String repoGroupId, java.lang.String repoArtifactId,
79          long[] licenseIds, java.util.List<byte[]> thumbnails,
80          java.util.List<byte[]> fullImages,
81          com.liferay.portal.service.ServiceContext serviceContext)
82          throws com.liferay.portal.PortalException,
83              com.liferay.portal.SystemException {
84          try {
85              Object paramObj0 = name;
86  
87              if (name == null) {
88                  paramObj0 = new NullWrapper("java.lang.String");
89              }
90  
91              Object paramObj1 = type;
92  
93              if (type == null) {
94                  paramObj1 = new NullWrapper("java.lang.String");
95              }
96  
97              Object paramObj2 = tags;
98  
99              if (tags == null) {
100                 paramObj2 = new NullWrapper("java.lang.String");
101             }
102 
103             Object paramObj3 = shortDescription;
104 
105             if (shortDescription == null) {
106                 paramObj3 = new NullWrapper("java.lang.String");
107             }
108 
109             Object paramObj4 = longDescription;
110 
111             if (longDescription == null) {
112                 paramObj4 = new NullWrapper("java.lang.String");
113             }
114 
115             Object paramObj5 = pageURL;
116 
117             if (pageURL == null) {
118                 paramObj5 = new NullWrapper("java.lang.String");
119             }
120 
121             Object paramObj6 = author;
122 
123             if (author == null) {
124                 paramObj6 = new NullWrapper("java.lang.String");
125             }
126 
127             Object paramObj7 = repoGroupId;
128 
129             if (repoGroupId == null) {
130                 paramObj7 = new NullWrapper("java.lang.String");
131             }
132 
133             Object paramObj8 = repoArtifactId;
134 
135             if (repoArtifactId == null) {
136                 paramObj8 = new NullWrapper("java.lang.String");
137             }
138 
139             Object paramObj9 = licenseIds;
140 
141             if (licenseIds == null) {
142                 paramObj9 = new NullWrapper("[J");
143             }
144 
145             Object paramObj10 = thumbnails;
146 
147             if (thumbnails == null) {
148                 paramObj10 = new NullWrapper("java.util.List");
149             }
150 
151             Object paramObj11 = fullImages;
152 
153             if (fullImages == null) {
154                 paramObj11 = new NullWrapper("java.util.List");
155             }
156 
157             Object paramObj12 = serviceContext;
158 
159             if (serviceContext == null) {
160                 paramObj12 = new NullWrapper(
161                         "com.liferay.portal.service.ServiceContext");
162             }
163 
164             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
165                     "addProductEntry",
166                     new Object[] {
167                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
168                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
169                         paramObj10, paramObj11, paramObj12
170                     });
171 
172             Object returnObj = null;
173 
174             try {
175                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
176             }
177             catch (Exception e) {
178                 if (e instanceof com.liferay.portal.PortalException) {
179                     throw (com.liferay.portal.PortalException)e;
180                 }
181 
182                 if (e instanceof com.liferay.portal.SystemException) {
183                     throw (com.liferay.portal.SystemException)e;
184                 }
185 
186                 throw new com.liferay.portal.SystemException(e);
187             }
188 
189             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
190         }
191         catch (com.liferay.portal.SystemException se) {
192             _log.error(se, se);
193 
194             throw se;
195         }
196     }
197 
198     public static void deleteProductEntry(HttpPrincipal httpPrincipal,
199         long productEntryId)
200         throws com.liferay.portal.PortalException,
201             com.liferay.portal.SystemException {
202         try {
203             Object paramObj0 = new LongWrapper(productEntryId);
204 
205             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
206                     "deleteProductEntry", new Object[] { paramObj0 });
207 
208             try {
209                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
210             }
211             catch (Exception e) {
212                 if (e instanceof com.liferay.portal.PortalException) {
213                     throw (com.liferay.portal.PortalException)e;
214                 }
215 
216                 if (e instanceof com.liferay.portal.SystemException) {
217                     throw (com.liferay.portal.SystemException)e;
218                 }
219 
220                 throw new com.liferay.portal.SystemException(e);
221             }
222         }
223         catch (com.liferay.portal.SystemException se) {
224             _log.error(se, se);
225 
226             throw se;
227         }
228     }
229 
230     public static com.liferay.portlet.softwarecatalog.model.SCProductEntry getProductEntry(
231         HttpPrincipal httpPrincipal, long productEntryId)
232         throws com.liferay.portal.PortalException,
233             com.liferay.portal.SystemException {
234         try {
235             Object paramObj0 = new LongWrapper(productEntryId);
236 
237             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
238                     "getProductEntry", new Object[] { paramObj0 });
239 
240             Object returnObj = null;
241 
242             try {
243                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
244             }
245             catch (Exception e) {
246                 if (e instanceof com.liferay.portal.PortalException) {
247                     throw (com.liferay.portal.PortalException)e;
248                 }
249 
250                 if (e instanceof com.liferay.portal.SystemException) {
251                     throw (com.liferay.portal.SystemException)e;
252                 }
253 
254                 throw new com.liferay.portal.SystemException(e);
255             }
256 
257             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
258         }
259         catch (com.liferay.portal.SystemException se) {
260             _log.error(se, se);
261 
262             throw se;
263         }
264     }
265 
266     public static com.liferay.portlet.softwarecatalog.model.SCProductEntry updateProductEntry(
267         HttpPrincipal httpPrincipal, long productEntryId,
268         java.lang.String name, java.lang.String type, java.lang.String tags,
269         java.lang.String shortDescription, java.lang.String longDescription,
270         java.lang.String pageURL, java.lang.String author,
271         java.lang.String repoGroupId, java.lang.String repoArtifactId,
272         long[] licenseIds, java.util.List<byte[]> thumbnails,
273         java.util.List<byte[]> fullImages)
274         throws com.liferay.portal.PortalException,
275             com.liferay.portal.SystemException {
276         try {
277             Object paramObj0 = new LongWrapper(productEntryId);
278 
279             Object paramObj1 = name;
280 
281             if (name == null) {
282                 paramObj1 = new NullWrapper("java.lang.String");
283             }
284 
285             Object paramObj2 = type;
286 
287             if (type == null) {
288                 paramObj2 = new NullWrapper("java.lang.String");
289             }
290 
291             Object paramObj3 = tags;
292 
293             if (tags == null) {
294                 paramObj3 = new NullWrapper("java.lang.String");
295             }
296 
297             Object paramObj4 = shortDescription;
298 
299             if (shortDescription == null) {
300                 paramObj4 = new NullWrapper("java.lang.String");
301             }
302 
303             Object paramObj5 = longDescription;
304 
305             if (longDescription == null) {
306                 paramObj5 = new NullWrapper("java.lang.String");
307             }
308 
309             Object paramObj6 = pageURL;
310 
311             if (pageURL == null) {
312                 paramObj6 = new NullWrapper("java.lang.String");
313             }
314 
315             Object paramObj7 = author;
316 
317             if (author == null) {
318                 paramObj7 = new NullWrapper("java.lang.String");
319             }
320 
321             Object paramObj8 = repoGroupId;
322 
323             if (repoGroupId == null) {
324                 paramObj8 = new NullWrapper("java.lang.String");
325             }
326 
327             Object paramObj9 = repoArtifactId;
328 
329             if (repoArtifactId == null) {
330                 paramObj9 = new NullWrapper("java.lang.String");
331             }
332 
333             Object paramObj10 = licenseIds;
334 
335             if (licenseIds == null) {
336                 paramObj10 = new NullWrapper("[J");
337             }
338 
339             Object paramObj11 = thumbnails;
340 
341             if (thumbnails == null) {
342                 paramObj11 = new NullWrapper("java.util.List");
343             }
344 
345             Object paramObj12 = fullImages;
346 
347             if (fullImages == null) {
348                 paramObj12 = new NullWrapper("java.util.List");
349             }
350 
351             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
352                     "updateProductEntry",
353                     new Object[] {
354                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
355                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
356                         paramObj10, paramObj11, paramObj12
357                     });
358 
359             Object returnObj = null;
360 
361             try {
362                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
363             }
364             catch (Exception e) {
365                 if (e instanceof com.liferay.portal.PortalException) {
366                     throw (com.liferay.portal.PortalException)e;
367                 }
368 
369                 if (e instanceof com.liferay.portal.SystemException) {
370                     throw (com.liferay.portal.SystemException)e;
371                 }
372 
373                 throw new com.liferay.portal.SystemException(e);
374             }
375 
376             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
377         }
378         catch (com.liferay.portal.SystemException se) {
379             _log.error(se, se);
380 
381             throw se;
382         }
383     }
384 
385     private static Log _log = LogFactoryUtil.getLog(SCProductEntryServiceHttp.class);
386 }