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