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