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          boolean addCommunityPermissions, boolean addGuestPermissions)
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 = new BooleanWrapper(addCommunityPermissions);
120 
121             Object paramObj8 = new BooleanWrapper(addGuestPermissions);
122 
123             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
124                     "addStructure",
125                     new Object[] {
126                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
127                         paramObj5, paramObj6, paramObj7, paramObj8
128                     });
129 
130             Object returnObj = null;
131 
132             try {
133                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
134             }
135             catch (Exception e) {
136                 if (e instanceof com.liferay.portal.PortalException) {
137                     throw (com.liferay.portal.PortalException)e;
138                 }
139 
140                 if (e instanceof com.liferay.portal.SystemException) {
141                     throw (com.liferay.portal.SystemException)e;
142                 }
143 
144                 throw new com.liferay.portal.SystemException(e);
145             }
146 
147             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
148         }
149         catch (com.liferay.portal.SystemException se) {
150             _log.error(se, se);
151 
152             throw se;
153         }
154     }
155 
156     public static com.liferay.portlet.journal.model.JournalStructure addStructure(
157         HttpPrincipal httpPrincipal, long groupId,
158         java.lang.String structureId, boolean autoStructureId,
159         java.lang.String parentStructureId, java.lang.String name,
160         java.lang.String description, java.lang.String xsd,
161         java.lang.String[] communityPermissions,
162         java.lang.String[] guestPermissions)
163         throws com.liferay.portal.PortalException,
164             com.liferay.portal.SystemException {
165         try {
166             Object paramObj0 = new LongWrapper(groupId);
167 
168             Object paramObj1 = structureId;
169 
170             if (structureId == null) {
171                 paramObj1 = new NullWrapper("java.lang.String");
172             }
173 
174             Object paramObj2 = new BooleanWrapper(autoStructureId);
175 
176             Object paramObj3 = parentStructureId;
177 
178             if (parentStructureId == null) {
179                 paramObj3 = new NullWrapper("java.lang.String");
180             }
181 
182             Object paramObj4 = name;
183 
184             if (name == null) {
185                 paramObj4 = new NullWrapper("java.lang.String");
186             }
187 
188             Object paramObj5 = description;
189 
190             if (description == null) {
191                 paramObj5 = new NullWrapper("java.lang.String");
192             }
193 
194             Object paramObj6 = xsd;
195 
196             if (xsd == null) {
197                 paramObj6 = new NullWrapper("java.lang.String");
198             }
199 
200             Object paramObj7 = communityPermissions;
201 
202             if (communityPermissions == null) {
203                 paramObj7 = new NullWrapper("[Ljava.lang.String;");
204             }
205 
206             Object paramObj8 = guestPermissions;
207 
208             if (guestPermissions == null) {
209                 paramObj8 = new NullWrapper("[Ljava.lang.String;");
210             }
211 
212             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
213                     "addStructure",
214                     new Object[] {
215                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
216                         paramObj5, paramObj6, paramObj7, paramObj8
217                     });
218 
219             Object returnObj = null;
220 
221             try {
222                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
223             }
224             catch (Exception e) {
225                 if (e instanceof com.liferay.portal.PortalException) {
226                     throw (com.liferay.portal.PortalException)e;
227                 }
228 
229                 if (e instanceof com.liferay.portal.SystemException) {
230                     throw (com.liferay.portal.SystemException)e;
231                 }
232 
233                 throw new com.liferay.portal.SystemException(e);
234             }
235 
236             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
237         }
238         catch (com.liferay.portal.SystemException se) {
239             _log.error(se, se);
240 
241             throw se;
242         }
243     }
244 
245     public static com.liferay.portlet.journal.model.JournalStructure copyStructure(
246         HttpPrincipal httpPrincipal, long groupId,
247         java.lang.String oldStructureId, java.lang.String newStructureId,
248         boolean autoStructureId)
249         throws com.liferay.portal.PortalException,
250             com.liferay.portal.SystemException {
251         try {
252             Object paramObj0 = new LongWrapper(groupId);
253 
254             Object paramObj1 = oldStructureId;
255 
256             if (oldStructureId == null) {
257                 paramObj1 = new NullWrapper("java.lang.String");
258             }
259 
260             Object paramObj2 = newStructureId;
261 
262             if (newStructureId == null) {
263                 paramObj2 = new NullWrapper("java.lang.String");
264             }
265 
266             Object paramObj3 = new BooleanWrapper(autoStructureId);
267 
268             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
269                     "copyStructure",
270                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
271 
272             Object returnObj = null;
273 
274             try {
275                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
276             }
277             catch (Exception e) {
278                 if (e instanceof com.liferay.portal.PortalException) {
279                     throw (com.liferay.portal.PortalException)e;
280                 }
281 
282                 if (e instanceof com.liferay.portal.SystemException) {
283                     throw (com.liferay.portal.SystemException)e;
284                 }
285 
286                 throw new com.liferay.portal.SystemException(e);
287             }
288 
289             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
290         }
291         catch (com.liferay.portal.SystemException se) {
292             _log.error(se, se);
293 
294             throw se;
295         }
296     }
297 
298     public static void deleteStructure(HttpPrincipal httpPrincipal,
299         long groupId, java.lang.String structureId)
300         throws com.liferay.portal.PortalException,
301             com.liferay.portal.SystemException {
302         try {
303             Object paramObj0 = new LongWrapper(groupId);
304 
305             Object paramObj1 = structureId;
306 
307             if (structureId == null) {
308                 paramObj1 = new NullWrapper("java.lang.String");
309             }
310 
311             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
312                     "deleteStructure", new Object[] { paramObj0, paramObj1 });
313 
314             try {
315                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
316             }
317             catch (Exception e) {
318                 if (e instanceof com.liferay.portal.PortalException) {
319                     throw (com.liferay.portal.PortalException)e;
320                 }
321 
322                 if (e instanceof com.liferay.portal.SystemException) {
323                     throw (com.liferay.portal.SystemException)e;
324                 }
325 
326                 throw new com.liferay.portal.SystemException(e);
327             }
328         }
329         catch (com.liferay.portal.SystemException se) {
330             _log.error(se, se);
331 
332             throw se;
333         }
334     }
335 
336     public static com.liferay.portlet.journal.model.JournalStructure getStructure(
337         HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
338         throws com.liferay.portal.PortalException,
339             com.liferay.portal.SystemException {
340         try {
341             Object paramObj0 = new LongWrapper(groupId);
342 
343             Object paramObj1 = structureId;
344 
345             if (structureId == null) {
346                 paramObj1 = new NullWrapper("java.lang.String");
347             }
348 
349             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
350                     "getStructure", new Object[] { paramObj0, paramObj1 });
351 
352             Object returnObj = null;
353 
354             try {
355                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
356             }
357             catch (Exception e) {
358                 if (e instanceof com.liferay.portal.PortalException) {
359                     throw (com.liferay.portal.PortalException)e;
360                 }
361 
362                 if (e instanceof com.liferay.portal.SystemException) {
363                     throw (com.liferay.portal.SystemException)e;
364                 }
365 
366                 throw new com.liferay.portal.SystemException(e);
367             }
368 
369             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
370         }
371         catch (com.liferay.portal.SystemException se) {
372             _log.error(se, se);
373 
374             throw se;
375         }
376     }
377 
378     public static com.liferay.portlet.journal.model.JournalStructure updateStructure(
379         HttpPrincipal httpPrincipal, long groupId,
380         java.lang.String structureId, java.lang.String parentStructureId,
381         java.lang.String name, java.lang.String description,
382         java.lang.String xsd)
383         throws com.liferay.portal.PortalException,
384             com.liferay.portal.SystemException {
385         try {
386             Object paramObj0 = new LongWrapper(groupId);
387 
388             Object paramObj1 = structureId;
389 
390             if (structureId == null) {
391                 paramObj1 = new NullWrapper("java.lang.String");
392             }
393 
394             Object paramObj2 = parentStructureId;
395 
396             if (parentStructureId == null) {
397                 paramObj2 = new NullWrapper("java.lang.String");
398             }
399 
400             Object paramObj3 = name;
401 
402             if (name == null) {
403                 paramObj3 = new NullWrapper("java.lang.String");
404             }
405 
406             Object paramObj4 = description;
407 
408             if (description == null) {
409                 paramObj4 = new NullWrapper("java.lang.String");
410             }
411 
412             Object paramObj5 = xsd;
413 
414             if (xsd == null) {
415                 paramObj5 = new NullWrapper("java.lang.String");
416             }
417 
418             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
419                     "updateStructure",
420                     new Object[] {
421                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
422                         paramObj5
423                     });
424 
425             Object returnObj = null;
426 
427             try {
428                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
429             }
430             catch (Exception e) {
431                 if (e instanceof com.liferay.portal.PortalException) {
432                     throw (com.liferay.portal.PortalException)e;
433                 }
434 
435                 if (e instanceof com.liferay.portal.SystemException) {
436                     throw (com.liferay.portal.SystemException)e;
437                 }
438 
439                 throw new com.liferay.portal.SystemException(e);
440             }
441 
442             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
443         }
444         catch (com.liferay.portal.SystemException se) {
445             _log.error(se, se);
446 
447             throw se;
448         }
449     }
450 
451     private static Log _log = LogFactoryUtil.getLog(JournalStructureServiceHttp.class);
452 }