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