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