1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.expando.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.IntegerWrapper;
20  import com.liferay.portal.kernel.util.LongWrapper;
21  import com.liferay.portal.kernel.util.MethodWrapper;
22  import com.liferay.portal.kernel.util.NullWrapper;
23  import com.liferay.portal.security.auth.HttpPrincipal;
24  import com.liferay.portal.service.http.TunnelUtil;
25  
26  import com.liferay.portlet.expando.service.ExpandoColumnServiceUtil;
27  
28  /**
29   * <a href="ExpandoColumnServiceHttp.java.html"><b><i>View Source</i></b></a>
30   *
31   * <p>
32   * ServiceBuilder generated this class. Modifications in this class will be
33   * overwritten the next time is generated.
34   * </p>
35   *
36   * <p>
37   * This class provides a HTTP utility for the
38   * {@link com.liferay.portlet.expando.service.ExpandoColumnServiceUtil} service utility. The
39   * static methods of this class calls the same methods of the service utility.
40   * However, the signatures are different because it requires an additional
41   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
42   * </p>
43   *
44   * <p>
45   * The benefits of using the HTTP utility is that it is fast and allows for
46   * tunneling without the cost of serializing to text. The drawback is that it
47   * only works with Java.
48   * </p>
49   *
50   * <p>
51   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
52   * configure security.
53   * </p>
54   *
55   * <p>
56   * The HTTP utility is only generated for remote services.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       ExpandoColumnServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.expando.service.ExpandoColumnServiceUtil
63   * @generated
64   */
65  public class ExpandoColumnServiceHttp {
66      public static com.liferay.portlet.expando.model.ExpandoColumn addColumn(
67          HttpPrincipal httpPrincipal, long tableId, java.lang.String name,
68          int type)
69          throws com.liferay.portal.kernel.exception.PortalException,
70              com.liferay.portal.kernel.exception.SystemException {
71          try {
72              Object paramObj0 = new LongWrapper(tableId);
73  
74              Object paramObj1 = name;
75  
76              if (name == null) {
77                  paramObj1 = new NullWrapper("java.lang.String");
78              }
79  
80              Object paramObj2 = new IntegerWrapper(type);
81  
82              MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
83                      "addColumn",
84                      new Object[] { paramObj0, paramObj1, paramObj2 });
85  
86              Object returnObj = null;
87  
88              try {
89                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
90              }
91              catch (Exception e) {
92                  if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
93                      throw (com.liferay.portal.kernel.exception.PortalException)e;
94                  }
95  
96                  if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
97                      throw (com.liferay.portal.kernel.exception.SystemException)e;
98                  }
99  
100                 throw new com.liferay.portal.kernel.exception.SystemException(e);
101             }
102 
103             return (com.liferay.portlet.expando.model.ExpandoColumn)returnObj;
104         }
105         catch (com.liferay.portal.kernel.exception.SystemException se) {
106             _log.error(se, se);
107 
108             throw se;
109         }
110     }
111 
112     public static com.liferay.portlet.expando.model.ExpandoColumn addColumn(
113         HttpPrincipal httpPrincipal, long tableId, java.lang.String name,
114         int type, java.lang.Object defaultData)
115         throws com.liferay.portal.kernel.exception.PortalException,
116             com.liferay.portal.kernel.exception.SystemException {
117         try {
118             Object paramObj0 = new LongWrapper(tableId);
119 
120             Object paramObj1 = name;
121 
122             if (name == null) {
123                 paramObj1 = new NullWrapper("java.lang.String");
124             }
125 
126             Object paramObj2 = new IntegerWrapper(type);
127 
128             Object paramObj3 = defaultData;
129 
130             if (defaultData == null) {
131                 paramObj3 = new NullWrapper("java.lang.Object");
132             }
133 
134             MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
135                     "addColumn",
136                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
137 
138             Object returnObj = null;
139 
140             try {
141                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
142             }
143             catch (Exception e) {
144                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
145                     throw (com.liferay.portal.kernel.exception.PortalException)e;
146                 }
147 
148                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
149                     throw (com.liferay.portal.kernel.exception.SystemException)e;
150                 }
151 
152                 throw new com.liferay.portal.kernel.exception.SystemException(e);
153             }
154 
155             return (com.liferay.portlet.expando.model.ExpandoColumn)returnObj;
156         }
157         catch (com.liferay.portal.kernel.exception.SystemException se) {
158             _log.error(se, se);
159 
160             throw se;
161         }
162     }
163 
164     public static void deleteColumn(HttpPrincipal httpPrincipal, long columnId)
165         throws com.liferay.portal.kernel.exception.PortalException,
166             com.liferay.portal.kernel.exception.SystemException {
167         try {
168             Object paramObj0 = new LongWrapper(columnId);
169 
170             MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
171                     "deleteColumn", new Object[] { paramObj0 });
172 
173             try {
174                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
175             }
176             catch (Exception e) {
177                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
178                     throw (com.liferay.portal.kernel.exception.PortalException)e;
179                 }
180 
181                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
182                     throw (com.liferay.portal.kernel.exception.SystemException)e;
183                 }
184 
185                 throw new com.liferay.portal.kernel.exception.SystemException(e);
186             }
187         }
188         catch (com.liferay.portal.kernel.exception.SystemException se) {
189             _log.error(se, se);
190 
191             throw se;
192         }
193     }
194 
195     public static com.liferay.portlet.expando.model.ExpandoColumn updateColumn(
196         HttpPrincipal httpPrincipal, long columnId, java.lang.String name,
197         int type)
198         throws com.liferay.portal.kernel.exception.PortalException,
199             com.liferay.portal.kernel.exception.SystemException {
200         try {
201             Object paramObj0 = new LongWrapper(columnId);
202 
203             Object paramObj1 = name;
204 
205             if (name == null) {
206                 paramObj1 = new NullWrapper("java.lang.String");
207             }
208 
209             Object paramObj2 = new IntegerWrapper(type);
210 
211             MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
212                     "updateColumn",
213                     new Object[] { paramObj0, paramObj1, paramObj2 });
214 
215             Object returnObj = null;
216 
217             try {
218                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
219             }
220             catch (Exception e) {
221                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
222                     throw (com.liferay.portal.kernel.exception.PortalException)e;
223                 }
224 
225                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
226                     throw (com.liferay.portal.kernel.exception.SystemException)e;
227                 }
228 
229                 throw new com.liferay.portal.kernel.exception.SystemException(e);
230             }
231 
232             return (com.liferay.portlet.expando.model.ExpandoColumn)returnObj;
233         }
234         catch (com.liferay.portal.kernel.exception.SystemException se) {
235             _log.error(se, se);
236 
237             throw se;
238         }
239     }
240 
241     public static com.liferay.portlet.expando.model.ExpandoColumn updateColumn(
242         HttpPrincipal httpPrincipal, long columnId, java.lang.String name,
243         int type, java.lang.Object defaultData)
244         throws com.liferay.portal.kernel.exception.PortalException,
245             com.liferay.portal.kernel.exception.SystemException {
246         try {
247             Object paramObj0 = new LongWrapper(columnId);
248 
249             Object paramObj1 = name;
250 
251             if (name == null) {
252                 paramObj1 = new NullWrapper("java.lang.String");
253             }
254 
255             Object paramObj2 = new IntegerWrapper(type);
256 
257             Object paramObj3 = defaultData;
258 
259             if (defaultData == null) {
260                 paramObj3 = new NullWrapper("java.lang.Object");
261             }
262 
263             MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
264                     "updateColumn",
265                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
266 
267             Object returnObj = null;
268 
269             try {
270                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
271             }
272             catch (Exception e) {
273                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
274                     throw (com.liferay.portal.kernel.exception.PortalException)e;
275                 }
276 
277                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
278                     throw (com.liferay.portal.kernel.exception.SystemException)e;
279                 }
280 
281                 throw new com.liferay.portal.kernel.exception.SystemException(e);
282             }
283 
284             return (com.liferay.portlet.expando.model.ExpandoColumn)returnObj;
285         }
286         catch (com.liferay.portal.kernel.exception.SystemException se) {
287             _log.error(se, se);
288 
289             throw se;
290         }
291     }
292 
293     public static com.liferay.portlet.expando.model.ExpandoColumn updateTypeSettings(
294         HttpPrincipal httpPrincipal, long columnId,
295         java.lang.String typeSettings)
296         throws com.liferay.portal.kernel.exception.PortalException,
297             com.liferay.portal.kernel.exception.SystemException {
298         try {
299             Object paramObj0 = new LongWrapper(columnId);
300 
301             Object paramObj1 = typeSettings;
302 
303             if (typeSettings == null) {
304                 paramObj1 = new NullWrapper("java.lang.String");
305             }
306 
307             MethodWrapper methodWrapper = new MethodWrapper(ExpandoColumnServiceUtil.class.getName(),
308                     "updateTypeSettings", new Object[] { paramObj0, paramObj1 });
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.kernel.exception.PortalException) {
317                     throw (com.liferay.portal.kernel.exception.PortalException)e;
318                 }
319 
320                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
321                     throw (com.liferay.portal.kernel.exception.SystemException)e;
322                 }
323 
324                 throw new com.liferay.portal.kernel.exception.SystemException(e);
325             }
326 
327             return (com.liferay.portlet.expando.model.ExpandoColumn)returnObj;
328         }
329         catch (com.liferay.portal.kernel.exception.SystemException se) {
330             _log.error(se, se);
331 
332             throw se;
333         }
334     }
335 
336     private static Log _log = LogFactoryUtil.getLog(ExpandoColumnServiceHttp.class);
337 }