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