1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.kernel.util.BooleanWrapper;
28  import com.liferay.portal.kernel.util.LongWrapper;
29  import com.liferay.portal.kernel.util.MethodWrapper;
30  import com.liferay.portal.kernel.util.NullWrapper;
31  import com.liferay.portal.security.auth.HttpPrincipal;
32  import com.liferay.portal.service.CompanyServiceUtil;
33  
34  /**
35   * <a href="CompanyServiceHttp.java.html"><b><i>View Source</i></b></a>
36   *
37   * <p>
38   * ServiceBuilder generated this class. Modifications in this class will be
39   * overwritten the next time is generated.
40   * </p>
41   *
42   * <p>
43   * This class provides a HTTP utility for the
44   * <code>com.liferay.portal.service.CompanyServiceUtil</code> service
45   * utility. The static methods of this class calls the same methods of the
46   * service utility. However, the signatures are different because it requires an
47   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
48   * parameter.
49   * </p>
50   *
51   * <p>
52   * The benefits of using the HTTP utility is that it is fast and allows for
53   * tunneling without the cost of serializing to text. The drawback is that it
54   * only works with Java.
55   * </p>
56   *
57   * <p>
58   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
59   * portal.properties to configure security.
60   * </p>
61   *
62   * <p>
63   * The HTTP utility is only generated for remote services.
64   * </p>
65   *
66   * @author Brian Wing Shun Chan
67   *
68   * @see com.liferay.portal.security.auth.HttpPrincipal
69   * @see com.liferay.portal.service.CompanyServiceUtil
70   * @see com.liferay.portal.service.http.CompanyServiceSoap
71   *
72   */
73  public class CompanyServiceHttp {
74      public static com.liferay.portal.model.Company addCompany(
75          HttpPrincipal httpPrincipal, java.lang.String webId,
76          java.lang.String virtualHost, java.lang.String mx)
77          throws com.liferay.portal.PortalException,
78              com.liferay.portal.SystemException {
79          try {
80              Object paramObj0 = webId;
81  
82              if (webId == null) {
83                  paramObj0 = new NullWrapper("java.lang.String");
84              }
85  
86              Object paramObj1 = virtualHost;
87  
88              if (virtualHost == null) {
89                  paramObj1 = new NullWrapper("java.lang.String");
90              }
91  
92              Object paramObj2 = mx;
93  
94              if (mx == null) {
95                  paramObj2 = new NullWrapper("java.lang.String");
96              }
97  
98              MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
99                      "addCompany",
100                     new Object[] { paramObj0, paramObj1, paramObj2 });
101 
102             Object returnObj = null;
103 
104             try {
105                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
106             }
107             catch (Exception e) {
108                 if (e instanceof com.liferay.portal.PortalException) {
109                     throw (com.liferay.portal.PortalException)e;
110                 }
111 
112                 if (e instanceof com.liferay.portal.SystemException) {
113                     throw (com.liferay.portal.SystemException)e;
114                 }
115 
116                 throw new com.liferay.portal.SystemException(e);
117             }
118 
119             return (com.liferay.portal.model.Company)returnObj;
120         }
121         catch (com.liferay.portal.SystemException se) {
122             _log.error(se, se);
123 
124             throw se;
125         }
126     }
127 
128     public static com.liferay.portal.model.Company updateCompany(
129         HttpPrincipal httpPrincipal, long companyId,
130         java.lang.String virtualHost, java.lang.String mx)
131         throws com.liferay.portal.PortalException,
132             com.liferay.portal.SystemException {
133         try {
134             Object paramObj0 = new LongWrapper(companyId);
135 
136             Object paramObj1 = virtualHost;
137 
138             if (virtualHost == null) {
139                 paramObj1 = new NullWrapper("java.lang.String");
140             }
141 
142             Object paramObj2 = mx;
143 
144             if (mx == null) {
145                 paramObj2 = new NullWrapper("java.lang.String");
146             }
147 
148             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
149                     "updateCompany",
150                     new Object[] { paramObj0, paramObj1, paramObj2 });
151 
152             Object returnObj = null;
153 
154             try {
155                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
156             }
157             catch (Exception e) {
158                 if (e instanceof com.liferay.portal.PortalException) {
159                     throw (com.liferay.portal.PortalException)e;
160                 }
161 
162                 if (e instanceof com.liferay.portal.SystemException) {
163                     throw (com.liferay.portal.SystemException)e;
164                 }
165 
166                 throw new com.liferay.portal.SystemException(e);
167             }
168 
169             return (com.liferay.portal.model.Company)returnObj;
170         }
171         catch (com.liferay.portal.SystemException se) {
172             _log.error(se, se);
173 
174             throw se;
175         }
176     }
177 
178     public static com.liferay.portal.model.Company updateCompany(
179         HttpPrincipal httpPrincipal, long companyId,
180         java.lang.String virtualHost, java.lang.String mx,
181         java.lang.String name, java.lang.String legalName,
182         java.lang.String legalId, java.lang.String legalType,
183         java.lang.String sicCode, java.lang.String tickerSymbol,
184         java.lang.String industry, java.lang.String type, java.lang.String size)
185         throws com.liferay.portal.PortalException,
186             com.liferay.portal.SystemException {
187         try {
188             Object paramObj0 = new LongWrapper(companyId);
189 
190             Object paramObj1 = virtualHost;
191 
192             if (virtualHost == null) {
193                 paramObj1 = new NullWrapper("java.lang.String");
194             }
195 
196             Object paramObj2 = mx;
197 
198             if (mx == null) {
199                 paramObj2 = new NullWrapper("java.lang.String");
200             }
201 
202             Object paramObj3 = name;
203 
204             if (name == null) {
205                 paramObj3 = new NullWrapper("java.lang.String");
206             }
207 
208             Object paramObj4 = legalName;
209 
210             if (legalName == null) {
211                 paramObj4 = new NullWrapper("java.lang.String");
212             }
213 
214             Object paramObj5 = legalId;
215 
216             if (legalId == null) {
217                 paramObj5 = new NullWrapper("java.lang.String");
218             }
219 
220             Object paramObj6 = legalType;
221 
222             if (legalType == null) {
223                 paramObj6 = new NullWrapper("java.lang.String");
224             }
225 
226             Object paramObj7 = sicCode;
227 
228             if (sicCode == null) {
229                 paramObj7 = new NullWrapper("java.lang.String");
230             }
231 
232             Object paramObj8 = tickerSymbol;
233 
234             if (tickerSymbol == null) {
235                 paramObj8 = new NullWrapper("java.lang.String");
236             }
237 
238             Object paramObj9 = industry;
239 
240             if (industry == null) {
241                 paramObj9 = new NullWrapper("java.lang.String");
242             }
243 
244             Object paramObj10 = type;
245 
246             if (type == null) {
247                 paramObj10 = new NullWrapper("java.lang.String");
248             }
249 
250             Object paramObj11 = size;
251 
252             if (size == null) {
253                 paramObj11 = new NullWrapper("java.lang.String");
254             }
255 
256             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
257                     "updateCompany",
258                     new Object[] {
259                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
260                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
261                         paramObj10, paramObj11
262                     });
263 
264             Object returnObj = null;
265 
266             try {
267                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
268             }
269             catch (Exception e) {
270                 if (e instanceof com.liferay.portal.PortalException) {
271                     throw (com.liferay.portal.PortalException)e;
272                 }
273 
274                 if (e instanceof com.liferay.portal.SystemException) {
275                     throw (com.liferay.portal.SystemException)e;
276                 }
277 
278                 throw new com.liferay.portal.SystemException(e);
279             }
280 
281             return (com.liferay.portal.model.Company)returnObj;
282         }
283         catch (com.liferay.portal.SystemException se) {
284             _log.error(se, se);
285 
286             throw se;
287         }
288     }
289 
290     public static void updateDisplay(HttpPrincipal httpPrincipal,
291         long companyId, java.lang.String languageId, java.lang.String timeZoneId)
292         throws com.liferay.portal.PortalException,
293             com.liferay.portal.SystemException {
294         try {
295             Object paramObj0 = new LongWrapper(companyId);
296 
297             Object paramObj1 = languageId;
298 
299             if (languageId == null) {
300                 paramObj1 = new NullWrapper("java.lang.String");
301             }
302 
303             Object paramObj2 = timeZoneId;
304 
305             if (timeZoneId == null) {
306                 paramObj2 = new NullWrapper("java.lang.String");
307             }
308 
309             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
310                     "updateDisplay",
311                     new Object[] { paramObj0, paramObj1, paramObj2 });
312 
313             try {
314                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
315             }
316             catch (Exception e) {
317                 if (e instanceof com.liferay.portal.PortalException) {
318                     throw (com.liferay.portal.PortalException)e;
319                 }
320 
321                 if (e instanceof com.liferay.portal.SystemException) {
322                     throw (com.liferay.portal.SystemException)e;
323                 }
324 
325                 throw new com.liferay.portal.SystemException(e);
326             }
327         }
328         catch (com.liferay.portal.SystemException se) {
329             _log.error(se, se);
330 
331             throw se;
332         }
333     }
334 
335     public static void updateLogo(HttpPrincipal httpPrincipal, long companyId,
336         java.io.File file)
337         throws com.liferay.portal.PortalException,
338             com.liferay.portal.SystemException {
339         try {
340             Object paramObj0 = new LongWrapper(companyId);
341 
342             Object paramObj1 = file;
343 
344             if (file == null) {
345                 paramObj1 = new NullWrapper("java.io.File");
346             }
347 
348             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
349                     "updateLogo", new Object[] { paramObj0, paramObj1 });
350 
351             try {
352                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
353             }
354             catch (Exception e) {
355                 if (e instanceof com.liferay.portal.PortalException) {
356                     throw (com.liferay.portal.PortalException)e;
357                 }
358 
359                 if (e instanceof com.liferay.portal.SystemException) {
360                     throw (com.liferay.portal.SystemException)e;
361                 }
362 
363                 throw new com.liferay.portal.SystemException(e);
364             }
365         }
366         catch (com.liferay.portal.SystemException se) {
367             _log.error(se, se);
368 
369             throw se;
370         }
371     }
372 
373     public static void updateSecurity(HttpPrincipal httpPrincipal,
374         long companyId, java.lang.String authType, boolean autoLogin,
375         boolean sendPassword, boolean strangers, boolean strangersWithMx,
376         boolean strangersVerify, boolean communityLogo)
377         throws com.liferay.portal.PortalException,
378             com.liferay.portal.SystemException {
379         try {
380             Object paramObj0 = new LongWrapper(companyId);
381 
382             Object paramObj1 = authType;
383 
384             if (authType == null) {
385                 paramObj1 = new NullWrapper("java.lang.String");
386             }
387 
388             Object paramObj2 = new BooleanWrapper(autoLogin);
389 
390             Object paramObj3 = new BooleanWrapper(sendPassword);
391 
392             Object paramObj4 = new BooleanWrapper(strangers);
393 
394             Object paramObj5 = new BooleanWrapper(strangersWithMx);
395 
396             Object paramObj6 = new BooleanWrapper(strangersVerify);
397 
398             Object paramObj7 = new BooleanWrapper(communityLogo);
399 
400             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
401                     "updateSecurity",
402                     new Object[] {
403                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
404                         paramObj5, paramObj6, paramObj7
405                     });
406 
407             try {
408                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
409             }
410             catch (Exception e) {
411                 if (e instanceof com.liferay.portal.PortalException) {
412                     throw (com.liferay.portal.PortalException)e;
413                 }
414 
415                 if (e instanceof com.liferay.portal.SystemException) {
416                     throw (com.liferay.portal.SystemException)e;
417                 }
418 
419                 throw new com.liferay.portal.SystemException(e);
420             }
421         }
422         catch (com.liferay.portal.SystemException se) {
423             _log.error(se, se);
424 
425             throw se;
426         }
427     }
428 
429     private static Log _log = LogFactoryUtil.getLog(CompanyServiceHttp.class);
430 }