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.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.http.TunnelUtil;
023    
024    import com.liferay.portlet.polls.service.PollsQuestionServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.polls.service.PollsQuestionServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author    Brian Wing Shun Chan
051     * @see       PollsQuestionServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.polls.service.PollsQuestionServiceUtil
054     * @generated
055     */
056    public class PollsQuestionServiceHttp {
057            public static com.liferay.portlet.polls.model.PollsQuestion addQuestion(
058                    HttpPrincipal httpPrincipal,
059                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
060                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
061                    int expirationDateMonth, int expirationDateDay, int expirationDateYear,
062                    int expirationDateHour, int expirationDateMinute, boolean neverExpire,
063                    java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
064                    com.liferay.portal.service.ServiceContext serviceContext)
065                    throws com.liferay.portal.kernel.exception.PortalException,
066                            com.liferay.portal.kernel.exception.SystemException {
067                    try {
068                            MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class.getName(),
069                                            "addQuestion", java.util.Map.class, java.util.Map.class,
070                                            int.class, int.class, int.class, int.class, int.class,
071                                            boolean.class, java.util.List.class,
072                                            com.liferay.portal.service.ServiceContext.class);
073    
074                            MethodHandler methodHandler = new MethodHandler(methodKey,
075                                            titleMap, descriptionMap, expirationDateMonth,
076                                            expirationDateDay, expirationDateYear, expirationDateHour,
077                                            expirationDateMinute, neverExpire, choices, serviceContext);
078    
079                            Object returnObj = null;
080    
081                            try {
082                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
083                            }
084                            catch (Exception e) {
085                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
086                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
087                                    }
088    
089                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
090                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
091                                    }
092    
093                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
094                            }
095    
096                            return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
097                    }
098                    catch (com.liferay.portal.kernel.exception.SystemException se) {
099                            _log.error(se, se);
100    
101                            throw se;
102                    }
103            }
104    
105            public static void deleteQuestion(HttpPrincipal httpPrincipal,
106                    long questionId)
107                    throws com.liferay.portal.kernel.exception.PortalException,
108                            com.liferay.portal.kernel.exception.SystemException {
109                    try {
110                            MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class.getName(),
111                                            "deleteQuestion", long.class);
112    
113                            MethodHandler methodHandler = new MethodHandler(methodKey,
114                                            questionId);
115    
116                            try {
117                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
118                            }
119                            catch (Exception e) {
120                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
121                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
122                                    }
123    
124                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
125                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
126                                    }
127    
128                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
129                            }
130                    }
131                    catch (com.liferay.portal.kernel.exception.SystemException se) {
132                            _log.error(se, se);
133    
134                            throw se;
135                    }
136            }
137    
138            public static com.liferay.portlet.polls.model.PollsQuestion getQuestion(
139                    HttpPrincipal httpPrincipal, long questionId)
140                    throws com.liferay.portal.kernel.exception.PortalException,
141                            com.liferay.portal.kernel.exception.SystemException {
142                    try {
143                            MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class.getName(),
144                                            "getQuestion", long.class);
145    
146                            MethodHandler methodHandler = new MethodHandler(methodKey,
147                                            questionId);
148    
149                            Object returnObj = null;
150    
151                            try {
152                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
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                            return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
167                    }
168                    catch (com.liferay.portal.kernel.exception.SystemException se) {
169                            _log.error(se, se);
170    
171                            throw se;
172                    }
173            }
174    
175            public static com.liferay.portlet.polls.model.PollsQuestion updateQuestion(
176                    HttpPrincipal httpPrincipal, long questionId,
177                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
178                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
179                    int expirationDateMonth, int expirationDateDay, int expirationDateYear,
180                    int expirationDateHour, int expirationDateMinute, boolean neverExpire,
181                    java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
182                    com.liferay.portal.service.ServiceContext serviceContext)
183                    throws com.liferay.portal.kernel.exception.PortalException,
184                            com.liferay.portal.kernel.exception.SystemException {
185                    try {
186                            MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class.getName(),
187                                            "updateQuestion", long.class, java.util.Map.class,
188                                            java.util.Map.class, int.class, int.class, int.class,
189                                            int.class, int.class, boolean.class, java.util.List.class,
190                                            com.liferay.portal.service.ServiceContext.class);
191    
192                            MethodHandler methodHandler = new MethodHandler(methodKey,
193                                            questionId, titleMap, descriptionMap, expirationDateMonth,
194                                            expirationDateDay, expirationDateYear, expirationDateHour,
195                                            expirationDateMinute, neverExpire, choices, serviceContext);
196    
197                            Object returnObj = null;
198    
199                            try {
200                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
201                            }
202                            catch (Exception e) {
203                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
204                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
205                                    }
206    
207                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
208                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
209                                    }
210    
211                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
212                            }
213    
214                            return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
215                    }
216                    catch (com.liferay.portal.kernel.exception.SystemException se) {
217                            _log.error(se, se);
218    
219                            throw se;
220                    }
221            }
222    
223            private static Log _log = LogFactoryUtil.getLog(PollsQuestionServiceHttp.class);
224    }