001    /**
002     * Copyright (c) 2000-2010 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.IntegerWrapper;
020    import com.liferay.portal.kernel.util.LongWrapper;
021    import com.liferay.portal.kernel.util.MethodWrapper;
022    import com.liferay.portal.kernel.util.NullWrapper;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.ListTypeServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portal.service.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 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       ListTypeServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portal.service.ListTypeServiceUtil
054     * @generated
055     */
056    public class ListTypeServiceHttp {
057            public static com.liferay.portal.model.ListType getListType(
058                    HttpPrincipal httpPrincipal, int listTypeId)
059                    throws com.liferay.portal.kernel.exception.PortalException,
060                            com.liferay.portal.kernel.exception.SystemException {
061                    try {
062                            Object paramObj0 = new IntegerWrapper(listTypeId);
063    
064                            MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
065                                            "getListType", new Object[] { paramObj0 });
066    
067                            Object returnObj = null;
068    
069                            try {
070                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
078                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
079                                    }
080    
081                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
082                            }
083    
084                            return (com.liferay.portal.model.ListType)returnObj;
085                    }
086                    catch (com.liferay.portal.kernel.exception.SystemException se) {
087                            _log.error(se, se);
088    
089                            throw se;
090                    }
091            }
092    
093            public static java.util.List<com.liferay.portal.model.ListType> getListTypes(
094                    HttpPrincipal httpPrincipal, java.lang.String type)
095                    throws com.liferay.portal.kernel.exception.SystemException {
096                    try {
097                            Object paramObj0 = type;
098    
099                            if (type == null) {
100                                    paramObj0 = new NullWrapper("java.lang.String");
101                            }
102    
103                            MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
104                                            "getListTypes", new Object[] { paramObj0 });
105    
106                            Object returnObj = null;
107    
108                            try {
109                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
110                            }
111                            catch (Exception e) {
112                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
113                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
114                                    }
115    
116                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
117                            }
118    
119                            return (java.util.List<com.liferay.portal.model.ListType>)returnObj;
120                    }
121                    catch (com.liferay.portal.kernel.exception.SystemException se) {
122                            _log.error(se, se);
123    
124                            throw se;
125                    }
126            }
127    
128            public static void validate(HttpPrincipal httpPrincipal, int listTypeId,
129                    java.lang.String type)
130                    throws com.liferay.portal.kernel.exception.PortalException,
131                            com.liferay.portal.kernel.exception.SystemException {
132                    try {
133                            Object paramObj0 = new IntegerWrapper(listTypeId);
134    
135                            Object paramObj1 = type;
136    
137                            if (type == null) {
138                                    paramObj1 = new NullWrapper("java.lang.String");
139                            }
140    
141                            MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
142                                            "validate", new Object[] { paramObj0, paramObj1 });
143    
144                            try {
145                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
146                            }
147                            catch (Exception e) {
148                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
149                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
150                                    }
151    
152                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
153                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
154                                    }
155    
156                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
157                            }
158                    }
159                    catch (com.liferay.portal.kernel.exception.SystemException se) {
160                            _log.error(se, se);
161    
162                            throw se;
163                    }
164            }
165    
166            public static void validate(HttpPrincipal httpPrincipal, int listTypeId,
167                    long classNameId, java.lang.String type)
168                    throws com.liferay.portal.kernel.exception.PortalException,
169                            com.liferay.portal.kernel.exception.SystemException {
170                    try {
171                            Object paramObj0 = new IntegerWrapper(listTypeId);
172    
173                            Object paramObj1 = new LongWrapper(classNameId);
174    
175                            Object paramObj2 = type;
176    
177                            if (type == null) {
178                                    paramObj2 = new NullWrapper("java.lang.String");
179                            }
180    
181                            MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
182                                            "validate", new Object[] { paramObj0, paramObj1, paramObj2 });
183    
184                            try {
185                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
186                            }
187                            catch (Exception e) {
188                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
189                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
190                                    }
191    
192                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
193                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
194                                    }
195    
196                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
197                            }
198                    }
199                    catch (com.liferay.portal.kernel.exception.SystemException se) {
200                            _log.error(se, se);
201    
202                            throw se;
203                    }
204            }
205    
206            private static Log _log = LogFactoryUtil.getLog(ListTypeServiceHttp.class);
207    }