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 addCompany(
129         HttpPrincipal httpPrincipal, java.lang.String webId,
130         java.lang.String virtualHost, java.lang.String mx,
131         java.lang.String shardName, boolean system)
132         throws com.liferay.portal.PortalException,
133             com.liferay.portal.SystemException {
134         try {
135             Object paramObj0 = webId;
136 
137             if (webId == null) {
138                 paramObj0 = new NullWrapper("java.lang.String");
139             }
140 
141             Object paramObj1 = virtualHost;
142 
143             if (virtualHost == null) {
144                 paramObj1 = new NullWrapper("java.lang.String");
145             }
146 
147             Object paramObj2 = mx;
148 
149             if (mx == null) {
150                 paramObj2 = new NullWrapper("java.lang.String");
151             }
152 
153             Object paramObj3 = shardName;
154 
155             if (shardName == null) {
156                 paramObj3 = new NullWrapper("java.lang.String");
157             }
158 
159             Object paramObj4 = new BooleanWrapper(system);
160 
161             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
162                     "addCompany",
163                     new Object[] {
164                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
165                     });
166 
167             Object returnObj = null;
168 
169             try {
170                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
171             }
172             catch (Exception e) {
173                 if (e instanceof com.liferay.portal.PortalException) {
174                     throw (com.liferay.portal.PortalException)e;
175                 }
176 
177                 if (e instanceof com.liferay.portal.SystemException) {
178                     throw (com.liferay.portal.SystemException)e;
179                 }
180 
181                 throw new com.liferay.portal.SystemException(e);
182             }
183 
184             return (com.liferay.portal.model.Company)returnObj;
185         }
186         catch (com.liferay.portal.SystemException se) {
187             _log.error(se, se);
188 
189             throw se;
190         }
191     }
192 
193     public static com.liferay.portal.model.Company updateCompany(
194         HttpPrincipal httpPrincipal, long companyId,
195         java.lang.String virtualHost, java.lang.String mx)
196         throws com.liferay.portal.PortalException,
197             com.liferay.portal.SystemException {
198         try {
199             Object paramObj0 = new LongWrapper(companyId);
200 
201             Object paramObj1 = virtualHost;
202 
203             if (virtualHost == null) {
204                 paramObj1 = new NullWrapper("java.lang.String");
205             }
206 
207             Object paramObj2 = mx;
208 
209             if (mx == null) {
210                 paramObj2 = new NullWrapper("java.lang.String");
211             }
212 
213             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
214                     "updateCompany",
215                     new Object[] { paramObj0, paramObj1, paramObj2 });
216 
217             Object returnObj = null;
218 
219             try {
220                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
221             }
222             catch (Exception e) {
223                 if (e instanceof com.liferay.portal.PortalException) {
224                     throw (com.liferay.portal.PortalException)e;
225                 }
226 
227                 if (e instanceof com.liferay.portal.SystemException) {
228                     throw (com.liferay.portal.SystemException)e;
229                 }
230 
231                 throw new com.liferay.portal.SystemException(e);
232             }
233 
234             return (com.liferay.portal.model.Company)returnObj;
235         }
236         catch (com.liferay.portal.SystemException se) {
237             _log.error(se, se);
238 
239             throw se;
240         }
241     }
242 
243     public static com.liferay.portal.model.Company updateCompany(
244         HttpPrincipal httpPrincipal, long companyId,
245         java.lang.String virtualHost, java.lang.String mx,
246         java.lang.String name, java.lang.String legalName,
247         java.lang.String legalId, java.lang.String legalType,
248         java.lang.String sicCode, java.lang.String tickerSymbol,
249         java.lang.String industry, java.lang.String type, java.lang.String size)
250         throws com.liferay.portal.PortalException,
251             com.liferay.portal.SystemException {
252         try {
253             Object paramObj0 = new LongWrapper(companyId);
254 
255             Object paramObj1 = virtualHost;
256 
257             if (virtualHost == null) {
258                 paramObj1 = new NullWrapper("java.lang.String");
259             }
260 
261             Object paramObj2 = mx;
262 
263             if (mx == null) {
264                 paramObj2 = new NullWrapper("java.lang.String");
265             }
266 
267             Object paramObj3 = name;
268 
269             if (name == null) {
270                 paramObj3 = new NullWrapper("java.lang.String");
271             }
272 
273             Object paramObj4 = legalName;
274 
275             if (legalName == null) {
276                 paramObj4 = new NullWrapper("java.lang.String");
277             }
278 
279             Object paramObj5 = legalId;
280 
281             if (legalId == null) {
282                 paramObj5 = new NullWrapper("java.lang.String");
283             }
284 
285             Object paramObj6 = legalType;
286 
287             if (legalType == null) {
288                 paramObj6 = new NullWrapper("java.lang.String");
289             }
290 
291             Object paramObj7 = sicCode;
292 
293             if (sicCode == null) {
294                 paramObj7 = new NullWrapper("java.lang.String");
295             }
296 
297             Object paramObj8 = tickerSymbol;
298 
299             if (tickerSymbol == null) {
300                 paramObj8 = new NullWrapper("java.lang.String");
301             }
302 
303             Object paramObj9 = industry;
304 
305             if (industry == null) {
306                 paramObj9 = new NullWrapper("java.lang.String");
307             }
308 
309             Object paramObj10 = type;
310 
311             if (type == null) {
312                 paramObj10 = new NullWrapper("java.lang.String");
313             }
314 
315             Object paramObj11 = size;
316 
317             if (size == null) {
318                 paramObj11 = new NullWrapper("java.lang.String");
319             }
320 
321             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
322                     "updateCompany",
323                     new Object[] {
324                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
325                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
326                         paramObj10, paramObj11
327                     });
328 
329             Object returnObj = null;
330 
331             try {
332                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
333             }
334             catch (Exception e) {
335                 if (e instanceof com.liferay.portal.PortalException) {
336                     throw (com.liferay.portal.PortalException)e;
337                 }
338 
339                 if (e instanceof com.liferay.portal.SystemException) {
340                     throw (com.liferay.portal.SystemException)e;
341                 }
342 
343                 throw new com.liferay.portal.SystemException(e);
344             }
345 
346             return (com.liferay.portal.model.Company)returnObj;
347         }
348         catch (com.liferay.portal.SystemException se) {
349             _log.error(se, se);
350 
351             throw se;
352         }
353     }
354 
355     public static void updateDisplay(HttpPrincipal httpPrincipal,
356         long companyId, java.lang.String languageId, java.lang.String timeZoneId)
357         throws com.liferay.portal.PortalException,
358             com.liferay.portal.SystemException {
359         try {
360             Object paramObj0 = new LongWrapper(companyId);
361 
362             Object paramObj1 = languageId;
363 
364             if (languageId == null) {
365                 paramObj1 = new NullWrapper("java.lang.String");
366             }
367 
368             Object paramObj2 = timeZoneId;
369 
370             if (timeZoneId == null) {
371                 paramObj2 = new NullWrapper("java.lang.String");
372             }
373 
374             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
375                     "updateDisplay",
376                     new Object[] { paramObj0, paramObj1, paramObj2 });
377 
378             try {
379                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
380             }
381             catch (Exception e) {
382                 if (e instanceof com.liferay.portal.PortalException) {
383                     throw (com.liferay.portal.PortalException)e;
384                 }
385 
386                 if (e instanceof com.liferay.portal.SystemException) {
387                     throw (com.liferay.portal.SystemException)e;
388                 }
389 
390                 throw new com.liferay.portal.SystemException(e);
391             }
392         }
393         catch (com.liferay.portal.SystemException se) {
394             _log.error(se, se);
395 
396             throw se;
397         }
398     }
399 
400     public static void updateLogo(HttpPrincipal httpPrincipal, long companyId,
401         java.io.File file)
402         throws com.liferay.portal.PortalException,
403             com.liferay.portal.SystemException {
404         try {
405             Object paramObj0 = new LongWrapper(companyId);
406 
407             Object paramObj1 = file;
408 
409             if (file == null) {
410                 paramObj1 = new NullWrapper("java.io.File");
411             }
412 
413             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
414                     "updateLogo", new Object[] { paramObj0, paramObj1 });
415 
416             try {
417                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
418             }
419             catch (Exception e) {
420                 if (e instanceof com.liferay.portal.PortalException) {
421                     throw (com.liferay.portal.PortalException)e;
422                 }
423 
424                 if (e instanceof com.liferay.portal.SystemException) {
425                     throw (com.liferay.portal.SystemException)e;
426                 }
427 
428                 throw new com.liferay.portal.SystemException(e);
429             }
430         }
431         catch (com.liferay.portal.SystemException se) {
432             _log.error(se, se);
433 
434             throw se;
435         }
436     }
437 
438     public static void updateSecurity(HttpPrincipal httpPrincipal,
439         long companyId, java.lang.String authType, boolean autoLogin,
440         boolean sendPassword, boolean strangers, boolean strangersWithMx,
441         boolean strangersVerify, boolean communityLogo)
442         throws com.liferay.portal.PortalException,
443             com.liferay.portal.SystemException {
444         try {
445             Object paramObj0 = new LongWrapper(companyId);
446 
447             Object paramObj1 = authType;
448 
449             if (authType == null) {
450                 paramObj1 = new NullWrapper("java.lang.String");
451             }
452 
453             Object paramObj2 = new BooleanWrapper(autoLogin);
454 
455             Object paramObj3 = new BooleanWrapper(sendPassword);
456 
457             Object paramObj4 = new BooleanWrapper(strangers);
458 
459             Object paramObj5 = new BooleanWrapper(strangersWithMx);
460 
461             Object paramObj6 = new BooleanWrapper(strangersVerify);
462 
463             Object paramObj7 = new BooleanWrapper(communityLogo);
464 
465             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
466                     "updateSecurity",
467                     new Object[] {
468                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
469                         paramObj5, paramObj6, paramObj7
470                     });
471 
472             try {
473                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
474             }
475             catch (Exception e) {
476                 if (e instanceof com.liferay.portal.PortalException) {
477                     throw (com.liferay.portal.PortalException)e;
478                 }
479 
480                 if (e instanceof com.liferay.portal.SystemException) {
481                     throw (com.liferay.portal.SystemException)e;
482                 }
483 
484                 throw new com.liferay.portal.SystemException(e);
485             }
486         }
487         catch (com.liferay.portal.SystemException se) {
488             _log.error(se, se);
489 
490             throw se;
491         }
492     }
493 
494     private static Log _log = LogFactoryUtil.getLog(CompanyServiceHttp.class);
495 }