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.CompanyServiceUtil;
23  
24  /**
25   * <a href="CompanyServiceHttp.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.CompanyServiceUtil} 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       CompanyServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.CompanyServiceUtil
59   * @generated
60   */
61  public class CompanyServiceHttp {
62      public static com.liferay.portal.model.Company addCompany(
63          HttpPrincipal httpPrincipal, java.lang.String webId,
64          java.lang.String virtualHost, java.lang.String mx,
65          java.lang.String shardName, boolean system)
66          throws com.liferay.portal.PortalException,
67              com.liferay.portal.SystemException {
68          try {
69              MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
70                      "addCompany", _addCompanyParameterTypes0);
71  
72              MethodHandler methodHandler = new MethodHandler(methodKey, webId,
73                      virtualHost, mx, shardName, system);
74  
75              Object returnObj = null;
76  
77              try {
78                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
79              }
80              catch (Exception e) {
81                  if (e instanceof com.liferay.portal.PortalException) {
82                      throw (com.liferay.portal.PortalException)e;
83                  }
84  
85                  if (e instanceof com.liferay.portal.SystemException) {
86                      throw (com.liferay.portal.SystemException)e;
87                  }
88  
89                  throw new com.liferay.portal.SystemException(e);
90              }
91  
92              return (com.liferay.portal.model.Company)returnObj;
93          }
94          catch (com.liferay.portal.SystemException se) {
95              _log.error(se, se);
96  
97              throw se;
98          }
99      }
100 
101     public static void deleteLogo(HttpPrincipal httpPrincipal, long companyId)
102         throws com.liferay.portal.PortalException,
103             com.liferay.portal.SystemException {
104         try {
105             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
106                     "deleteLogo", _deleteLogoParameterTypes1);
107 
108             MethodHandler methodHandler = new MethodHandler(methodKey, companyId);
109 
110             try {
111                 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         catch (com.liferay.portal.SystemException se) {
126             _log.error(se, se);
127 
128             throw se;
129         }
130     }
131 
132     public static com.liferay.portal.model.Company getCompanyById(
133         HttpPrincipal httpPrincipal, long companyId)
134         throws com.liferay.portal.PortalException,
135             com.liferay.portal.SystemException {
136         try {
137             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
138                     "getCompanyById", _getCompanyByIdParameterTypes2);
139 
140             MethodHandler methodHandler = new MethodHandler(methodKey, companyId);
141 
142             Object returnObj = null;
143 
144             try {
145                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
146             }
147             catch (Exception e) {
148                 if (e instanceof com.liferay.portal.PortalException) {
149                     throw (com.liferay.portal.PortalException)e;
150                 }
151 
152                 if (e instanceof com.liferay.portal.SystemException) {
153                     throw (com.liferay.portal.SystemException)e;
154                 }
155 
156                 throw new com.liferay.portal.SystemException(e);
157             }
158 
159             return (com.liferay.portal.model.Company)returnObj;
160         }
161         catch (com.liferay.portal.SystemException se) {
162             _log.error(se, se);
163 
164             throw se;
165         }
166     }
167 
168     public static com.liferay.portal.model.Company getCompanyByLogoId(
169         HttpPrincipal httpPrincipal, long logoId)
170         throws com.liferay.portal.PortalException,
171             com.liferay.portal.SystemException {
172         try {
173             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
174                     "getCompanyByLogoId", _getCompanyByLogoIdParameterTypes3);
175 
176             MethodHandler methodHandler = new MethodHandler(methodKey, logoId);
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 (com.liferay.portal.model.Company)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.Company getCompanyByMx(
205         HttpPrincipal httpPrincipal, java.lang.String mx)
206         throws com.liferay.portal.PortalException,
207             com.liferay.portal.SystemException {
208         try {
209             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
210                     "getCompanyByMx", _getCompanyByMxParameterTypes4);
211 
212             MethodHandler methodHandler = new MethodHandler(methodKey, mx);
213 
214             Object returnObj = null;
215 
216             try {
217                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
218             }
219             catch (Exception e) {
220                 if (e instanceof com.liferay.portal.PortalException) {
221                     throw (com.liferay.portal.PortalException)e;
222                 }
223 
224                 if (e instanceof com.liferay.portal.SystemException) {
225                     throw (com.liferay.portal.SystemException)e;
226                 }
227 
228                 throw new com.liferay.portal.SystemException(e);
229             }
230 
231             return (com.liferay.portal.model.Company)returnObj;
232         }
233         catch (com.liferay.portal.SystemException se) {
234             _log.error(se, se);
235 
236             throw se;
237         }
238     }
239 
240     public static com.liferay.portal.model.Company getCompanyByVirtualHost(
241         HttpPrincipal httpPrincipal, java.lang.String virtualHost)
242         throws com.liferay.portal.PortalException,
243             com.liferay.portal.SystemException {
244         try {
245             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
246                     "getCompanyByVirtualHost",
247                     _getCompanyByVirtualHostParameterTypes5);
248 
249             MethodHandler methodHandler = new MethodHandler(methodKey,
250                     virtualHost);
251 
252             Object returnObj = null;
253 
254             try {
255                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
256             }
257             catch (Exception e) {
258                 if (e instanceof com.liferay.portal.PortalException) {
259                     throw (com.liferay.portal.PortalException)e;
260                 }
261 
262                 if (e instanceof com.liferay.portal.SystemException) {
263                     throw (com.liferay.portal.SystemException)e;
264                 }
265 
266                 throw new com.liferay.portal.SystemException(e);
267             }
268 
269             return (com.liferay.portal.model.Company)returnObj;
270         }
271         catch (com.liferay.portal.SystemException se) {
272             _log.error(se, se);
273 
274             throw se;
275         }
276     }
277 
278     public static com.liferay.portal.model.Company getCompanyByWebId(
279         HttpPrincipal httpPrincipal, java.lang.String webId)
280         throws com.liferay.portal.PortalException,
281             com.liferay.portal.SystemException {
282         try {
283             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
284                     "getCompanyByWebId", _getCompanyByWebIdParameterTypes6);
285 
286             MethodHandler methodHandler = new MethodHandler(methodKey, webId);
287 
288             Object returnObj = null;
289 
290             try {
291                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
292             }
293             catch (Exception e) {
294                 if (e instanceof com.liferay.portal.PortalException) {
295                     throw (com.liferay.portal.PortalException)e;
296                 }
297 
298                 if (e instanceof com.liferay.portal.SystemException) {
299                     throw (com.liferay.portal.SystemException)e;
300                 }
301 
302                 throw new com.liferay.portal.SystemException(e);
303             }
304 
305             return (com.liferay.portal.model.Company)returnObj;
306         }
307         catch (com.liferay.portal.SystemException se) {
308             _log.error(se, se);
309 
310             throw se;
311         }
312     }
313 
314     public static void removePreferences(HttpPrincipal httpPrincipal,
315         long companyId, java.lang.String[] keys)
316         throws com.liferay.portal.PortalException,
317             com.liferay.portal.SystemException {
318         try {
319             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
320                     "removePreferences", _removePreferencesParameterTypes7);
321 
322             MethodHandler methodHandler = new MethodHandler(methodKey,
323                     companyId, keys);
324 
325             try {
326                 TunnelUtil.invoke(httpPrincipal, methodHandler);
327             }
328             catch (Exception e) {
329                 if (e instanceof com.liferay.portal.PortalException) {
330                     throw (com.liferay.portal.PortalException)e;
331                 }
332 
333                 if (e instanceof com.liferay.portal.SystemException) {
334                     throw (com.liferay.portal.SystemException)e;
335                 }
336 
337                 throw new com.liferay.portal.SystemException(e);
338             }
339         }
340         catch (com.liferay.portal.SystemException se) {
341             _log.error(se, se);
342 
343             throw se;
344         }
345     }
346 
347     public static com.liferay.portal.model.Company updateCompany(
348         HttpPrincipal httpPrincipal, long companyId,
349         java.lang.String virtualHost, java.lang.String mx)
350         throws com.liferay.portal.PortalException,
351             com.liferay.portal.SystemException {
352         try {
353             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
354                     "updateCompany", _updateCompanyParameterTypes8);
355 
356             MethodHandler methodHandler = new MethodHandler(methodKey,
357                     companyId, virtualHost, mx);
358 
359             Object returnObj = null;
360 
361             try {
362                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
363             }
364             catch (Exception e) {
365                 if (e instanceof com.liferay.portal.PortalException) {
366                     throw (com.liferay.portal.PortalException)e;
367                 }
368 
369                 if (e instanceof com.liferay.portal.SystemException) {
370                     throw (com.liferay.portal.SystemException)e;
371                 }
372 
373                 throw new com.liferay.portal.SystemException(e);
374             }
375 
376             return (com.liferay.portal.model.Company)returnObj;
377         }
378         catch (com.liferay.portal.SystemException se) {
379             _log.error(se, se);
380 
381             throw se;
382         }
383     }
384 
385     public static com.liferay.portal.model.Company updateCompany(
386         HttpPrincipal httpPrincipal, long companyId,
387         java.lang.String virtualHost, java.lang.String mx,
388         java.lang.String homeURL, java.lang.String name,
389         java.lang.String legalName, java.lang.String legalId,
390         java.lang.String legalType, java.lang.String sicCode,
391         java.lang.String tickerSymbol, java.lang.String industry,
392         java.lang.String type, java.lang.String size)
393         throws com.liferay.portal.PortalException,
394             com.liferay.portal.SystemException {
395         try {
396             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
397                     "updateCompany", _updateCompanyParameterTypes9);
398 
399             MethodHandler methodHandler = new MethodHandler(methodKey,
400                     companyId, virtualHost, mx, homeURL, name, legalName,
401                     legalId, legalType, sicCode, tickerSymbol, industry, type,
402                     size);
403 
404             Object returnObj = null;
405 
406             try {
407                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
408             }
409             catch (Exception e) {
410                 if (e instanceof com.liferay.portal.PortalException) {
411                     throw (com.liferay.portal.PortalException)e;
412                 }
413 
414                 if (e instanceof com.liferay.portal.SystemException) {
415                     throw (com.liferay.portal.SystemException)e;
416                 }
417 
418                 throw new com.liferay.portal.SystemException(e);
419             }
420 
421             return (com.liferay.portal.model.Company)returnObj;
422         }
423         catch (com.liferay.portal.SystemException se) {
424             _log.error(se, se);
425 
426             throw se;
427         }
428     }
429 
430     public static com.liferay.portal.model.Company updateCompany(
431         HttpPrincipal httpPrincipal, long companyId,
432         java.lang.String virtualHost, java.lang.String mx,
433         java.lang.String homeURL, java.lang.String name,
434         java.lang.String legalName, java.lang.String legalId,
435         java.lang.String legalType, java.lang.String sicCode,
436         java.lang.String tickerSymbol, java.lang.String industry,
437         java.lang.String type, java.lang.String size,
438         java.lang.String languageId, java.lang.String timeZoneId,
439         java.util.List<com.liferay.portal.model.Address> addresses,
440         java.util.List<com.liferay.portal.model.EmailAddress> emailAddresses,
441         java.util.List<com.liferay.portal.model.Phone> phones,
442         java.util.List<com.liferay.portal.model.Website> websites,
443         com.liferay.portal.kernel.util.UnicodeProperties properties)
444         throws com.liferay.portal.PortalException,
445             com.liferay.portal.SystemException {
446         try {
447             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
448                     "updateCompany", _updateCompanyParameterTypes10);
449 
450             MethodHandler methodHandler = new MethodHandler(methodKey,
451                     companyId, virtualHost, mx, homeURL, name, legalName,
452                     legalId, legalType, sicCode, tickerSymbol, industry, type,
453                     size, languageId, timeZoneId, addresses, emailAddresses,
454                     phones, websites, properties);
455 
456             Object returnObj = null;
457 
458             try {
459                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
460             }
461             catch (Exception e) {
462                 if (e instanceof com.liferay.portal.PortalException) {
463                     throw (com.liferay.portal.PortalException)e;
464                 }
465 
466                 if (e instanceof com.liferay.portal.SystemException) {
467                     throw (com.liferay.portal.SystemException)e;
468                 }
469 
470                 throw new com.liferay.portal.SystemException(e);
471             }
472 
473             return (com.liferay.portal.model.Company)returnObj;
474         }
475         catch (com.liferay.portal.SystemException se) {
476             _log.error(se, se);
477 
478             throw se;
479         }
480     }
481 
482     public static void updateDisplay(HttpPrincipal httpPrincipal,
483         long companyId, java.lang.String languageId, java.lang.String timeZoneId)
484         throws com.liferay.portal.PortalException,
485             com.liferay.portal.SystemException {
486         try {
487             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
488                     "updateDisplay", _updateDisplayParameterTypes11);
489 
490             MethodHandler methodHandler = new MethodHandler(methodKey,
491                     companyId, languageId, timeZoneId);
492 
493             try {
494                 TunnelUtil.invoke(httpPrincipal, methodHandler);
495             }
496             catch (Exception e) {
497                 if (e instanceof com.liferay.portal.PortalException) {
498                     throw (com.liferay.portal.PortalException)e;
499                 }
500 
501                 if (e instanceof com.liferay.portal.SystemException) {
502                     throw (com.liferay.portal.SystemException)e;
503                 }
504 
505                 throw new com.liferay.portal.SystemException(e);
506             }
507         }
508         catch (com.liferay.portal.SystemException se) {
509             _log.error(se, se);
510 
511             throw se;
512         }
513     }
514 
515     public static void updateLogo(HttpPrincipal httpPrincipal, long companyId,
516         java.io.File file)
517         throws com.liferay.portal.PortalException,
518             com.liferay.portal.SystemException {
519         try {
520             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
521                     "updateLogo", _updateLogoParameterTypes12);
522 
523             MethodHandler methodHandler = new MethodHandler(methodKey,
524                     companyId, file);
525 
526             try {
527                 TunnelUtil.invoke(httpPrincipal, methodHandler);
528             }
529             catch (Exception e) {
530                 if (e instanceof com.liferay.portal.PortalException) {
531                     throw (com.liferay.portal.PortalException)e;
532                 }
533 
534                 if (e instanceof com.liferay.portal.SystemException) {
535                     throw (com.liferay.portal.SystemException)e;
536                 }
537 
538                 throw new com.liferay.portal.SystemException(e);
539             }
540         }
541         catch (com.liferay.portal.SystemException se) {
542             _log.error(se, se);
543 
544             throw se;
545         }
546     }
547 
548     public static void updatePreferences(HttpPrincipal httpPrincipal,
549         long companyId,
550         com.liferay.portal.kernel.util.UnicodeProperties properties)
551         throws com.liferay.portal.PortalException,
552             com.liferay.portal.SystemException {
553         try {
554             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
555                     "updatePreferences", _updatePreferencesParameterTypes13);
556 
557             MethodHandler methodHandler = new MethodHandler(methodKey,
558                     companyId, properties);
559 
560             try {
561                 TunnelUtil.invoke(httpPrincipal, methodHandler);
562             }
563             catch (Exception e) {
564                 if (e instanceof com.liferay.portal.PortalException) {
565                     throw (com.liferay.portal.PortalException)e;
566                 }
567 
568                 if (e instanceof com.liferay.portal.SystemException) {
569                     throw (com.liferay.portal.SystemException)e;
570                 }
571 
572                 throw new com.liferay.portal.SystemException(e);
573             }
574         }
575         catch (com.liferay.portal.SystemException se) {
576             _log.error(se, se);
577 
578             throw se;
579         }
580     }
581 
582     public static void updateSecurity(HttpPrincipal httpPrincipal,
583         long companyId, java.lang.String authType, boolean autoLogin,
584         boolean sendPassword, boolean strangers, boolean strangersWithMx,
585         boolean strangersVerify, boolean communityLogo)
586         throws com.liferay.portal.PortalException,
587             com.liferay.portal.SystemException {
588         try {
589             MethodKey methodKey = new MethodKey(CompanyServiceUtil.class.getName(),
590                     "updateSecurity", _updateSecurityParameterTypes14);
591 
592             MethodHandler methodHandler = new MethodHandler(methodKey,
593                     companyId, authType, autoLogin, sendPassword, strangers,
594                     strangersWithMx, strangersVerify, communityLogo);
595 
596             try {
597                 TunnelUtil.invoke(httpPrincipal, methodHandler);
598             }
599             catch (Exception e) {
600                 if (e instanceof com.liferay.portal.PortalException) {
601                     throw (com.liferay.portal.PortalException)e;
602                 }
603 
604                 if (e instanceof com.liferay.portal.SystemException) {
605                     throw (com.liferay.portal.SystemException)e;
606                 }
607 
608                 throw new com.liferay.portal.SystemException(e);
609             }
610         }
611         catch (com.liferay.portal.SystemException se) {
612             _log.error(se, se);
613 
614             throw se;
615         }
616     }
617 
618     private static Log _log = LogFactoryUtil.getLog(CompanyServiceHttp.class);
619     private static final Class<?>[] _addCompanyParameterTypes0 = new Class[] {
620             java.lang.String.class, java.lang.String.class,
621             java.lang.String.class, java.lang.String.class, boolean.class
622         };
623     private static final Class<?>[] _deleteLogoParameterTypes1 = new Class[] {
624             long.class
625         };
626     private static final Class<?>[] _getCompanyByIdParameterTypes2 = new Class[] {
627             long.class
628         };
629     private static final Class<?>[] _getCompanyByLogoIdParameterTypes3 = new Class[] {
630             long.class
631         };
632     private static final Class<?>[] _getCompanyByMxParameterTypes4 = new Class[] {
633             java.lang.String.class
634         };
635     private static final Class<?>[] _getCompanyByVirtualHostParameterTypes5 = new Class[] {
636             java.lang.String.class
637         };
638     private static final Class<?>[] _getCompanyByWebIdParameterTypes6 = new Class[] {
639             java.lang.String.class
640         };
641     private static final Class<?>[] _removePreferencesParameterTypes7 = new Class[] {
642             long.class, java.lang.String[].class
643         };
644     private static final Class<?>[] _updateCompanyParameterTypes8 = new Class[] {
645             long.class, java.lang.String.class, java.lang.String.class
646         };
647     private static final Class<?>[] _updateCompanyParameterTypes9 = new Class[] {
648             long.class, java.lang.String.class, java.lang.String.class,
649             java.lang.String.class, java.lang.String.class,
650             java.lang.String.class, java.lang.String.class,
651             java.lang.String.class, java.lang.String.class,
652             java.lang.String.class, java.lang.String.class,
653             java.lang.String.class, java.lang.String.class
654         };
655     private static final Class<?>[] _updateCompanyParameterTypes10 = new Class[] {
656             long.class, java.lang.String.class, java.lang.String.class,
657             java.lang.String.class, java.lang.String.class,
658             java.lang.String.class, java.lang.String.class,
659             java.lang.String.class, java.lang.String.class,
660             java.lang.String.class, java.lang.String.class,
661             java.lang.String.class, java.lang.String.class,
662             java.lang.String.class, java.lang.String.class, java.util.List.class,
663             java.util.List.class, java.util.List.class, java.util.List.class,
664             com.liferay.portal.kernel.util.UnicodeProperties.class
665         };
666     private static final Class<?>[] _updateDisplayParameterTypes11 = new Class[] {
667             long.class, java.lang.String.class, java.lang.String.class
668         };
669     private static final Class<?>[] _updateLogoParameterTypes12 = new Class[] {
670             long.class, java.io.File.class
671         };
672     private static final Class<?>[] _updatePreferencesParameterTypes13 = new Class[] {
673             long.class, com.liferay.portal.kernel.util.UnicodeProperties.class
674         };
675     private static final Class<?>[] _updateSecurityParameterTypes14 = new Class[] {
676             long.class, java.lang.String.class, boolean.class, boolean.class,
677             boolean.class, boolean.class, boolean.class, boolean.class
678         };
679 }