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   * <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, java.lang.String name,
79          java.lang.String url, boolean active, int priority,
80          com.liferay.portal.service.ServiceContext serviceContext)
81          throws com.liferay.portal.PortalException,
82              com.liferay.portal.SystemException {
83          try {
84              Object paramObj0 = name;
85  
86              if (name == null) {
87                  paramObj0 = new NullWrapper("java.lang.String");
88              }
89  
90              Object paramObj1 = url;
91  
92              if (url == null) {
93                  paramObj1 = new NullWrapper("java.lang.String");
94              }
95  
96              Object paramObj2 = new BooleanWrapper(active);
97  
98              Object paramObj3 = new IntegerWrapper(priority);
99  
100             Object paramObj4 = serviceContext;
101 
102             if (serviceContext == null) {
103                 paramObj4 = new NullWrapper(
104                         "com.liferay.portal.service.ServiceContext");
105             }
106 
107             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
108                     "addFrameworkVersion",
109                     new Object[] {
110                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
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 void deleteFrameworkVersion(HttpPrincipal httpPrincipal,
140         long frameworkVersionId)
141         throws com.liferay.portal.PortalException,
142             com.liferay.portal.SystemException {
143         try {
144             Object paramObj0 = new LongWrapper(frameworkVersionId);
145 
146             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
147                     "deleteFrameworkVersion", new Object[] { paramObj0 });
148 
149             try {
150                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
151             }
152             catch (Exception e) {
153                 if (e instanceof com.liferay.portal.PortalException) {
154                     throw (com.liferay.portal.PortalException)e;
155                 }
156 
157                 if (e instanceof com.liferay.portal.SystemException) {
158                     throw (com.liferay.portal.SystemException)e;
159                 }
160 
161                 throw new com.liferay.portal.SystemException(e);
162             }
163         }
164         catch (com.liferay.portal.SystemException se) {
165             _log.error(se, se);
166 
167             throw se;
168         }
169     }
170 
171     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion getFrameworkVersion(
172         HttpPrincipal httpPrincipal, long frameworkVersionId)
173         throws com.liferay.portal.PortalException,
174             com.liferay.portal.SystemException {
175         try {
176             Object paramObj0 = new LongWrapper(frameworkVersionId);
177 
178             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
179                     "getFrameworkVersion", new Object[] { paramObj0 });
180 
181             Object returnObj = null;
182 
183             try {
184                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
185             }
186             catch (Exception e) {
187                 if (e instanceof com.liferay.portal.PortalException) {
188                     throw (com.liferay.portal.PortalException)e;
189                 }
190 
191                 if (e instanceof com.liferay.portal.SystemException) {
192                     throw (com.liferay.portal.SystemException)e;
193                 }
194 
195                 throw new com.liferay.portal.SystemException(e);
196             }
197 
198             return (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion)returnObj;
199         }
200         catch (com.liferay.portal.SystemException se) {
201             _log.error(se, se);
202 
203             throw se;
204         }
205     }
206 
207     public static java.util.List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getFrameworkVersions(
208         HttpPrincipal httpPrincipal, long groupId, boolean active)
209         throws com.liferay.portal.SystemException {
210         try {
211             Object paramObj0 = new LongWrapper(groupId);
212 
213             Object paramObj1 = new BooleanWrapper(active);
214 
215             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
216                     "getFrameworkVersions",
217                     new Object[] { paramObj0, paramObj1 });
218 
219             Object returnObj = null;
220 
221             try {
222                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
223             }
224             catch (Exception e) {
225                 if (e instanceof com.liferay.portal.SystemException) {
226                     throw (com.liferay.portal.SystemException)e;
227                 }
228 
229                 throw new com.liferay.portal.SystemException(e);
230             }
231 
232             return (java.util.List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)returnObj;
233         }
234         catch (com.liferay.portal.SystemException se) {
235             _log.error(se, se);
236 
237             throw se;
238         }
239     }
240 
241     public static java.util.List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getFrameworkVersions(
242         HttpPrincipal httpPrincipal, long groupId, boolean active, int start,
243         int end) throws com.liferay.portal.SystemException {
244         try {
245             Object paramObj0 = new LongWrapper(groupId);
246 
247             Object paramObj1 = new BooleanWrapper(active);
248 
249             Object paramObj2 = new IntegerWrapper(start);
250 
251             Object paramObj3 = new IntegerWrapper(end);
252 
253             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
254                     "getFrameworkVersions",
255                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
256 
257             Object returnObj = null;
258 
259             try {
260                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
261             }
262             catch (Exception e) {
263                 if (e instanceof com.liferay.portal.SystemException) {
264                     throw (com.liferay.portal.SystemException)e;
265                 }
266 
267                 throw new com.liferay.portal.SystemException(e);
268             }
269 
270             return (java.util.List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)returnObj;
271         }
272         catch (com.liferay.portal.SystemException se) {
273             _log.error(se, se);
274 
275             throw se;
276         }
277     }
278 
279     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion updateFrameworkVersion(
280         HttpPrincipal httpPrincipal, long frameworkVersionId,
281         java.lang.String name, java.lang.String url, boolean active,
282         int priority)
283         throws com.liferay.portal.PortalException,
284             com.liferay.portal.SystemException {
285         try {
286             Object paramObj0 = new LongWrapper(frameworkVersionId);
287 
288             Object paramObj1 = name;
289 
290             if (name == null) {
291                 paramObj1 = new NullWrapper("java.lang.String");
292             }
293 
294             Object paramObj2 = url;
295 
296             if (url == null) {
297                 paramObj2 = new NullWrapper("java.lang.String");
298             }
299 
300             Object paramObj3 = new BooleanWrapper(active);
301 
302             Object paramObj4 = new IntegerWrapper(priority);
303 
304             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
305                     "updateFrameworkVersion",
306                     new Object[] {
307                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
308                     });
309 
310             Object returnObj = null;
311 
312             try {
313                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
314             }
315             catch (Exception e) {
316                 if (e instanceof com.liferay.portal.PortalException) {
317                     throw (com.liferay.portal.PortalException)e;
318                 }
319 
320                 if (e instanceof com.liferay.portal.SystemException) {
321                     throw (com.liferay.portal.SystemException)e;
322                 }
323 
324                 throw new com.liferay.portal.SystemException(e);
325             }
326 
327             return (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion)returnObj;
328         }
329         catch (com.liferay.portal.SystemException se) {
330             _log.error(se, se);
331 
332             throw se;
333         }
334     }
335 
336     private static Log _log = LogFactoryUtil.getLog(SCFrameworkVersionServiceHttp.class);
337 }