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.expando.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.IntegerWrapper;
28  import com.liferay.portal.kernel.util.LongWrapper;
29  import com.liferay.portal.kernel.util.MethodWrapper;
30  import com.liferay.portal.kernel.util.NullWrapper;
31  import com.liferay.portal.security.auth.HttpPrincipal;
32  import com.liferay.portal.service.http.TunnelUtil;
33  
34  import com.liferay.portlet.expando.service.ExpandoColumnServiceUtil;
35  
36  /**
37   * <a href="ExpandoColumnServiceHttp.java.html"><b><i>View Source</i></b></a>
38   *
39   * <p>
40   * ServiceBuilder generated this class. Modifications in this class will be
41   * overwritten the next time is generated.
42   * </p>
43   *
44   * <p>
45   * This class provides a HTTP utility for the
46   * {@link com.liferay.portlet.expando.service.ExpandoColumnServiceUtil} service utility. The
47   * static methods of this class calls the same methods of the service utility.
48   * However, the signatures are different because it requires an additional
49   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
50   * </p>
51   *
52   * <p>
53   * The benefits of using the HTTP utility is that it is fast and allows for
54   * tunneling without the cost of serializing to text. The drawback is that it
55   * only works with Java.
56   * </p>
57   *
58   * <p>
59   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
60   * 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   * @see       ExpandoColumnServiceSoap
69   * @see       com.liferay.portal.security.auth.HttpPrincipal
70   * @see       com.liferay.portlet.expando.service.ExpandoColumnServiceUtil
71   * @generated
72   */
73  public class ExpandoColumnServiceHttp {
74      public static com.liferay.portlet.expando.model.ExpandoColumn addColumn(
75          HttpPrincipal httpPrincipal, long tableId, java.lang.String name,
76          int type)
77          throws com.liferay.portal.PortalException,
78              com.liferay.portal.SystemException {
79          try {
80              Object paramObj0 = new LongWrapper(tableId);
81  
82              Object paramObj1 = name;
83  
84              if (name == null) {
85                  paramObj1 = new NullWrapper("java.lang.String");
86              }
87  
88              Object paramObj2 = new IntegerWrapper(type);
89  
90              MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
91                      "addColumn",
92                      new Object[] { paramObj0, paramObj1, paramObj2 });
93  
94              Object returnObj = null;
95  
96              try {
97                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
98              }
99              catch (Exception e) {
100                 if (e instanceof com.liferay.portal.PortalException) {
101                     throw (com.liferay.portal.PortalException)e;
102                 }
103 
104                 if (e instanceof com.liferay.portal.SystemException) {
105                     throw (com.liferay.portal.SystemException)e;
106                 }
107 
108                 throw new com.liferay.portal.SystemException(e);
109             }
110 
111             return (com.liferay.portlet.expando.model.ExpandoColumn)returnObj;
112         }
113         catch (com.liferay.portal.SystemException se) {
114             _log.error(se, se);
115 
116             throw se;
117         }
118     }
119 
120     public static com.liferay.portlet.expando.model.ExpandoColumn addColumn(
121         HttpPrincipal httpPrincipal, long tableId, java.lang.String name,
122         int type, java.lang.Object defaultData)
123         throws com.liferay.portal.PortalException,
124             com.liferay.portal.SystemException {
125         try {
126             Object paramObj0 = new LongWrapper(tableId);
127 
128             Object paramObj1 = name;
129 
130             if (name == null) {
131                 paramObj1 = new NullWrapper("java.lang.String");
132             }
133 
134             Object paramObj2 = new IntegerWrapper(type);
135 
136             Object paramObj3 = defaultData;
137 
138             if (defaultData == null) {
139                 paramObj3 = new NullWrapper("java.lang.Object");
140             }
141 
142             MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
143                     "addColumn",
144                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
145 
146             Object returnObj = null;
147 
148             try {
149                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
150             }
151             catch (Exception e) {
152                 if (e instanceof com.liferay.portal.PortalException) {
153                     throw (com.liferay.portal.PortalException)e;
154                 }
155 
156                 if (e instanceof com.liferay.portal.SystemException) {
157                     throw (com.liferay.portal.SystemException)e;
158                 }
159 
160                 throw new com.liferay.portal.SystemException(e);
161             }
162 
163             return (com.liferay.portlet.expando.model.ExpandoColumn)returnObj;
164         }
165         catch (com.liferay.portal.SystemException se) {
166             _log.error(se, se);
167 
168             throw se;
169         }
170     }
171 
172     public static void deleteColumn(HttpPrincipal httpPrincipal, long columnId)
173         throws com.liferay.portal.PortalException,
174             com.liferay.portal.SystemException {
175         try {
176             Object paramObj0 = new LongWrapper(columnId);
177 
178             MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
179                     "deleteColumn", new Object[] { paramObj0 });
180 
181             try {
182                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
183             }
184             catch (Exception e) {
185                 if (e instanceof com.liferay.portal.PortalException) {
186                     throw (com.liferay.portal.PortalException)e;
187                 }
188 
189                 if (e instanceof com.liferay.portal.SystemException) {
190                     throw (com.liferay.portal.SystemException)e;
191                 }
192 
193                 throw new com.liferay.portal.SystemException(e);
194             }
195         }
196         catch (com.liferay.portal.SystemException se) {
197             _log.error(se, se);
198 
199             throw se;
200         }
201     }
202 
203     public static com.liferay.portlet.expando.model.ExpandoColumn updateColumn(
204         HttpPrincipal httpPrincipal, long columnId, java.lang.String name,
205         int type)
206         throws com.liferay.portal.PortalException,
207             com.liferay.portal.SystemException {
208         try {
209             Object paramObj0 = new LongWrapper(columnId);
210 
211             Object paramObj1 = name;
212 
213             if (name == null) {
214                 paramObj1 = new NullWrapper("java.lang.String");
215             }
216 
217             Object paramObj2 = new IntegerWrapper(type);
218 
219             MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
220                     "updateColumn",
221                     new Object[] { paramObj0, paramObj1, paramObj2 });
222 
223             Object returnObj = null;
224 
225             try {
226                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
227             }
228             catch (Exception e) {
229                 if (e instanceof com.liferay.portal.PortalException) {
230                     throw (com.liferay.portal.PortalException)e;
231                 }
232 
233                 if (e instanceof com.liferay.portal.SystemException) {
234                     throw (com.liferay.portal.SystemException)e;
235                 }
236 
237                 throw new com.liferay.portal.SystemException(e);
238             }
239 
240             return (com.liferay.portlet.expando.model.ExpandoColumn)returnObj;
241         }
242         catch (com.liferay.portal.SystemException se) {
243             _log.error(se, se);
244 
245             throw se;
246         }
247     }
248 
249     public static com.liferay.portlet.expando.model.ExpandoColumn updateColumn(
250         HttpPrincipal httpPrincipal, long columnId, java.lang.String name,
251         int type, java.lang.Object defaultData)
252         throws com.liferay.portal.PortalException,
253             com.liferay.portal.SystemException {
254         try {
255             Object paramObj0 = new LongWrapper(columnId);
256 
257             Object paramObj1 = name;
258 
259             if (name == null) {
260                 paramObj1 = new NullWrapper("java.lang.String");
261             }
262 
263             Object paramObj2 = new IntegerWrapper(type);
264 
265             Object paramObj3 = defaultData;
266 
267             if (defaultData == null) {
268                 paramObj3 = new NullWrapper("java.lang.Object");
269             }
270 
271             MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
272                     "updateColumn",
273                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
274 
275             Object returnObj = null;
276 
277             try {
278                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
279             }
280             catch (Exception e) {
281                 if (e instanceof com.liferay.portal.PortalException) {
282                     throw (com.liferay.portal.PortalException)e;
283                 }
284 
285                 if (e instanceof com.liferay.portal.SystemException) {
286                     throw (com.liferay.portal.SystemException)e;
287                 }
288 
289                 throw new com.liferay.portal.SystemException(e);
290             }
291 
292             return (com.liferay.portlet.expando.model.ExpandoColumn)returnObj;
293         }
294         catch (com.liferay.portal.SystemException se) {
295             _log.error(se, se);
296 
297             throw se;
298         }
299     }
300 
301     public static com.liferay.portlet.expando.model.ExpandoColumn updateTypeSettings(
302         HttpPrincipal httpPrincipal, long columnId,
303         java.lang.String typeSettings)
304         throws com.liferay.portal.PortalException,
305             com.liferay.portal.SystemException {
306         try {
307             Object paramObj0 = new LongWrapper(columnId);
308 
309             Object paramObj1 = typeSettings;
310 
311             if (typeSettings == null) {
312                 paramObj1 = new NullWrapper("java.lang.String");
313             }
314 
315             MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
316                     "updateTypeSettings", new Object[] { paramObj0, paramObj1 });
317 
318             Object returnObj = null;
319 
320             try {
321                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
322             }
323             catch (Exception e) {
324                 if (e instanceof com.liferay.portal.PortalException) {
325                     throw (com.liferay.portal.PortalException)e;
326                 }
327 
328                 if (e instanceof com.liferay.portal.SystemException) {
329                     throw (com.liferay.portal.SystemException)e;
330                 }
331 
332                 throw new com.liferay.portal.SystemException(e);
333             }
334 
335             return (com.liferay.portlet.expando.model.ExpandoColumn)returnObj;
336         }
337         catch (com.liferay.portal.SystemException se) {
338             _log.error(se, se);
339 
340             throw se;
341         }
342     }
343 
344     private static Log _log = LogFactoryUtil.getLog(ExpandoColumnServiceHttp.class);
345 }