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