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