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