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.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 java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> search(
243                    HttpPrincipal httpPrincipal, long companyId, long groupId,
244                    long structureId, java.lang.String keywords, java.lang.String type,
245                    java.lang.String mode, int start, int end,
246                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
247                    throws com.liferay.portal.kernel.exception.SystemException {
248                    try {
249                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
250                                            "search", _searchParameterTypes5);
251    
252                            MethodHandler methodHandler = new MethodHandler(methodKey,
253                                            companyId, groupId, structureId, keywords, type, mode,
254                                            start, end, orderByComparator);
255    
256                            Object returnObj = null;
257    
258                            try {
259                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
260                            }
261                            catch (Exception e) {
262                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
263                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
264                                    }
265    
266                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
267                            }
268    
269                            return (java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate>)returnObj;
270                    }
271                    catch (com.liferay.portal.kernel.exception.SystemException se) {
272                            _log.error(se, se);
273    
274                            throw se;
275                    }
276            }
277    
278            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> search(
279                    HttpPrincipal httpPrincipal, long companyId, long groupId,
280                    long structureId, java.lang.String name, java.lang.String description,
281                    java.lang.String type, java.lang.String mode,
282                    java.lang.String language, boolean andOperator, int start, int end,
283                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
284                    throws com.liferay.portal.kernel.exception.SystemException {
285                    try {
286                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
287                                            "search", _searchParameterTypes6);
288    
289                            MethodHandler methodHandler = new MethodHandler(methodKey,
290                                            companyId, groupId, structureId, name, description, type,
291                                            mode, language, andOperator, start, end, orderByComparator);
292    
293                            Object returnObj = null;
294    
295                            try {
296                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
297                            }
298                            catch (Exception e) {
299                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
300                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
301                                    }
302    
303                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
304                            }
305    
306                            return (java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate>)returnObj;
307                    }
308                    catch (com.liferay.portal.kernel.exception.SystemException se) {
309                            _log.error(se, se);
310    
311                            throw se;
312                    }
313            }
314    
315            public static int searchCount(HttpPrincipal httpPrincipal, long companyId,
316                    long groupId, long structureId, java.lang.String keywords,
317                    java.lang.String type, java.lang.String mode)
318                    throws com.liferay.portal.kernel.exception.SystemException {
319                    try {
320                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
321                                            "searchCount", _searchCountParameterTypes7);
322    
323                            MethodHandler methodHandler = new MethodHandler(methodKey,
324                                            companyId, groupId, structureId, keywords, type, mode);
325    
326                            Object returnObj = null;
327    
328                            try {
329                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
330                            }
331                            catch (Exception e) {
332                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
333                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
334                                    }
335    
336                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
337                            }
338    
339                            return ((Integer)returnObj).intValue();
340                    }
341                    catch (com.liferay.portal.kernel.exception.SystemException se) {
342                            _log.error(se, se);
343    
344                            throw se;
345                    }
346            }
347    
348            public static int searchCount(HttpPrincipal httpPrincipal, long companyId,
349                    long groupId, long structureId, java.lang.String name,
350                    java.lang.String description, java.lang.String type,
351                    java.lang.String mode, java.lang.String language, boolean andOperator)
352                    throws com.liferay.portal.kernel.exception.SystemException {
353                    try {
354                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
355                                            "searchCount", _searchCountParameterTypes8);
356    
357                            MethodHandler methodHandler = new MethodHandler(methodKey,
358                                            companyId, groupId, structureId, name, description, type,
359                                            mode, language, andOperator);
360    
361                            Object returnObj = null;
362    
363                            try {
364                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
365                            }
366                            catch (Exception e) {
367                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
368                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
369                                    }
370    
371                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
372                            }
373    
374                            return ((Integer)returnObj).intValue();
375                    }
376                    catch (com.liferay.portal.kernel.exception.SystemException se) {
377                            _log.error(se, se);
378    
379                            throw se;
380                    }
381            }
382    
383            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate updateTemplate(
384                    HttpPrincipal httpPrincipal, long templateId,
385                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
386                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
387                    java.lang.String type, java.lang.String mode,
388                    java.lang.String language, java.lang.String script,
389                    com.liferay.portal.service.ServiceContext serviceContext)
390                    throws com.liferay.portal.kernel.exception.PortalException,
391                            com.liferay.portal.kernel.exception.SystemException {
392                    try {
393                            MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
394                                            "updateTemplate", _updateTemplateParameterTypes9);
395    
396                            MethodHandler methodHandler = new MethodHandler(methodKey,
397                                            templateId, nameMap, descriptionMap, type, mode, language,
398                                            script, serviceContext);
399    
400                            Object returnObj = null;
401    
402                            try {
403                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
404                            }
405                            catch (Exception e) {
406                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
407                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
408                                    }
409    
410                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
411                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
412                                    }
413    
414                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
415                            }
416    
417                            return (com.liferay.portlet.dynamicdatamapping.model.DDMTemplate)returnObj;
418                    }
419                    catch (com.liferay.portal.kernel.exception.SystemException se) {
420                            _log.error(se, se);
421    
422                            throw se;
423                    }
424            }
425    
426            private static Log _log = LogFactoryUtil.getLog(DDMTemplateServiceHttp.class);
427            private static final Class<?>[] _addTemplateParameterTypes0 = new Class[] {
428                            long.class, long.class, java.util.Map.class, java.util.Map.class,
429                            java.lang.String.class, java.lang.String.class,
430                            java.lang.String.class, java.lang.String.class,
431                            com.liferay.portal.service.ServiceContext.class
432                    };
433            private static final Class<?>[] _copyTemplatesParameterTypes1 = new Class[] {
434                            long.class, long.class, java.lang.String.class,
435                            com.liferay.portal.service.ServiceContext.class
436                    };
437            private static final Class<?>[] _deleteTemplateParameterTypes2 = new Class[] {
438                            long.class
439                    };
440            private static final Class<?>[] _getTemplateParameterTypes3 = new Class[] {
441                            long.class
442                    };
443            private static final Class<?>[] _getTemplatesParameterTypes4 = new Class[] {
444                            long.class, java.lang.String.class, java.lang.String.class
445                    };
446            private static final Class<?>[] _searchParameterTypes5 = new Class[] {
447                            long.class, long.class, long.class, java.lang.String.class,
448                            java.lang.String.class, java.lang.String.class, int.class, int.class,
449                            com.liferay.portal.kernel.util.OrderByComparator.class
450                    };
451            private static final Class<?>[] _searchParameterTypes6 = new Class[] {
452                            long.class, long.class, long.class, java.lang.String.class,
453                            java.lang.String.class, java.lang.String.class,
454                            java.lang.String.class, java.lang.String.class, boolean.class,
455                            int.class, int.class,
456                            com.liferay.portal.kernel.util.OrderByComparator.class
457                    };
458            private static final Class<?>[] _searchCountParameterTypes7 = new Class[] {
459                            long.class, long.class, long.class, java.lang.String.class,
460                            java.lang.String.class, java.lang.String.class
461                    };
462            private static final Class<?>[] _searchCountParameterTypes8 = new Class[] {
463                            long.class, long.class, long.class, java.lang.String.class,
464                            java.lang.String.class, java.lang.String.class,
465                            java.lang.String.class, java.lang.String.class, boolean.class
466                    };
467            private static final Class<?>[] _updateTemplateParameterTypes9 = new Class[] {
468                            long.class, java.util.Map.class, java.util.Map.class,
469                            java.lang.String.class, java.lang.String.class,
470                            java.lang.String.class, java.lang.String.class,
471                            com.liferay.portal.service.ServiceContext.class
472                    };
473    }