1   /**
2    * Copyright (c) 2000-2007 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  import com.liferay.portal.service.http.TunnelUtil;
34  
35  /**
36   * <a href="CompanyServiceHttp.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be overwritten
40   * the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class provides a HTTP utility for the <code>com.liferay.portal.service.CompanyServiceUtil</code>
45   * service 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> parameter.
48   * </p>
49   *
50   * <p>
51   * The benefits of using the HTTP utility is that it is fast and allows for tunneling
52   * without the cost of serializing to text. The drawback is that it only works with
53   * Java.
54   * </p>
55   *
56   * <p>
57   * Set the property <code>tunnel.servlet.hosts.allowed</code> in portal.properties
58   * to 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   *
67   * @see com.liferay.portal.security.auth.HttpPrincipal
68   * @see com.liferay.portal.service.CompanyServiceUtil
69   * @see com.liferay.portal.service.http.CompanyServiceSoap
70   *
71   */
72  public class CompanyServiceHttp {
73      public static com.liferay.portal.model.Company addCompany(
74          HttpPrincipal httpPrincipal, java.lang.String webId,
75          java.lang.String virtualHost, java.lang.String mx)
76          throws com.liferay.portal.SystemException, 
77              com.liferay.portal.PortalException {
78          try {
79              Object paramObj0 = webId;
80  
81              if (webId == null) {
82                  paramObj0 = new NullWrapper("java.lang.String");
83              }
84  
85              Object paramObj1 = virtualHost;
86  
87              if (virtualHost == null) {
88                  paramObj1 = new NullWrapper("java.lang.String");
89              }
90  
91              Object paramObj2 = mx;
92  
93              if (mx == null) {
94                  paramObj2 = new NullWrapper("java.lang.String");
95              }
96  
97              MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
98                      "addCompany",
99                      new Object[] { paramObj0, paramObj1, paramObj2 });
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.SystemException) {
107                     throw (com.liferay.portal.SystemException)e;
108                 }
109 
110                 if (e instanceof com.liferay.portal.PortalException) {
111                     throw (com.liferay.portal.PortalException)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             throw se;
122         }
123     }
124 
125     public static com.liferay.portal.model.Company updateCompany(
126         HttpPrincipal httpPrincipal, long companyId,
127         java.lang.String virtualHost, java.lang.String mx)
128         throws com.liferay.portal.SystemException, 
129             com.liferay.portal.PortalException {
130         try {
131             Object paramObj0 = new LongWrapper(companyId);
132             Object paramObj1 = virtualHost;
133 
134             if (virtualHost == null) {
135                 paramObj1 = new NullWrapper("java.lang.String");
136             }
137 
138             Object paramObj2 = mx;
139 
140             if (mx == null) {
141                 paramObj2 = new NullWrapper("java.lang.String");
142             }
143 
144             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
145                     "updateCompany",
146                     new Object[] { paramObj0, paramObj1, paramObj2 });
147             Object returnObj = null;
148 
149             try {
150                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
151             }
152             catch (Exception e) {
153                 if (e instanceof com.liferay.portal.SystemException) {
154                     throw (com.liferay.portal.SystemException)e;
155                 }
156 
157                 if (e instanceof com.liferay.portal.PortalException) {
158                     throw (com.liferay.portal.PortalException)e;
159                 }
160 
161                 throw new com.liferay.portal.SystemException(e);
162             }
163 
164             return (com.liferay.portal.model.Company)returnObj;
165         }
166         catch (com.liferay.portal.SystemException se) {
167             _log.error(se, se);
168             throw se;
169         }
170     }
171 
172     public static com.liferay.portal.model.Company updateCompany(
173         HttpPrincipal httpPrincipal, long companyId,
174         java.lang.String virtualHost, java.lang.String mx,
175         java.lang.String name, java.lang.String legalName,
176         java.lang.String legalId, java.lang.String legalType,
177         java.lang.String sicCode, java.lang.String tickerSymbol,
178         java.lang.String industry, java.lang.String type, java.lang.String size)
179         throws com.liferay.portal.SystemException, 
180             com.liferay.portal.PortalException {
181         try {
182             Object paramObj0 = new LongWrapper(companyId);
183             Object paramObj1 = virtualHost;
184 
185             if (virtualHost == null) {
186                 paramObj1 = new NullWrapper("java.lang.String");
187             }
188 
189             Object paramObj2 = mx;
190 
191             if (mx == null) {
192                 paramObj2 = new NullWrapper("java.lang.String");
193             }
194 
195             Object paramObj3 = name;
196 
197             if (name == null) {
198                 paramObj3 = new NullWrapper("java.lang.String");
199             }
200 
201             Object paramObj4 = legalName;
202 
203             if (legalName == null) {
204                 paramObj4 = new NullWrapper("java.lang.String");
205             }
206 
207             Object paramObj5 = legalId;
208 
209             if (legalId == null) {
210                 paramObj5 = new NullWrapper("java.lang.String");
211             }
212 
213             Object paramObj6 = legalType;
214 
215             if (legalType == null) {
216                 paramObj6 = new NullWrapper("java.lang.String");
217             }
218 
219             Object paramObj7 = sicCode;
220 
221             if (sicCode == null) {
222                 paramObj7 = new NullWrapper("java.lang.String");
223             }
224 
225             Object paramObj8 = tickerSymbol;
226 
227             if (tickerSymbol == null) {
228                 paramObj8 = new NullWrapper("java.lang.String");
229             }
230 
231             Object paramObj9 = industry;
232 
233             if (industry == null) {
234                 paramObj9 = new NullWrapper("java.lang.String");
235             }
236 
237             Object paramObj10 = type;
238 
239             if (type == null) {
240                 paramObj10 = new NullWrapper("java.lang.String");
241             }
242 
243             Object paramObj11 = size;
244 
245             if (size == null) {
246                 paramObj11 = new NullWrapper("java.lang.String");
247             }
248 
249             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
250                     "updateCompany",
251                     new Object[] {
252                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
253                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
254                         paramObj10, paramObj11
255                     });
256             Object returnObj = null;
257 
258             try {
259                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
260             }
261             catch (Exception e) {
262                 if (e instanceof com.liferay.portal.SystemException) {
263                     throw (com.liferay.portal.SystemException)e;
264                 }
265 
266                 if (e instanceof com.liferay.portal.PortalException) {
267                     throw (com.liferay.portal.PortalException)e;
268                 }
269 
270                 throw new com.liferay.portal.SystemException(e);
271             }
272 
273             return (com.liferay.portal.model.Company)returnObj;
274         }
275         catch (com.liferay.portal.SystemException se) {
276             _log.error(se, se);
277             throw se;
278         }
279     }
280 
281     public static void updateDisplay(HttpPrincipal httpPrincipal,
282         long companyId, java.lang.String languageId, java.lang.String timeZoneId)
283         throws com.liferay.portal.SystemException, 
284             com.liferay.portal.PortalException {
285         try {
286             Object paramObj0 = new LongWrapper(companyId);
287             Object paramObj1 = languageId;
288 
289             if (languageId == null) {
290                 paramObj1 = new NullWrapper("java.lang.String");
291             }
292 
293             Object paramObj2 = timeZoneId;
294 
295             if (timeZoneId == null) {
296                 paramObj2 = new NullWrapper("java.lang.String");
297             }
298 
299             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
300                     "updateDisplay",
301                     new Object[] { paramObj0, paramObj1, paramObj2 });
302 
303             try {
304                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
305             }
306             catch (Exception e) {
307                 if (e instanceof com.liferay.portal.SystemException) {
308                     throw (com.liferay.portal.SystemException)e;
309                 }
310 
311                 if (e instanceof com.liferay.portal.PortalException) {
312                     throw (com.liferay.portal.PortalException)e;
313                 }
314 
315                 throw new com.liferay.portal.SystemException(e);
316             }
317         }
318         catch (com.liferay.portal.SystemException se) {
319             _log.error(se, se);
320             throw se;
321         }
322     }
323 
324     public static void updateLogo(HttpPrincipal httpPrincipal, long companyId,
325         java.io.File file)
326         throws com.liferay.portal.SystemException, 
327             com.liferay.portal.PortalException {
328         try {
329             Object paramObj0 = new LongWrapper(companyId);
330             Object paramObj1 = file;
331 
332             if (file == null) {
333                 paramObj1 = new NullWrapper("java.io.File");
334             }
335 
336             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
337                     "updateLogo", new Object[] { paramObj0, paramObj1 });
338 
339             try {
340                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
341             }
342             catch (Exception e) {
343                 if (e instanceof com.liferay.portal.SystemException) {
344                     throw (com.liferay.portal.SystemException)e;
345                 }
346 
347                 if (e instanceof com.liferay.portal.PortalException) {
348                     throw (com.liferay.portal.PortalException)e;
349                 }
350 
351                 throw new com.liferay.portal.SystemException(e);
352             }
353         }
354         catch (com.liferay.portal.SystemException se) {
355             _log.error(se, se);
356             throw se;
357         }
358     }
359 
360     public static void updateSecurity(HttpPrincipal httpPrincipal,
361         long companyId, java.lang.String authType, boolean autoLogin,
362         boolean sendPassword, boolean strangers, boolean strangersWithMx,
363         boolean strangersVerify, boolean communityLogo)
364         throws com.liferay.portal.SystemException, 
365             com.liferay.portal.PortalException {
366         try {
367             Object paramObj0 = new LongWrapper(companyId);
368             Object paramObj1 = authType;
369 
370             if (authType == null) {
371                 paramObj1 = new NullWrapper("java.lang.String");
372             }
373 
374             Object paramObj2 = new BooleanWrapper(autoLogin);
375             Object paramObj3 = new BooleanWrapper(sendPassword);
376             Object paramObj4 = new BooleanWrapper(strangers);
377             Object paramObj5 = new BooleanWrapper(strangersWithMx);
378             Object paramObj6 = new BooleanWrapper(strangersVerify);
379             Object paramObj7 = new BooleanWrapper(communityLogo);
380             MethodWrapper methodWrapper = new MethodWrapper(CompanyServiceUtil.class.getName(),
381                     "updateSecurity",
382                     new Object[] {
383                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
384                         paramObj5, paramObj6, paramObj7
385                     });
386 
387             try {
388                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
389             }
390             catch (Exception e) {
391                 if (e instanceof com.liferay.portal.SystemException) {
392                     throw (com.liferay.portal.SystemException)e;
393                 }
394 
395                 if (e instanceof com.liferay.portal.PortalException) {
396                     throw (com.liferay.portal.PortalException)e;
397                 }
398 
399                 throw new com.liferay.portal.SystemException(e);
400             }
401         }
402         catch (com.liferay.portal.SystemException se) {
403             _log.error(se, se);
404             throw se;
405         }
406     }
407 
408     private static Log _log = LogFactoryUtil.getLog(CompanyServiceHttp.class);
409 }