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