001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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 void deleteTemplate(HttpPrincipal httpPrincipal,
101                    long templateId)
102                    throws com.liferay.portal.kernel.exception.PortalException,
103                            com.liferay.portal.kernel.exception.SystemException {
104                    try {
105                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
106                                            "deleteTemplate", _deleteTemplateParameterTypes1);
107    
108                            MethodHandler methodHandler = new MethodHandler(methodKey,
109                                            templateId);
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.dynamicdatamapping.model.DDMTemplate getTemplate(
134                    HttpPrincipal httpPrincipal, long templateId)
135                    throws com.liferay.portal.kernel.exception.PortalException,
136                            com.liferay.portal.kernel.exception.SystemException {
137                    try {
138                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
139                                            "getTemplate", _getTemplateParameterTypes2);
140    
141                            MethodHandler methodHandler = new MethodHandler(methodKey,
142                                            templateId);
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.dynamicdatamapping.model.DDMTemplate)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 java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> getTemplates(
171                    HttpPrincipal httpPrincipal, long structureId, java.lang.String type,
172                    java.lang.String mode)
173                    throws com.liferay.portal.kernel.exception.SystemException {
174                    try {
175                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
176                                            "getTemplates", _getTemplatesParameterTypes3);
177    
178                            MethodHandler methodHandler = new MethodHandler(methodKey,
179                                            structureId, type, mode);
180    
181                            Object returnObj = null;
182    
183                            try {
184                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
185                            }
186                            catch (Exception e) {
187                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
188                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
189                                    }
190    
191                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
192                            }
193    
194                            return (java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate>)returnObj;
195                    }
196                    catch (com.liferay.portal.kernel.exception.SystemException se) {
197                            _log.error(se, se);
198    
199                            throw se;
200                    }
201            }
202    
203            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate updateTemplate(
204                    HttpPrincipal httpPrincipal, long templateId,
205                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
206                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
207                    java.lang.String type, java.lang.String mode,
208                    java.lang.String language, java.lang.String script,
209                    com.liferay.portal.service.ServiceContext serviceContext)
210                    throws com.liferay.portal.kernel.exception.PortalException,
211                            com.liferay.portal.kernel.exception.SystemException {
212                    try {
213                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
214                                            "updateTemplate", _updateTemplateParameterTypes4);
215    
216                            MethodHandler methodHandler = new MethodHandler(methodKey,
217                                            templateId, nameMap, descriptionMap, type, mode, language,
218                                            script, serviceContext);
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.PortalException) {
227                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
228                                    }
229    
230                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
231                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
232                                    }
233    
234                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
235                            }
236    
237                            return (com.liferay.portlet.dynamicdatamapping.model.DDMTemplate)returnObj;
238                    }
239                    catch (com.liferay.portal.kernel.exception.SystemException se) {
240                            _log.error(se, se);
241    
242                            throw se;
243                    }
244            }
245    
246            private static Log _log = LogFactoryUtil.getLog(DDMTemplateServiceHttp.class);
247            private static final Class<?>[] _addTemplateParameterTypes0 = new Class[] {
248                            long.class, long.class, java.util.Map.class, java.util.Map.class,
249                            java.lang.String.class, java.lang.String.class,
250                            java.lang.String.class, java.lang.String.class,
251                            com.liferay.portal.service.ServiceContext.class
252                    };
253            private static final Class<?>[] _deleteTemplateParameterTypes1 = new Class[] {
254                            long.class
255                    };
256            private static final Class<?>[] _getTemplateParameterTypes2 = new Class[] {
257                            long.class
258                    };
259            private static final Class<?>[] _getTemplatesParameterTypes3 = new Class[] {
260                            long.class, java.lang.String.class, java.lang.String.class
261                    };
262            private static final Class<?>[] _updateTemplateParameterTypes4 = new Class[] {
263                            long.class, java.util.Map.class, java.util.Map.class,
264                            java.lang.String.class, java.lang.String.class,
265                            java.lang.String.class, java.lang.String.class,
266                            com.liferay.portal.service.ServiceContext.class
267                    };
268    }