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.portlet.journal.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.http.TunnelUtil;
25  
26  import com.liferay.portlet.journal.service.JournalStructureServiceUtil;
27  
28  /**
29   * <a href="JournalStructureServiceHttp.java.html"><b><i>View Source</i></b></a>
30   *
31   * <p>
32   * ServiceBuilder generated this class. Modifications in this class will be
33   * overwritten the next time is generated.
34   * </p>
35   *
36   * <p>
37   * This class provides a HTTP utility for the
38   * {@link com.liferay.portlet.journal.service.JournalStructureServiceUtil} service utility. The
39   * static methods of this class calls the same methods of the service utility.
40   * However, the signatures are different because it requires an additional
41   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
42   * </p>
43   *
44   * <p>
45   * The benefits of using the HTTP utility is that it is fast and allows for
46   * tunneling without the cost of serializing to text. The drawback is that it
47   * only works with Java.
48   * </p>
49   *
50   * <p>
51   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
52   * configure security.
53   * </p>
54   *
55   * <p>
56   * The HTTP utility is only generated for remote services.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       JournalStructureServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.journal.service.JournalStructureServiceUtil
63   * @generated
64   */
65  public class JournalStructureServiceHttp {
66      public static com.liferay.portlet.journal.model.JournalStructure addStructure(
67          HttpPrincipal httpPrincipal, long groupId,
68          java.lang.String structureId, boolean autoStructureId,
69          java.lang.String parentStructureId, java.lang.String name,
70          java.lang.String description, java.lang.String xsd,
71          com.liferay.portal.service.ServiceContext serviceContext)
72          throws com.liferay.portal.kernel.exception.PortalException,
73              com.liferay.portal.kernel.exception.SystemException {
74          try {
75              Object paramObj0 = new LongWrapper(groupId);
76  
77              Object paramObj1 = structureId;
78  
79              if (structureId == null) {
80                  paramObj1 = new NullWrapper("java.lang.String");
81              }
82  
83              Object paramObj2 = new BooleanWrapper(autoStructureId);
84  
85              Object paramObj3 = parentStructureId;
86  
87              if (parentStructureId == null) {
88                  paramObj3 = new NullWrapper("java.lang.String");
89              }
90  
91              Object paramObj4 = name;
92  
93              if (name == null) {
94                  paramObj4 = new NullWrapper("java.lang.String");
95              }
96  
97              Object paramObj5 = description;
98  
99              if (description == null) {
100                 paramObj5 = new NullWrapper("java.lang.String");
101             }
102 
103             Object paramObj6 = xsd;
104 
105             if (xsd == null) {
106                 paramObj6 = new NullWrapper("java.lang.String");
107             }
108 
109             Object paramObj7 = serviceContext;
110 
111             if (serviceContext == null) {
112                 paramObj7 = new NullWrapper(
113                         "com.liferay.portal.service.ServiceContext");
114             }
115 
116             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
117                     "addStructure",
118                     new Object[] {
119                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
120                         paramObj5, paramObj6, paramObj7
121                     });
122 
123             Object returnObj = null;
124 
125             try {
126                 returnObj = 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             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
141         }
142         catch (com.liferay.portal.kernel.exception.SystemException se) {
143             _log.error(se, se);
144 
145             throw se;
146         }
147     }
148 
149     public static com.liferay.portlet.journal.model.JournalStructure copyStructure(
150         HttpPrincipal httpPrincipal, long groupId,
151         java.lang.String oldStructureId, java.lang.String newStructureId,
152         boolean autoStructureId)
153         throws com.liferay.portal.kernel.exception.PortalException,
154             com.liferay.portal.kernel.exception.SystemException {
155         try {
156             Object paramObj0 = new LongWrapper(groupId);
157 
158             Object paramObj1 = oldStructureId;
159 
160             if (oldStructureId == null) {
161                 paramObj1 = new NullWrapper("java.lang.String");
162             }
163 
164             Object paramObj2 = newStructureId;
165 
166             if (newStructureId == null) {
167                 paramObj2 = new NullWrapper("java.lang.String");
168             }
169 
170             Object paramObj3 = new BooleanWrapper(autoStructureId);
171 
172             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
173                     "copyStructure",
174                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
175 
176             Object returnObj = null;
177 
178             try {
179                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
180             }
181             catch (Exception e) {
182                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
183                     throw (com.liferay.portal.kernel.exception.PortalException)e;
184                 }
185 
186                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
187                     throw (com.liferay.portal.kernel.exception.SystemException)e;
188                 }
189 
190                 throw new com.liferay.portal.kernel.exception.SystemException(e);
191             }
192 
193             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
194         }
195         catch (com.liferay.portal.kernel.exception.SystemException se) {
196             _log.error(se, se);
197 
198             throw se;
199         }
200     }
201 
202     public static void deleteStructure(HttpPrincipal httpPrincipal,
203         long groupId, java.lang.String structureId)
204         throws com.liferay.portal.kernel.exception.PortalException,
205             com.liferay.portal.kernel.exception.SystemException {
206         try {
207             Object paramObj0 = new LongWrapper(groupId);
208 
209             Object paramObj1 = structureId;
210 
211             if (structureId == null) {
212                 paramObj1 = new NullWrapper("java.lang.String");
213             }
214 
215             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
216                     "deleteStructure", new Object[] { paramObj0, paramObj1 });
217 
218             try {
219                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
220             }
221             catch (Exception e) {
222                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
223                     throw (com.liferay.portal.kernel.exception.PortalException)e;
224                 }
225 
226                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
227                     throw (com.liferay.portal.kernel.exception.SystemException)e;
228                 }
229 
230                 throw new com.liferay.portal.kernel.exception.SystemException(e);
231             }
232         }
233         catch (com.liferay.portal.kernel.exception.SystemException se) {
234             _log.error(se, se);
235 
236             throw se;
237         }
238     }
239 
240     public static com.liferay.portlet.journal.model.JournalStructure getStructure(
241         HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
242         throws com.liferay.portal.kernel.exception.PortalException,
243             com.liferay.portal.kernel.exception.SystemException {
244         try {
245             Object paramObj0 = new LongWrapper(groupId);
246 
247             Object paramObj1 = structureId;
248 
249             if (structureId == null) {
250                 paramObj1 = new NullWrapper("java.lang.String");
251             }
252 
253             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
254                     "getStructure", new Object[] { paramObj0, paramObj1 });
255 
256             Object returnObj = null;
257 
258             try {
259                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
260             }
261             catch (Exception e) {
262                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
263                     throw (com.liferay.portal.kernel.exception.PortalException)e;
264                 }
265 
266                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
267                     throw (com.liferay.portal.kernel.exception.SystemException)e;
268                 }
269 
270                 throw new com.liferay.portal.kernel.exception.SystemException(e);
271             }
272 
273             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
274         }
275         catch (com.liferay.portal.kernel.exception.SystemException se) {
276             _log.error(se, se);
277 
278             throw se;
279         }
280     }
281 
282     public static com.liferay.portlet.journal.model.JournalStructure updateStructure(
283         HttpPrincipal httpPrincipal, long groupId,
284         java.lang.String structureId, java.lang.String parentStructureId,
285         java.lang.String name, java.lang.String description,
286         java.lang.String xsd,
287         com.liferay.portal.service.ServiceContext serviceContext)
288         throws com.liferay.portal.kernel.exception.PortalException,
289             com.liferay.portal.kernel.exception.SystemException {
290         try {
291             Object paramObj0 = new LongWrapper(groupId);
292 
293             Object paramObj1 = structureId;
294 
295             if (structureId == null) {
296                 paramObj1 = new NullWrapper("java.lang.String");
297             }
298 
299             Object paramObj2 = parentStructureId;
300 
301             if (parentStructureId == null) {
302                 paramObj2 = new NullWrapper("java.lang.String");
303             }
304 
305             Object paramObj3 = name;
306 
307             if (name == null) {
308                 paramObj3 = new NullWrapper("java.lang.String");
309             }
310 
311             Object paramObj4 = description;
312 
313             if (description == null) {
314                 paramObj4 = new NullWrapper("java.lang.String");
315             }
316 
317             Object paramObj5 = xsd;
318 
319             if (xsd == null) {
320                 paramObj5 = new NullWrapper("java.lang.String");
321             }
322 
323             Object paramObj6 = serviceContext;
324 
325             if (serviceContext == null) {
326                 paramObj6 = new NullWrapper(
327                         "com.liferay.portal.service.ServiceContext");
328             }
329 
330             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
331                     "updateStructure",
332                     new Object[] {
333                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
334                         paramObj5, paramObj6
335                     });
336 
337             Object returnObj = null;
338 
339             try {
340                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
341             }
342             catch (Exception e) {
343                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
344                     throw (com.liferay.portal.kernel.exception.PortalException)e;
345                 }
346 
347                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
348                     throw (com.liferay.portal.kernel.exception.SystemException)e;
349                 }
350 
351                 throw new com.liferay.portal.kernel.exception.SystemException(e);
352             }
353 
354             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
355         }
356         catch (com.liferay.portal.kernel.exception.SystemException se) {
357             _log.error(se, se);
358 
359             throw se;
360         }
361     }
362 
363     private static Log _log = LogFactoryUtil.getLog(JournalStructureServiceHttp.class);
364 }