001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.polls.service.http;
022:
023: import com.liferay.portal.kernel.log.Log;
024: import com.liferay.portal.kernel.log.LogFactoryUtil;
025: import com.liferay.portal.kernel.util.BooleanWrapper;
026: import com.liferay.portal.kernel.util.IntegerWrapper;
027: import com.liferay.portal.kernel.util.LongWrapper;
028: import com.liferay.portal.kernel.util.MethodWrapper;
029: import com.liferay.portal.kernel.util.NullWrapper;
030: import com.liferay.portal.security.auth.HttpPrincipal;
031: import com.liferay.portal.service.http.TunnelUtil;
032:
033: import com.liferay.portlet.polls.service.PollsQuestionServiceUtil;
034:
035: /**
036: * <a href="PollsQuestionServiceHttp.java.html"><b><i>View Source</i></b></a>
037: *
038: * <p>
039: * ServiceBuilder generated this class. Modifications in this class will be
040: * overwritten the next time is generated.
041: * </p>
042: *
043: * <p>
044: * This class provides a HTTP utility for the
045: * <code>com.liferay.portlet.polls.service.PollsQuestionServiceUtil</code> service
046: * utility. The static methods of this class calls the same methods of the
047: * service utility. However, the signatures are different because it requires an
048: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
049: * parameter.
050: * </p>
051: *
052: * <p>
053: * The benefits of using the HTTP utility is that it is fast and allows for
054: * tunneling without the cost of serializing to text. The drawback is that it
055: * only works with Java.
056: * </p>
057: *
058: * <p>
059: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
060: * portal.properties to configure security.
061: * </p>
062: *
063: * <p>
064: * The HTTP utility is only generated for remote services.
065: * </p>
066: *
067: * @author Brian Wing Shun Chan
068: *
069: * @see com.liferay.portal.security.auth.HttpPrincipal
070: * @see com.liferay.portlet.polls.service.PollsQuestionServiceUtil
071: * @see com.liferay.portlet.polls.service.http.PollsQuestionServiceSoap
072: *
073: */
074: public class PollsQuestionServiceHttp {
075: public static com.liferay.portlet.polls.model.PollsQuestion addQuestion(
076: HttpPrincipal httpPrincipal, long plid,
077: java.lang.String title, java.lang.String description,
078: int expirationDateMonth, int expirationDateDay,
079: int expirationDateYear, int expirationDateHour,
080: int expirationDateMinute, boolean neverExpire,
081: java.util.List choices, boolean addCommunityPermissions,
082: boolean addGuestPermissions)
083: throws com.liferay.portal.SystemException,
084: com.liferay.portal.PortalException {
085: try {
086: Object paramObj0 = new LongWrapper(plid);
087:
088: Object paramObj1 = title;
089:
090: if (title == null) {
091: paramObj1 = new NullWrapper("java.lang.String");
092: }
093:
094: Object paramObj2 = description;
095:
096: if (description == null) {
097: paramObj2 = new NullWrapper("java.lang.String");
098: }
099:
100: Object paramObj3 = new IntegerWrapper(expirationDateMonth);
101:
102: Object paramObj4 = new IntegerWrapper(expirationDateDay);
103:
104: Object paramObj5 = new IntegerWrapper(expirationDateYear);
105:
106: Object paramObj6 = new IntegerWrapper(expirationDateHour);
107:
108: Object paramObj7 = new IntegerWrapper(expirationDateMinute);
109:
110: Object paramObj8 = new BooleanWrapper(neverExpire);
111:
112: Object paramObj9 = choices;
113:
114: if (choices == null) {
115: paramObj9 = new NullWrapper("java.util.List");
116: }
117:
118: Object paramObj10 = new BooleanWrapper(
119: addCommunityPermissions);
120:
121: Object paramObj11 = new BooleanWrapper(addGuestPermissions);
122:
123: MethodWrapper methodWrapper = new MethodWrapper(
124: PollsQuestionServiceUtil.class.getName(),
125: "addQuestion", new Object[] { paramObj0, paramObj1,
126: paramObj2, paramObj3, paramObj4, paramObj5,
127: paramObj6, paramObj7, paramObj8, paramObj9,
128: paramObj10, paramObj11 });
129:
130: Object returnObj = null;
131:
132: try {
133: returnObj = TunnelUtil.invoke(httpPrincipal,
134: methodWrapper);
135: } catch (Exception e) {
136: if (e instanceof com.liferay.portal.SystemException) {
137: throw (com.liferay.portal.SystemException) e;
138: }
139:
140: if (e instanceof com.liferay.portal.PortalException) {
141: throw (com.liferay.portal.PortalException) e;
142: }
143:
144: throw new com.liferay.portal.SystemException(e);
145: }
146:
147: return (com.liferay.portlet.polls.model.PollsQuestion) returnObj;
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,
157: java.lang.String title, java.lang.String description,
158: int expirationDateMonth, int expirationDateDay,
159: int expirationDateYear, int expirationDateHour,
160: int expirationDateMinute, boolean neverExpire,
161: java.util.List choices,
162: java.lang.String[] communityPermissions,
163: java.lang.String[] guestPermissions)
164: throws com.liferay.portal.SystemException,
165: com.liferay.portal.PortalException {
166: try {
167: Object paramObj0 = new LongWrapper(plid);
168:
169: Object paramObj1 = title;
170:
171: if (title == null) {
172: paramObj1 = new NullWrapper("java.lang.String");
173: }
174:
175: Object paramObj2 = description;
176:
177: if (description == null) {
178: paramObj2 = new NullWrapper("java.lang.String");
179: }
180:
181: Object paramObj3 = new IntegerWrapper(expirationDateMonth);
182:
183: Object paramObj4 = new IntegerWrapper(expirationDateDay);
184:
185: Object paramObj5 = new IntegerWrapper(expirationDateYear);
186:
187: Object paramObj6 = new IntegerWrapper(expirationDateHour);
188:
189: Object paramObj7 = new IntegerWrapper(expirationDateMinute);
190:
191: Object paramObj8 = new BooleanWrapper(neverExpire);
192:
193: Object paramObj9 = choices;
194:
195: if (choices == null) {
196: paramObj9 = new NullWrapper("java.util.List");
197: }
198:
199: Object paramObj10 = communityPermissions;
200:
201: if (communityPermissions == null) {
202: paramObj10 = new NullWrapper("[Ljava.lang.String;");
203: }
204:
205: Object paramObj11 = guestPermissions;
206:
207: if (guestPermissions == null) {
208: paramObj11 = new NullWrapper("[Ljava.lang.String;");
209: }
210:
211: MethodWrapper methodWrapper = new MethodWrapper(
212: PollsQuestionServiceUtil.class.getName(),
213: "addQuestion", new Object[] { paramObj0, paramObj1,
214: paramObj2, paramObj3, paramObj4, paramObj5,
215: paramObj6, paramObj7, paramObj8, paramObj9,
216: paramObj10, paramObj11 });
217:
218: Object returnObj = null;
219:
220: try {
221: returnObj = TunnelUtil.invoke(httpPrincipal,
222: methodWrapper);
223: } catch (Exception e) {
224: if (e instanceof com.liferay.portal.SystemException) {
225: throw (com.liferay.portal.SystemException) e;
226: }
227:
228: if (e instanceof com.liferay.portal.PortalException) {
229: throw (com.liferay.portal.PortalException) e;
230: }
231:
232: throw new com.liferay.portal.SystemException(e);
233: }
234:
235: return (com.liferay.portlet.polls.model.PollsQuestion) returnObj;
236: } catch (com.liferay.portal.SystemException se) {
237: _log.error(se, se);
238:
239: throw se;
240: }
241: }
242:
243: public static void deleteQuestion(HttpPrincipal httpPrincipal,
244: long questionId) throws com.liferay.portal.SystemException,
245: com.liferay.portal.PortalException {
246: try {
247: Object paramObj0 = new LongWrapper(questionId);
248:
249: MethodWrapper methodWrapper = new MethodWrapper(
250: PollsQuestionServiceUtil.class.getName(),
251: "deleteQuestion", new Object[] { paramObj0 });
252:
253: try {
254: TunnelUtil.invoke(httpPrincipal, methodWrapper);
255: } catch (Exception e) {
256: if (e instanceof com.liferay.portal.SystemException) {
257: throw (com.liferay.portal.SystemException) e;
258: }
259:
260: if (e instanceof com.liferay.portal.PortalException) {
261: throw (com.liferay.portal.PortalException) e;
262: }
263:
264: throw new com.liferay.portal.SystemException(e);
265: }
266: } catch (com.liferay.portal.SystemException se) {
267: _log.error(se, se);
268:
269: throw se;
270: }
271: }
272:
273: public static com.liferay.portlet.polls.model.PollsQuestion getQuestion(
274: HttpPrincipal httpPrincipal, long questionId)
275: throws com.liferay.portal.SystemException,
276: com.liferay.portal.PortalException {
277: try {
278: Object paramObj0 = new LongWrapper(questionId);
279:
280: MethodWrapper methodWrapper = new MethodWrapper(
281: PollsQuestionServiceUtil.class.getName(),
282: "getQuestion", new Object[] { paramObj0 });
283:
284: Object returnObj = null;
285:
286: try {
287: returnObj = TunnelUtil.invoke(httpPrincipal,
288: methodWrapper);
289: } catch (Exception e) {
290: if (e instanceof com.liferay.portal.SystemException) {
291: throw (com.liferay.portal.SystemException) e;
292: }
293:
294: if (e instanceof com.liferay.portal.PortalException) {
295: throw (com.liferay.portal.PortalException) e;
296: }
297:
298: throw new com.liferay.portal.SystemException(e);
299: }
300:
301: return (com.liferay.portlet.polls.model.PollsQuestion) returnObj;
302: } catch (com.liferay.portal.SystemException se) {
303: _log.error(se, se);
304:
305: throw se;
306: }
307: }
308:
309: public static com.liferay.portlet.polls.model.PollsQuestion updateQuestion(
310: HttpPrincipal httpPrincipal, long questionId,
311: java.lang.String title, java.lang.String description,
312: int expirationDateMonth, int expirationDateDay,
313: int expirationDateYear, int expirationDateHour,
314: int expirationDateMinute, boolean neverExpire,
315: java.util.List choices)
316: throws com.liferay.portal.SystemException,
317: com.liferay.portal.PortalException {
318: try {
319: Object paramObj0 = new LongWrapper(questionId);
320:
321: Object paramObj1 = title;
322:
323: if (title == null) {
324: paramObj1 = new NullWrapper("java.lang.String");
325: }
326:
327: Object paramObj2 = description;
328:
329: if (description == null) {
330: paramObj2 = new NullWrapper("java.lang.String");
331: }
332:
333: Object paramObj3 = new IntegerWrapper(expirationDateMonth);
334:
335: Object paramObj4 = new IntegerWrapper(expirationDateDay);
336:
337: Object paramObj5 = new IntegerWrapper(expirationDateYear);
338:
339: Object paramObj6 = new IntegerWrapper(expirationDateHour);
340:
341: Object paramObj7 = new IntegerWrapper(expirationDateMinute);
342:
343: Object paramObj8 = new BooleanWrapper(neverExpire);
344:
345: Object paramObj9 = choices;
346:
347: if (choices == null) {
348: paramObj9 = new NullWrapper("java.util.List");
349: }
350:
351: MethodWrapper methodWrapper = new MethodWrapper(
352: PollsQuestionServiceUtil.class.getName(),
353: "updateQuestion", new Object[] { paramObj0,
354: paramObj1, paramObj2, paramObj3, paramObj4,
355: paramObj5, paramObj6, paramObj7, paramObj8,
356: paramObj9 });
357:
358: Object returnObj = null;
359:
360: try {
361: returnObj = TunnelUtil.invoke(httpPrincipal,
362: methodWrapper);
363: } catch (Exception e) {
364: if (e instanceof com.liferay.portal.SystemException) {
365: throw (com.liferay.portal.SystemException) e;
366: }
367:
368: if (e instanceof com.liferay.portal.PortalException) {
369: throw (com.liferay.portal.PortalException) e;
370: }
371:
372: throw new com.liferay.portal.SystemException(e);
373: }
374:
375: return (com.liferay.portlet.polls.model.PollsQuestion) returnObj;
376: } catch (com.liferay.portal.SystemException se) {
377: _log.error(se, se);
378:
379: throw se;
380: }
381: }
382:
383: private static Log _log = LogFactoryUtil
384: .getLog(PollsQuestionServiceHttp.class);
385: }
|