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