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.IntegerWrapper;
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.ListTypeServiceUtil;
33  
34  /**
35   * <a href="ListTypeServiceHttp.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.ListTypeServiceUtil} 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       ListTypeServiceSoap
67   * @see       com.liferay.portal.security.auth.HttpPrincipal
68   * @see       com.liferay.portal.service.ListTypeServiceUtil
69   * @generated
70   */
71  public class ListTypeServiceHttp {
72      public static com.liferay.portal.model.ListType getListType(
73          HttpPrincipal httpPrincipal, int listTypeId)
74          throws com.liferay.portal.PortalException,
75              com.liferay.portal.SystemException {
76          try {
77              Object paramObj0 = new IntegerWrapper(listTypeId);
78  
79              MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
80                      "getListType", new Object[] { paramObj0 });
81  
82              Object returnObj = null;
83  
84              try {
85                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
86              }
87              catch (Exception e) {
88                  if (e instanceof com.liferay.portal.PortalException) {
89                      throw (com.liferay.portal.PortalException)e;
90                  }
91  
92                  if (e instanceof com.liferay.portal.SystemException) {
93                      throw (com.liferay.portal.SystemException)e;
94                  }
95  
96                  throw new com.liferay.portal.SystemException(e);
97              }
98  
99              return (com.liferay.portal.model.ListType)returnObj;
100         }
101         catch (com.liferay.portal.SystemException se) {
102             _log.error(se, se);
103 
104             throw se;
105         }
106     }
107 
108     public static java.util.List<com.liferay.portal.model.ListType> getListTypes(
109         HttpPrincipal httpPrincipal, java.lang.String type)
110         throws com.liferay.portal.SystemException {
111         try {
112             Object paramObj0 = type;
113 
114             if (type == null) {
115                 paramObj0 = new NullWrapper("java.lang.String");
116             }
117 
118             MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
119                     "getListTypes", new Object[] { paramObj0 });
120 
121             Object returnObj = null;
122 
123             try {
124                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
125             }
126             catch (Exception e) {
127                 if (e instanceof com.liferay.portal.SystemException) {
128                     throw (com.liferay.portal.SystemException)e;
129                 }
130 
131                 throw new com.liferay.portal.SystemException(e);
132             }
133 
134             return (java.util.List<com.liferay.portal.model.ListType>)returnObj;
135         }
136         catch (com.liferay.portal.SystemException se) {
137             _log.error(se, se);
138 
139             throw se;
140         }
141     }
142 
143     public static void validate(HttpPrincipal httpPrincipal, int listTypeId,
144         java.lang.String type)
145         throws com.liferay.portal.PortalException,
146             com.liferay.portal.SystemException {
147         try {
148             Object paramObj0 = new IntegerWrapper(listTypeId);
149 
150             Object paramObj1 = type;
151 
152             if (type == null) {
153                 paramObj1 = new NullWrapper("java.lang.String");
154             }
155 
156             MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
157                     "validate", new Object[] { paramObj0, paramObj1 });
158 
159             try {
160                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
161             }
162             catch (Exception e) {
163                 if (e instanceof com.liferay.portal.PortalException) {
164                     throw (com.liferay.portal.PortalException)e;
165                 }
166 
167                 if (e instanceof com.liferay.portal.SystemException) {
168                     throw (com.liferay.portal.SystemException)e;
169                 }
170 
171                 throw new com.liferay.portal.SystemException(e);
172             }
173         }
174         catch (com.liferay.portal.SystemException se) {
175             _log.error(se, se);
176 
177             throw se;
178         }
179     }
180 
181     public static void validate(HttpPrincipal httpPrincipal, int listTypeId,
182         long classNameId, java.lang.String type)
183         throws com.liferay.portal.PortalException,
184             com.liferay.portal.SystemException {
185         try {
186             Object paramObj0 = new IntegerWrapper(listTypeId);
187 
188             Object paramObj1 = new LongWrapper(classNameId);
189 
190             Object paramObj2 = type;
191 
192             if (type == null) {
193                 paramObj2 = new NullWrapper("java.lang.String");
194             }
195 
196             MethodWrapper methodWrapper = new MethodWrapper(ListTypeServiceUtil.class.getName(),
197                     "validate", new Object[] { paramObj0, paramObj1, paramObj2 });
198 
199             try {
200                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
201             }
202             catch (Exception e) {
203                 if (e instanceof com.liferay.portal.PortalException) {
204                     throw (com.liferay.portal.PortalException)e;
205                 }
206 
207                 if (e instanceof com.liferay.portal.SystemException) {
208                     throw (com.liferay.portal.SystemException)e;
209                 }
210 
211                 throw new com.liferay.portal.SystemException(e);
212             }
213         }
214         catch (com.liferay.portal.SystemException se) {
215             _log.error(se, se);
216 
217             throw se;
218         }
219     }
220 
221     private static Log _log = LogFactoryUtil.getLog(ListTypeServiceHttp.class);
222 }