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.LocalizationUtil;
020    
021    import com.liferay.portlet.polls.service.PollsQuestionServiceUtil;
022    
023    import java.rmi.RemoteException;
024    
025    import java.util.Locale;
026    import java.util.Map;
027    
028    /**
029     * <p>
030     * This class provides a SOAP utility for the
031     * {@link com.liferay.portlet.polls.service.PollsQuestionServiceUtil} service utility. The
032     * static methods of this class calls the same methods of the service utility.
033     * However, the signatures are different because it is difficult for SOAP to
034     * support certain types.
035     * </p>
036     *
037     * <p>
038     * ServiceBuilder follows certain rules in translating the methods. For example,
039     * if the method in the service utility returns a {@link java.util.List}, that
040     * is translated to an array of {@link com.liferay.portlet.polls.model.PollsQuestionSoap}.
041     * If the method in the service utility returns a
042     * {@link com.liferay.portlet.polls.model.PollsQuestion}, that is translated to a
043     * {@link com.liferay.portlet.polls.model.PollsQuestionSoap}. Methods that SOAP cannot
044     * safely wire are skipped.
045     * </p>
046     *
047     * <p>
048     * The benefits of using the SOAP utility is that it is cross platform
049     * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and
050     * even Perl, to call the generated services. One drawback of SOAP is that it is
051     * slow because it needs to serialize all calls into a text format (XML).
052     * </p>
053     *
054     * <p>
055     * You can see a list of services at
056     * http://localhost:8080/api/secure/axis. Set the property
057     * <b>axis.servlet.hosts.allowed</b> in portal.properties to configure
058     * security.
059     * </p>
060     *
061     * <p>
062     * The SOAP utility is only generated for remote services.
063     * </p>
064     *
065     * @author    Brian Wing Shun Chan
066     * @see       PollsQuestionServiceHttp
067     * @see       com.liferay.portlet.polls.model.PollsQuestionSoap
068     * @see       com.liferay.portlet.polls.service.PollsQuestionServiceUtil
069     * @generated
070     */
071    public class PollsQuestionServiceSoap {
072            public static com.liferay.portlet.polls.model.PollsQuestionSoap addQuestion(
073                    java.lang.String[] titleMapLanguageIds,
074                    java.lang.String[] titleMapValues,
075                    java.lang.String[] descriptionMapLanguageIds,
076                    java.lang.String[] descriptionMapValues, int expirationDateMonth,
077                    int expirationDateDay, int expirationDateYear, int expirationDateHour,
078                    int expirationDateMinute, boolean neverExpire,
079                    com.liferay.portlet.polls.model.PollsChoiceSoap[] choices,
080                    com.liferay.portal.service.ServiceContext serviceContext)
081                    throws RemoteException {
082                    try {
083                            Map<Locale, String> titleMap = LocalizationUtil.getLocalizationMap(titleMapLanguageIds,
084                                            titleMapValues);
085                            Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds,
086                                            descriptionMapValues);
087    
088                            com.liferay.portlet.polls.model.PollsQuestion returnValue = PollsQuestionServiceUtil.addQuestion(titleMap,
089                                            descriptionMap, expirationDateMonth, expirationDateDay,
090                                            expirationDateYear, expirationDateHour,
091                                            expirationDateMinute, neverExpire,
092                                            com.liferay.portlet.polls.model.impl.PollsChoiceModelImpl.toModels(
093                                                    choices), serviceContext);
094    
095                            return com.liferay.portlet.polls.model.PollsQuestionSoap.toSoapModel(returnValue);
096                    }
097                    catch (Exception e) {
098                            _log.error(e, e);
099    
100                            throw new RemoteException(e.getMessage());
101                    }
102            }
103    
104            public static void deleteQuestion(long questionId)
105                    throws RemoteException {
106                    try {
107                            PollsQuestionServiceUtil.deleteQuestion(questionId);
108                    }
109                    catch (Exception e) {
110                            _log.error(e, e);
111    
112                            throw new RemoteException(e.getMessage());
113                    }
114            }
115    
116            public static com.liferay.portlet.polls.model.PollsQuestionSoap getQuestion(
117                    long questionId) throws RemoteException {
118                    try {
119                            com.liferay.portlet.polls.model.PollsQuestion returnValue = PollsQuestionServiceUtil.getQuestion(questionId);
120    
121                            return com.liferay.portlet.polls.model.PollsQuestionSoap.toSoapModel(returnValue);
122                    }
123                    catch (Exception e) {
124                            _log.error(e, e);
125    
126                            throw new RemoteException(e.getMessage());
127                    }
128            }
129    
130            public static com.liferay.portlet.polls.model.PollsQuestionSoap updateQuestion(
131                    long questionId, java.lang.String[] titleMapLanguageIds,
132                    java.lang.String[] titleMapValues,
133                    java.lang.String[] descriptionMapLanguageIds,
134                    java.lang.String[] descriptionMapValues, int expirationDateMonth,
135                    int expirationDateDay, int expirationDateYear, int expirationDateHour,
136                    int expirationDateMinute, boolean neverExpire,
137                    com.liferay.portlet.polls.model.PollsChoiceSoap[] choices,
138                    com.liferay.portal.service.ServiceContext serviceContext)
139                    throws RemoteException {
140                    try {
141                            Map<Locale, String> titleMap = LocalizationUtil.getLocalizationMap(titleMapLanguageIds,
142                                            titleMapValues);
143                            Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds,
144                                            descriptionMapValues);
145    
146                            com.liferay.portlet.polls.model.PollsQuestion returnValue = PollsQuestionServiceUtil.updateQuestion(questionId,
147                                            titleMap, descriptionMap, expirationDateMonth,
148                                            expirationDateDay, expirationDateYear, expirationDateHour,
149                                            expirationDateMinute, neverExpire,
150                                            com.liferay.portlet.polls.model.impl.PollsChoiceModelImpl.toModels(
151                                                    choices), serviceContext);
152    
153                            return com.liferay.portlet.polls.model.PollsQuestionSoap.toSoapModel(returnValue);
154                    }
155                    catch (Exception e) {
156                            _log.error(e, e);
157    
158                            throw new RemoteException(e.getMessage());
159                    }
160            }
161    
162            private static Log _log = LogFactoryUtil.getLog(PollsQuestionServiceSoap.class);
163    }