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