1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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.IntegerWrapper;
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.ListTypeServiceUtil;
25  
26  /**
27   * <a href="ListTypeServiceHttp.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.ListTypeServiceUtil} 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       ListTypeServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portal.service.ListTypeServiceUtil
61   * @generated
62   */
63  public class ListTypeServiceHttp {
64      public static com.liferay.portal.model.ListType getListType(
65          HttpPrincipal httpPrincipal, int listTypeId)
66          throws com.liferay.portal.kernel.exception.PortalException,
67              com.liferay.portal.kernel.exception.SystemException {
68          try {
69              Object paramObj0 = new IntegerWrapper(listTypeId);
70  
71              MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
72                      "getListType", new Object[] { paramObj0 });
73  
74              Object returnObj = null;
75  
76              try {
77                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
78              }
79              catch (Exception e) {
80                  if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
81                      throw (com.liferay.portal.kernel.exception.PortalException)e;
82                  }
83  
84                  if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
85                      throw (com.liferay.portal.kernel.exception.SystemException)e;
86                  }
87  
88                  throw new com.liferay.portal.kernel.exception.SystemException(e);
89              }
90  
91              return (com.liferay.portal.model.ListType)returnObj;
92          }
93          catch (com.liferay.portal.kernel.exception.SystemException se) {
94              _log.error(se, se);
95  
96              throw se;
97          }
98      }
99  
100     public static java.util.List<com.liferay.portal.model.ListType> getListTypes(
101         HttpPrincipal httpPrincipal, java.lang.String type)
102         throws com.liferay.portal.kernel.exception.SystemException {
103         try {
104             Object paramObj0 = type;
105 
106             if (type == null) {
107                 paramObj0 = new NullWrapper("java.lang.String");
108             }
109 
110             MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
111                     "getListTypes", new Object[] { paramObj0 });
112 
113             Object returnObj = null;
114 
115             try {
116                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
117             }
118             catch (Exception e) {
119                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
120                     throw (com.liferay.portal.kernel.exception.SystemException)e;
121                 }
122 
123                 throw new com.liferay.portal.kernel.exception.SystemException(e);
124             }
125 
126             return (java.util.List<com.liferay.portal.model.ListType>)returnObj;
127         }
128         catch (com.liferay.portal.kernel.exception.SystemException se) {
129             _log.error(se, se);
130 
131             throw se;
132         }
133     }
134 
135     public static void validate(HttpPrincipal httpPrincipal, int listTypeId,
136         java.lang.String type)
137         throws com.liferay.portal.kernel.exception.PortalException,
138             com.liferay.portal.kernel.exception.SystemException {
139         try {
140             Object paramObj0 = new IntegerWrapper(listTypeId);
141 
142             Object paramObj1 = type;
143 
144             if (type == null) {
145                 paramObj1 = new NullWrapper("java.lang.String");
146             }
147 
148             MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
149                     "validate", new Object[] { paramObj0, paramObj1 });
150 
151             try {
152                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
153             }
154             catch (Exception e) {
155                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
156                     throw (com.liferay.portal.kernel.exception.PortalException)e;
157                 }
158 
159                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
160                     throw (com.liferay.portal.kernel.exception.SystemException)e;
161                 }
162 
163                 throw new com.liferay.portal.kernel.exception.SystemException(e);
164             }
165         }
166         catch (com.liferay.portal.kernel.exception.SystemException se) {
167             _log.error(se, se);
168 
169             throw se;
170         }
171     }
172 
173     public static void validate(HttpPrincipal httpPrincipal, int listTypeId,
174         long classNameId, java.lang.String type)
175         throws com.liferay.portal.kernel.exception.PortalException,
176             com.liferay.portal.kernel.exception.SystemException {
177         try {
178             Object paramObj0 = new IntegerWrapper(listTypeId);
179 
180             Object paramObj1 = new LongWrapper(classNameId);
181 
182             Object paramObj2 = type;
183 
184             if (type == null) {
185                 paramObj2 = new NullWrapper("java.lang.String");
186             }
187 
188             MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
189                     "validate", new Object[] { paramObj0, paramObj1, paramObj2 });
190 
191             try {
192                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
193             }
194             catch (Exception e) {
195                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
196                     throw (com.liferay.portal.kernel.exception.PortalException)e;
197                 }
198 
199                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
200                     throw (com.liferay.portal.kernel.exception.SystemException)e;
201                 }
202 
203                 throw new com.liferay.portal.kernel.exception.SystemException(e);
204             }
205         }
206         catch (com.liferay.portal.kernel.exception.SystemException se) {
207             _log.error(se, se);
208 
209             throw se;
210         }
211     }
212 
213     private static Log _log = LogFactoryUtil.getLog(ListTypeServiceHttp.class);
214 }