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.polls.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.BooleanWrapper;
20  import com.liferay.portal.kernel.util.IntegerWrapper;
21  import com.liferay.portal.kernel.util.LongWrapper;
22  import com.liferay.portal.kernel.util.MethodWrapper;
23  import com.liferay.portal.kernel.util.NullWrapper;
24  import com.liferay.portal.security.auth.HttpPrincipal;
25  import com.liferay.portal.service.http.TunnelUtil;
26  
27  import com.liferay.portlet.polls.service.PollsQuestionServiceUtil;
28  
29  /**
30   * <a href="PollsQuestionServiceHttp.java.html"><b><i>View Source</i></b></a>
31   *
32   * <p>
33   * ServiceBuilder generated this class. Modifications in this class will be
34   * overwritten the next time is generated.
35   * </p>
36   *
37   * <p>
38   * This class provides a HTTP utility for the
39   * {@link com.liferay.portlet.polls.service.PollsQuestionServiceUtil} service utility. The
40   * static methods of this class calls the same methods of the service utility.
41   * However, the signatures are different because it requires an additional
42   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
43   * </p>
44   *
45   * <p>
46   * The benefits of using the HTTP utility is that it is fast and allows for
47   * tunneling without the cost of serializing to text. The drawback is that it
48   * only works with Java.
49   * </p>
50   *
51   * <p>
52   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
53   * configure security.
54   * </p>
55   *
56   * <p>
57   * The HTTP utility is only generated for remote services.
58   * </p>
59   *
60   * @author    Brian Wing Shun Chan
61   * @see       PollsQuestionServiceSoap
62   * @see       com.liferay.portal.security.auth.HttpPrincipal
63   * @see       com.liferay.portlet.polls.service.PollsQuestionServiceUtil
64   * @generated
65   */
66  public class PollsQuestionServiceHttp {
67      public static com.liferay.portlet.polls.model.PollsQuestion addQuestion(
68          HttpPrincipal httpPrincipal,
69          java.util.Map<java.util.Locale, String> titleMap,
70          java.util.Map<java.util.Locale, String> descriptionMap,
71          int expirationDateMonth, int expirationDateDay, int expirationDateYear,
72          int expirationDateHour, int expirationDateMinute, boolean neverExpire,
73          java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
74          com.liferay.portal.service.ServiceContext serviceContext)
75          throws com.liferay.portal.kernel.exception.PortalException,
76              com.liferay.portal.kernel.exception.SystemException {
77          try {
78              Object paramObj0 = titleMap;
79  
80              if (titleMap == null) {
81                  paramObj0 = new NullWrapper("java.util.Map");
82              }
83  
84              Object paramObj1 = descriptionMap;
85  
86              if (descriptionMap == null) {
87                  paramObj1 = new NullWrapper("java.util.Map");
88              }
89  
90              Object paramObj2 = new IntegerWrapper(expirationDateMonth);
91  
92              Object paramObj3 = new IntegerWrapper(expirationDateDay);
93  
94              Object paramObj4 = new IntegerWrapper(expirationDateYear);
95  
96              Object paramObj5 = new IntegerWrapper(expirationDateHour);
97  
98              Object paramObj6 = new IntegerWrapper(expirationDateMinute);
99  
100             Object paramObj7 = new BooleanWrapper(neverExpire);
101 
102             Object paramObj8 = choices;
103 
104             if (choices == null) {
105                 paramObj8 = new NullWrapper("java.util.List");
106             }
107 
108             Object paramObj9 = serviceContext;
109 
110             if (serviceContext == null) {
111                 paramObj9 = new NullWrapper(
112                         "com.liferay.portal.service.ServiceContext");
113             }
114 
115             MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
116                     "addQuestion",
117                     new Object[] {
118                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
119                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9
120                     });
121 
122             Object returnObj = null;
123 
124             try {
125                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
126             }
127             catch (Exception e) {
128                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
129                     throw (com.liferay.portal.kernel.exception.PortalException)e;
130                 }
131 
132                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
133                     throw (com.liferay.portal.kernel.exception.SystemException)e;
134                 }
135 
136                 throw new com.liferay.portal.kernel.exception.SystemException(e);
137             }
138 
139             return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
140         }
141         catch (com.liferay.portal.kernel.exception.SystemException se) {
142             _log.error(se, se);
143 
144             throw se;
145         }
146     }
147 
148     public static void deleteQuestion(HttpPrincipal httpPrincipal,
149         long questionId)
150         throws com.liferay.portal.kernel.exception.PortalException,
151             com.liferay.portal.kernel.exception.SystemException {
152         try {
153             Object paramObj0 = new LongWrapper(questionId);
154 
155             MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
156                     "deleteQuestion", new Object[] { paramObj0 });
157 
158             try {
159                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
160             }
161             catch (Exception e) {
162                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
163                     throw (com.liferay.portal.kernel.exception.PortalException)e;
164                 }
165 
166                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
167                     throw (com.liferay.portal.kernel.exception.SystemException)e;
168                 }
169 
170                 throw new com.liferay.portal.kernel.exception.SystemException(e);
171             }
172         }
173         catch (com.liferay.portal.kernel.exception.SystemException se) {
174             _log.error(se, se);
175 
176             throw se;
177         }
178     }
179 
180     public static com.liferay.portlet.polls.model.PollsQuestion getQuestion(
181         HttpPrincipal httpPrincipal, long questionId)
182         throws com.liferay.portal.kernel.exception.PortalException,
183             com.liferay.portal.kernel.exception.SystemException {
184         try {
185             Object paramObj0 = new LongWrapper(questionId);
186 
187             MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
188                     "getQuestion", new Object[] { paramObj0 });
189 
190             Object returnObj = null;
191 
192             try {
193                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
194             }
195             catch (Exception e) {
196                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
197                     throw (com.liferay.portal.kernel.exception.PortalException)e;
198                 }
199 
200                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
201                     throw (com.liferay.portal.kernel.exception.SystemException)e;
202                 }
203 
204                 throw new com.liferay.portal.kernel.exception.SystemException(e);
205             }
206 
207             return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
208         }
209         catch (com.liferay.portal.kernel.exception.SystemException se) {
210             _log.error(se, se);
211 
212             throw se;
213         }
214     }
215 
216     public static com.liferay.portlet.polls.model.PollsQuestion updateQuestion(
217         HttpPrincipal httpPrincipal, long questionId,
218         java.util.Map<java.util.Locale, String> titleMap,
219         java.util.Map<java.util.Locale, String> descriptionMap,
220         int expirationDateMonth, int expirationDateDay, int expirationDateYear,
221         int expirationDateHour, int expirationDateMinute, boolean neverExpire,
222         java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
223         com.liferay.portal.service.ServiceContext serviceContext)
224         throws com.liferay.portal.kernel.exception.PortalException,
225             com.liferay.portal.kernel.exception.SystemException {
226         try {
227             Object paramObj0 = new LongWrapper(questionId);
228 
229             Object paramObj1 = titleMap;
230 
231             if (titleMap == null) {
232                 paramObj1 = new NullWrapper("java.util.Map");
233             }
234 
235             Object paramObj2 = descriptionMap;
236 
237             if (descriptionMap == null) {
238                 paramObj2 = new NullWrapper("java.util.Map");
239             }
240 
241             Object paramObj3 = new IntegerWrapper(expirationDateMonth);
242 
243             Object paramObj4 = new IntegerWrapper(expirationDateDay);
244 
245             Object paramObj5 = new IntegerWrapper(expirationDateYear);
246 
247             Object paramObj6 = new IntegerWrapper(expirationDateHour);
248 
249             Object paramObj7 = new IntegerWrapper(expirationDateMinute);
250 
251             Object paramObj8 = new BooleanWrapper(neverExpire);
252 
253             Object paramObj9 = choices;
254 
255             if (choices == null) {
256                 paramObj9 = new NullWrapper("java.util.List");
257             }
258 
259             Object paramObj10 = serviceContext;
260 
261             if (serviceContext == null) {
262                 paramObj10 = new NullWrapper(
263                         "com.liferay.portal.service.ServiceContext");
264             }
265 
266             MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
267                     "updateQuestion",
268                     new Object[] {
269                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
270                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
271                         paramObj10
272                     });
273 
274             Object returnObj = null;
275 
276             try {
277                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
278             }
279             catch (Exception e) {
280                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
281                     throw (com.liferay.portal.kernel.exception.PortalException)e;
282                 }
283 
284                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
285                     throw (com.liferay.portal.kernel.exception.SystemException)e;
286                 }
287 
288                 throw new com.liferay.portal.kernel.exception.SystemException(e);
289             }
290 
291             return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
292         }
293         catch (com.liferay.portal.kernel.exception.SystemException se) {
294             _log.error(se, se);
295 
296             throw se;
297         }
298     }
299 
300     private static Log _log = LogFactoryUtil.getLog(PollsQuestionServiceHttp.class);
301 }