1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.journal.service.http;
21  
22  import com.liferay.portal.kernel.log.Log;
23  import com.liferay.portal.kernel.log.LogFactoryUtil;
24  import com.liferay.portal.kernel.util.BooleanWrapper;
25  import com.liferay.portal.kernel.util.LongWrapper;
26  import com.liferay.portal.kernel.util.MethodWrapper;
27  import com.liferay.portal.kernel.util.NullWrapper;
28  import com.liferay.portal.security.auth.HttpPrincipal;
29  import com.liferay.portal.service.http.TunnelUtil;
30  
31  import com.liferay.portlet.journal.service.JournalStructureServiceUtil;
32  
33  /**
34   * <a href="JournalStructureServiceHttp.java.html"><b><i>View Source</i></b></a>
35   *
36   * <p>
37   * ServiceBuilder generated this class. Modifications in this class will be
38   * overwritten the next time is generated.
39   * </p>
40   *
41   * <p>
42   * This class provides a HTTP utility for the
43   * <code>com.liferay.portlet.journal.service.JournalStructureServiceUtil</code> service
44   * utility. The static methods of this class calls the same methods of the
45   * service utility. However, the signatures are different because it requires an
46   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
47   * parameter.
48   * </p>
49   *
50   * <p>
51   * The benefits of using the HTTP utility is that it is fast and allows for
52   * tunneling without the cost of serializing to text. The drawback is that it
53   * only works with Java.
54   * </p>
55   *
56   * <p>
57   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
58   * portal.properties to configure security.
59   * </p>
60   *
61   * <p>
62   * The HTTP utility is only generated for remote services.
63   * </p>
64   *
65   * @author Brian Wing Shun Chan
66   *
67   * @see com.liferay.portal.security.auth.HttpPrincipal
68   * @see com.liferay.portlet.journal.service.JournalStructureServiceUtil
69   * @see com.liferay.portlet.journal.service.http.JournalStructureServiceSoap
70   *
71   */
72  public class JournalStructureServiceHttp {
73      public static com.liferay.portlet.journal.model.JournalStructure addStructure(
74          HttpPrincipal httpPrincipal, java.lang.String structureId,
75          boolean autoStructureId, long plid, java.lang.String name,
76          java.lang.String description, java.lang.String xsd,
77          boolean addCommunityPermissions, boolean addGuestPermissions)
78          throws com.liferay.portal.PortalException,
79              com.liferay.portal.SystemException {
80          try {
81              Object paramObj0 = structureId;
82  
83              if (structureId == null) {
84                  paramObj0 = new NullWrapper("java.lang.String");
85              }
86  
87              Object paramObj1 = new BooleanWrapper(autoStructureId);
88  
89              Object paramObj2 = new LongWrapper(plid);
90  
91              Object paramObj3 = name;
92  
93              if (name == null) {
94                  paramObj3 = new NullWrapper("java.lang.String");
95              }
96  
97              Object paramObj4 = description;
98  
99              if (description == null) {
100                 paramObj4 = new NullWrapper("java.lang.String");
101             }
102 
103             Object paramObj5 = xsd;
104 
105             if (xsd == null) {
106                 paramObj5 = new NullWrapper("java.lang.String");
107             }
108 
109             Object paramObj6 = new BooleanWrapper(addCommunityPermissions);
110 
111             Object paramObj7 = new BooleanWrapper(addGuestPermissions);
112 
113             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
114                     "addStructure",
115                     new Object[] {
116                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
117                         paramObj5, paramObj6, paramObj7
118                     });
119 
120             Object returnObj = null;
121 
122             try {
123                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
124             }
125             catch (Exception e) {
126                 if (e instanceof com.liferay.portal.PortalException) {
127                     throw (com.liferay.portal.PortalException)e;
128                 }
129 
130                 if (e instanceof com.liferay.portal.SystemException) {
131                     throw (com.liferay.portal.SystemException)e;
132                 }
133 
134                 throw new com.liferay.portal.SystemException(e);
135             }
136 
137             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
138         }
139         catch (com.liferay.portal.SystemException se) {
140             _log.error(se, se);
141 
142             throw se;
143         }
144     }
145 
146     public static com.liferay.portlet.journal.model.JournalStructure addStructure(
147         HttpPrincipal httpPrincipal, java.lang.String structureId,
148         boolean autoStructureId, long plid, java.lang.String name,
149         java.lang.String description, java.lang.String xsd,
150         java.lang.String[] communityPermissions,
151         java.lang.String[] guestPermissions)
152         throws com.liferay.portal.PortalException,
153             com.liferay.portal.SystemException {
154         try {
155             Object paramObj0 = structureId;
156 
157             if (structureId == null) {
158                 paramObj0 = new NullWrapper("java.lang.String");
159             }
160 
161             Object paramObj1 = new BooleanWrapper(autoStructureId);
162 
163             Object paramObj2 = new LongWrapper(plid);
164 
165             Object paramObj3 = name;
166 
167             if (name == null) {
168                 paramObj3 = new NullWrapper("java.lang.String");
169             }
170 
171             Object paramObj4 = description;
172 
173             if (description == null) {
174                 paramObj4 = new NullWrapper("java.lang.String");
175             }
176 
177             Object paramObj5 = xsd;
178 
179             if (xsd == null) {
180                 paramObj5 = new NullWrapper("java.lang.String");
181             }
182 
183             Object paramObj6 = communityPermissions;
184 
185             if (communityPermissions == null) {
186                 paramObj6 = new NullWrapper("[Ljava.lang.String;");
187             }
188 
189             Object paramObj7 = guestPermissions;
190 
191             if (guestPermissions == null) {
192                 paramObj7 = new NullWrapper("[Ljava.lang.String;");
193             }
194 
195             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
196                     "addStructure",
197                     new Object[] {
198                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
199                         paramObj5, paramObj6, paramObj7
200                     });
201 
202             Object returnObj = null;
203 
204             try {
205                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
206             }
207             catch (Exception e) {
208                 if (e instanceof com.liferay.portal.PortalException) {
209                     throw (com.liferay.portal.PortalException)e;
210                 }
211 
212                 if (e instanceof com.liferay.portal.SystemException) {
213                     throw (com.liferay.portal.SystemException)e;
214                 }
215 
216                 throw new com.liferay.portal.SystemException(e);
217             }
218 
219             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
220         }
221         catch (com.liferay.portal.SystemException se) {
222             _log.error(se, se);
223 
224             throw se;
225         }
226     }
227 
228     public static com.liferay.portlet.journal.model.JournalStructure copyStructure(
229         HttpPrincipal httpPrincipal, long groupId,
230         java.lang.String oldStructureId, java.lang.String newStructureId,
231         boolean autoStructureId)
232         throws com.liferay.portal.PortalException,
233             com.liferay.portal.SystemException {
234         try {
235             Object paramObj0 = new LongWrapper(groupId);
236 
237             Object paramObj1 = oldStructureId;
238 
239             if (oldStructureId == null) {
240                 paramObj1 = new NullWrapper("java.lang.String");
241             }
242 
243             Object paramObj2 = newStructureId;
244 
245             if (newStructureId == null) {
246                 paramObj2 = new NullWrapper("java.lang.String");
247             }
248 
249             Object paramObj3 = new BooleanWrapper(autoStructureId);
250 
251             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
252                     "copyStructure",
253                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
254 
255             Object returnObj = null;
256 
257             try {
258                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
259             }
260             catch (Exception e) {
261                 if (e instanceof com.liferay.portal.PortalException) {
262                     throw (com.liferay.portal.PortalException)e;
263                 }
264 
265                 if (e instanceof com.liferay.portal.SystemException) {
266                     throw (com.liferay.portal.SystemException)e;
267                 }
268 
269                 throw new com.liferay.portal.SystemException(e);
270             }
271 
272             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
273         }
274         catch (com.liferay.portal.SystemException se) {
275             _log.error(se, se);
276 
277             throw se;
278         }
279     }
280 
281     public static void deleteStructure(HttpPrincipal httpPrincipal,
282         long groupId, java.lang.String structureId)
283         throws com.liferay.portal.PortalException,
284             com.liferay.portal.SystemException {
285         try {
286             Object paramObj0 = new LongWrapper(groupId);
287 
288             Object paramObj1 = structureId;
289 
290             if (structureId == null) {
291                 paramObj1 = new NullWrapper("java.lang.String");
292             }
293 
294             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
295                     "deleteStructure", new Object[] { paramObj0, paramObj1 });
296 
297             try {
298                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
299             }
300             catch (Exception e) {
301                 if (e instanceof com.liferay.portal.PortalException) {
302                     throw (com.liferay.portal.PortalException)e;
303                 }
304 
305                 if (e instanceof com.liferay.portal.SystemException) {
306                     throw (com.liferay.portal.SystemException)e;
307                 }
308 
309                 throw new com.liferay.portal.SystemException(e);
310             }
311         }
312         catch (com.liferay.portal.SystemException se) {
313             _log.error(se, se);
314 
315             throw se;
316         }
317     }
318 
319     public static com.liferay.portlet.journal.model.JournalStructure getStructure(
320         HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
321         throws com.liferay.portal.PortalException,
322             com.liferay.portal.SystemException {
323         try {
324             Object paramObj0 = new LongWrapper(groupId);
325 
326             Object paramObj1 = structureId;
327 
328             if (structureId == null) {
329                 paramObj1 = new NullWrapper("java.lang.String");
330             }
331 
332             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
333                     "getStructure", new Object[] { paramObj0, paramObj1 });
334 
335             Object returnObj = null;
336 
337             try {
338                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
339             }
340             catch (Exception e) {
341                 if (e instanceof com.liferay.portal.PortalException) {
342                     throw (com.liferay.portal.PortalException)e;
343                 }
344 
345                 if (e instanceof com.liferay.portal.SystemException) {
346                     throw (com.liferay.portal.SystemException)e;
347                 }
348 
349                 throw new com.liferay.portal.SystemException(e);
350             }
351 
352             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
353         }
354         catch (com.liferay.portal.SystemException se) {
355             _log.error(se, se);
356 
357             throw se;
358         }
359     }
360 
361     public static com.liferay.portlet.journal.model.JournalStructure updateStructure(
362         HttpPrincipal httpPrincipal, long groupId,
363         java.lang.String structureId, java.lang.String name,
364         java.lang.String description, java.lang.String xsd)
365         throws com.liferay.portal.PortalException,
366             com.liferay.portal.SystemException {
367         try {
368             Object paramObj0 = new LongWrapper(groupId);
369 
370             Object paramObj1 = structureId;
371 
372             if (structureId == null) {
373                 paramObj1 = new NullWrapper("java.lang.String");
374             }
375 
376             Object paramObj2 = name;
377 
378             if (name == null) {
379                 paramObj2 = new NullWrapper("java.lang.String");
380             }
381 
382             Object paramObj3 = description;
383 
384             if (description == null) {
385                 paramObj3 = new NullWrapper("java.lang.String");
386             }
387 
388             Object paramObj4 = xsd;
389 
390             if (xsd == null) {
391                 paramObj4 = new NullWrapper("java.lang.String");
392             }
393 
394             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
395                     "updateStructure",
396                     new Object[] {
397                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
398                     });
399 
400             Object returnObj = null;
401 
402             try {
403                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
404             }
405             catch (Exception e) {
406                 if (e instanceof com.liferay.portal.PortalException) {
407                     throw (com.liferay.portal.PortalException)e;
408                 }
409 
410                 if (e instanceof com.liferay.portal.SystemException) {
411                     throw (com.liferay.portal.SystemException)e;
412                 }
413 
414                 throw new com.liferay.portal.SystemException(e);
415             }
416 
417             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
418         }
419         catch (com.liferay.portal.SystemException se) {
420             _log.error(se, se);
421 
422             throw se;
423         }
424     }
425 
426     private static Log _log = LogFactoryUtil.getLog(JournalStructureServiceHttp.class);
427 }