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.LayoutBranchServiceUtil;
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 LayoutBranchServiceUtil} 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 LayoutBranchServiceSoap
051     * @see HttpPrincipal
052     * @see LayoutBranchServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class LayoutBranchServiceHttp {
057            public static com.liferay.portal.kernel.model.LayoutBranch addLayoutBranch(
058                    HttpPrincipal httpPrincipal, long layoutRevisionId,
059                    java.lang.String name, java.lang.String description, boolean master,
060                    com.liferay.portal.kernel.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException {
062                    try {
063                            MethodKey methodKey = new MethodKey(LayoutBranchServiceUtil.class,
064                                            "addLayoutBranch", _addLayoutBranchParameterTypes0);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey,
067                                            layoutRevisionId, name, description, master, serviceContext);
068    
069                            Object returnObj = null;
070    
071                            try {
072                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
073                            }
074                            catch (Exception e) {
075                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
076                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
077                                    }
078    
079                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
080                            }
081    
082                            return (com.liferay.portal.kernel.model.LayoutBranch)returnObj;
083                    }
084                    catch (com.liferay.portal.kernel.exception.SystemException se) {
085                            _log.error(se, se);
086    
087                            throw se;
088                    }
089            }
090    
091            public static void deleteLayoutBranch(HttpPrincipal httpPrincipal,
092                    long layoutBranchId)
093                    throws com.liferay.portal.kernel.exception.PortalException {
094                    try {
095                            MethodKey methodKey = new MethodKey(LayoutBranchServiceUtil.class,
096                                            "deleteLayoutBranch", _deleteLayoutBranchParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey,
099                                            layoutBranchId);
100    
101                            try {
102                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
103                            }
104                            catch (Exception e) {
105                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
106                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
107                                    }
108    
109                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
110                            }
111                    }
112                    catch (com.liferay.portal.kernel.exception.SystemException se) {
113                            _log.error(se, se);
114    
115                            throw se;
116                    }
117            }
118    
119            public static com.liferay.portal.kernel.model.LayoutBranch updateLayoutBranch(
120                    HttpPrincipal httpPrincipal, long layoutBranchId,
121                    java.lang.String name, java.lang.String description,
122                    com.liferay.portal.kernel.service.ServiceContext serviceContext)
123                    throws com.liferay.portal.kernel.exception.PortalException {
124                    try {
125                            MethodKey methodKey = new MethodKey(LayoutBranchServiceUtil.class,
126                                            "updateLayoutBranch", _updateLayoutBranchParameterTypes2);
127    
128                            MethodHandler methodHandler = new MethodHandler(methodKey,
129                                            layoutBranchId, name, description, serviceContext);
130    
131                            Object returnObj = null;
132    
133                            try {
134                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
135                            }
136                            catch (Exception e) {
137                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
138                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
139                                    }
140    
141                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
142                            }
143    
144                            return (com.liferay.portal.kernel.model.LayoutBranch)returnObj;
145                    }
146                    catch (com.liferay.portal.kernel.exception.SystemException se) {
147                            _log.error(se, se);
148    
149                            throw se;
150                    }
151            }
152    
153            private static Log _log = LogFactoryUtil.getLog(LayoutBranchServiceHttp.class);
154            private static final Class<?>[] _addLayoutBranchParameterTypes0 = new Class[] {
155                            long.class, java.lang.String.class, java.lang.String.class,
156                            boolean.class,
157                            com.liferay.portal.kernel.service.ServiceContext.class
158                    };
159            private static final Class<?>[] _deleteLayoutBranchParameterTypes1 = new Class[] {
160                            long.class
161                    };
162            private static final Class<?>[] _updateLayoutBranchParameterTypes2 = new Class[] {
163                            long.class, java.lang.String.class, java.lang.String.class,
164                            com.liferay.portal.kernel.service.ServiceContext.class
165                    };
166    }