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.BooleanWrapper;
20  import com.liferay.portal.kernel.util.LongWrapper;
21  import com.liferay.portal.kernel.util.MethodWrapper;
22  import com.liferay.portal.kernel.util.NullWrapper;
23  import com.liferay.portal.security.auth.HttpPrincipal;
24  import com.liferay.portal.service.CompanyServiceUtil;
25  
26  /**
27   * <a href="CompanyServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portal.service.CompanyServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       CompanyServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portal.service.CompanyServiceUtil
61   * @generated
62   */
63  public class CompanyServiceHttp {
64      public static com.liferay.portal.model.Company addCompany(
65          HttpPrincipal httpPrincipal, java.lang.String webId,
66          java.lang.String virtualHost, java.lang.String mx)
67          throws com.liferay.portal.PortalException,
68              com.liferay.portal.SystemException {
69          try {
70              Object paramObj0 = webId;
71  
72              if (webId == null) {
73                  paramObj0 = new NullWrapper("java.lang.String");
74              }
75  
76              Object paramObj1 = virtualHost;
77  
78              if (virtualHost == null) {
79                  paramObj1 = new NullWrapper("java.lang.String");
80              }
81  
82              Object paramObj2 = mx;
83  
84              if (mx == null) {
85                  paramObj2 = new NullWrapper("java.lang.String");
86              }
87  
88              MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
89                      "addCompany",
90                      new Object[] { paramObj0, paramObj1, paramObj2 });
91  
92              Object returnObj = null;
93  
94              try {
95                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
96              }
97              catch (Exception e) {
98                  if (e instanceof com.liferay.portal.PortalException) {
99                      throw (com.liferay.portal.PortalException)e;
100                 }
101 
102                 if (e instanceof com.liferay.portal.SystemException) {
103                     throw (com.liferay.portal.SystemException)e;
104                 }
105 
106                 throw new com.liferay.portal.SystemException(e);
107             }
108 
109             return (com.liferay.portal.model.Company)returnObj;
110         }
111         catch (com.liferay.portal.SystemException se) {
112             _log.error(se, se);
113 
114             throw se;
115         }
116     }
117 
118     public static com.liferay.portal.model.Company addCompany(
119         HttpPrincipal httpPrincipal, java.lang.String webId,
120         java.lang.String virtualHost, java.lang.String mx,
121         java.lang.String shardName, boolean system)
122         throws com.liferay.portal.PortalException,
123             com.liferay.portal.SystemException {
124         try {
125             Object paramObj0 = webId;
126 
127             if (webId == null) {
128                 paramObj0 = new NullWrapper("java.lang.String");
129             }
130 
131             Object paramObj1 = virtualHost;
132 
133             if (virtualHost == null) {
134                 paramObj1 = new NullWrapper("java.lang.String");
135             }
136 
137             Object paramObj2 = mx;
138 
139             if (mx == null) {
140                 paramObj2 = new NullWrapper("java.lang.String");
141             }
142 
143             Object paramObj3 = shardName;
144 
145             if (shardName == null) {
146                 paramObj3 = new NullWrapper("java.lang.String");
147             }
148 
149             Object paramObj4 = new BooleanWrapper(system);
150 
151             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
152                     "addCompany",
153                     new Object[] {
154                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
155                     });
156 
157             Object returnObj = null;
158 
159             try {
160                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
161             }
162             catch (Exception e) {
163                 if (e instanceof com.liferay.portal.PortalException) {
164                     throw (com.liferay.portal.PortalException)e;
165                 }
166 
167                 if (e instanceof com.liferay.portal.SystemException) {
168                     throw (com.liferay.portal.SystemException)e;
169                 }
170 
171                 throw new com.liferay.portal.SystemException(e);
172             }
173 
174             return (com.liferay.portal.model.Company)returnObj;
175         }
176         catch (com.liferay.portal.SystemException se) {
177             _log.error(se, se);
178 
179             throw se;
180         }
181     }
182 
183     public static com.liferay.portal.model.Company updateCompany(
184         HttpPrincipal httpPrincipal, long companyId,
185         java.lang.String virtualHost, java.lang.String mx)
186         throws com.liferay.portal.PortalException,
187             com.liferay.portal.SystemException {
188         try {
189             Object paramObj0 = new LongWrapper(companyId);
190 
191             Object paramObj1 = virtualHost;
192 
193             if (virtualHost == null) {
194                 paramObj1 = new NullWrapper("java.lang.String");
195             }
196 
197             Object paramObj2 = mx;
198 
199             if (mx == null) {
200                 paramObj2 = new NullWrapper("java.lang.String");
201             }
202 
203             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
204                     "updateCompany",
205                     new Object[] { paramObj0, paramObj1, paramObj2 });
206 
207             Object returnObj = null;
208 
209             try {
210                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
211             }
212             catch (Exception e) {
213                 if (e instanceof com.liferay.portal.PortalException) {
214                     throw (com.liferay.portal.PortalException)e;
215                 }
216 
217                 if (e instanceof com.liferay.portal.SystemException) {
218                     throw (com.liferay.portal.SystemException)e;
219                 }
220 
221                 throw new com.liferay.portal.SystemException(e);
222             }
223 
224             return (com.liferay.portal.model.Company)returnObj;
225         }
226         catch (com.liferay.portal.SystemException se) {
227             _log.error(se, se);
228 
229             throw se;
230         }
231     }
232 
233     public static com.liferay.portal.model.Company updateCompany(
234         HttpPrincipal httpPrincipal, long companyId,
235         java.lang.String virtualHost, java.lang.String mx,
236         java.lang.String name, java.lang.String legalName,
237         java.lang.String legalId, java.lang.String legalType,
238         java.lang.String sicCode, java.lang.String tickerSymbol,
239         java.lang.String industry, java.lang.String type, java.lang.String size)
240         throws com.liferay.portal.PortalException,
241             com.liferay.portal.SystemException {
242         try {
243             Object paramObj0 = new LongWrapper(companyId);
244 
245             Object paramObj1 = virtualHost;
246 
247             if (virtualHost == null) {
248                 paramObj1 = new NullWrapper("java.lang.String");
249             }
250 
251             Object paramObj2 = mx;
252 
253             if (mx == null) {
254                 paramObj2 = new NullWrapper("java.lang.String");
255             }
256 
257             Object paramObj3 = name;
258 
259             if (name == null) {
260                 paramObj3 = new NullWrapper("java.lang.String");
261             }
262 
263             Object paramObj4 = legalName;
264 
265             if (legalName == null) {
266                 paramObj4 = new NullWrapper("java.lang.String");
267             }
268 
269             Object paramObj5 = legalId;
270 
271             if (legalId == null) {
272                 paramObj5 = new NullWrapper("java.lang.String");
273             }
274 
275             Object paramObj6 = legalType;
276 
277             if (legalType == null) {
278                 paramObj6 = new NullWrapper("java.lang.String");
279             }
280 
281             Object paramObj7 = sicCode;
282 
283             if (sicCode == null) {
284                 paramObj7 = new NullWrapper("java.lang.String");
285             }
286 
287             Object paramObj8 = tickerSymbol;
288 
289             if (tickerSymbol == null) {
290                 paramObj8 = new NullWrapper("java.lang.String");
291             }
292 
293             Object paramObj9 = industry;
294 
295             if (industry == null) {
296                 paramObj9 = new NullWrapper("java.lang.String");
297             }
298 
299             Object paramObj10 = type;
300 
301             if (type == null) {
302                 paramObj10 = new NullWrapper("java.lang.String");
303             }
304 
305             Object paramObj11 = size;
306 
307             if (size == null) {
308                 paramObj11 = new NullWrapper("java.lang.String");
309             }
310 
311             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
312                     "updateCompany",
313                     new Object[] {
314                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
315                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
316                         paramObj10, paramObj11
317                     });
318 
319             Object returnObj = null;
320 
321             try {
322                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
323             }
324             catch (Exception e) {
325                 if (e instanceof com.liferay.portal.PortalException) {
326                     throw (com.liferay.portal.PortalException)e;
327                 }
328 
329                 if (e instanceof com.liferay.portal.SystemException) {
330                     throw (com.liferay.portal.SystemException)e;
331                 }
332 
333                 throw new com.liferay.portal.SystemException(e);
334             }
335 
336             return (com.liferay.portal.model.Company)returnObj;
337         }
338         catch (com.liferay.portal.SystemException se) {
339             _log.error(se, se);
340 
341             throw se;
342         }
343     }
344 
345     public static void updateDisplay(HttpPrincipal httpPrincipal,
346         long companyId, java.lang.String languageId, java.lang.String timeZoneId)
347         throws com.liferay.portal.PortalException,
348             com.liferay.portal.SystemException {
349         try {
350             Object paramObj0 = new LongWrapper(companyId);
351 
352             Object paramObj1 = languageId;
353 
354             if (languageId == null) {
355                 paramObj1 = new NullWrapper("java.lang.String");
356             }
357 
358             Object paramObj2 = timeZoneId;
359 
360             if (timeZoneId == null) {
361                 paramObj2 = new NullWrapper("java.lang.String");
362             }
363 
364             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
365                     "updateDisplay",
366                     new Object[] { paramObj0, paramObj1, paramObj2 });
367 
368             try {
369                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
370             }
371             catch (Exception e) {
372                 if (e instanceof com.liferay.portal.PortalException) {
373                     throw (com.liferay.portal.PortalException)e;
374                 }
375 
376                 if (e instanceof com.liferay.portal.SystemException) {
377                     throw (com.liferay.portal.SystemException)e;
378                 }
379 
380                 throw new com.liferay.portal.SystemException(e);
381             }
382         }
383         catch (com.liferay.portal.SystemException se) {
384             _log.error(se, se);
385 
386             throw se;
387         }
388     }
389 
390     public static void updateLogo(HttpPrincipal httpPrincipal, long companyId,
391         java.io.File file)
392         throws com.liferay.portal.PortalException,
393             com.liferay.portal.SystemException {
394         try {
395             Object paramObj0 = new LongWrapper(companyId);
396 
397             Object paramObj1 = file;
398 
399             if (file == null) {
400                 paramObj1 = new NullWrapper("java.io.File");
401             }
402 
403             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
404                     "updateLogo", new Object[] { paramObj0, paramObj1 });
405 
406             try {
407                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
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         catch (com.liferay.portal.SystemException se) {
422             _log.error(se, se);
423 
424             throw se;
425         }
426     }
427 
428     public static void updateSecurity(HttpPrincipal httpPrincipal,
429         long companyId, java.lang.String authType, boolean autoLogin,
430         boolean sendPassword, boolean strangers, boolean strangersWithMx,
431         boolean strangersVerify, boolean communityLogo)
432         throws com.liferay.portal.PortalException,
433             com.liferay.portal.SystemException {
434         try {
435             Object paramObj0 = new LongWrapper(companyId);
436 
437             Object paramObj1 = authType;
438 
439             if (authType == null) {
440                 paramObj1 = new NullWrapper("java.lang.String");
441             }
442 
443             Object paramObj2 = new BooleanWrapper(autoLogin);
444 
445             Object paramObj3 = new BooleanWrapper(sendPassword);
446 
447             Object paramObj4 = new BooleanWrapper(strangers);
448 
449             Object paramObj5 = new BooleanWrapper(strangersWithMx);
450 
451             Object paramObj6 = new BooleanWrapper(strangersVerify);
452 
453             Object paramObj7 = new BooleanWrapper(communityLogo);
454 
455             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
456                     "updateSecurity",
457                     new Object[] {
458                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
459                         paramObj5, paramObj6, paramObj7
460                     });
461 
462             try {
463                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
464             }
465             catch (Exception e) {
466                 if (e instanceof com.liferay.portal.PortalException) {
467                     throw (com.liferay.portal.PortalException)e;
468                 }
469 
470                 if (e instanceof com.liferay.portal.SystemException) {
471                     throw (com.liferay.portal.SystemException)e;
472                 }
473 
474                 throw new com.liferay.portal.SystemException(e);
475             }
476         }
477         catch (com.liferay.portal.SystemException se) {
478             _log.error(se, se);
479 
480             throw se;
481         }
482     }
483 
484     private static Log _log = LogFactoryUtil.getLog(CompanyServiceHttp.class);
485 }