1
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
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, java.util.List choices,
80 boolean addCommunityPermissions, boolean addGuestPermissions)
81 throws com.liferay.portal.SystemException,
82 com.liferay.portal.PortalException {
83 try {
84 Object paramObj0 = new LongWrapper(plid);
85 Object paramObj1 = title;
86
87 if (title == null) {
88 paramObj1 = new NullWrapper("java.lang.String");
89 }
90
91 Object paramObj2 = description;
92
93 if (description == null) {
94 paramObj2 = new NullWrapper("java.lang.String");
95 }
96
97 Object paramObj3 = new IntegerWrapper(expirationDateMonth);
98 Object paramObj4 = new IntegerWrapper(expirationDateDay);
99 Object paramObj5 = new IntegerWrapper(expirationDateYear);
100 Object paramObj6 = new IntegerWrapper(expirationDateHour);
101 Object paramObj7 = new IntegerWrapper(expirationDateMinute);
102 Object paramObj8 = new BooleanWrapper(neverExpire);
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 Object paramObj11 = new BooleanWrapper(addGuestPermissions);
111 MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
112 "addQuestion",
113 new Object[] {
114 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
115 paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
116 paramObj10, paramObj11
117 });
118 Object returnObj = null;
119
120 try {
121 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
122 }
123 catch (Exception e) {
124 if (e instanceof com.liferay.portal.SystemException) {
125 throw (com.liferay.portal.SystemException)e;
126 }
127
128 if (e instanceof com.liferay.portal.PortalException) {
129 throw (com.liferay.portal.PortalException)e;
130 }
131
132 throw new com.liferay.portal.SystemException(e);
133 }
134
135 return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
136 }
137 catch (com.liferay.portal.SystemException se) {
138 _log.error(se, se);
139 throw se;
140 }
141 }
142
143 public static com.liferay.portlet.polls.model.PollsQuestion addQuestion(
144 HttpPrincipal httpPrincipal, long plid, java.lang.String title,
145 java.lang.String description, int expirationDateMonth,
146 int expirationDateDay, int expirationDateYear, int expirationDateHour,
147 int expirationDateMinute, boolean neverExpire, java.util.List choices,
148 java.lang.String[] communityPermissions,
149 java.lang.String[] guestPermissions)
150 throws com.liferay.portal.SystemException,
151 com.liferay.portal.PortalException {
152 try {
153 Object paramObj0 = new LongWrapper(plid);
154 Object paramObj1 = title;
155
156 if (title == null) {
157 paramObj1 = new NullWrapper("java.lang.String");
158 }
159
160 Object paramObj2 = description;
161
162 if (description == null) {
163 paramObj2 = new NullWrapper("java.lang.String");
164 }
165
166 Object paramObj3 = new IntegerWrapper(expirationDateMonth);
167 Object paramObj4 = new IntegerWrapper(expirationDateDay);
168 Object paramObj5 = new IntegerWrapper(expirationDateYear);
169 Object paramObj6 = new IntegerWrapper(expirationDateHour);
170 Object paramObj7 = new IntegerWrapper(expirationDateMinute);
171 Object paramObj8 = new BooleanWrapper(neverExpire);
172 Object paramObj9 = choices;
173
174 if (choices == null) {
175 paramObj9 = new NullWrapper("java.util.List");
176 }
177
178 Object paramObj10 = communityPermissions;
179
180 if (communityPermissions == null) {
181 paramObj10 = new NullWrapper("[Ljava.lang.String;");
182 }
183
184 Object paramObj11 = guestPermissions;
185
186 if (guestPermissions == null) {
187 paramObj11 = new NullWrapper("[Ljava.lang.String;");
188 }
189
190 MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
191 "addQuestion",
192 new Object[] {
193 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
194 paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
195 paramObj10, paramObj11
196 });
197 Object returnObj = null;
198
199 try {
200 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
201 }
202 catch (Exception e) {
203 if (e instanceof com.liferay.portal.SystemException) {
204 throw (com.liferay.portal.SystemException)e;
205 }
206
207 if (e instanceof com.liferay.portal.PortalException) {
208 throw (com.liferay.portal.PortalException)e;
209 }
210
211 throw new com.liferay.portal.SystemException(e);
212 }
213
214 return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
215 }
216 catch (com.liferay.portal.SystemException se) {
217 _log.error(se, se);
218 throw se;
219 }
220 }
221
222 public static void deleteQuestion(HttpPrincipal httpPrincipal,
223 long questionId)
224 throws com.liferay.portal.SystemException,
225 com.liferay.portal.PortalException {
226 try {
227 Object paramObj0 = new LongWrapper(questionId);
228 MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
229 "deleteQuestion", new Object[] { paramObj0 });
230
231 try {
232 TunnelUtil.invoke(httpPrincipal, methodWrapper);
233 }
234 catch (Exception e) {
235 if (e instanceof com.liferay.portal.SystemException) {
236 throw (com.liferay.portal.SystemException)e;
237 }
238
239 if (e instanceof com.liferay.portal.PortalException) {
240 throw (com.liferay.portal.PortalException)e;
241 }
242
243 throw new com.liferay.portal.SystemException(e);
244 }
245 }
246 catch (com.liferay.portal.SystemException se) {
247 _log.error(se, se);
248 throw se;
249 }
250 }
251
252 public static com.liferay.portlet.polls.model.PollsQuestion getQuestion(
253 HttpPrincipal httpPrincipal, long questionId)
254 throws com.liferay.portal.SystemException,
255 com.liferay.portal.PortalException {
256 try {
257 Object paramObj0 = new LongWrapper(questionId);
258 MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
259 "getQuestion", new Object[] { paramObj0 });
260 Object returnObj = null;
261
262 try {
263 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
264 }
265 catch (Exception e) {
266 if (e instanceof com.liferay.portal.SystemException) {
267 throw (com.liferay.portal.SystemException)e;
268 }
269
270 if (e instanceof com.liferay.portal.PortalException) {
271 throw (com.liferay.portal.PortalException)e;
272 }
273
274 throw new com.liferay.portal.SystemException(e);
275 }
276
277 return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
278 }
279 catch (com.liferay.portal.SystemException se) {
280 _log.error(se, se);
281 throw se;
282 }
283 }
284
285 public static com.liferay.portlet.polls.model.PollsQuestion updateQuestion(
286 HttpPrincipal httpPrincipal, long questionId, java.lang.String title,
287 java.lang.String description, int expirationDateMonth,
288 int expirationDateDay, int expirationDateYear, int expirationDateHour,
289 int expirationDateMinute, boolean neverExpire, java.util.List choices)
290 throws com.liferay.portal.SystemException,
291 com.liferay.portal.PortalException {
292 try {
293 Object paramObj0 = new LongWrapper(questionId);
294 Object paramObj1 = title;
295
296 if (title == null) {
297 paramObj1 = new NullWrapper("java.lang.String");
298 }
299
300 Object paramObj2 = description;
301
302 if (description == null) {
303 paramObj2 = new NullWrapper("java.lang.String");
304 }
305
306 Object paramObj3 = new IntegerWrapper(expirationDateMonth);
307 Object paramObj4 = new IntegerWrapper(expirationDateDay);
308 Object paramObj5 = new IntegerWrapper(expirationDateYear);
309 Object paramObj6 = new IntegerWrapper(expirationDateHour);
310 Object paramObj7 = new IntegerWrapper(expirationDateMinute);
311 Object paramObj8 = new BooleanWrapper(neverExpire);
312 Object paramObj9 = choices;
313
314 if (choices == null) {
315 paramObj9 = new NullWrapper("java.util.List");
316 }
317
318 MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
319 "updateQuestion",
320 new Object[] {
321 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
322 paramObj5, paramObj6, paramObj7, paramObj8, paramObj9
323 });
324 Object returnObj = null;
325
326 try {
327 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
328 }
329 catch (Exception e) {
330 if (e instanceof com.liferay.portal.SystemException) {
331 throw (com.liferay.portal.SystemException)e;
332 }
333
334 if (e instanceof com.liferay.portal.PortalException) {
335 throw (com.liferay.portal.PortalException)e;
336 }
337
338 throw new com.liferay.portal.SystemException(e);
339 }
340
341 return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
342 }
343 catch (com.liferay.portal.SystemException se) {
344 _log.error(se, se);
345 throw se;
346 }
347 }
348
349 private static Log _log = LogFactoryUtil.getLog(PollsQuestionServiceHttp.class);
350 }