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.WebsiteServiceUtil;
23  
24  /**
25   * <a href="WebsiteServiceHttp.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.WebsiteServiceUtil} 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       WebsiteServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.WebsiteServiceUtil
59   * @generated
60   */
61  public class WebsiteServiceHttp {
62      public static com.liferay.portal.model.Website addWebsite(
63          HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
64          java.lang.String url, int typeId, boolean primary)
65          throws com.liferay.portal.PortalException,
66              com.liferay.portal.SystemException {
67          try {
68              MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class.getName(),
69                      "addWebsite", _addWebsiteParameterTypes0);
70  
71              MethodHandler methodHandler = new MethodHandler(methodKey,
72                      className, classPK, url, typeId, primary);
73  
74              Object returnObj = null;
75  
76              try {
77                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
78              }
79              catch (Exception e) {
80                  if (e instanceof com.liferay.portal.PortalException) {
81                      throw (com.liferay.portal.PortalException)e;
82                  }
83  
84                  if (e instanceof com.liferay.portal.SystemException) {
85                      throw (com.liferay.portal.SystemException)e;
86                  }
87  
88                  throw new com.liferay.portal.SystemException(e);
89              }
90  
91              return (com.liferay.portal.model.Website)returnObj;
92          }
93          catch (com.liferay.portal.SystemException se) {
94              _log.error(se, se);
95  
96              throw se;
97          }
98      }
99  
100     public static void deleteWebsite(HttpPrincipal httpPrincipal, long websiteId)
101         throws com.liferay.portal.PortalException,
102             com.liferay.portal.SystemException {
103         try {
104             MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class.getName(),
105                     "deleteWebsite", _deleteWebsiteParameterTypes1);
106 
107             MethodHandler methodHandler = new MethodHandler(methodKey, websiteId);
108 
109             try {
110                 TunnelUtil.invoke(httpPrincipal, methodHandler);
111             }
112             catch (Exception e) {
113                 if (e instanceof com.liferay.portal.PortalException) {
114                     throw (com.liferay.portal.PortalException)e;
115                 }
116 
117                 if (e instanceof com.liferay.portal.SystemException) {
118                     throw (com.liferay.portal.SystemException)e;
119                 }
120 
121                 throw new com.liferay.portal.SystemException(e);
122             }
123         }
124         catch (com.liferay.portal.SystemException se) {
125             _log.error(se, se);
126 
127             throw se;
128         }
129     }
130 
131     public static com.liferay.portal.model.Website getWebsite(
132         HttpPrincipal httpPrincipal, long websiteId)
133         throws com.liferay.portal.PortalException,
134             com.liferay.portal.SystemException {
135         try {
136             MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class.getName(),
137                     "getWebsite", _getWebsiteParameterTypes2);
138 
139             MethodHandler methodHandler = new MethodHandler(methodKey, websiteId);
140 
141             Object returnObj = null;
142 
143             try {
144                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
145             }
146             catch (Exception e) {
147                 if (e instanceof com.liferay.portal.PortalException) {
148                     throw (com.liferay.portal.PortalException)e;
149                 }
150 
151                 if (e instanceof com.liferay.portal.SystemException) {
152                     throw (com.liferay.portal.SystemException)e;
153                 }
154 
155                 throw new com.liferay.portal.SystemException(e);
156             }
157 
158             return (com.liferay.portal.model.Website)returnObj;
159         }
160         catch (com.liferay.portal.SystemException se) {
161             _log.error(se, se);
162 
163             throw se;
164         }
165     }
166 
167     public static java.util.List<com.liferay.portal.model.Website> getWebsites(
168         HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
169         throws com.liferay.portal.PortalException,
170             com.liferay.portal.SystemException {
171         try {
172             MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class.getName(),
173                     "getWebsites", _getWebsitesParameterTypes3);
174 
175             MethodHandler methodHandler = new MethodHandler(methodKey,
176                     className, classPK);
177 
178             Object returnObj = null;
179 
180             try {
181                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
182             }
183             catch (Exception e) {
184                 if (e instanceof com.liferay.portal.PortalException) {
185                     throw (com.liferay.portal.PortalException)e;
186                 }
187 
188                 if (e instanceof com.liferay.portal.SystemException) {
189                     throw (com.liferay.portal.SystemException)e;
190                 }
191 
192                 throw new com.liferay.portal.SystemException(e);
193             }
194 
195             return (java.util.List<com.liferay.portal.model.Website>)returnObj;
196         }
197         catch (com.liferay.portal.SystemException se) {
198             _log.error(se, se);
199 
200             throw se;
201         }
202     }
203 
204     public static com.liferay.portal.model.Website updateWebsite(
205         HttpPrincipal httpPrincipal, long websiteId, java.lang.String url,
206         int typeId, boolean primary)
207         throws com.liferay.portal.PortalException,
208             com.liferay.portal.SystemException {
209         try {
210             MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class.getName(),
211                     "updateWebsite", _updateWebsiteParameterTypes4);
212 
213             MethodHandler methodHandler = new MethodHandler(methodKey,
214                     websiteId, url, typeId, primary);
215 
216             Object returnObj = null;
217 
218             try {
219                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
220             }
221             catch (Exception e) {
222                 if (e instanceof com.liferay.portal.PortalException) {
223                     throw (com.liferay.portal.PortalException)e;
224                 }
225 
226                 if (e instanceof com.liferay.portal.SystemException) {
227                     throw (com.liferay.portal.SystemException)e;
228                 }
229 
230                 throw new com.liferay.portal.SystemException(e);
231             }
232 
233             return (com.liferay.portal.model.Website)returnObj;
234         }
235         catch (com.liferay.portal.SystemException se) {
236             _log.error(se, se);
237 
238             throw se;
239         }
240     }
241 
242     private static Log _log = LogFactoryUtil.getLog(WebsiteServiceHttp.class);
243     private static final Class<?>[] _addWebsiteParameterTypes0 = new Class[] {
244             java.lang.String.class, long.class, java.lang.String.class,
245             int.class, boolean.class
246         };
247     private static final Class<?>[] _deleteWebsiteParameterTypes1 = new Class[] {
248             long.class
249         };
250     private static final Class<?>[] _getWebsiteParameterTypes2 = new Class[] {
251             long.class
252         };
253     private static final Class<?>[] _getWebsitesParameterTypes3 = new Class[] {
254             java.lang.String.class, long.class
255         };
256     private static final Class<?>[] _updateWebsiteParameterTypes4 = new Class[] {
257             long.class, java.lang.String.class, int.class, boolean.class
258         };
259 }