001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.polls.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.BooleanWrapper;
020    import com.liferay.portal.kernel.util.IntegerWrapper;
021    import com.liferay.portal.kernel.util.LongWrapper;
022    import com.liferay.portal.kernel.util.MethodWrapper;
023    import com.liferay.portal.kernel.util.NullWrapper;
024    import com.liferay.portal.security.auth.HttpPrincipal;
025    import com.liferay.portal.service.http.TunnelUtil;
026    
027    import com.liferay.portlet.polls.service.PollsQuestionServiceUtil;
028    
029    /**
030     * <p>
031     * This class provides a HTTP utility for the
032     * {@link com.liferay.portlet.polls.service.PollsQuestionServiceUtil} service utility. The
033     * static methods of this class calls the same methods of the service utility.
034     * However, the signatures are different because it requires an additional
035     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
036     * </p>
037     *
038     * <p>
039     * The benefits of using the HTTP utility is that it is fast and allows for
040     * tunneling without the cost of serializing to text. The drawback is that it
041     * only works with Java.
042     * </p>
043     *
044     * <p>
045     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
046     * configure security.
047     * </p>
048     *
049     * <p>
050     * The HTTP utility is only generated for remote services.
051     * </p>
052     *
053     * @author    Brian Wing Shun Chan
054     * @see       PollsQuestionServiceSoap
055     * @see       com.liferay.portal.security.auth.HttpPrincipal
056     * @see       com.liferay.portlet.polls.service.PollsQuestionServiceUtil
057     * @generated
058     */
059    public class PollsQuestionServiceHttp {
060            public static com.liferay.portlet.polls.model.PollsQuestion addQuestion(
061                    HttpPrincipal httpPrincipal,
062                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
063                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
064                    int expirationDateMonth, int expirationDateDay, int expirationDateYear,
065                    int expirationDateHour, int expirationDateMinute, boolean neverExpire,
066                    java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
067                    com.liferay.portal.service.ServiceContext serviceContext)
068                    throws com.liferay.portal.kernel.exception.PortalException,
069                            com.liferay.portal.kernel.exception.SystemException {
070                    try {
071                            Object paramObj0 = titleMap;
072    
073                            if (titleMap == null) {
074                                    paramObj0 = new NullWrapper("java.util.Map");
075                            }
076    
077                            Object paramObj1 = descriptionMap;
078    
079                            if (descriptionMap == null) {
080                                    paramObj1 = new NullWrapper("java.util.Map");
081                            }
082    
083                            Object paramObj2 = new IntegerWrapper(expirationDateMonth);
084    
085                            Object paramObj3 = new IntegerWrapper(expirationDateDay);
086    
087                            Object paramObj4 = new IntegerWrapper(expirationDateYear);
088    
089                            Object paramObj5 = new IntegerWrapper(expirationDateHour);
090    
091                            Object paramObj6 = new IntegerWrapper(expirationDateMinute);
092    
093                            Object paramObj7 = new BooleanWrapper(neverExpire);
094    
095                            Object paramObj8 = choices;
096    
097                            if (choices == null) {
098                                    paramObj8 = new NullWrapper("java.util.List");
099                            }
100    
101                            Object paramObj9 = serviceContext;
102    
103                            if (serviceContext == null) {
104                                    paramObj9 = new NullWrapper(
105                                                    "com.liferay.portal.service.ServiceContext");
106                            }
107    
108                            MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
109                                            "addQuestion",
110                                            new Object[] {
111                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
112                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9
113                                            });
114    
115                            Object returnObj = null;
116    
117                            try {
118                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
119                            }
120                            catch (Exception e) {
121                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
122                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
123                                    }
124    
125                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
126                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
127                                    }
128    
129                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
130                            }
131    
132                            return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
133                    }
134                    catch (com.liferay.portal.kernel.exception.SystemException se) {
135                            _log.error(se, se);
136    
137                            throw se;
138                    }
139            }
140    
141            public static void deleteQuestion(HttpPrincipal httpPrincipal,
142                    long questionId)
143                    throws com.liferay.portal.kernel.exception.PortalException,
144                            com.liferay.portal.kernel.exception.SystemException {
145                    try {
146                            Object paramObj0 = new LongWrapper(questionId);
147    
148                            MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
149                                            "deleteQuestion", new Object[] { paramObj0 });
150    
151                            try {
152                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
153                            }
154                            catch (Exception e) {
155                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
156                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
157                                    }
158    
159                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
160                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
161                                    }
162    
163                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
164                            }
165                    }
166                    catch (com.liferay.portal.kernel.exception.SystemException se) {
167                            _log.error(se, se);
168    
169                            throw se;
170                    }
171            }
172    
173            public static com.liferay.portlet.polls.model.PollsQuestion getQuestion(
174                    HttpPrincipal httpPrincipal, long questionId)
175                    throws com.liferay.portal.kernel.exception.PortalException,
176                            com.liferay.portal.kernel.exception.SystemException {
177                    try {
178                            Object paramObj0 = new LongWrapper(questionId);
179    
180                            MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
181                                            "getQuestion", new Object[] { paramObj0 });
182    
183                            Object returnObj = null;
184    
185                            try {
186                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
187                            }
188                            catch (Exception e) {
189                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
190                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
191                                    }
192    
193                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
194                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
195                                    }
196    
197                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
198                            }
199    
200                            return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
201                    }
202                    catch (com.liferay.portal.kernel.exception.SystemException se) {
203                            _log.error(se, se);
204    
205                            throw se;
206                    }
207            }
208    
209            public static com.liferay.portlet.polls.model.PollsQuestion updateQuestion(
210                    HttpPrincipal httpPrincipal, long questionId,
211                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
212                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
213                    int expirationDateMonth, int expirationDateDay, int expirationDateYear,
214                    int expirationDateHour, int expirationDateMinute, boolean neverExpire,
215                    java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
216                    com.liferay.portal.service.ServiceContext serviceContext)
217                    throws com.liferay.portal.kernel.exception.PortalException,
218                            com.liferay.portal.kernel.exception.SystemException {
219                    try {
220                            Object paramObj0 = new LongWrapper(questionId);
221    
222                            Object paramObj1 = titleMap;
223    
224                            if (titleMap == null) {
225                                    paramObj1 = new NullWrapper("java.util.Map");
226                            }
227    
228                            Object paramObj2 = descriptionMap;
229    
230                            if (descriptionMap == null) {
231                                    paramObj2 = new NullWrapper("java.util.Map");
232                            }
233    
234                            Object paramObj3 = new IntegerWrapper(expirationDateMonth);
235    
236                            Object paramObj4 = new IntegerWrapper(expirationDateDay);
237    
238                            Object paramObj5 = new IntegerWrapper(expirationDateYear);
239    
240                            Object paramObj6 = new IntegerWrapper(expirationDateHour);
241    
242                            Object paramObj7 = new IntegerWrapper(expirationDateMinute);
243    
244                            Object paramObj8 = new BooleanWrapper(neverExpire);
245    
246                            Object paramObj9 = choices;
247    
248                            if (choices == null) {
249                                    paramObj9 = new NullWrapper("java.util.List");
250                            }
251    
252                            Object paramObj10 = serviceContext;
253    
254                            if (serviceContext == null) {
255                                    paramObj10 = new NullWrapper(
256                                                    "com.liferay.portal.service.ServiceContext");
257                            }
258    
259                            MethodWrapper methodWrapper = new MethodWrapper(PollsQuestionServiceUtil.class.getName(),
260                                            "updateQuestion",
261                                            new Object[] {
262                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
263                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
264                                                    paramObj10
265                                            });
266    
267                            Object returnObj = null;
268    
269                            try {
270                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
271                            }
272                            catch (Exception e) {
273                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
274                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
275                                    }
276    
277                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
278                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
279                                    }
280    
281                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
282                            }
283    
284                            return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
285                    }
286                    catch (com.liferay.portal.kernel.exception.SystemException se) {
287                            _log.error(se, se);
288    
289                            throw se;
290                    }
291            }
292    
293            private static Log _log = LogFactoryUtil.getLog(PollsQuestionServiceHttp.class);
294    }