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