1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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.BooleanWrapper;
20  import com.liferay.portal.kernel.util.LongWrapper;
21  import com.liferay.portal.kernel.util.MethodWrapper;
22  import com.liferay.portal.kernel.util.NullWrapper;
23  import com.liferay.portal.security.auth.HttpPrincipal;
24  import com.liferay.portal.service.LayoutSetServiceUtil;
25  
26  /**
27   * <a href="LayoutSetServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portal.service.LayoutSetServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       LayoutSetServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portal.service.LayoutSetServiceUtil
61   * @generated
62   */
63  public class LayoutSetServiceHttp {
64      public static void updateLogo(HttpPrincipal httpPrincipal, long groupId,
65          boolean privateLayout, boolean logo, java.io.File file)
66          throws com.liferay.portal.kernel.exception.PortalException,
67              com.liferay.portal.kernel.exception.SystemException {
68          try {
69              Object paramObj0 = new LongWrapper(groupId);
70  
71              Object paramObj1 = new BooleanWrapper(privateLayout);
72  
73              Object paramObj2 = new BooleanWrapper(logo);
74  
75              Object paramObj3 = file;
76  
77              if (file == null) {
78                  paramObj3 = new NullWrapper("java.io.File");
79              }
80  
81              MethodWrapper methodWrapper = new MethodWrapper(LayoutSetServiceUtil.class.getName(),
82                      "updateLogo",
83                      new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
84  
85              try {
86                  TunnelUtil.invoke(httpPrincipal, methodWrapper);
87              }
88              catch (Exception e) {
89                  if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
90                      throw (com.liferay.portal.kernel.exception.PortalException)e;
91                  }
92  
93                  if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
94                      throw (com.liferay.portal.kernel.exception.SystemException)e;
95                  }
96  
97                  throw new com.liferay.portal.kernel.exception.SystemException(e);
98              }
99          }
100         catch (com.liferay.portal.kernel.exception.SystemException se) {
101             _log.error(se, se);
102 
103             throw se;
104         }
105     }
106 
107     public static com.liferay.portal.model.LayoutSet updateLookAndFeel(
108         HttpPrincipal httpPrincipal, long groupId, boolean privateLayout,
109         java.lang.String themeId, java.lang.String colorSchemeId,
110         java.lang.String css, boolean wapTheme)
111         throws com.liferay.portal.kernel.exception.PortalException,
112             com.liferay.portal.kernel.exception.SystemException {
113         try {
114             Object paramObj0 = new LongWrapper(groupId);
115 
116             Object paramObj1 = new BooleanWrapper(privateLayout);
117 
118             Object paramObj2 = themeId;
119 
120             if (themeId == null) {
121                 paramObj2 = new NullWrapper("java.lang.String");
122             }
123 
124             Object paramObj3 = colorSchemeId;
125 
126             if (colorSchemeId == null) {
127                 paramObj3 = new NullWrapper("java.lang.String");
128             }
129 
130             Object paramObj4 = css;
131 
132             if (css == null) {
133                 paramObj4 = new NullWrapper("java.lang.String");
134             }
135 
136             Object paramObj5 = new BooleanWrapper(wapTheme);
137 
138             MethodWrapper methodWrapper = new MethodWrapper(LayoutSetServiceUtil.class.getName(),
139                     "updateLookAndFeel",
140                     new Object[] {
141                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
142                         paramObj5
143                     });
144 
145             Object returnObj = null;
146 
147             try {
148                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
149             }
150             catch (Exception e) {
151                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
152                     throw (com.liferay.portal.kernel.exception.PortalException)e;
153                 }
154 
155                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
156                     throw (com.liferay.portal.kernel.exception.SystemException)e;
157                 }
158 
159                 throw new com.liferay.portal.kernel.exception.SystemException(e);
160             }
161 
162             return (com.liferay.portal.model.LayoutSet)returnObj;
163         }
164         catch (com.liferay.portal.kernel.exception.SystemException se) {
165             _log.error(se, se);
166 
167             throw se;
168         }
169     }
170 
171     public static com.liferay.portal.model.LayoutSet updateVirtualHost(
172         HttpPrincipal httpPrincipal, long groupId, boolean privateLayout,
173         java.lang.String virtualHost)
174         throws com.liferay.portal.kernel.exception.PortalException,
175             com.liferay.portal.kernel.exception.SystemException {
176         try {
177             Object paramObj0 = new LongWrapper(groupId);
178 
179             Object paramObj1 = new BooleanWrapper(privateLayout);
180 
181             Object paramObj2 = virtualHost;
182 
183             if (virtualHost == null) {
184                 paramObj2 = new NullWrapper("java.lang.String");
185             }
186 
187             MethodWrapper methodWrapper = new MethodWrapper(LayoutSetServiceUtil.class.getName(),
188                     "updateVirtualHost",
189                     new Object[] { paramObj0, paramObj1, paramObj2 });
190 
191             Object returnObj = null;
192 
193             try {
194                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
195             }
196             catch (Exception e) {
197                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
198                     throw (com.liferay.portal.kernel.exception.PortalException)e;
199                 }
200 
201                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
202                     throw (com.liferay.portal.kernel.exception.SystemException)e;
203                 }
204 
205                 throw new com.liferay.portal.kernel.exception.SystemException(e);
206             }
207 
208             return (com.liferay.portal.model.LayoutSet)returnObj;
209         }
210         catch (com.liferay.portal.kernel.exception.SystemException se) {
211             _log.error(se, se);
212 
213             throw se;
214         }
215     }
216 
217     private static Log _log = LogFactoryUtil.getLog(LayoutSetServiceHttp.class);
218 }