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