001    /**
002     * Copyright (c) 2000-2012 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.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.dynamicdatamapping.service.DDMTemplateServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.dynamicdatamapping.service.DDMTemplateServiceUtil} 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       DDMTemplateServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.dynamicdatamapping.service.DDMTemplateServiceUtil
054     * @generated
055     */
056    public class DDMTemplateServiceHttp {
057            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate addTemplate(
058                    HttpPrincipal httpPrincipal, long groupId, long structureId,
059                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
060                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
061                    java.lang.String type, java.lang.String mode,
062                    java.lang.String language, java.lang.String script,
063                    com.liferay.portal.service.ServiceContext serviceContext)
064                    throws com.liferay.portal.kernel.exception.PortalException,
065                            com.liferay.portal.kernel.exception.SystemException {
066                    try {
067                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
068                                            "addTemplate", _addTemplateParameterTypes0);
069    
070                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
071                                            structureId, nameMap, descriptionMap, type, mode, language,
072                                            script, 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.dynamicdatamapping.model.DDMTemplate)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 java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> copyTemplates(
101                    HttpPrincipal httpPrincipal, long structureId, long newStructureId,
102                    java.lang.String type,
103                    com.liferay.portal.service.ServiceContext serviceContext)
104                    throws com.liferay.portal.kernel.exception.PortalException,
105                            com.liferay.portal.kernel.exception.SystemException {
106                    try {
107                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
108                                            "copyTemplates", _copyTemplatesParameterTypes1);
109    
110                            MethodHandler methodHandler = new MethodHandler(methodKey,
111                                            structureId, newStructureId, type, serviceContext);
112    
113                            Object returnObj = null;
114    
115                            try {
116                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
117                            }
118                            catch (Exception e) {
119                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
120                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
121                                    }
122    
123                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
124                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
125                                    }
126    
127                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
128                            }
129    
130                            return (java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate>)returnObj;
131                    }
132                    catch (com.liferay.portal.kernel.exception.SystemException se) {
133                            _log.error(se, se);
134    
135                            throw se;
136                    }
137            }
138    
139            public static void deleteTemplate(HttpPrincipal httpPrincipal,
140                    long templateId)
141                    throws com.liferay.portal.kernel.exception.PortalException,
142                            com.liferay.portal.kernel.exception.SystemException {
143                    try {
144                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
145                                            "deleteTemplate", _deleteTemplateParameterTypes2);
146    
147                            MethodHandler methodHandler = new MethodHandler(methodKey,
148                                            templateId);
149    
150                            try {
151                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
152                            }
153                            catch (Exception e) {
154                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
155                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
156                                    }
157    
158                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
159                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
160                                    }
161    
162                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
163                            }
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.dynamicdatamapping.model.DDMTemplate getTemplate(
173                    HttpPrincipal httpPrincipal, long templateId)
174                    throws com.liferay.portal.kernel.exception.PortalException,
175                            com.liferay.portal.kernel.exception.SystemException {
176                    try {
177                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
178                                            "getTemplate", _getTemplateParameterTypes3);
179    
180                            MethodHandler methodHandler = new MethodHandler(methodKey,
181                                            templateId);
182    
183                            Object returnObj = null;
184    
185                            try {
186                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
187                            }
188                            catch (Exception e) {
189                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
190                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
191                                    }
192    
193                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
194                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
195                                    }
196    
197                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
198                            }
199    
200                            return (com.liferay.portlet.dynamicdatamapping.model.DDMTemplate)returnObj;
201                    }
202                    catch (com.liferay.portal.kernel.exception.SystemException se) {
203                            _log.error(se, se);
204    
205                            throw se;
206                    }
207            }
208    
209            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> getTemplates(
210                    HttpPrincipal httpPrincipal, long structureId, java.lang.String type,
211                    java.lang.String mode)
212                    throws com.liferay.portal.kernel.exception.SystemException {
213                    try {
214                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
215                                            "getTemplates", _getTemplatesParameterTypes4);
216    
217                            MethodHandler methodHandler = new MethodHandler(methodKey,
218                                            structureId, type, mode);
219    
220                            Object returnObj = null;
221    
222                            try {
223                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
224                            }
225                            catch (Exception e) {
226                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
227                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
228                                    }
229    
230                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
231                            }
232    
233                            return (java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate>)returnObj;
234                    }
235                    catch (com.liferay.portal.kernel.exception.SystemException se) {
236                            _log.error(se, se);
237    
238                            throw se;
239                    }
240            }
241    
242            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate updateTemplate(
243                    HttpPrincipal httpPrincipal, long templateId,
244                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
245                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
246                    java.lang.String type, java.lang.String mode,
247                    java.lang.String language, java.lang.String script,
248                    com.liferay.portal.service.ServiceContext serviceContext)
249                    throws com.liferay.portal.kernel.exception.PortalException,
250                            com.liferay.portal.kernel.exception.SystemException {
251                    try {
252                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
253                                            "updateTemplate", _updateTemplateParameterTypes5);
254    
255                            MethodHandler methodHandler = new MethodHandler(methodKey,
256                                            templateId, nameMap, descriptionMap, type, mode, language,
257                                            script, serviceContext);
258    
259                            Object returnObj = null;
260    
261                            try {
262                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
263                            }
264                            catch (Exception e) {
265                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
266                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
267                                    }
268    
269                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
270                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
271                                    }
272    
273                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
274                            }
275    
276                            return (com.liferay.portlet.dynamicdatamapping.model.DDMTemplate)returnObj;
277                    }
278                    catch (com.liferay.portal.kernel.exception.SystemException se) {
279                            _log.error(se, se);
280    
281                            throw se;
282                    }
283            }
284    
285            private static Log _log = LogFactoryUtil.getLog(DDMTemplateServiceHttp.class);
286            private static final Class<?>[] _addTemplateParameterTypes0 = new Class[] {
287                            long.class, long.class, java.util.Map.class, java.util.Map.class,
288                            java.lang.String.class, java.lang.String.class,
289                            java.lang.String.class, java.lang.String.class,
290                            com.liferay.portal.service.ServiceContext.class
291                    };
292            private static final Class<?>[] _copyTemplatesParameterTypes1 = new Class[] {
293                            long.class, long.class, java.lang.String.class,
294                            com.liferay.portal.service.ServiceContext.class
295                    };
296            private static final Class<?>[] _deleteTemplateParameterTypes2 = new Class[] {
297                            long.class
298                    };
299            private static final Class<?>[] _getTemplateParameterTypes3 = new Class[] {
300                            long.class
301                    };
302            private static final Class<?>[] _getTemplatesParameterTypes4 = new Class[] {
303                            long.class, java.lang.String.class, java.lang.String.class
304                    };
305            private static final Class<?>[] _updateTemplateParameterTypes5 = new Class[] {
306                            long.class, java.util.Map.class, java.util.Map.class,
307                            java.lang.String.class, java.lang.String.class,
308                            java.lang.String.class, java.lang.String.class,
309                            com.liferay.portal.service.ServiceContext.class
310                    };
311    }