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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.polls.service.PollsQuestionServiceUtil;
25  
26  /**
27   * <a href="PollsQuestionServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.polls.service.PollsQuestionServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       PollsQuestionServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.polls.service.PollsQuestionServiceUtil
61   * @generated
62   */
63  public class PollsQuestionServiceHttp {
64      public static com.liferay.portlet.polls.model.PollsQuestion addQuestion(
65          HttpPrincipal httpPrincipal, java.lang.String title,
66          java.lang.String description, int expirationDateMonth,
67          int expirationDateDay, int expirationDateYear, int expirationDateHour,
68          int expirationDateMinute, boolean neverExpire,
69          java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
70          com.liferay.portal.service.ServiceContext serviceContext)
71          throws com.liferay.portal.PortalException,
72              com.liferay.portal.SystemException {
73          try {
74              MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class.getName(),
75                      "addQuestion", _addQuestionParameterTypes0);
76  
77              MethodHandler methodHandler = new MethodHandler(methodKey, title,
78                      description, expirationDateMonth, expirationDateDay,
79                      expirationDateYear, expirationDateHour,
80                      expirationDateMinute, neverExpire, choices, serviceContext);
81  
82              Object returnObj = null;
83  
84              try {
85                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
86              }
87              catch (Exception e) {
88                  if (e instanceof com.liferay.portal.PortalException) {
89                      throw (com.liferay.portal.PortalException)e;
90                  }
91  
92                  if (e instanceof com.liferay.portal.SystemException) {
93                      throw (com.liferay.portal.SystemException)e;
94                  }
95  
96                  throw new com.liferay.portal.SystemException(e);
97              }
98  
99              return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
100         }
101         catch (com.liferay.portal.SystemException se) {
102             _log.error(se, se);
103 
104             throw se;
105         }
106     }
107 
108     public static void deleteQuestion(HttpPrincipal httpPrincipal,
109         long questionId)
110         throws com.liferay.portal.PortalException,
111             com.liferay.portal.SystemException {
112         try {
113             MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class.getName(),
114                     "deleteQuestion", _deleteQuestionParameterTypes1);
115 
116             MethodHandler methodHandler = new MethodHandler(methodKey,
117                     questionId);
118 
119             try {
120                 TunnelUtil.invoke(httpPrincipal, methodHandler);
121             }
122             catch (Exception e) {
123                 if (e instanceof com.liferay.portal.PortalException) {
124                     throw (com.liferay.portal.PortalException)e;
125                 }
126 
127                 if (e instanceof com.liferay.portal.SystemException) {
128                     throw (com.liferay.portal.SystemException)e;
129                 }
130 
131                 throw new com.liferay.portal.SystemException(e);
132             }
133         }
134         catch (com.liferay.portal.SystemException se) {
135             _log.error(se, se);
136 
137             throw se;
138         }
139     }
140 
141     public static com.liferay.portlet.polls.model.PollsQuestion getQuestion(
142         HttpPrincipal httpPrincipal, long questionId)
143         throws com.liferay.portal.PortalException,
144             com.liferay.portal.SystemException {
145         try {
146             MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class.getName(),
147                     "getQuestion", _getQuestionParameterTypes2);
148 
149             MethodHandler methodHandler = new MethodHandler(methodKey,
150                     questionId);
151 
152             Object returnObj = null;
153 
154             try {
155                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
156             }
157             catch (Exception e) {
158                 if (e instanceof com.liferay.portal.PortalException) {
159                     throw (com.liferay.portal.PortalException)e;
160                 }
161 
162                 if (e instanceof com.liferay.portal.SystemException) {
163                     throw (com.liferay.portal.SystemException)e;
164                 }
165 
166                 throw new com.liferay.portal.SystemException(e);
167             }
168 
169             return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
170         }
171         catch (com.liferay.portal.SystemException se) {
172             _log.error(se, se);
173 
174             throw se;
175         }
176     }
177 
178     public static com.liferay.portlet.polls.model.PollsQuestion updateQuestion(
179         HttpPrincipal httpPrincipal, long questionId, java.lang.String title,
180         java.lang.String description, int expirationDateMonth,
181         int expirationDateDay, int expirationDateYear, int expirationDateHour,
182         int expirationDateMinute, boolean neverExpire,
183         java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
184         com.liferay.portal.service.ServiceContext serviceContext)
185         throws com.liferay.portal.PortalException,
186             com.liferay.portal.SystemException {
187         try {
188             MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class.getName(),
189                     "updateQuestion", _updateQuestionParameterTypes3);
190 
191             MethodHandler methodHandler = new MethodHandler(methodKey,
192                     questionId, title, description, expirationDateMonth,
193                     expirationDateDay, expirationDateYear, expirationDateHour,
194                     expirationDateMinute, neverExpire, choices, serviceContext);
195 
196             Object returnObj = null;
197 
198             try {
199                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
200             }
201             catch (Exception e) {
202                 if (e instanceof com.liferay.portal.PortalException) {
203                     throw (com.liferay.portal.PortalException)e;
204                 }
205 
206                 if (e instanceof com.liferay.portal.SystemException) {
207                     throw (com.liferay.portal.SystemException)e;
208                 }
209 
210                 throw new com.liferay.portal.SystemException(e);
211             }
212 
213             return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
214         }
215         catch (com.liferay.portal.SystemException se) {
216             _log.error(se, se);
217 
218             throw se;
219         }
220     }
221 
222     private static Log _log = LogFactoryUtil.getLog(PollsQuestionServiceHttp.class);
223     private static final Class<?>[] _addQuestionParameterTypes0 = new Class[] {
224             java.lang.String.class, java.lang.String.class, int.class, int.class,
225             int.class, int.class, int.class, boolean.class, java.util.List.class,
226             com.liferay.portal.service.ServiceContext.class
227         };
228     private static final Class<?>[] _deleteQuestionParameterTypes1 = new Class[] {
229             long.class
230         };
231     private static final Class<?>[] _getQuestionParameterTypes2 = new Class[] {
232             long.class
233         };
234     private static final Class<?>[] _updateQuestionParameterTypes3 = new Class[] {
235             long.class, java.lang.String.class, java.lang.String.class,
236             int.class, int.class, int.class, int.class, int.class, boolean.class,
237             java.util.List.class,
238             com.liferay.portal.service.ServiceContext.class
239         };
240 }