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.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.softwarecatalog.service.SCProductEntryServiceUtil;
35  
36  /**
37   * <a href="SCProductEntryServiceHttp.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.softwarecatalog.service.SCProductEntryServiceUtil} 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       SCProductEntryServiceSoap
69   * @see       com.liferay.portal.security.auth.HttpPrincipal
70   * @see       com.liferay.portlet.softwarecatalog.service.SCProductEntryServiceUtil
71   * @generated
72   */
73  public class SCProductEntryServiceHttp {
74      public static com.liferay.portlet.softwarecatalog.model.SCProductEntry addProductEntry(
75          HttpPrincipal httpPrincipal, long plid, java.lang.String name,
76          java.lang.String type, java.lang.String tags,
77          java.lang.String shortDescription, java.lang.String longDescription,
78          java.lang.String pageURL, java.lang.String author,
79          java.lang.String repoGroupId, java.lang.String repoArtifactId,
80          long[] licenseIds, java.util.List<byte[]> thumbnails,
81          java.util.List<byte[]> fullImages, boolean addCommunityPermissions,
82          boolean addGuestPermissions)
83          throws com.liferay.portal.PortalException,
84              com.liferay.portal.SystemException {
85          try {
86              Object paramObj0 = new LongWrapper(plid);
87  
88              Object paramObj1 = name;
89  
90              if (name == null) {
91                  paramObj1 = new NullWrapper("java.lang.String");
92              }
93  
94              Object paramObj2 = type;
95  
96              if (type == null) {
97                  paramObj2 = new NullWrapper("java.lang.String");
98              }
99  
100             Object paramObj3 = tags;
101 
102             if (tags == null) {
103                 paramObj3 = new NullWrapper("java.lang.String");
104             }
105 
106             Object paramObj4 = shortDescription;
107 
108             if (shortDescription == null) {
109                 paramObj4 = new NullWrapper("java.lang.String");
110             }
111 
112             Object paramObj5 = longDescription;
113 
114             if (longDescription == null) {
115                 paramObj5 = new NullWrapper("java.lang.String");
116             }
117 
118             Object paramObj6 = pageURL;
119 
120             if (pageURL == null) {
121                 paramObj6 = new NullWrapper("java.lang.String");
122             }
123 
124             Object paramObj7 = author;
125 
126             if (author == null) {
127                 paramObj7 = new NullWrapper("java.lang.String");
128             }
129 
130             Object paramObj8 = repoGroupId;
131 
132             if (repoGroupId == null) {
133                 paramObj8 = new NullWrapper("java.lang.String");
134             }
135 
136             Object paramObj9 = repoArtifactId;
137 
138             if (repoArtifactId == null) {
139                 paramObj9 = new NullWrapper("java.lang.String");
140             }
141 
142             Object paramObj10 = licenseIds;
143 
144             if (licenseIds == null) {
145                 paramObj10 = new NullWrapper("[J");
146             }
147 
148             Object paramObj11 = thumbnails;
149 
150             if (thumbnails == null) {
151                 paramObj11 = new NullWrapper("java.util.List");
152             }
153 
154             Object paramObj12 = fullImages;
155 
156             if (fullImages == null) {
157                 paramObj12 = new NullWrapper("java.util.List");
158             }
159 
160             Object paramObj13 = new BooleanWrapper(addCommunityPermissions);
161 
162             Object paramObj14 = new BooleanWrapper(addGuestPermissions);
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, paramObj13,
170                         paramObj14
171                     });
172 
173             Object returnObj = null;
174 
175             try {
176                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
177             }
178             catch (Exception e) {
179                 if (e instanceof com.liferay.portal.PortalException) {
180                     throw (com.liferay.portal.PortalException)e;
181                 }
182 
183                 if (e instanceof com.liferay.portal.SystemException) {
184                     throw (com.liferay.portal.SystemException)e;
185                 }
186 
187                 throw new com.liferay.portal.SystemException(e);
188             }
189 
190             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
191         }
192         catch (com.liferay.portal.SystemException se) {
193             _log.error(se, se);
194 
195             throw se;
196         }
197     }
198 
199     public static com.liferay.portlet.softwarecatalog.model.SCProductEntry addProductEntry(
200         HttpPrincipal httpPrincipal, long plid, java.lang.String name,
201         java.lang.String type, java.lang.String tags,
202         java.lang.String shortDescription, java.lang.String longDescription,
203         java.lang.String pageURL, java.lang.String author,
204         java.lang.String repoGroupId, java.lang.String repoArtifactId,
205         long[] licenseIds, java.util.List<byte[]> thumbnails,
206         java.util.List<byte[]> fullImages,
207         java.lang.String[] communityPermissions,
208         java.lang.String[] guestPermissions)
209         throws com.liferay.portal.PortalException,
210             com.liferay.portal.SystemException {
211         try {
212             Object paramObj0 = new LongWrapper(plid);
213 
214             Object paramObj1 = name;
215 
216             if (name == null) {
217                 paramObj1 = new NullWrapper("java.lang.String");
218             }
219 
220             Object paramObj2 = type;
221 
222             if (type == null) {
223                 paramObj2 = new NullWrapper("java.lang.String");
224             }
225 
226             Object paramObj3 = tags;
227 
228             if (tags == null) {
229                 paramObj3 = new NullWrapper("java.lang.String");
230             }
231 
232             Object paramObj4 = shortDescription;
233 
234             if (shortDescription == null) {
235                 paramObj4 = new NullWrapper("java.lang.String");
236             }
237 
238             Object paramObj5 = longDescription;
239 
240             if (longDescription == null) {
241                 paramObj5 = new NullWrapper("java.lang.String");
242             }
243 
244             Object paramObj6 = pageURL;
245 
246             if (pageURL == null) {
247                 paramObj6 = new NullWrapper("java.lang.String");
248             }
249 
250             Object paramObj7 = author;
251 
252             if (author == null) {
253                 paramObj7 = new NullWrapper("java.lang.String");
254             }
255 
256             Object paramObj8 = repoGroupId;
257 
258             if (repoGroupId == null) {
259                 paramObj8 = new NullWrapper("java.lang.String");
260             }
261 
262             Object paramObj9 = repoArtifactId;
263 
264             if (repoArtifactId == null) {
265                 paramObj9 = new NullWrapper("java.lang.String");
266             }
267 
268             Object paramObj10 = licenseIds;
269 
270             if (licenseIds == null) {
271                 paramObj10 = new NullWrapper("[J");
272             }
273 
274             Object paramObj11 = thumbnails;
275 
276             if (thumbnails == null) {
277                 paramObj11 = new NullWrapper("java.util.List");
278             }
279 
280             Object paramObj12 = fullImages;
281 
282             if (fullImages == null) {
283                 paramObj12 = new NullWrapper("java.util.List");
284             }
285 
286             Object paramObj13 = communityPermissions;
287 
288             if (communityPermissions == null) {
289                 paramObj13 = new NullWrapper("[Ljava.lang.String;");
290             }
291 
292             Object paramObj14 = guestPermissions;
293 
294             if (guestPermissions == null) {
295                 paramObj14 = new NullWrapper("[Ljava.lang.String;");
296             }
297 
298             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
299                     "addProductEntry",
300                     new Object[] {
301                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
302                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
303                         paramObj10, paramObj11, paramObj12, paramObj13,
304                         paramObj14
305                     });
306 
307             Object returnObj = null;
308 
309             try {
310                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
311             }
312             catch (Exception e) {
313                 if (e instanceof com.liferay.portal.PortalException) {
314                     throw (com.liferay.portal.PortalException)e;
315                 }
316 
317                 if (e instanceof com.liferay.portal.SystemException) {
318                     throw (com.liferay.portal.SystemException)e;
319                 }
320 
321                 throw new com.liferay.portal.SystemException(e);
322             }
323 
324             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
325         }
326         catch (com.liferay.portal.SystemException se) {
327             _log.error(se, se);
328 
329             throw se;
330         }
331     }
332 
333     public static void deleteProductEntry(HttpPrincipal httpPrincipal,
334         long productEntryId)
335         throws com.liferay.portal.PortalException,
336             com.liferay.portal.SystemException {
337         try {
338             Object paramObj0 = new LongWrapper(productEntryId);
339 
340             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
341                     "deleteProductEntry", new Object[] { paramObj0 });
342 
343             try {
344                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
345             }
346             catch (Exception e) {
347                 if (e instanceof com.liferay.portal.PortalException) {
348                     throw (com.liferay.portal.PortalException)e;
349                 }
350 
351                 if (e instanceof com.liferay.portal.SystemException) {
352                     throw (com.liferay.portal.SystemException)e;
353                 }
354 
355                 throw new com.liferay.portal.SystemException(e);
356             }
357         }
358         catch (com.liferay.portal.SystemException se) {
359             _log.error(se, se);
360 
361             throw se;
362         }
363     }
364 
365     public static com.liferay.portlet.softwarecatalog.model.SCProductEntry getProductEntry(
366         HttpPrincipal httpPrincipal, long productEntryId)
367         throws com.liferay.portal.PortalException,
368             com.liferay.portal.SystemException {
369         try {
370             Object paramObj0 = new LongWrapper(productEntryId);
371 
372             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
373                     "getProductEntry", new Object[] { paramObj0 });
374 
375             Object returnObj = null;
376 
377             try {
378                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
379             }
380             catch (Exception e) {
381                 if (e instanceof com.liferay.portal.PortalException) {
382                     throw (com.liferay.portal.PortalException)e;
383                 }
384 
385                 if (e instanceof com.liferay.portal.SystemException) {
386                     throw (com.liferay.portal.SystemException)e;
387                 }
388 
389                 throw new com.liferay.portal.SystemException(e);
390             }
391 
392             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
393         }
394         catch (com.liferay.portal.SystemException se) {
395             _log.error(se, se);
396 
397             throw se;
398         }
399     }
400 
401     public static com.liferay.portlet.softwarecatalog.model.SCProductEntry updateProductEntry(
402         HttpPrincipal httpPrincipal, long productEntryId,
403         java.lang.String name, java.lang.String type, java.lang.String tags,
404         java.lang.String shortDescription, java.lang.String longDescription,
405         java.lang.String pageURL, java.lang.String author,
406         java.lang.String repoGroupId, java.lang.String repoArtifactId,
407         long[] licenseIds, java.util.List<byte[]> thumbnails,
408         java.util.List<byte[]> fullImages)
409         throws com.liferay.portal.PortalException,
410             com.liferay.portal.SystemException {
411         try {
412             Object paramObj0 = new LongWrapper(productEntryId);
413 
414             Object paramObj1 = name;
415 
416             if (name == null) {
417                 paramObj1 = new NullWrapper("java.lang.String");
418             }
419 
420             Object paramObj2 = type;
421 
422             if (type == null) {
423                 paramObj2 = new NullWrapper("java.lang.String");
424             }
425 
426             Object paramObj3 = tags;
427 
428             if (tags == null) {
429                 paramObj3 = new NullWrapper("java.lang.String");
430             }
431 
432             Object paramObj4 = shortDescription;
433 
434             if (shortDescription == null) {
435                 paramObj4 = new NullWrapper("java.lang.String");
436             }
437 
438             Object paramObj5 = longDescription;
439 
440             if (longDescription == null) {
441                 paramObj5 = new NullWrapper("java.lang.String");
442             }
443 
444             Object paramObj6 = pageURL;
445 
446             if (pageURL == null) {
447                 paramObj6 = new NullWrapper("java.lang.String");
448             }
449 
450             Object paramObj7 = author;
451 
452             if (author == null) {
453                 paramObj7 = new NullWrapper("java.lang.String");
454             }
455 
456             Object paramObj8 = repoGroupId;
457 
458             if (repoGroupId == null) {
459                 paramObj8 = new NullWrapper("java.lang.String");
460             }
461 
462             Object paramObj9 = repoArtifactId;
463 
464             if (repoArtifactId == null) {
465                 paramObj9 = new NullWrapper("java.lang.String");
466             }
467 
468             Object paramObj10 = licenseIds;
469 
470             if (licenseIds == null) {
471                 paramObj10 = new NullWrapper("[J");
472             }
473 
474             Object paramObj11 = thumbnails;
475 
476             if (thumbnails == null) {
477                 paramObj11 = new NullWrapper("java.util.List");
478             }
479 
480             Object paramObj12 = fullImages;
481 
482             if (fullImages == null) {
483                 paramObj12 = new NullWrapper("java.util.List");
484             }
485 
486             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
487                     "updateProductEntry",
488                     new Object[] {
489                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
490                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
491                         paramObj10, paramObj11, paramObj12
492                     });
493 
494             Object returnObj = null;
495 
496             try {
497                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
498             }
499             catch (Exception e) {
500                 if (e instanceof com.liferay.portal.PortalException) {
501                     throw (com.liferay.portal.PortalException)e;
502                 }
503 
504                 if (e instanceof com.liferay.portal.SystemException) {
505                     throw (com.liferay.portal.SystemException)e;
506                 }
507 
508                 throw new com.liferay.portal.SystemException(e);
509             }
510 
511             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
512         }
513         catch (com.liferay.portal.SystemException se) {
514             _log.error(se, se);
515 
516             throw se;
517         }
518     }
519 
520     private static Log _log = LogFactoryUtil.getLog(SCProductEntryServiceHttp.class);
521 }