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.SystemException,
82              com.liferay.portal.PortalException {
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.SystemException) {
130                     throw (com.liferay.portal.SystemException)e;
131                 }
132 
133                 if (e instanceof com.liferay.portal.PortalException) {
134                     throw (com.liferay.portal.PortalException)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.SystemException,
156             com.liferay.portal.PortalException {
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.SystemException) {
212                     throw (com.liferay.portal.SystemException)e;
213                 }
214 
215                 if (e instanceof com.liferay.portal.PortalException) {
216                     throw (com.liferay.portal.PortalException)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 void deleteStructure(HttpPrincipal httpPrincipal,
232         long groupId, java.lang.String structureId)
233         throws com.liferay.portal.SystemException,
234             com.liferay.portal.PortalException {
235         try {
236             Object paramObj0 = new LongWrapper(groupId);
237 
238             Object paramObj1 = structureId;
239 
240             if (structureId == null) {
241                 paramObj1 = new NullWrapper("java.lang.String");
242             }
243 
244             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
245                     "deleteStructure", new Object[] { paramObj0, paramObj1 });
246 
247             try {
248                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
249             }
250             catch (Exception e) {
251                 if (e instanceof com.liferay.portal.SystemException) {
252                     throw (com.liferay.portal.SystemException)e;
253                 }
254 
255                 if (e instanceof com.liferay.portal.PortalException) {
256                     throw (com.liferay.portal.PortalException)e;
257                 }
258 
259                 throw new com.liferay.portal.SystemException(e);
260             }
261         }
262         catch (com.liferay.portal.SystemException se) {
263             _log.error(se, se);
264 
265             throw se;
266         }
267     }
268 
269     public static com.liferay.portlet.journal.model.JournalStructure getStructure(
270         HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
271         throws com.liferay.portal.SystemException,
272             com.liferay.portal.PortalException {
273         try {
274             Object paramObj0 = new LongWrapper(groupId);
275 
276             Object paramObj1 = structureId;
277 
278             if (structureId == null) {
279                 paramObj1 = new NullWrapper("java.lang.String");
280             }
281 
282             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
283                     "getStructure", new Object[] { paramObj0, paramObj1 });
284 
285             Object returnObj = null;
286 
287             try {
288                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
289             }
290             catch (Exception e) {
291                 if (e instanceof com.liferay.portal.SystemException) {
292                     throw (com.liferay.portal.SystemException)e;
293                 }
294 
295                 if (e instanceof com.liferay.portal.PortalException) {
296                     throw (com.liferay.portal.PortalException)e;
297                 }
298 
299                 throw new com.liferay.portal.SystemException(e);
300             }
301 
302             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
303         }
304         catch (com.liferay.portal.SystemException se) {
305             _log.error(se, se);
306 
307             throw se;
308         }
309     }
310 
311     public static com.liferay.portlet.journal.model.JournalStructure updateStructure(
312         HttpPrincipal httpPrincipal, long groupId,
313         java.lang.String structureId, java.lang.String name,
314         java.lang.String description, java.lang.String xsd)
315         throws com.liferay.portal.SystemException,
316             com.liferay.portal.PortalException {
317         try {
318             Object paramObj0 = new LongWrapper(groupId);
319 
320             Object paramObj1 = structureId;
321 
322             if (structureId == null) {
323                 paramObj1 = new NullWrapper("java.lang.String");
324             }
325 
326             Object paramObj2 = name;
327 
328             if (name == null) {
329                 paramObj2 = new NullWrapper("java.lang.String");
330             }
331 
332             Object paramObj3 = description;
333 
334             if (description == null) {
335                 paramObj3 = new NullWrapper("java.lang.String");
336             }
337 
338             Object paramObj4 = xsd;
339 
340             if (xsd == null) {
341                 paramObj4 = new NullWrapper("java.lang.String");
342             }
343 
344             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
345                     "updateStructure",
346                     new Object[] {
347                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
348                     });
349 
350             Object returnObj = null;
351 
352             try {
353                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
354             }
355             catch (Exception e) {
356                 if (e instanceof com.liferay.portal.SystemException) {
357                     throw (com.liferay.portal.SystemException)e;
358                 }
359 
360                 if (e instanceof com.liferay.portal.PortalException) {
361                     throw (com.liferay.portal.PortalException)e;
362                 }
363 
364                 throw new com.liferay.portal.SystemException(e);
365             }
366 
367             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
368         }
369         catch (com.liferay.portal.SystemException se) {
370             _log.error(se, se);
371 
372             throw se;
373         }
374     }
375 
376     private static Log _log = LogFactoryUtil.getLog(JournalStructureServiceHttp.class);
377 }