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 thumbnails,
83          java.util.List fullImages, boolean addCommunityPermissions,
84          boolean addGuestPermissions)
85          throws com.liferay.portal.SystemException, 
86              com.liferay.portal.PortalException {
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.SystemException) {
182                     throw (com.liferay.portal.SystemException)e;
183                 }
184 
185                 if (e instanceof com.liferay.portal.PortalException) {
186                     throw (com.liferay.portal.PortalException)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 thumbnails,
208         java.util.List fullImages, java.lang.String[] communityPermissions,
209         java.lang.String[] guestPermissions)
210         throws com.liferay.portal.SystemException, 
211             com.liferay.portal.PortalException {
212         try {
213             Object paramObj0 = new LongWrapper(plid);
214 
215             Object paramObj1 = name;
216 
217             if (name == null) {
218                 paramObj1 = new NullWrapper("java.lang.String");
219             }
220 
221             Object paramObj2 = type;
222 
223             if (type == null) {
224                 paramObj2 = new NullWrapper("java.lang.String");
225             }
226 
227             Object paramObj3 = tags;
228 
229             if (tags == null) {
230                 paramObj3 = new NullWrapper("java.lang.String");
231             }
232 
233             Object paramObj4 = shortDescription;
234 
235             if (shortDescription == null) {
236                 paramObj4 = new NullWrapper("java.lang.String");
237             }
238 
239             Object paramObj5 = longDescription;
240 
241             if (longDescription == null) {
242                 paramObj5 = new NullWrapper("java.lang.String");
243             }
244 
245             Object paramObj6 = pageURL;
246 
247             if (pageURL == null) {
248                 paramObj6 = new NullWrapper("java.lang.String");
249             }
250 
251             Object paramObj7 = author;
252 
253             if (author == null) {
254                 paramObj7 = new NullWrapper("java.lang.String");
255             }
256 
257             Object paramObj8 = repoGroupId;
258 
259             if (repoGroupId == null) {
260                 paramObj8 = new NullWrapper("java.lang.String");
261             }
262 
263             Object paramObj9 = repoArtifactId;
264 
265             if (repoArtifactId == null) {
266                 paramObj9 = new NullWrapper("java.lang.String");
267             }
268 
269             Object paramObj10 = licenseIds;
270 
271             if (licenseIds == null) {
272                 paramObj10 = new NullWrapper("[J");
273             }
274 
275             Object paramObj11 = thumbnails;
276 
277             if (thumbnails == null) {
278                 paramObj11 = new NullWrapper("java.util.List");
279             }
280 
281             Object paramObj12 = fullImages;
282 
283             if (fullImages == null) {
284                 paramObj12 = new NullWrapper("java.util.List");
285             }
286 
287             Object paramObj13 = communityPermissions;
288 
289             if (communityPermissions == null) {
290                 paramObj13 = new NullWrapper("[Ljava.lang.String;");
291             }
292 
293             Object paramObj14 = guestPermissions;
294 
295             if (guestPermissions == null) {
296                 paramObj14 = new NullWrapper("[Ljava.lang.String;");
297             }
298 
299             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
300                     "addProductEntry",
301                     new Object[] {
302                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
303                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
304                         paramObj10, paramObj11, paramObj12, paramObj13,
305                         paramObj14
306                     });
307 
308             Object returnObj = null;
309 
310             try {
311                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
312             }
313             catch (Exception e) {
314                 if (e instanceof com.liferay.portal.SystemException) {
315                     throw (com.liferay.portal.SystemException)e;
316                 }
317 
318                 if (e instanceof com.liferay.portal.PortalException) {
319                     throw (com.liferay.portal.PortalException)e;
320                 }
321 
322                 throw new com.liferay.portal.SystemException(e);
323             }
324 
325             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
326         }
327         catch (com.liferay.portal.SystemException se) {
328             _log.error(se, se);
329 
330             throw se;
331         }
332     }
333 
334     public static void deleteProductEntry(HttpPrincipal httpPrincipal,
335         long productEntryId)
336         throws com.liferay.portal.SystemException, 
337             com.liferay.portal.PortalException {
338         try {
339             Object paramObj0 = new LongWrapper(productEntryId);
340 
341             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
342                     "deleteProductEntry", new Object[] { paramObj0 });
343 
344             try {
345                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
346             }
347             catch (Exception e) {
348                 if (e instanceof com.liferay.portal.SystemException) {
349                     throw (com.liferay.portal.SystemException)e;
350                 }
351 
352                 if (e instanceof com.liferay.portal.PortalException) {
353                     throw (com.liferay.portal.PortalException)e;
354                 }
355 
356                 throw new com.liferay.portal.SystemException(e);
357             }
358         }
359         catch (com.liferay.portal.SystemException se) {
360             _log.error(se, se);
361 
362             throw se;
363         }
364     }
365 
366     public static com.liferay.portlet.softwarecatalog.model.SCProductEntry getProductEntry(
367         HttpPrincipal httpPrincipal, long productEntryId)
368         throws com.liferay.portal.SystemException, 
369             com.liferay.portal.PortalException {
370         try {
371             Object paramObj0 = new LongWrapper(productEntryId);
372 
373             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
374                     "getProductEntry", new Object[] { paramObj0 });
375 
376             Object returnObj = null;
377 
378             try {
379                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
380             }
381             catch (Exception e) {
382                 if (e instanceof com.liferay.portal.SystemException) {
383                     throw (com.liferay.portal.SystemException)e;
384                 }
385 
386                 if (e instanceof com.liferay.portal.PortalException) {
387                     throw (com.liferay.portal.PortalException)e;
388                 }
389 
390                 throw new com.liferay.portal.SystemException(e);
391             }
392 
393             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
394         }
395         catch (com.liferay.portal.SystemException se) {
396             _log.error(se, se);
397 
398             throw se;
399         }
400     }
401 
402     public static com.liferay.portlet.softwarecatalog.model.SCProductEntry updateProductEntry(
403         HttpPrincipal httpPrincipal, long productEntryId,
404         java.lang.String name, java.lang.String type, java.lang.String tags,
405         java.lang.String shortDescription, java.lang.String longDescription,
406         java.lang.String pageURL, java.lang.String author,
407         java.lang.String repoGroupId, java.lang.String repoArtifactId,
408         long[] licenseIds, java.util.List thumbnails, java.util.List fullImages)
409         throws com.liferay.portal.SystemException, 
410             com.liferay.portal.PortalException {
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.SystemException) {
501                     throw (com.liferay.portal.SystemException)e;
502                 }
503 
504                 if (e instanceof com.liferay.portal.PortalException) {
505                     throw (com.liferay.portal.PortalException)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 }