1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.LayoutSetServiceUtil;
23  
24  /**
25   * <a href="LayoutSetServiceHttp.java.html"><b><i>View Source</i></b></a>
26   *
27   * <p>
28   * ServiceBuilder generated this class. Modifications in this class will be
29   * overwritten the next time is generated.
30   * </p>
31   *
32   * <p>
33   * This class provides a HTTP utility for the
34   * {@link com.liferay.portal.service.LayoutSetServiceUtil} service utility. The
35   * static methods of this class calls the same methods of the service utility.
36   * However, the signatures are different because it requires an additional
37   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
38   * </p>
39   *
40   * <p>
41   * The benefits of using the HTTP utility is that it is fast and allows for
42   * tunneling without the cost of serializing to text. The drawback is that it
43   * only works with Java.
44   * </p>
45   *
46   * <p>
47   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
48   * configure security.
49   * </p>
50   *
51   * <p>
52   * The HTTP utility is only generated for remote services.
53   * </p>
54   *
55   * @author    Brian Wing Shun Chan
56   * @see       LayoutSetServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.LayoutSetServiceUtil
59   * @generated
60   */
61  public class LayoutSetServiceHttp {
62      public static void updateLogo(HttpPrincipal httpPrincipal, long groupId,
63          boolean privateLayout, boolean logo, java.io.File file)
64          throws com.liferay.portal.PortalException,
65              com.liferay.portal.SystemException {
66          try {
67              MethodKey methodKey = new MethodKey(LayoutSetServiceUtil.class.getName(),
68                      "updateLogo", _updateLogoParameterTypes0);
69  
70              MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
71                      privateLayout, logo, file);
72  
73              try {
74                  TunnelUtil.invoke(httpPrincipal, methodHandler);
75              }
76              catch (Exception e) {
77                  if (e instanceof com.liferay.portal.PortalException) {
78                      throw (com.liferay.portal.PortalException)e;
79                  }
80  
81                  if (e instanceof com.liferay.portal.SystemException) {
82                      throw (com.liferay.portal.SystemException)e;
83                  }
84  
85                  throw new com.liferay.portal.SystemException(e);
86              }
87          }
88          catch (com.liferay.portal.SystemException se) {
89              _log.error(se, se);
90  
91              throw se;
92          }
93      }
94  
95      public static com.liferay.portal.model.LayoutSet updateLookAndFeel(
96          HttpPrincipal httpPrincipal, long groupId, boolean privateLayout,
97          java.lang.String themeId, java.lang.String colorSchemeId,
98          java.lang.String css, boolean wapTheme)
99          throws com.liferay.portal.PortalException,
100             com.liferay.portal.SystemException {
101         try {
102             MethodKey methodKey = new MethodKey(LayoutSetServiceUtil.class.getName(),
103                     "updateLookAndFeel", _updateLookAndFeelParameterTypes1);
104 
105             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
106                     privateLayout, themeId, colorSchemeId, css, wapTheme);
107 
108             Object returnObj = null;
109 
110             try {
111                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
112             }
113             catch (Exception e) {
114                 if (e instanceof com.liferay.portal.PortalException) {
115                     throw (com.liferay.portal.PortalException)e;
116                 }
117 
118                 if (e instanceof com.liferay.portal.SystemException) {
119                     throw (com.liferay.portal.SystemException)e;
120                 }
121 
122                 throw new com.liferay.portal.SystemException(e);
123             }
124 
125             return (com.liferay.portal.model.LayoutSet)returnObj;
126         }
127         catch (com.liferay.portal.SystemException se) {
128             _log.error(se, se);
129 
130             throw se;
131         }
132     }
133 
134     public static com.liferay.portal.model.LayoutSet updateVirtualHost(
135         HttpPrincipal httpPrincipal, long groupId, boolean privateLayout,
136         java.lang.String virtualHost)
137         throws com.liferay.portal.PortalException,
138             com.liferay.portal.SystemException {
139         try {
140             MethodKey methodKey = new MethodKey(LayoutSetServiceUtil.class.getName(),
141                     "updateVirtualHost", _updateVirtualHostParameterTypes2);
142 
143             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
144                     privateLayout, virtualHost);
145 
146             Object returnObj = null;
147 
148             try {
149                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
150             }
151             catch (Exception e) {
152                 if (e instanceof com.liferay.portal.PortalException) {
153                     throw (com.liferay.portal.PortalException)e;
154                 }
155 
156                 if (e instanceof com.liferay.portal.SystemException) {
157                     throw (com.liferay.portal.SystemException)e;
158                 }
159 
160                 throw new com.liferay.portal.SystemException(e);
161             }
162 
163             return (com.liferay.portal.model.LayoutSet)returnObj;
164         }
165         catch (com.liferay.portal.SystemException se) {
166             _log.error(se, se);
167 
168             throw se;
169         }
170     }
171 
172     private static Log _log = LogFactoryUtil.getLog(LayoutSetServiceHttp.class);
173     private static final Class<?>[] _updateLogoParameterTypes0 = new Class[] {
174             long.class, boolean.class, boolean.class, java.io.File.class
175         };
176     private static final Class<?>[] _updateLookAndFeelParameterTypes1 = new Class[] {
177             long.class, boolean.class, java.lang.String.class,
178             java.lang.String.class, java.lang.String.class, boolean.class
179         };
180     private static final Class<?>[] _updateVirtualHostParameterTypes2 = new Class[] {
181             long.class, boolean.class, java.lang.String.class
182         };
183 }