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