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.SCFrameworkVersionServiceUtil;
36  
37  /**
38   * <a href="SCFrameworkVersionServiceHttp.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.SCFrameworkVersionServiceUtil} 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       SCFrameworkVersionServiceSoap
70   * @see       com.liferay.portal.security.auth.HttpPrincipal
71   * @see       com.liferay.portlet.softwarecatalog.service.SCFrameworkVersionServiceUtil
72   * @generated
73   */
74  public class SCFrameworkVersionServiceHttp {
75      public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion addFrameworkVersion(
76          HttpPrincipal httpPrincipal, long plid, java.lang.String name,
77          java.lang.String url, boolean active, int priority,
78          boolean addCommunityPermissions, boolean addGuestPermissions)
79          throws com.liferay.portal.PortalException,
80              com.liferay.portal.SystemException {
81          try {
82              Object paramObj0 = new LongWrapper(plid);
83  
84              Object paramObj1 = name;
85  
86              if (name == null) {
87                  paramObj1 = new NullWrapper("java.lang.String");
88              }
89  
90              Object paramObj2 = url;
91  
92              if (url == null) {
93                  paramObj2 = new NullWrapper("java.lang.String");
94              }
95  
96              Object paramObj3 = new BooleanWrapper(active);
97  
98              Object paramObj4 = new IntegerWrapper(priority);
99  
100             Object paramObj5 = new BooleanWrapper(addCommunityPermissions);
101 
102             Object paramObj6 = new BooleanWrapper(addGuestPermissions);
103 
104             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
105                     "addFrameworkVersion",
106                     new Object[] {
107                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
108                         paramObj5, paramObj6
109                     });
110 
111             Object returnObj = null;
112 
113             try {
114                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
115             }
116             catch (Exception e) {
117                 if (e instanceof com.liferay.portal.PortalException) {
118                     throw (com.liferay.portal.PortalException)e;
119                 }
120 
121                 if (e instanceof com.liferay.portal.SystemException) {
122                     throw (com.liferay.portal.SystemException)e;
123                 }
124 
125                 throw new com.liferay.portal.SystemException(e);
126             }
127 
128             return (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion)returnObj;
129         }
130         catch (com.liferay.portal.SystemException se) {
131             _log.error(se, se);
132 
133             throw se;
134         }
135     }
136 
137     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion addFrameworkVersion(
138         HttpPrincipal httpPrincipal, long plid, java.lang.String name,
139         java.lang.String url, boolean active, int priority,
140         java.lang.String[] communityPermissions,
141         java.lang.String[] guestPermissions)
142         throws com.liferay.portal.PortalException,
143             com.liferay.portal.SystemException {
144         try {
145             Object paramObj0 = new LongWrapper(plid);
146 
147             Object paramObj1 = name;
148 
149             if (name == null) {
150                 paramObj1 = new NullWrapper("java.lang.String");
151             }
152 
153             Object paramObj2 = url;
154 
155             if (url == null) {
156                 paramObj2 = new NullWrapper("java.lang.String");
157             }
158 
159             Object paramObj3 = new BooleanWrapper(active);
160 
161             Object paramObj4 = new IntegerWrapper(priority);
162 
163             Object paramObj5 = communityPermissions;
164 
165             if (communityPermissions == null) {
166                 paramObj5 = new NullWrapper("[Ljava.lang.String;");
167             }
168 
169             Object paramObj6 = guestPermissions;
170 
171             if (guestPermissions == null) {
172                 paramObj6 = new NullWrapper("[Ljava.lang.String;");
173             }
174 
175             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
176                     "addFrameworkVersion",
177                     new Object[] {
178                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
179                         paramObj5, paramObj6
180                     });
181 
182             Object returnObj = null;
183 
184             try {
185                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
186             }
187             catch (Exception e) {
188                 if (e instanceof com.liferay.portal.PortalException) {
189                     throw (com.liferay.portal.PortalException)e;
190                 }
191 
192                 if (e instanceof com.liferay.portal.SystemException) {
193                     throw (com.liferay.portal.SystemException)e;
194                 }
195 
196                 throw new com.liferay.portal.SystemException(e);
197             }
198 
199             return (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion)returnObj;
200         }
201         catch (com.liferay.portal.SystemException se) {
202             _log.error(se, se);
203 
204             throw se;
205         }
206     }
207 
208     public static void deleteFrameworkVersion(HttpPrincipal httpPrincipal,
209         long frameworkVersionId)
210         throws com.liferay.portal.PortalException,
211             com.liferay.portal.SystemException {
212         try {
213             Object paramObj0 = new LongWrapper(frameworkVersionId);
214 
215             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
216                     "deleteFrameworkVersion", new Object[] { paramObj0 });
217 
218             try {
219                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
220             }
221             catch (Exception e) {
222                 if (e instanceof com.liferay.portal.PortalException) {
223                     throw (com.liferay.portal.PortalException)e;
224                 }
225 
226                 if (e instanceof com.liferay.portal.SystemException) {
227                     throw (com.liferay.portal.SystemException)e;
228                 }
229 
230                 throw new com.liferay.portal.SystemException(e);
231             }
232         }
233         catch (com.liferay.portal.SystemException se) {
234             _log.error(se, se);
235 
236             throw se;
237         }
238     }
239 
240     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion getFrameworkVersion(
241         HttpPrincipal httpPrincipal, long frameworkVersionId)
242         throws com.liferay.portal.PortalException,
243             com.liferay.portal.SystemException {
244         try {
245             Object paramObj0 = new LongWrapper(frameworkVersionId);
246 
247             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
248                     "getFrameworkVersion", new Object[] { paramObj0 });
249 
250             Object returnObj = null;
251 
252             try {
253                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
254             }
255             catch (Exception e) {
256                 if (e instanceof com.liferay.portal.PortalException) {
257                     throw (com.liferay.portal.PortalException)e;
258                 }
259 
260                 if (e instanceof com.liferay.portal.SystemException) {
261                     throw (com.liferay.portal.SystemException)e;
262                 }
263 
264                 throw new com.liferay.portal.SystemException(e);
265             }
266 
267             return (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion)returnObj;
268         }
269         catch (com.liferay.portal.SystemException se) {
270             _log.error(se, se);
271 
272             throw se;
273         }
274     }
275 
276     public static java.util.List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getFrameworkVersions(
277         HttpPrincipal httpPrincipal, long groupId, boolean active)
278         throws com.liferay.portal.SystemException {
279         try {
280             Object paramObj0 = new LongWrapper(groupId);
281 
282             Object paramObj1 = new BooleanWrapper(active);
283 
284             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
285                     "getFrameworkVersions",
286                     new Object[] { paramObj0, paramObj1 });
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.SystemException) {
295                     throw (com.liferay.portal.SystemException)e;
296                 }
297 
298                 throw new com.liferay.portal.SystemException(e);
299             }
300 
301             return (java.util.List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)returnObj;
302         }
303         catch (com.liferay.portal.SystemException se) {
304             _log.error(se, se);
305 
306             throw se;
307         }
308     }
309 
310     public static java.util.List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getFrameworkVersions(
311         HttpPrincipal httpPrincipal, long groupId, boolean active, int start,
312         int end) throws com.liferay.portal.SystemException {
313         try {
314             Object paramObj0 = new LongWrapper(groupId);
315 
316             Object paramObj1 = new BooleanWrapper(active);
317 
318             Object paramObj2 = new IntegerWrapper(start);
319 
320             Object paramObj3 = new IntegerWrapper(end);
321 
322             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
323                     "getFrameworkVersions",
324                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
325 
326             Object returnObj = null;
327 
328             try {
329                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
330             }
331             catch (Exception e) {
332                 if (e instanceof com.liferay.portal.SystemException) {
333                     throw (com.liferay.portal.SystemException)e;
334                 }
335 
336                 throw new com.liferay.portal.SystemException(e);
337             }
338 
339             return (java.util.List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)returnObj;
340         }
341         catch (com.liferay.portal.SystemException se) {
342             _log.error(se, se);
343 
344             throw se;
345         }
346     }
347 
348     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion updateFrameworkVersion(
349         HttpPrincipal httpPrincipal, long frameworkVersionId,
350         java.lang.String name, java.lang.String url, boolean active,
351         int priority)
352         throws com.liferay.portal.PortalException,
353             com.liferay.portal.SystemException {
354         try {
355             Object paramObj0 = new LongWrapper(frameworkVersionId);
356 
357             Object paramObj1 = name;
358 
359             if (name == null) {
360                 paramObj1 = new NullWrapper("java.lang.String");
361             }
362 
363             Object paramObj2 = url;
364 
365             if (url == null) {
366                 paramObj2 = new NullWrapper("java.lang.String");
367             }
368 
369             Object paramObj3 = new BooleanWrapper(active);
370 
371             Object paramObj4 = new IntegerWrapper(priority);
372 
373             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
374                     "updateFrameworkVersion",
375                     new Object[] {
376                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
377                     });
378 
379             Object returnObj = null;
380 
381             try {
382                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
383             }
384             catch (Exception e) {
385                 if (e instanceof com.liferay.portal.PortalException) {
386                     throw (com.liferay.portal.PortalException)e;
387                 }
388 
389                 if (e instanceof com.liferay.portal.SystemException) {
390                     throw (com.liferay.portal.SystemException)e;
391                 }
392 
393                 throw new com.liferay.portal.SystemException(e);
394             }
395 
396             return (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion)returnObj;
397         }
398         catch (com.liferay.portal.SystemException se) {
399             _log.error(se, se);
400 
401             throw se;
402         }
403     }
404 
405     private static Log _log = LogFactoryUtil.getLog(SCFrameworkVersionServiceHttp.class);
406 }