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