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.IntegerWrapper;
29  import com.liferay.portal.kernel.util.LongWrapper;
30  import com.liferay.portal.kernel.util.MethodWrapper;
31  import com.liferay.portal.kernel.util.NullWrapper;
32  import com.liferay.portal.security.auth.HttpPrincipal;
33  import com.liferay.portal.service.http.TunnelUtil;
34  
35  import com.liferay.portlet.softwarecatalog.service.SCProductVersionServiceUtil;
36  
37  /**
38   * <a href="SCProductVersionServiceHttp.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be
42   * overwritten the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This class provides a HTTP utility for the
47   * {@link com.liferay.portlet.softwarecatalog.service.SCProductVersionServiceUtil} service utility. The
48   * static methods of this class calls the same methods of the service utility.
49   * However, the signatures are different because it requires an additional
50   * {@link com.liferay.portal.security.auth.HttpPrincipal} 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 <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
61   * 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   * @see       SCProductVersionServiceSoap
70   * @see       com.liferay.portal.security.auth.HttpPrincipal
71   * @see       com.liferay.portlet.softwarecatalog.service.SCProductVersionServiceUtil
72   * @generated
73   */
74  public class SCProductVersionServiceHttp {
75      public static com.liferay.portlet.softwarecatalog.model.SCProductVersion addProductVersion(
76          HttpPrincipal httpPrincipal, long productEntryId,
77          java.lang.String version, java.lang.String changeLog,
78          java.lang.String downloadPageURL, java.lang.String directDownloadURL,
79          boolean testDirectDownloadURL, boolean repoStoreArtifact,
80          long[] frameworkVersionIds, boolean addCommunityPermissions,
81          boolean addGuestPermissions)
82          throws com.liferay.portal.PortalException,
83              com.liferay.portal.SystemException {
84          try {
85              Object paramObj0 = new LongWrapper(productEntryId);
86  
87              Object paramObj1 = version;
88  
89              if (version == null) {
90                  paramObj1 = new NullWrapper("java.lang.String");
91              }
92  
93              Object paramObj2 = changeLog;
94  
95              if (changeLog == null) {
96                  paramObj2 = new NullWrapper("java.lang.String");
97              }
98  
99              Object paramObj3 = downloadPageURL;
100 
101             if (downloadPageURL == null) {
102                 paramObj3 = new NullWrapper("java.lang.String");
103             }
104 
105             Object paramObj4 = directDownloadURL;
106 
107             if (directDownloadURL == null) {
108                 paramObj4 = new NullWrapper("java.lang.String");
109             }
110 
111             Object paramObj5 = new BooleanWrapper(testDirectDownloadURL);
112 
113             Object paramObj6 = new BooleanWrapper(repoStoreArtifact);
114 
115             Object paramObj7 = frameworkVersionIds;
116 
117             if (frameworkVersionIds == null) {
118                 paramObj7 = new NullWrapper("[J");
119             }
120 
121             Object paramObj8 = new BooleanWrapper(addCommunityPermissions);
122 
123             Object paramObj9 = new BooleanWrapper(addGuestPermissions);
124 
125             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
126                     "addProductVersion",
127                     new Object[] {
128                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
129                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9
130                     });
131 
132             Object returnObj = null;
133 
134             try {
135                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
136             }
137             catch (Exception e) {
138                 if (e instanceof com.liferay.portal.PortalException) {
139                     throw (com.liferay.portal.PortalException)e;
140                 }
141 
142                 if (e instanceof com.liferay.portal.SystemException) {
143                     throw (com.liferay.portal.SystemException)e;
144                 }
145 
146                 throw new com.liferay.portal.SystemException(e);
147             }
148 
149             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
150         }
151         catch (com.liferay.portal.SystemException se) {
152             _log.error(se, se);
153 
154             throw se;
155         }
156     }
157 
158     public static com.liferay.portlet.softwarecatalog.model.SCProductVersion addProductVersion(
159         HttpPrincipal httpPrincipal, long productEntryId,
160         java.lang.String version, java.lang.String changeLog,
161         java.lang.String downloadPageURL, java.lang.String directDownloadURL,
162         boolean testDirectDownloadURL, boolean repoStoreArtifact,
163         long[] frameworkVersionIds, java.lang.String[] communityPermissions,
164         java.lang.String[] guestPermissions)
165         throws com.liferay.portal.PortalException,
166             com.liferay.portal.SystemException {
167         try {
168             Object paramObj0 = new LongWrapper(productEntryId);
169 
170             Object paramObj1 = version;
171 
172             if (version == null) {
173                 paramObj1 = new NullWrapper("java.lang.String");
174             }
175 
176             Object paramObj2 = changeLog;
177 
178             if (changeLog == null) {
179                 paramObj2 = new NullWrapper("java.lang.String");
180             }
181 
182             Object paramObj3 = downloadPageURL;
183 
184             if (downloadPageURL == null) {
185                 paramObj3 = new NullWrapper("java.lang.String");
186             }
187 
188             Object paramObj4 = directDownloadURL;
189 
190             if (directDownloadURL == null) {
191                 paramObj4 = new NullWrapper("java.lang.String");
192             }
193 
194             Object paramObj5 = new BooleanWrapper(testDirectDownloadURL);
195 
196             Object paramObj6 = new BooleanWrapper(repoStoreArtifact);
197 
198             Object paramObj7 = frameworkVersionIds;
199 
200             if (frameworkVersionIds == null) {
201                 paramObj7 = new NullWrapper("[J");
202             }
203 
204             Object paramObj8 = communityPermissions;
205 
206             if (communityPermissions == null) {
207                 paramObj8 = new NullWrapper("[Ljava.lang.String;");
208             }
209 
210             Object paramObj9 = guestPermissions;
211 
212             if (guestPermissions == null) {
213                 paramObj9 = new NullWrapper("[Ljava.lang.String;");
214             }
215 
216             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
217                     "addProductVersion",
218                     new Object[] {
219                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
220                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9
221                     });
222 
223             Object returnObj = null;
224 
225             try {
226                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
227             }
228             catch (Exception e) {
229                 if (e instanceof com.liferay.portal.PortalException) {
230                     throw (com.liferay.portal.PortalException)e;
231                 }
232 
233                 if (e instanceof com.liferay.portal.SystemException) {
234                     throw (com.liferay.portal.SystemException)e;
235                 }
236 
237                 throw new com.liferay.portal.SystemException(e);
238             }
239 
240             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
241         }
242         catch (com.liferay.portal.SystemException se) {
243             _log.error(se, se);
244 
245             throw se;
246         }
247     }
248 
249     public static void deleteProductVersion(HttpPrincipal httpPrincipal,
250         long productVersionId)
251         throws com.liferay.portal.PortalException,
252             com.liferay.portal.SystemException {
253         try {
254             Object paramObj0 = new LongWrapper(productVersionId);
255 
256             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
257                     "deleteProductVersion", new Object[] { paramObj0 });
258 
259             try {
260                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
261             }
262             catch (Exception e) {
263                 if (e instanceof com.liferay.portal.PortalException) {
264                     throw (com.liferay.portal.PortalException)e;
265                 }
266 
267                 if (e instanceof com.liferay.portal.SystemException) {
268                     throw (com.liferay.portal.SystemException)e;
269                 }
270 
271                 throw new com.liferay.portal.SystemException(e);
272             }
273         }
274         catch (com.liferay.portal.SystemException se) {
275             _log.error(se, se);
276 
277             throw se;
278         }
279     }
280 
281     public static com.liferay.portlet.softwarecatalog.model.SCProductVersion getProductVersion(
282         HttpPrincipal httpPrincipal, long productVersionId)
283         throws com.liferay.portal.PortalException,
284             com.liferay.portal.SystemException {
285         try {
286             Object paramObj0 = new LongWrapper(productVersionId);
287 
288             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
289                     "getProductVersion", new Object[] { paramObj0 });
290 
291             Object returnObj = null;
292 
293             try {
294                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
295             }
296             catch (Exception e) {
297                 if (e instanceof com.liferay.portal.PortalException) {
298                     throw (com.liferay.portal.PortalException)e;
299                 }
300 
301                 if (e instanceof com.liferay.portal.SystemException) {
302                     throw (com.liferay.portal.SystemException)e;
303                 }
304 
305                 throw new com.liferay.portal.SystemException(e);
306             }
307 
308             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
309         }
310         catch (com.liferay.portal.SystemException se) {
311             _log.error(se, se);
312 
313             throw se;
314         }
315     }
316 
317     public static java.util.List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getProductVersions(
318         HttpPrincipal httpPrincipal, long productEntryId, int start, int end)
319         throws com.liferay.portal.PortalException,
320             com.liferay.portal.SystemException {
321         try {
322             Object paramObj0 = new LongWrapper(productEntryId);
323 
324             Object paramObj1 = new IntegerWrapper(start);
325 
326             Object paramObj2 = new IntegerWrapper(end);
327 
328             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
329                     "getProductVersions",
330                     new Object[] { paramObj0, paramObj1, paramObj2 });
331 
332             Object returnObj = null;
333 
334             try {
335                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
336             }
337             catch (Exception e) {
338                 if (e instanceof com.liferay.portal.PortalException) {
339                     throw (com.liferay.portal.PortalException)e;
340                 }
341 
342                 if (e instanceof com.liferay.portal.SystemException) {
343                     throw (com.liferay.portal.SystemException)e;
344                 }
345 
346                 throw new com.liferay.portal.SystemException(e);
347             }
348 
349             return (java.util.List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)returnObj;
350         }
351         catch (com.liferay.portal.SystemException se) {
352             _log.error(se, se);
353 
354             throw se;
355         }
356     }
357 
358     public static int getProductVersionsCount(HttpPrincipal httpPrincipal,
359         long productEntryId)
360         throws com.liferay.portal.PortalException,
361             com.liferay.portal.SystemException {
362         try {
363             Object paramObj0 = new LongWrapper(productEntryId);
364 
365             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
366                     "getProductVersionsCount", new Object[] { paramObj0 });
367 
368             Object returnObj = null;
369 
370             try {
371                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
372             }
373             catch (Exception e) {
374                 if (e instanceof com.liferay.portal.PortalException) {
375                     throw (com.liferay.portal.PortalException)e;
376                 }
377 
378                 if (e instanceof com.liferay.portal.SystemException) {
379                     throw (com.liferay.portal.SystemException)e;
380                 }
381 
382                 throw new com.liferay.portal.SystemException(e);
383             }
384 
385             return ((Integer)returnObj).intValue();
386         }
387         catch (com.liferay.portal.SystemException se) {
388             _log.error(se, se);
389 
390             throw se;
391         }
392     }
393 
394     public static com.liferay.portlet.softwarecatalog.model.SCProductVersion updateProductVersion(
395         HttpPrincipal httpPrincipal, long productVersionId,
396         java.lang.String version, java.lang.String changeLog,
397         java.lang.String downloadPageURL, java.lang.String directDownloadURL,
398         boolean testDirectDownloadURL, boolean repoStoreArtifact,
399         long[] frameworkVersionIds)
400         throws com.liferay.portal.PortalException,
401             com.liferay.portal.SystemException {
402         try {
403             Object paramObj0 = new LongWrapper(productVersionId);
404 
405             Object paramObj1 = version;
406 
407             if (version == null) {
408                 paramObj1 = new NullWrapper("java.lang.String");
409             }
410 
411             Object paramObj2 = changeLog;
412 
413             if (changeLog == null) {
414                 paramObj2 = new NullWrapper("java.lang.String");
415             }
416 
417             Object paramObj3 = downloadPageURL;
418 
419             if (downloadPageURL == null) {
420                 paramObj3 = new NullWrapper("java.lang.String");
421             }
422 
423             Object paramObj4 = directDownloadURL;
424 
425             if (directDownloadURL == null) {
426                 paramObj4 = new NullWrapper("java.lang.String");
427             }
428 
429             Object paramObj5 = new BooleanWrapper(testDirectDownloadURL);
430 
431             Object paramObj6 = new BooleanWrapper(repoStoreArtifact);
432 
433             Object paramObj7 = frameworkVersionIds;
434 
435             if (frameworkVersionIds == null) {
436                 paramObj7 = new NullWrapper("[J");
437             }
438 
439             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
440                     "updateProductVersion",
441                     new Object[] {
442                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
443                         paramObj5, paramObj6, paramObj7
444                     });
445 
446             Object returnObj = null;
447 
448             try {
449                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
450             }
451             catch (Exception e) {
452                 if (e instanceof com.liferay.portal.PortalException) {
453                     throw (com.liferay.portal.PortalException)e;
454                 }
455 
456                 if (e instanceof com.liferay.portal.SystemException) {
457                     throw (com.liferay.portal.SystemException)e;
458                 }
459 
460                 throw new com.liferay.portal.SystemException(e);
461             }
462 
463             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
464         }
465         catch (com.liferay.portal.SystemException se) {
466             _log.error(se, se);
467 
468             throw se;
469         }
470     }
471 
472     private static Log _log = LogFactoryUtil.getLog(SCProductVersionServiceHttp.class);
473 }