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