001    /**
002     * Copyright (c) 2000-2013 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", _addQuestionParameterTypes0);
070    
071                            MethodHandler methodHandler = new MethodHandler(methodKey,
072                                            titleMap, descriptionMap, expirationDateMonth,
073                                            expirationDateDay, expirationDateYear, expirationDateHour,
074                                            expirationDateMinute, neverExpire, choices, serviceContext);
075    
076                            Object returnObj = null;
077    
078                            try {
079                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
080                            }
081                            catch (Exception e) {
082                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
083                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
084                                    }
085    
086                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
087                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
088                                    }
089    
090                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
091                            }
092    
093                            return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
094                    }
095                    catch (com.liferay.portal.kernel.exception.SystemException se) {
096                            _log.error(se, se);
097    
098                            throw se;
099                    }
100            }
101    
102            public static void deleteQuestion(HttpPrincipal httpPrincipal,
103                    long questionId)
104                    throws com.liferay.portal.kernel.exception.PortalException,
105                            com.liferay.portal.kernel.exception.SystemException {
106                    try {
107                            MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class.getName(),
108                                            "deleteQuestion", _deleteQuestionParameterTypes1);
109    
110                            MethodHandler methodHandler = new MethodHandler(methodKey,
111                                            questionId);
112    
113                            try {
114                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
115                            }
116                            catch (Exception e) {
117                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
118                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
119                                    }
120    
121                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
122                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
123                                    }
124    
125                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
126                            }
127                    }
128                    catch (com.liferay.portal.kernel.exception.SystemException se) {
129                            _log.error(se, se);
130    
131                            throw se;
132                    }
133            }
134    
135            public static com.liferay.portlet.polls.model.PollsQuestion getQuestion(
136                    HttpPrincipal httpPrincipal, long questionId)
137                    throws com.liferay.portal.kernel.exception.PortalException,
138                            com.liferay.portal.kernel.exception.SystemException {
139                    try {
140                            MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class.getName(),
141                                            "getQuestion", _getQuestionParameterTypes2);
142    
143                            MethodHandler methodHandler = new MethodHandler(methodKey,
144                                            questionId);
145    
146                            Object returnObj = null;
147    
148                            try {
149                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
150                            }
151                            catch (Exception e) {
152                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
153                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
154                                    }
155    
156                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
157                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
158                                    }
159    
160                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
161                            }
162    
163                            return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
164                    }
165                    catch (com.liferay.portal.kernel.exception.SystemException se) {
166                            _log.error(se, se);
167    
168                            throw se;
169                    }
170            }
171    
172            public static com.liferay.portlet.polls.model.PollsQuestion updateQuestion(
173                    HttpPrincipal httpPrincipal, long questionId,
174                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
175                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
176                    int expirationDateMonth, int expirationDateDay, int expirationDateYear,
177                    int expirationDateHour, int expirationDateMinute, boolean neverExpire,
178                    java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
179                    com.liferay.portal.service.ServiceContext serviceContext)
180                    throws com.liferay.portal.kernel.exception.PortalException,
181                            com.liferay.portal.kernel.exception.SystemException {
182                    try {
183                            MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class.getName(),
184                                            "updateQuestion", _updateQuestionParameterTypes3);
185    
186                            MethodHandler methodHandler = new MethodHandler(methodKey,
187                                            questionId, titleMap, descriptionMap, expirationDateMonth,
188                                            expirationDateDay, expirationDateYear, expirationDateHour,
189                                            expirationDateMinute, neverExpire, choices, serviceContext);
190    
191                            Object returnObj = null;
192    
193                            try {
194                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
195                            }
196                            catch (Exception e) {
197                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
198                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
199                                    }
200    
201                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
202                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
203                                    }
204    
205                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
206                            }
207    
208                            return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
209                    }
210                    catch (com.liferay.portal.kernel.exception.SystemException se) {
211                            _log.error(se, se);
212    
213                            throw se;
214                    }
215            }
216    
217            private static Log _log = LogFactoryUtil.getLog(PollsQuestionServiceHttp.class);
218            private static final Class<?>[] _addQuestionParameterTypes0 = new Class[] {
219                            java.util.Map.class, java.util.Map.class, int.class, int.class,
220                            int.class, int.class, int.class, boolean.class, java.util.List.class,
221                            com.liferay.portal.service.ServiceContext.class
222                    };
223            private static final Class<?>[] _deleteQuestionParameterTypes1 = new Class[] {
224                            long.class
225                    };
226            private static final Class<?>[] _getQuestionParameterTypes2 = new Class[] {
227                            long.class
228                    };
229            private static final Class<?>[] _updateQuestionParameterTypes3 = new Class[] {
230                            long.class, java.util.Map.class, java.util.Map.class, int.class,
231                            int.class, int.class, int.class, int.class, boolean.class,
232                            java.util.List.class,
233                            com.liferay.portal.service.ServiceContext.class
234                    };
235    }