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.dynamicdatamapping.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.dynamicdatamapping.service.DDMTemplateServiceUtil;
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.dynamicdatamapping.service.DDMTemplateServiceUtil} 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.dynamicdatamapping.model.DDMTemplateSoap}.
041     * If the method in the service utility returns a
042     * {@link com.liferay.portlet.dynamicdatamapping.model.DDMTemplate}, that is translated to a
043     * {@link com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap}. 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       DDMTemplateServiceHttp
067     * @see       com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap
068     * @see       com.liferay.portlet.dynamicdatamapping.service.DDMTemplateServiceUtil
069     * @generated
070     */
071    public class DDMTemplateServiceSoap {
072            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap addTemplate(
073                    long groupId, long structureId, java.lang.String[] nameMapLanguageIds,
074                    java.lang.String[] nameMapValues,
075                    java.lang.String[] descriptionMapLanguageIds,
076                    java.lang.String[] descriptionMapValues, java.lang.String type,
077                    java.lang.String mode, java.lang.String language,
078                    java.lang.String script,
079                    com.liferay.portal.service.ServiceContext serviceContext)
080                    throws RemoteException {
081                    try {
082                            Map<Locale, String> nameMap = LocalizationUtil.getLocalizationMap(nameMapLanguageIds,
083                                            nameMapValues);
084                            Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds,
085                                            descriptionMapValues);
086    
087                            com.liferay.portlet.dynamicdatamapping.model.DDMTemplate returnValue =
088                                    DDMTemplateServiceUtil.addTemplate(groupId, structureId,
089                                            nameMap, descriptionMap, type, mode, language, script,
090                                            serviceContext);
091    
092                            return com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap.toSoapModel(returnValue);
093                    }
094                    catch (Exception e) {
095                            _log.error(e, e);
096    
097                            throw new RemoteException(e.getMessage());
098                    }
099            }
100    
101            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap[] copyTemplates(
102                    long structureId, long newStructureId, java.lang.String type,
103                    com.liferay.portal.service.ServiceContext serviceContext)
104                    throws RemoteException {
105                    try {
106                            java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> returnValue =
107                                    DDMTemplateServiceUtil.copyTemplates(structureId,
108                                            newStructureId, type, serviceContext);
109    
110                            return com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap.toSoapModels(returnValue);
111                    }
112                    catch (Exception e) {
113                            _log.error(e, e);
114    
115                            throw new RemoteException(e.getMessage());
116                    }
117            }
118    
119            public static void deleteTemplate(long templateId)
120                    throws RemoteException {
121                    try {
122                            DDMTemplateServiceUtil.deleteTemplate(templateId);
123                    }
124                    catch (Exception e) {
125                            _log.error(e, e);
126    
127                            throw new RemoteException(e.getMessage());
128                    }
129            }
130    
131            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap getTemplate(
132                    long templateId) throws RemoteException {
133                    try {
134                            com.liferay.portlet.dynamicdatamapping.model.DDMTemplate returnValue =
135                                    DDMTemplateServiceUtil.getTemplate(templateId);
136    
137                            return com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap.toSoapModel(returnValue);
138                    }
139                    catch (Exception e) {
140                            _log.error(e, e);
141    
142                            throw new RemoteException(e.getMessage());
143                    }
144            }
145    
146            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap[] getTemplates(
147                    long structureId, java.lang.String type, java.lang.String mode)
148                    throws RemoteException {
149                    try {
150                            java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> returnValue =
151                                    DDMTemplateServiceUtil.getTemplates(structureId, type, mode);
152    
153                            return com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap.toSoapModels(returnValue);
154                    }
155                    catch (Exception e) {
156                            _log.error(e, e);
157    
158                            throw new RemoteException(e.getMessage());
159                    }
160            }
161    
162            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap[] search(
163                    long companyId, long groupId, long structureId,
164                    java.lang.String keywords, java.lang.String type,
165                    java.lang.String mode, int start, int end,
166                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
167                    throws RemoteException {
168                    try {
169                            java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> returnValue =
170                                    DDMTemplateServiceUtil.search(companyId, groupId, structureId,
171                                            keywords, type, mode, start, end, orderByComparator);
172    
173                            return com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap.toSoapModels(returnValue);
174                    }
175                    catch (Exception e) {
176                            _log.error(e, e);
177    
178                            throw new RemoteException(e.getMessage());
179                    }
180            }
181    
182            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap[] search(
183                    long companyId, long groupId, long structureId, java.lang.String name,
184                    java.lang.String description, java.lang.String type,
185                    java.lang.String mode, java.lang.String language, boolean andOperator,
186                    int start, int end,
187                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
188                    throws RemoteException {
189                    try {
190                            java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> returnValue =
191                                    DDMTemplateServiceUtil.search(companyId, groupId, structureId,
192                                            name, description, type, mode, language, andOperator,
193                                            start, end, orderByComparator);
194    
195                            return com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap.toSoapModels(returnValue);
196                    }
197                    catch (Exception e) {
198                            _log.error(e, e);
199    
200                            throw new RemoteException(e.getMessage());
201                    }
202            }
203    
204            public static int searchCount(long companyId, long groupId,
205                    long structureId, java.lang.String keywords, java.lang.String type,
206                    java.lang.String mode) throws RemoteException {
207                    try {
208                            int returnValue = DDMTemplateServiceUtil.searchCount(companyId,
209                                            groupId, structureId, keywords, type, mode);
210    
211                            return returnValue;
212                    }
213                    catch (Exception e) {
214                            _log.error(e, e);
215    
216                            throw new RemoteException(e.getMessage());
217                    }
218            }
219    
220            public static int searchCount(long companyId, long groupId,
221                    long structureId, java.lang.String name, java.lang.String description,
222                    java.lang.String type, java.lang.String mode,
223                    java.lang.String language, boolean andOperator)
224                    throws RemoteException {
225                    try {
226                            int returnValue = DDMTemplateServiceUtil.searchCount(companyId,
227                                            groupId, structureId, name, description, type, mode,
228                                            language, andOperator);
229    
230                            return returnValue;
231                    }
232                    catch (Exception e) {
233                            _log.error(e, e);
234    
235                            throw new RemoteException(e.getMessage());
236                    }
237            }
238    
239            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap updateTemplate(
240                    long templateId, java.lang.String[] nameMapLanguageIds,
241                    java.lang.String[] nameMapValues,
242                    java.lang.String[] descriptionMapLanguageIds,
243                    java.lang.String[] descriptionMapValues, java.lang.String type,
244                    java.lang.String mode, java.lang.String language,
245                    java.lang.String script,
246                    com.liferay.portal.service.ServiceContext serviceContext)
247                    throws RemoteException {
248                    try {
249                            Map<Locale, String> nameMap = LocalizationUtil.getLocalizationMap(nameMapLanguageIds,
250                                            nameMapValues);
251                            Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds,
252                                            descriptionMapValues);
253    
254                            com.liferay.portlet.dynamicdatamapping.model.DDMTemplate returnValue =
255                                    DDMTemplateServiceUtil.updateTemplate(templateId, nameMap,
256                                            descriptionMap, type, mode, language, script, serviceContext);
257    
258                            return com.liferay.portlet.dynamicdatamapping.model.DDMTemplateSoap.toSoapModel(returnValue);
259                    }
260                    catch (Exception e) {
261                            _log.error(e, e);
262    
263                            throw new RemoteException(e.getMessage());
264                    }
265            }
266    
267            private static Log _log = LogFactoryUtil.getLog(DDMTemplateServiceSoap.class);
268    }