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.util.MethodHandler;
022    import com.liferay.portal.kernel.util.MethodKey;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.LayoutBranchServiceUtil;
025    
026    /**
027     * Provides the HTTP utility for the
028     * {@link LayoutBranchServiceUtil} service utility. The
029     * static methods of this class calls the same methods of the service utility.
030     * However, the signatures are different because it requires an additional
031     * {@link HttpPrincipal} parameter.
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author Brian Wing Shun Chan
049     * @see LayoutBranchServiceSoap
050     * @see HttpPrincipal
051     * @see LayoutBranchServiceUtil
052     * @generated
053     */
054    @ProviderType
055    public class LayoutBranchServiceHttp {
056            public static com.liferay.portal.model.LayoutBranch addLayoutBranch(
057                    HttpPrincipal httpPrincipal, long layoutRevisionId,
058                    java.lang.String name, java.lang.String description, boolean master,
059                    com.liferay.portal.service.ServiceContext serviceContext)
060                    throws com.liferay.portal.kernel.exception.PortalException {
061                    try {
062                            MethodKey methodKey = new MethodKey(LayoutBranchServiceUtil.class,
063                                            "addLayoutBranch", _addLayoutBranchParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey,
066                                            layoutRevisionId, name, description, master, serviceContext);
067    
068                            Object returnObj = null;
069    
070                            try {
071                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
072                            }
073                            catch (Exception e) {
074                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
075                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080    
081                            return (com.liferay.portal.model.LayoutBranch)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 void deleteLayoutBranch(HttpPrincipal httpPrincipal,
091                    long layoutBranchId)
092                    throws com.liferay.portal.kernel.exception.PortalException {
093                    try {
094                            MethodKey methodKey = new MethodKey(LayoutBranchServiceUtil.class,
095                                            "deleteLayoutBranch", _deleteLayoutBranchParameterTypes1);
096    
097                            MethodHandler methodHandler = new MethodHandler(methodKey,
098                                            layoutBranchId);
099    
100                            try {
101                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
102                            }
103                            catch (Exception e) {
104                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
105                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
106                                    }
107    
108                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
109                            }
110                    }
111                    catch (com.liferay.portal.kernel.exception.SystemException se) {
112                            _log.error(se, se);
113    
114                            throw se;
115                    }
116            }
117    
118            public static com.liferay.portal.model.LayoutBranch updateLayoutBranch(
119                    HttpPrincipal httpPrincipal, long layoutBranchId,
120                    java.lang.String name, java.lang.String description,
121                    com.liferay.portal.service.ServiceContext serviceContext)
122                    throws com.liferay.portal.kernel.exception.PortalException {
123                    try {
124                            MethodKey methodKey = new MethodKey(LayoutBranchServiceUtil.class,
125                                            "updateLayoutBranch", _updateLayoutBranchParameterTypes2);
126    
127                            MethodHandler methodHandler = new MethodHandler(methodKey,
128                                            layoutBranchId, name, description, serviceContext);
129    
130                            Object returnObj = null;
131    
132                            try {
133                                    returnObj = 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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
141                            }
142    
143                            return (com.liferay.portal.model.LayoutBranch)returnObj;
144                    }
145                    catch (com.liferay.portal.kernel.exception.SystemException se) {
146                            _log.error(se, se);
147    
148                            throw se;
149                    }
150            }
151    
152            private static Log _log = LogFactoryUtil.getLog(LayoutBranchServiceHttp.class);
153            private static final Class<?>[] _addLayoutBranchParameterTypes0 = new Class[] {
154                            long.class, java.lang.String.class, java.lang.String.class,
155                            boolean.class, com.liferay.portal.service.ServiceContext.class
156                    };
157            private static final Class<?>[] _deleteLayoutBranchParameterTypes1 = new Class[] {
158                            long.class
159                    };
160            private static final Class<?>[] _updateLayoutBranchParameterTypes2 = new Class[] {
161                            long.class, java.lang.String.class, java.lang.String.class,
162                            com.liferay.portal.service.ServiceContext.class
163                    };
164    }