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