1   /**
2    * Copyright (c) 2000-2009 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 getCompanyById(
129         HttpPrincipal httpPrincipal, long companyId)
130         throws com.liferay.portal.PortalException,
131             com.liferay.portal.SystemException {
132         try {
133             Object paramObj0 = new LongWrapper(companyId);
134 
135             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
136                     "getCompanyById", new Object[] { paramObj0 });
137 
138             Object returnObj = null;
139 
140             try {
141                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
142             }
143             catch (Exception e) {
144                 if (e instanceof com.liferay.portal.PortalException) {
145                     throw (com.liferay.portal.PortalException)e;
146                 }
147 
148                 if (e instanceof com.liferay.portal.SystemException) {
149                     throw (com.liferay.portal.SystemException)e;
150                 }
151 
152                 throw new com.liferay.portal.SystemException(e);
153             }
154 
155             return (com.liferay.portal.model.Company)returnObj;
156         }
157         catch (com.liferay.portal.SystemException se) {
158             _log.error(se, se);
159 
160             throw se;
161         }
162     }
163 
164     public static com.liferay.portal.model.Company getCompanyByLogoId(
165         HttpPrincipal httpPrincipal, long logoId)
166         throws com.liferay.portal.PortalException,
167             com.liferay.portal.SystemException {
168         try {
169             Object paramObj0 = new LongWrapper(logoId);
170 
171             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
172                     "getCompanyByLogoId", new Object[] { paramObj0 });
173 
174             Object returnObj = null;
175 
176             try {
177                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
178             }
179             catch (Exception e) {
180                 if (e instanceof com.liferay.portal.PortalException) {
181                     throw (com.liferay.portal.PortalException)e;
182                 }
183 
184                 if (e instanceof com.liferay.portal.SystemException) {
185                     throw (com.liferay.portal.SystemException)e;
186                 }
187 
188                 throw new com.liferay.portal.SystemException(e);
189             }
190 
191             return (com.liferay.portal.model.Company)returnObj;
192         }
193         catch (com.liferay.portal.SystemException se) {
194             _log.error(se, se);
195 
196             throw se;
197         }
198     }
199 
200     public static com.liferay.portal.model.Company getCompanyByMx(
201         HttpPrincipal httpPrincipal, java.lang.String mx)
202         throws com.liferay.portal.PortalException,
203             com.liferay.portal.SystemException {
204         try {
205             Object paramObj0 = mx;
206 
207             if (mx == null) {
208                 paramObj0 = new NullWrapper("java.lang.String");
209             }
210 
211             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
212                     "getCompanyByMx", new Object[] { paramObj0 });
213 
214             Object returnObj = null;
215 
216             try {
217                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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             Object paramObj0 = virtualHost;
246 
247             if (virtualHost == null) {
248                 paramObj0 = new NullWrapper("java.lang.String");
249             }
250 
251             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
252                     "getCompanyByVirtualHost", new Object[] { paramObj0 });
253 
254             Object returnObj = null;
255 
256             try {
257                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
258             }
259             catch (Exception e) {
260                 if (e instanceof com.liferay.portal.PortalException) {
261                     throw (com.liferay.portal.PortalException)e;
262                 }
263 
264                 if (e instanceof com.liferay.portal.SystemException) {
265                     throw (com.liferay.portal.SystemException)e;
266                 }
267 
268                 throw new com.liferay.portal.SystemException(e);
269             }
270 
271             return (com.liferay.portal.model.Company)returnObj;
272         }
273         catch (com.liferay.portal.SystemException se) {
274             _log.error(se, se);
275 
276             throw se;
277         }
278     }
279 
280     public static com.liferay.portal.model.Company getCompanyByWebId(
281         HttpPrincipal httpPrincipal, java.lang.String webId)
282         throws com.liferay.portal.PortalException,
283             com.liferay.portal.SystemException {
284         try {
285             Object paramObj0 = webId;
286 
287             if (webId == null) {
288                 paramObj0 = new NullWrapper("java.lang.String");
289             }
290 
291             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
292                     "getCompanyByWebId", new Object[] { paramObj0 });
293 
294             Object returnObj = null;
295 
296             try {
297                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
298             }
299             catch (Exception e) {
300                 if (e instanceof com.liferay.portal.PortalException) {
301                     throw (com.liferay.portal.PortalException)e;
302                 }
303 
304                 if (e instanceof com.liferay.portal.SystemException) {
305                     throw (com.liferay.portal.SystemException)e;
306                 }
307 
308                 throw new com.liferay.portal.SystemException(e);
309             }
310 
311             return (com.liferay.portal.model.Company)returnObj;
312         }
313         catch (com.liferay.portal.SystemException se) {
314             _log.error(se, se);
315 
316             throw se;
317         }
318     }
319 
320     public static com.liferay.portal.model.Company updateCompany(
321         HttpPrincipal httpPrincipal, long companyId,
322         java.lang.String virtualHost, java.lang.String mx)
323         throws com.liferay.portal.PortalException,
324             com.liferay.portal.SystemException {
325         try {
326             Object paramObj0 = new LongWrapper(companyId);
327 
328             Object paramObj1 = virtualHost;
329 
330             if (virtualHost == null) {
331                 paramObj1 = new NullWrapper("java.lang.String");
332             }
333 
334             Object paramObj2 = mx;
335 
336             if (mx == null) {
337                 paramObj2 = new NullWrapper("java.lang.String");
338             }
339 
340             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
341                     "updateCompany",
342                     new Object[] { paramObj0, paramObj1, paramObj2 });
343 
344             Object returnObj = null;
345 
346             try {
347                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
348             }
349             catch (Exception e) {
350                 if (e instanceof com.liferay.portal.PortalException) {
351                     throw (com.liferay.portal.PortalException)e;
352                 }
353 
354                 if (e instanceof com.liferay.portal.SystemException) {
355                     throw (com.liferay.portal.SystemException)e;
356                 }
357 
358                 throw new com.liferay.portal.SystemException(e);
359             }
360 
361             return (com.liferay.portal.model.Company)returnObj;
362         }
363         catch (com.liferay.portal.SystemException se) {
364             _log.error(se, se);
365 
366             throw se;
367         }
368     }
369 
370     public static com.liferay.portal.model.Company updateCompany(
371         HttpPrincipal httpPrincipal, long companyId,
372         java.lang.String virtualHost, java.lang.String mx,
373         java.lang.String homeURL, java.lang.String name,
374         java.lang.String legalName, java.lang.String legalId,
375         java.lang.String legalType, java.lang.String sicCode,
376         java.lang.String tickerSymbol, java.lang.String industry,
377         java.lang.String type, java.lang.String size)
378         throws com.liferay.portal.PortalException,
379             com.liferay.portal.SystemException {
380         try {
381             Object paramObj0 = new LongWrapper(companyId);
382 
383             Object paramObj1 = virtualHost;
384 
385             if (virtualHost == null) {
386                 paramObj1 = new NullWrapper("java.lang.String");
387             }
388 
389             Object paramObj2 = mx;
390 
391             if (mx == null) {
392                 paramObj2 = new NullWrapper("java.lang.String");
393             }
394 
395             Object paramObj3 = homeURL;
396 
397             if (homeURL == null) {
398                 paramObj3 = new NullWrapper("java.lang.String");
399             }
400 
401             Object paramObj4 = name;
402 
403             if (name == null) {
404                 paramObj4 = new NullWrapper("java.lang.String");
405             }
406 
407             Object paramObj5 = legalName;
408 
409             if (legalName == null) {
410                 paramObj5 = new NullWrapper("java.lang.String");
411             }
412 
413             Object paramObj6 = legalId;
414 
415             if (legalId == null) {
416                 paramObj6 = new NullWrapper("java.lang.String");
417             }
418 
419             Object paramObj7 = legalType;
420 
421             if (legalType == null) {
422                 paramObj7 = new NullWrapper("java.lang.String");
423             }
424 
425             Object paramObj8 = sicCode;
426 
427             if (sicCode == null) {
428                 paramObj8 = new NullWrapper("java.lang.String");
429             }
430 
431             Object paramObj9 = tickerSymbol;
432 
433             if (tickerSymbol == null) {
434                 paramObj9 = new NullWrapper("java.lang.String");
435             }
436 
437             Object paramObj10 = industry;
438 
439             if (industry == null) {
440                 paramObj10 = new NullWrapper("java.lang.String");
441             }
442 
443             Object paramObj11 = type;
444 
445             if (type == null) {
446                 paramObj11 = new NullWrapper("java.lang.String");
447             }
448 
449             Object paramObj12 = size;
450 
451             if (size == null) {
452                 paramObj12 = new NullWrapper("java.lang.String");
453             }
454 
455             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
456                     "updateCompany",
457                     new Object[] {
458                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
459                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
460                         paramObj10, paramObj11, paramObj12
461                     });
462 
463             Object returnObj = null;
464 
465             try {
466                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
467             }
468             catch (Exception e) {
469                 if (e instanceof com.liferay.portal.PortalException) {
470                     throw (com.liferay.portal.PortalException)e;
471                 }
472 
473                 if (e instanceof com.liferay.portal.SystemException) {
474                     throw (com.liferay.portal.SystemException)e;
475                 }
476 
477                 throw new com.liferay.portal.SystemException(e);
478             }
479 
480             return (com.liferay.portal.model.Company)returnObj;
481         }
482         catch (com.liferay.portal.SystemException se) {
483             _log.error(se, se);
484 
485             throw se;
486         }
487     }
488 
489     public static void updateDisplay(HttpPrincipal httpPrincipal,
490         long companyId, java.lang.String languageId, java.lang.String timeZoneId)
491         throws com.liferay.portal.PortalException,
492             com.liferay.portal.SystemException {
493         try {
494             Object paramObj0 = new LongWrapper(companyId);
495 
496             Object paramObj1 = languageId;
497 
498             if (languageId == null) {
499                 paramObj1 = new NullWrapper("java.lang.String");
500             }
501 
502             Object paramObj2 = timeZoneId;
503 
504             if (timeZoneId == null) {
505                 paramObj2 = new NullWrapper("java.lang.String");
506             }
507 
508             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
509                     "updateDisplay",
510                     new Object[] { paramObj0, paramObj1, paramObj2 });
511 
512             try {
513                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
514             }
515             catch (Exception e) {
516                 if (e instanceof com.liferay.portal.PortalException) {
517                     throw (com.liferay.portal.PortalException)e;
518                 }
519 
520                 if (e instanceof com.liferay.portal.SystemException) {
521                     throw (com.liferay.portal.SystemException)e;
522                 }
523 
524                 throw new com.liferay.portal.SystemException(e);
525             }
526         }
527         catch (com.liferay.portal.SystemException se) {
528             _log.error(se, se);
529 
530             throw se;
531         }
532     }
533 
534     public static void updateLogo(HttpPrincipal httpPrincipal, long companyId,
535         java.io.File file)
536         throws com.liferay.portal.PortalException,
537             com.liferay.portal.SystemException {
538         try {
539             Object paramObj0 = new LongWrapper(companyId);
540 
541             Object paramObj1 = file;
542 
543             if (file == null) {
544                 paramObj1 = new NullWrapper("java.io.File");
545             }
546 
547             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
548                     "updateLogo", new Object[] { paramObj0, paramObj1 });
549 
550             try {
551                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
552             }
553             catch (Exception e) {
554                 if (e instanceof com.liferay.portal.PortalException) {
555                     throw (com.liferay.portal.PortalException)e;
556                 }
557 
558                 if (e instanceof com.liferay.portal.SystemException) {
559                     throw (com.liferay.portal.SystemException)e;
560                 }
561 
562                 throw new com.liferay.portal.SystemException(e);
563             }
564         }
565         catch (com.liferay.portal.SystemException se) {
566             _log.error(se, se);
567 
568             throw se;
569         }
570     }
571 
572     public static void updateSecurity(HttpPrincipal httpPrincipal,
573         long companyId, java.lang.String authType, boolean autoLogin,
574         boolean sendPassword, boolean strangers, boolean strangersWithMx,
575         boolean strangersVerify, boolean communityLogo)
576         throws com.liferay.portal.PortalException,
577             com.liferay.portal.SystemException {
578         try {
579             Object paramObj0 = new LongWrapper(companyId);
580 
581             Object paramObj1 = authType;
582 
583             if (authType == null) {
584                 paramObj1 = new NullWrapper("java.lang.String");
585             }
586 
587             Object paramObj2 = new BooleanWrapper(autoLogin);
588 
589             Object paramObj3 = new BooleanWrapper(sendPassword);
590 
591             Object paramObj4 = new BooleanWrapper(strangers);
592 
593             Object paramObj5 = new BooleanWrapper(strangersWithMx);
594 
595             Object paramObj6 = new BooleanWrapper(strangersVerify);
596 
597             Object paramObj7 = new BooleanWrapper(communityLogo);
598 
599             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
600                     "updateSecurity",
601                     new Object[] {
602                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
603                         paramObj5, paramObj6, paramObj7
604                     });
605 
606             try {
607                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
608             }
609             catch (Exception e) {
610                 if (e instanceof com.liferay.portal.PortalException) {
611                     throw (com.liferay.portal.PortalException)e;
612                 }
613 
614                 if (e instanceof com.liferay.portal.SystemException) {
615                     throw (com.liferay.portal.SystemException)e;
616                 }
617 
618                 throw new com.liferay.portal.SystemException(e);
619             }
620         }
621         catch (com.liferay.portal.SystemException se) {
622             _log.error(se, se);
623 
624             throw se;
625         }
626     }
627 
628     private static Log _log = LogFactoryUtil.getLog(CompanyServiceHttp.class);
629 }