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.BooleanWrapper;
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.LayoutSetPrototypeServiceUtil;
25  
26  /**
27   * <a href="LayoutSetPrototypeServiceHttp.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.LayoutSetPrototypeServiceUtil} 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       LayoutSetPrototypeServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portal.service.LayoutSetPrototypeServiceUtil
61   * @generated
62   */
63  public class LayoutSetPrototypeServiceHttp {
64      public static com.liferay.portal.model.LayoutSetPrototype addLayoutSetPrototype(
65          HttpPrincipal httpPrincipal,
66          java.util.Map<java.util.Locale, String> nameMap,
67          java.lang.String description, boolean active)
68          throws com.liferay.portal.kernel.exception.PortalException,
69              com.liferay.portal.kernel.exception.SystemException {
70          try {
71              Object paramObj0 = nameMap;
72  
73              if (nameMap == null) {
74                  paramObj0 = new NullWrapper("java.util.Map");
75              }
76  
77              Object paramObj1 = description;
78  
79              if (description == null) {
80                  paramObj1 = new NullWrapper("java.lang.String");
81              }
82  
83              Object paramObj2 = new BooleanWrapper(active);
84  
85              MethodWrapper methodWrapper = new MethodWrapper(LayoutSetPrototypeServiceUtil.class.getName(),
86                      "addLayoutSetPrototype",
87                      new Object[] { paramObj0, paramObj1, paramObj2 });
88  
89              Object returnObj = null;
90  
91              try {
92                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
93              }
94              catch (Exception e) {
95                  if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
96                      throw (com.liferay.portal.kernel.exception.PortalException)e;
97                  }
98  
99                  if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
100                     throw (com.liferay.portal.kernel.exception.SystemException)e;
101                 }
102 
103                 throw new com.liferay.portal.kernel.exception.SystemException(e);
104             }
105 
106             return (com.liferay.portal.model.LayoutSetPrototype)returnObj;
107         }
108         catch (com.liferay.portal.kernel.exception.SystemException se) {
109             _log.error(se, se);
110 
111             throw se;
112         }
113     }
114 
115     public static void deleteLayoutSetPrototype(HttpPrincipal httpPrincipal,
116         long layoutSetPrototypeId)
117         throws com.liferay.portal.kernel.exception.PortalException,
118             com.liferay.portal.kernel.exception.SystemException {
119         try {
120             Object paramObj0 = new LongWrapper(layoutSetPrototypeId);
121 
122             MethodWrapper methodWrapper = new MethodWrapper(LayoutSetPrototypeServiceUtil.class.getName(),
123                     "deleteLayoutSetPrototype", new Object[] { paramObj0 });
124 
125             try {
126                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
127             }
128             catch (Exception e) {
129                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
130                     throw (com.liferay.portal.kernel.exception.PortalException)e;
131                 }
132 
133                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
134                     throw (com.liferay.portal.kernel.exception.SystemException)e;
135                 }
136 
137                 throw new com.liferay.portal.kernel.exception.SystemException(e);
138             }
139         }
140         catch (com.liferay.portal.kernel.exception.SystemException se) {
141             _log.error(se, se);
142 
143             throw se;
144         }
145     }
146 
147     public static com.liferay.portal.model.LayoutSetPrototype getLayoutSetPrototype(
148         HttpPrincipal httpPrincipal, long layoutSetPrototypeId)
149         throws com.liferay.portal.kernel.exception.PortalException,
150             com.liferay.portal.kernel.exception.SystemException {
151         try {
152             Object paramObj0 = new LongWrapper(layoutSetPrototypeId);
153 
154             MethodWrapper methodWrapper = new MethodWrapper(LayoutSetPrototypeServiceUtil.class.getName(),
155                     "getLayoutSetPrototype", new Object[] { paramObj0 });
156 
157             Object returnObj = null;
158 
159             try {
160                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
161             }
162             catch (Exception e) {
163                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
164                     throw (com.liferay.portal.kernel.exception.PortalException)e;
165                 }
166 
167                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
168                     throw (com.liferay.portal.kernel.exception.SystemException)e;
169                 }
170 
171                 throw new com.liferay.portal.kernel.exception.SystemException(e);
172             }
173 
174             return (com.liferay.portal.model.LayoutSetPrototype)returnObj;
175         }
176         catch (com.liferay.portal.kernel.exception.SystemException se) {
177             _log.error(se, se);
178 
179             throw se;
180         }
181     }
182 
183     public static java.util.List<com.liferay.portal.model.LayoutSetPrototype> search(
184         HttpPrincipal httpPrincipal, long companyId, java.lang.Boolean active,
185         com.liferay.portal.kernel.util.OrderByComparator obc)
186         throws com.liferay.portal.kernel.exception.PortalException,
187             com.liferay.portal.kernel.exception.SystemException {
188         try {
189             Object paramObj0 = new LongWrapper(companyId);
190 
191             Object paramObj1 = active;
192 
193             if (active == null) {
194                 paramObj1 = new NullWrapper("java.lang.Boolean");
195             }
196 
197             Object paramObj2 = obc;
198 
199             if (obc == null) {
200                 paramObj2 = new NullWrapper(
201                         "com.liferay.portal.kernel.util.OrderByComparator");
202             }
203 
204             MethodWrapper methodWrapper = new MethodWrapper(LayoutSetPrototypeServiceUtil.class.getName(),
205                     "search", new Object[] { paramObj0, paramObj1, paramObj2 });
206 
207             Object returnObj = null;
208 
209             try {
210                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
211             }
212             catch (Exception e) {
213                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
214                     throw (com.liferay.portal.kernel.exception.PortalException)e;
215                 }
216 
217                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
218                     throw (com.liferay.portal.kernel.exception.SystemException)e;
219                 }
220 
221                 throw new com.liferay.portal.kernel.exception.SystemException(e);
222             }
223 
224             return (java.util.List<com.liferay.portal.model.LayoutSetPrototype>)returnObj;
225         }
226         catch (com.liferay.portal.kernel.exception.SystemException se) {
227             _log.error(se, se);
228 
229             throw se;
230         }
231     }
232 
233     public static com.liferay.portal.model.LayoutSetPrototype updateLayoutSetPrototype(
234         HttpPrincipal httpPrincipal, long layoutSetPrototypeId,
235         java.util.Map<java.util.Locale, String> nameMap,
236         java.lang.String description, boolean active)
237         throws com.liferay.portal.kernel.exception.PortalException,
238             com.liferay.portal.kernel.exception.SystemException {
239         try {
240             Object paramObj0 = new LongWrapper(layoutSetPrototypeId);
241 
242             Object paramObj1 = nameMap;
243 
244             if (nameMap == null) {
245                 paramObj1 = new NullWrapper("java.util.Map");
246             }
247 
248             Object paramObj2 = description;
249 
250             if (description == null) {
251                 paramObj2 = new NullWrapper("java.lang.String");
252             }
253 
254             Object paramObj3 = new BooleanWrapper(active);
255 
256             MethodWrapper methodWrapper = new MethodWrapper(LayoutSetPrototypeServiceUtil.class.getName(),
257                     "updateLayoutSetPrototype",
258                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
259 
260             Object returnObj = null;
261 
262             try {
263                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
264             }
265             catch (Exception e) {
266                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
267                     throw (com.liferay.portal.kernel.exception.PortalException)e;
268                 }
269 
270                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
271                     throw (com.liferay.portal.kernel.exception.SystemException)e;
272                 }
273 
274                 throw new com.liferay.portal.kernel.exception.SystemException(e);
275             }
276 
277             return (com.liferay.portal.model.LayoutSetPrototype)returnObj;
278         }
279         catch (com.liferay.portal.kernel.exception.SystemException se) {
280             _log.error(se, se);
281 
282             throw se;
283         }
284     }
285 
286     private static Log _log = LogFactoryUtil.getLog(LayoutSetPrototypeServiceHttp.class);
287 }