001    /**
002     * Copyright (c) 2000-present 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.portal.service.http;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.security.auth.HttpPrincipal;
022    import com.liferay.portal.kernel.service.ListTypeServiceUtil;
023    import com.liferay.portal.kernel.service.http.TunnelUtil;
024    import com.liferay.portal.kernel.util.MethodHandler;
025    import com.liferay.portal.kernel.util.MethodKey;
026    
027    /**
028     * Provides the HTTP utility for the
029     * {@link ListTypeServiceUtil} 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 HttpPrincipal} parameter.
033     *
034     * <p>
035     * The benefits of using the HTTP utility is that it is fast and allows for
036     * tunneling without the cost of serializing to text. The drawback is that it
037     * only works with Java.
038     * </p>
039     *
040     * <p>
041     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
042     * configure security.
043     * </p>
044     *
045     * <p>
046     * The HTTP utility is only generated for remote services.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see ListTypeServiceSoap
051     * @see HttpPrincipal
052     * @see ListTypeServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class ListTypeServiceHttp {
057            public static com.liferay.portal.kernel.model.ListType getListType(
058                    HttpPrincipal httpPrincipal, long listTypeId)
059                    throws com.liferay.portal.kernel.exception.PortalException {
060                    try {
061                            MethodKey methodKey = new MethodKey(ListTypeServiceUtil.class,
062                                            "getListType", _getListTypeParameterTypes0);
063    
064                            MethodHandler methodHandler = new MethodHandler(methodKey,
065                                            listTypeId);
066    
067                            Object returnObj = null;
068    
069                            try {
070                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
071                            }
072                            catch (Exception e) {
073                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
074                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
075                                    }
076    
077                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
078                            }
079    
080                            return (com.liferay.portal.kernel.model.ListType)returnObj;
081                    }
082                    catch (com.liferay.portal.kernel.exception.SystemException se) {
083                            _log.error(se, se);
084    
085                            throw se;
086                    }
087            }
088    
089            public static java.util.List<com.liferay.portal.kernel.model.ListType> getListTypes(
090                    HttpPrincipal httpPrincipal, java.lang.String type) {
091                    try {
092                            MethodKey methodKey = new MethodKey(ListTypeServiceUtil.class,
093                                            "getListTypes", _getListTypesParameterTypes1);
094    
095                            MethodHandler methodHandler = new MethodHandler(methodKey, type);
096    
097                            Object returnObj = null;
098    
099                            try {
100                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
101                            }
102                            catch (Exception e) {
103                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
104                            }
105    
106                            return (java.util.List<com.liferay.portal.kernel.model.ListType>)returnObj;
107                    }
108                    catch (com.liferay.portal.kernel.exception.SystemException se) {
109                            _log.error(se, se);
110    
111                            throw se;
112                    }
113            }
114    
115            public static void validate(HttpPrincipal httpPrincipal, long listTypeId,
116                    long classNameId, java.lang.String type)
117                    throws com.liferay.portal.kernel.exception.PortalException {
118                    try {
119                            MethodKey methodKey = new MethodKey(ListTypeServiceUtil.class,
120                                            "validate", _validateParameterTypes2);
121    
122                            MethodHandler methodHandler = new MethodHandler(methodKey,
123                                            listTypeId, classNameId, type);
124    
125                            try {
126                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
127                            }
128                            catch (Exception e) {
129                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
130                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
131                                    }
132    
133                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
134                            }
135                    }
136                    catch (com.liferay.portal.kernel.exception.SystemException se) {
137                            _log.error(se, se);
138    
139                            throw se;
140                    }
141            }
142    
143            public static void validate(HttpPrincipal httpPrincipal, long listTypeId,
144                    java.lang.String type)
145                    throws com.liferay.portal.kernel.exception.PortalException {
146                    try {
147                            MethodKey methodKey = new MethodKey(ListTypeServiceUtil.class,
148                                            "validate", _validateParameterTypes3);
149    
150                            MethodHandler methodHandler = new MethodHandler(methodKey,
151                                            listTypeId, type);
152    
153                            try {
154                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
155                            }
156                            catch (Exception e) {
157                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
158                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
159                                    }
160    
161                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
162                            }
163                    }
164                    catch (com.liferay.portal.kernel.exception.SystemException se) {
165                            _log.error(se, se);
166    
167                            throw se;
168                    }
169            }
170    
171            private static Log _log = LogFactoryUtil.getLog(ListTypeServiceHttp.class);
172            private static final Class<?>[] _getListTypeParameterTypes0 = new Class[] {
173                            long.class
174                    };
175            private static final Class<?>[] _getListTypesParameterTypes1 = new Class[] {
176                            java.lang.String.class
177                    };
178            private static final Class<?>[] _validateParameterTypes2 = new Class[] {
179                            long.class, long.class, java.lang.String.class
180                    };
181            private static final Class<?>[] _validateParameterTypes3 = new Class[] {
182                            long.class, java.lang.String.class
183                    };
184    }