1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
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, long plid, java.lang.String title,
69          java.lang.String description, int expirationDateMonth,
70          int expirationDateDay, int expirationDateYear, int expirationDateHour,
71          int expirationDateMinute, boolean neverExpire,
72          java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
73          boolean addCommunityPermissions, boolean addGuestPermissions)
74          throws com.liferay.portal.PortalException,
75              com.liferay.portal.SystemException {
76          try {
77              Object paramObj0 = new LongWrapper(plid);
78  
79              Object paramObj1 = title;
80  
81              if (title == null) {
82                  paramObj1 = new NullWrapper("java.lang.String");
83              }
84  
85              Object paramObj2 = description;
86  
87              if (description == null) {
88                  paramObj2 = new NullWrapper("java.lang.String");
89              }
90  
91              Object paramObj3 = new IntegerWrapper(expirationDateMonth);
92  
93              Object paramObj4 = new IntegerWrapper(expirationDateDay);
94  
95              Object paramObj5 = new IntegerWrapper(expirationDateYear);
96  
97              Object paramObj6 = new IntegerWrapper(expirationDateHour);
98  
99              Object paramObj7 = new IntegerWrapper(expirationDateMinute);
100 
101             Object paramObj8 = new BooleanWrapper(neverExpire);
102 
103             Object paramObj9 = choices;
104 
105             if (choices == null) {
106                 paramObj9 = new NullWrapper("java.util.List");
107             }
108 
109             Object paramObj10 = new BooleanWrapper(addCommunityPermissions);
110 
111             Object paramObj11 = new BooleanWrapper(addGuestPermissions);
112 
113             MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
114                     "addQuestion",
115                     new Object[] {
116                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
117                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
118                         paramObj10, paramObj11
119                     });
120 
121             Object returnObj = null;
122 
123             try {
124                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
125             }
126             catch (Exception e) {
127                 if (e instanceof com.liferay.portal.PortalException) {
128                     throw (com.liferay.portal.PortalException)e;
129                 }
130 
131                 if (e instanceof com.liferay.portal.SystemException) {
132                     throw (com.liferay.portal.SystemException)e;
133                 }
134 
135                 throw new com.liferay.portal.SystemException(e);
136             }
137 
138             return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
139         }
140         catch (com.liferay.portal.SystemException se) {
141             _log.error(se, se);
142 
143             throw se;
144         }
145     }
146 
147     public static com.liferay.portlet.polls.model.PollsQuestion addQuestion(
148         HttpPrincipal httpPrincipal, long plid, java.lang.String title,
149         java.lang.String description, int expirationDateMonth,
150         int expirationDateDay, int expirationDateYear, int expirationDateHour,
151         int expirationDateMinute, boolean neverExpire,
152         java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
153         java.lang.String[] communityPermissions,
154         java.lang.String[] guestPermissions)
155         throws com.liferay.portal.PortalException,
156             com.liferay.portal.SystemException {
157         try {
158             Object paramObj0 = new LongWrapper(plid);
159 
160             Object paramObj1 = title;
161 
162             if (title == null) {
163                 paramObj1 = new NullWrapper("java.lang.String");
164             }
165 
166             Object paramObj2 = description;
167 
168             if (description == null) {
169                 paramObj2 = new NullWrapper("java.lang.String");
170             }
171 
172             Object paramObj3 = new IntegerWrapper(expirationDateMonth);
173 
174             Object paramObj4 = new IntegerWrapper(expirationDateDay);
175 
176             Object paramObj5 = new IntegerWrapper(expirationDateYear);
177 
178             Object paramObj6 = new IntegerWrapper(expirationDateHour);
179 
180             Object paramObj7 = new IntegerWrapper(expirationDateMinute);
181 
182             Object paramObj8 = new BooleanWrapper(neverExpire);
183 
184             Object paramObj9 = choices;
185 
186             if (choices == null) {
187                 paramObj9 = new NullWrapper("java.util.List");
188             }
189 
190             Object paramObj10 = communityPermissions;
191 
192             if (communityPermissions == null) {
193                 paramObj10 = new NullWrapper("[Ljava.lang.String;");
194             }
195 
196             Object paramObj11 = guestPermissions;
197 
198             if (guestPermissions == null) {
199                 paramObj11 = new NullWrapper("[Ljava.lang.String;");
200             }
201 
202             MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
203                     "addQuestion",
204                     new Object[] {
205                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
206                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
207                         paramObj10, paramObj11
208                     });
209 
210             Object returnObj = null;
211 
212             try {
213                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
214             }
215             catch (Exception e) {
216                 if (e instanceof com.liferay.portal.PortalException) {
217                     throw (com.liferay.portal.PortalException)e;
218                 }
219 
220                 if (e instanceof com.liferay.portal.SystemException) {
221                     throw (com.liferay.portal.SystemException)e;
222                 }
223 
224                 throw new com.liferay.portal.SystemException(e);
225             }
226 
227             return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
228         }
229         catch (com.liferay.portal.SystemException se) {
230             _log.error(se, se);
231 
232             throw se;
233         }
234     }
235 
236     public static void deleteQuestion(HttpPrincipal httpPrincipal,
237         long questionId)
238         throws com.liferay.portal.PortalException,
239             com.liferay.portal.SystemException {
240         try {
241             Object paramObj0 = new LongWrapper(questionId);
242 
243             MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
244                     "deleteQuestion", new Object[] { paramObj0 });
245 
246             try {
247                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
248             }
249             catch (Exception e) {
250                 if (e instanceof com.liferay.portal.PortalException) {
251                     throw (com.liferay.portal.PortalException)e;
252                 }
253 
254                 if (e instanceof com.liferay.portal.SystemException) {
255                     throw (com.liferay.portal.SystemException)e;
256                 }
257 
258                 throw new com.liferay.portal.SystemException(e);
259             }
260         }
261         catch (com.liferay.portal.SystemException se) {
262             _log.error(se, se);
263 
264             throw se;
265         }
266     }
267 
268     public static com.liferay.portlet.polls.model.PollsQuestion getQuestion(
269         HttpPrincipal httpPrincipal, long questionId)
270         throws com.liferay.portal.PortalException,
271             com.liferay.portal.SystemException {
272         try {
273             Object paramObj0 = new LongWrapper(questionId);
274 
275             MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
276                     "getQuestion", new Object[] { paramObj0 });
277 
278             Object returnObj = null;
279 
280             try {
281                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
282             }
283             catch (Exception e) {
284                 if (e instanceof com.liferay.portal.PortalException) {
285                     throw (com.liferay.portal.PortalException)e;
286                 }
287 
288                 if (e instanceof com.liferay.portal.SystemException) {
289                     throw (com.liferay.portal.SystemException)e;
290                 }
291 
292                 throw new com.liferay.portal.SystemException(e);
293             }
294 
295             return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
296         }
297         catch (com.liferay.portal.SystemException se) {
298             _log.error(se, se);
299 
300             throw se;
301         }
302     }
303 
304     public static com.liferay.portlet.polls.model.PollsQuestion updateQuestion(
305         HttpPrincipal httpPrincipal, long questionId, java.lang.String title,
306         java.lang.String description, int expirationDateMonth,
307         int expirationDateDay, int expirationDateYear, int expirationDateHour,
308         int expirationDateMinute, boolean neverExpire,
309         java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices)
310         throws com.liferay.portal.PortalException,
311             com.liferay.portal.SystemException {
312         try {
313             Object paramObj0 = new LongWrapper(questionId);
314 
315             Object paramObj1 = title;
316 
317             if (title == null) {
318                 paramObj1 = new NullWrapper("java.lang.String");
319             }
320 
321             Object paramObj2 = description;
322 
323             if (description == null) {
324                 paramObj2 = new NullWrapper("java.lang.String");
325             }
326 
327             Object paramObj3 = new IntegerWrapper(expirationDateMonth);
328 
329             Object paramObj4 = new IntegerWrapper(expirationDateDay);
330 
331             Object paramObj5 = new IntegerWrapper(expirationDateYear);
332 
333             Object paramObj6 = new IntegerWrapper(expirationDateHour);
334 
335             Object paramObj7 = new IntegerWrapper(expirationDateMinute);
336 
337             Object paramObj8 = new BooleanWrapper(neverExpire);
338 
339             Object paramObj9 = choices;
340 
341             if (choices == null) {
342                 paramObj9 = new NullWrapper("java.util.List");
343             }
344 
345             MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
346                     "updateQuestion",
347                     new Object[] {
348                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
349                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9
350                     });
351 
352             Object returnObj = null;
353 
354             try {
355                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
356             }
357             catch (Exception e) {
358                 if (e instanceof com.liferay.portal.PortalException) {
359                     throw (com.liferay.portal.PortalException)e;
360                 }
361 
362                 if (e instanceof com.liferay.portal.SystemException) {
363                     throw (com.liferay.portal.SystemException)e;
364                 }
365 
366                 throw new com.liferay.portal.SystemException(e);
367             }
368 
369             return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
370         }
371         catch (com.liferay.portal.SystemException se) {
372             _log.error(se, se);
373 
374             throw se;
375         }
376     }
377 
378     private static Log _log = LogFactoryUtil.getLog(PollsQuestionServiceHttp.class);
379 }