1   /**
2    * Copyright (c) 2000-2010 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   *
12   *
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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.ListTypeServiceUtil;
23  
24  /**
25   * <a href="ListTypeServiceHttp.java.html"><b><i>View Source</i></b></a>
26   *
27   * <p>
28   * ServiceBuilder generated this class. Modifications in this class will be
29   * overwritten the next time is generated.
30   * </p>
31   *
32   * <p>
33   * This class provides a HTTP utility for the
34   * {@link com.liferay.portal.service.ListTypeServiceUtil} service utility. The
35   * static methods of this class calls the same methods of the service utility.
36   * However, the signatures are different because it requires an additional
37   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
38   * </p>
39   *
40   * <p>
41   * The benefits of using the HTTP utility is that it is fast and allows for
42   * tunneling without the cost of serializing to text. The drawback is that it
43   * only works with Java.
44   * </p>
45   *
46   * <p>
47   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
48   * configure security.
49   * </p>
50   *
51   * <p>
52   * The HTTP utility is only generated for remote services.
53   * </p>
54   *
55   * @author    Brian Wing Shun Chan
56   * @see       ListTypeServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.ListTypeServiceUtil
59   * @generated
60   */
61  public class ListTypeServiceHttp {
62      public static com.liferay.portal.model.ListType getListType(
63          HttpPrincipal httpPrincipal, int listTypeId)
64          throws com.liferay.portal.PortalException,
65              com.liferay.portal.SystemException {
66          try {
67              MethodKey methodKey = new MethodKey(ListTypeServiceUtil.class.getName(),
68                      "getListType", _getListTypeParameterTypes0);
69  
70              MethodHandler methodHandler = new MethodHandler(methodKey,
71                      listTypeId);
72  
73              Object returnObj = null;
74  
75              try {
76                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
77              }
78              catch (Exception e) {
79                  if (e instanceof com.liferay.portal.PortalException) {
80                      throw (com.liferay.portal.PortalException)e;
81                  }
82  
83                  if (e instanceof com.liferay.portal.SystemException) {
84                      throw (com.liferay.portal.SystemException)e;
85                  }
86  
87                  throw new com.liferay.portal.SystemException(e);
88              }
89  
90              return (com.liferay.portal.model.ListType)returnObj;
91          }
92          catch (com.liferay.portal.SystemException se) {
93              _log.error(se, se);
94  
95              throw se;
96          }
97      }
98  
99      public static java.util.List<com.liferay.portal.model.ListType> getListTypes(
100         HttpPrincipal httpPrincipal, java.lang.String type)
101         throws com.liferay.portal.SystemException {
102         try {
103             MethodKey methodKey = new MethodKey(ListTypeServiceUtil.class.getName(),
104                     "getListTypes", _getListTypesParameterTypes1);
105 
106             MethodHandler methodHandler = new MethodHandler(methodKey, type);
107 
108             Object returnObj = null;
109 
110             try {
111                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
112             }
113             catch (Exception e) {
114                 if (e instanceof com.liferay.portal.SystemException) {
115                     throw (com.liferay.portal.SystemException)e;
116                 }
117 
118                 throw new com.liferay.portal.SystemException(e);
119             }
120 
121             return (java.util.List<com.liferay.portal.model.ListType>)returnObj;
122         }
123         catch (com.liferay.portal.SystemException se) {
124             _log.error(se, se);
125 
126             throw se;
127         }
128     }
129 
130     public static void validate(HttpPrincipal httpPrincipal, int listTypeId,
131         java.lang.String type)
132         throws com.liferay.portal.PortalException,
133             com.liferay.portal.SystemException {
134         try {
135             MethodKey methodKey = new MethodKey(ListTypeServiceUtil.class.getName(),
136                     "validate", _validateParameterTypes2);
137 
138             MethodHandler methodHandler = new MethodHandler(methodKey,
139                     listTypeId, type);
140 
141             try {
142                 TunnelUtil.invoke(httpPrincipal, methodHandler);
143             }
144             catch (Exception e) {
145                 if (e instanceof com.liferay.portal.PortalException) {
146                     throw (com.liferay.portal.PortalException)e;
147                 }
148 
149                 if (e instanceof com.liferay.portal.SystemException) {
150                     throw (com.liferay.portal.SystemException)e;
151                 }
152 
153                 throw new com.liferay.portal.SystemException(e);
154             }
155         }
156         catch (com.liferay.portal.SystemException se) {
157             _log.error(se, se);
158 
159             throw se;
160         }
161     }
162 
163     public static void validate(HttpPrincipal httpPrincipal, int listTypeId,
164         long classNameId, java.lang.String type)
165         throws com.liferay.portal.PortalException,
166             com.liferay.portal.SystemException {
167         try {
168             MethodKey methodKey = new MethodKey(ListTypeServiceUtil.class.getName(),
169                     "validate", _validateParameterTypes3);
170 
171             MethodHandler methodHandler = new MethodHandler(methodKey,
172                     listTypeId, classNameId, type);
173 
174             try {
175                 TunnelUtil.invoke(httpPrincipal, methodHandler);
176             }
177             catch (Exception e) {
178                 if (e instanceof com.liferay.portal.PortalException) {
179                     throw (com.liferay.portal.PortalException)e;
180                 }
181 
182                 if (e instanceof com.liferay.portal.SystemException) {
183                     throw (com.liferay.portal.SystemException)e;
184                 }
185 
186                 throw new com.liferay.portal.SystemException(e);
187             }
188         }
189         catch (com.liferay.portal.SystemException se) {
190             _log.error(se, se);
191 
192             throw se;
193         }
194     }
195 
196     private static Log _log = LogFactoryUtil.getLog(ListTypeServiceHttp.class);
197     private static final Class<?>[] _getListTypeParameterTypes0 = new Class[] {
198             int.class
199         };
200     private static final Class<?>[] _getListTypesParameterTypes1 = new Class[] {
201             java.lang.String.class
202         };
203     private static final Class<?>[] _validateParameterTypes2 = new Class[] {
204             int.class, java.lang.String.class
205         };
206     private static final Class<?>[] _validateParameterTypes3 = new Class[] {
207             int.class, long.class, java.lang.String.class
208         };
209 }