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.BooleanWrapper;
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.LayoutPrototypeServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portal.service.LayoutPrototypeServiceUtil} 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       LayoutPrototypeServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portal.service.LayoutPrototypeServiceUtil
054     * @generated
055     */
056    public class LayoutPrototypeServiceHttp {
057            public static com.liferay.portal.model.LayoutPrototype addLayoutPrototype(
058                    HttpPrincipal httpPrincipal,
059                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
060                    java.lang.String description, boolean active)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            Object paramObj0 = nameMap;
065    
066                            if (nameMap == null) {
067                                    paramObj0 = new NullWrapper("java.util.Map");
068                            }
069    
070                            Object paramObj1 = description;
071    
072                            if (description == null) {
073                                    paramObj1 = new NullWrapper("java.lang.String");
074                            }
075    
076                            Object paramObj2 = new BooleanWrapper(active);
077    
078                            MethodWrapper methodWrapper = new MethodWrapper(LayoutPrototypeServiceUtil.class.getName(),
079                                            "addLayoutPrototype",
080                                            new Object[] { paramObj0, paramObj1, paramObj2 });
081    
082                            Object returnObj = null;
083    
084                            try {
085                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
086                            }
087                            catch (Exception e) {
088                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
089                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
090                                    }
091    
092                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
093                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
094                                    }
095    
096                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
097                            }
098    
099                            return (com.liferay.portal.model.LayoutPrototype)returnObj;
100                    }
101                    catch (com.liferay.portal.kernel.exception.SystemException se) {
102                            _log.error(se, se);
103    
104                            throw se;
105                    }
106            }
107    
108            public static void deleteLayoutPrototype(HttpPrincipal httpPrincipal,
109                    long layoutPrototypeId)
110                    throws com.liferay.portal.kernel.exception.PortalException,
111                            com.liferay.portal.kernel.exception.SystemException {
112                    try {
113                            Object paramObj0 = new LongWrapper(layoutPrototypeId);
114    
115                            MethodWrapper methodWrapper = new MethodWrapper(LayoutPrototypeServiceUtil.class.getName(),
116                                            "deleteLayoutPrototype", new Object[] { paramObj0 });
117    
118                            try {
119                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
120                            }
121                            catch (Exception e) {
122                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
123                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
124                                    }
125    
126                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
127                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
128                                    }
129    
130                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
131                            }
132                    }
133                    catch (com.liferay.portal.kernel.exception.SystemException se) {
134                            _log.error(se, se);
135    
136                            throw se;
137                    }
138            }
139    
140            public static com.liferay.portal.model.LayoutPrototype getLayoutPrototype(
141                    HttpPrincipal httpPrincipal, long layoutPrototypeId)
142                    throws com.liferay.portal.kernel.exception.PortalException,
143                            com.liferay.portal.kernel.exception.SystemException {
144                    try {
145                            Object paramObj0 = new LongWrapper(layoutPrototypeId);
146    
147                            MethodWrapper methodWrapper = new MethodWrapper(LayoutPrototypeServiceUtil.class.getName(),
148                                            "getLayoutPrototype", new Object[] { paramObj0 });
149    
150                            Object returnObj = null;
151    
152                            try {
153                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
154                            }
155                            catch (Exception e) {
156                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
157                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
158                                    }
159    
160                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
161                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
162                                    }
163    
164                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
165                            }
166    
167                            return (com.liferay.portal.model.LayoutPrototype)returnObj;
168                    }
169                    catch (com.liferay.portal.kernel.exception.SystemException se) {
170                            _log.error(se, se);
171    
172                            throw se;
173                    }
174            }
175    
176            public static java.util.List<com.liferay.portal.model.LayoutPrototype> search(
177                    HttpPrincipal httpPrincipal, long companyId, java.lang.Boolean active,
178                    com.liferay.portal.kernel.util.OrderByComparator obc)
179                    throws com.liferay.portal.kernel.exception.PortalException,
180                            com.liferay.portal.kernel.exception.SystemException {
181                    try {
182                            Object paramObj0 = new LongWrapper(companyId);
183    
184                            Object paramObj1 = active;
185    
186                            if (active == null) {
187                                    paramObj1 = new NullWrapper("java.lang.Boolean");
188                            }
189    
190                            Object paramObj2 = obc;
191    
192                            if (obc == null) {
193                                    paramObj2 = new NullWrapper(
194                                                    "com.liferay.portal.kernel.util.OrderByComparator");
195                            }
196    
197                            MethodWrapper methodWrapper = new MethodWrapper(LayoutPrototypeServiceUtil.class.getName(),
198                                            "search", new Object[] { paramObj0, paramObj1, paramObj2 });
199    
200                            Object returnObj = null;
201    
202                            try {
203                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
204                            }
205                            catch (Exception e) {
206                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
207                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
208                                    }
209    
210                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
211                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
212                                    }
213    
214                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
215                            }
216    
217                            return (java.util.List<com.liferay.portal.model.LayoutPrototype>)returnObj;
218                    }
219                    catch (com.liferay.portal.kernel.exception.SystemException se) {
220                            _log.error(se, se);
221    
222                            throw se;
223                    }
224            }
225    
226            public static com.liferay.portal.model.LayoutPrototype updateLayoutPrototype(
227                    HttpPrincipal httpPrincipal, long layoutPrototypeId,
228                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
229                    java.lang.String description, boolean active)
230                    throws com.liferay.portal.kernel.exception.PortalException,
231                            com.liferay.portal.kernel.exception.SystemException {
232                    try {
233                            Object paramObj0 = new LongWrapper(layoutPrototypeId);
234    
235                            Object paramObj1 = nameMap;
236    
237                            if (nameMap == null) {
238                                    paramObj1 = new NullWrapper("java.util.Map");
239                            }
240    
241                            Object paramObj2 = description;
242    
243                            if (description == null) {
244                                    paramObj2 = new NullWrapper("java.lang.String");
245                            }
246    
247                            Object paramObj3 = new BooleanWrapper(active);
248    
249                            MethodWrapper methodWrapper = new MethodWrapper(LayoutPrototypeServiceUtil.class.getName(),
250                                            "updateLayoutPrototype",
251                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
252    
253                            Object returnObj = null;
254    
255                            try {
256                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
257                            }
258                            catch (Exception e) {
259                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
260                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
261                                    }
262    
263                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
264                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
265                                    }
266    
267                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
268                            }
269    
270                            return (com.liferay.portal.model.LayoutPrototype)returnObj;
271                    }
272                    catch (com.liferay.portal.kernel.exception.SystemException se) {
273                            _log.error(se, se);
274    
275                            throw se;
276                    }
277            }
278    
279            private static Log _log = LogFactoryUtil.getLog(LayoutPrototypeServiceHttp.class);
280    }