1   /**
2    * Copyright (c) 2000-2007 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 overwritten
41   * the next time is generated.
42   * </p>
43   *
44   * <p>
45   * This class provides a HTTP utility for the <code>com.liferay.portlet.journal.service.JournalStructureServiceUtil</code>
46   * service utility. The static methods of this class calls the same methods of the
47   * service utility. However, the signatures are different because it requires an
48   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code> parameter.
49   * </p>
50   *
51   * <p>
52   * The benefits of using the HTTP utility is that it is fast and allows for tunneling
53   * without the cost of serializing to text. The drawback is that it only works with
54   * Java.
55   * </p>
56   *
57   * <p>
58   * Set the property <code>tunnel.servlet.hosts.allowed</code> in portal.properties
59   * to configure security.
60   * </p>
61   *
62   * <p>
63   * The HTTP utility is only generated for remote services.
64   * </p>
65   *
66   * @author Brian Wing Shun Chan
67   *
68   * @see com.liferay.portal.security.auth.HttpPrincipal
69   * @see com.liferay.portlet.journal.service.JournalStructureServiceUtil
70   * @see com.liferay.portlet.journal.service.http.JournalStructureServiceSoap
71   *
72   */
73  public class JournalStructureServiceHttp {
74      public static com.liferay.portlet.journal.model.JournalStructure addStructure(
75          HttpPrincipal httpPrincipal, java.lang.String structureId,
76          boolean autoStructureId, long plid, java.lang.String name,
77          java.lang.String description, java.lang.String xsd,
78          boolean addCommunityPermissions, boolean addGuestPermissions)
79          throws com.liferay.portal.SystemException, 
80              com.liferay.portal.PortalException {
81          try {
82              Object paramObj0 = structureId;
83  
84              if (structureId == null) {
85                  paramObj0 = new NullWrapper("java.lang.String");
86              }
87  
88              Object paramObj1 = new BooleanWrapper(autoStructureId);
89              Object paramObj2 = new LongWrapper(plid);
90              Object paramObj3 = name;
91  
92              if (name == null) {
93                  paramObj3 = new NullWrapper("java.lang.String");
94              }
95  
96              Object paramObj4 = description;
97  
98              if (description == null) {
99                  paramObj4 = new NullWrapper("java.lang.String");
100             }
101 
102             Object paramObj5 = xsd;
103 
104             if (xsd == null) {
105                 paramObj5 = new NullWrapper("java.lang.String");
106             }
107 
108             Object paramObj6 = new BooleanWrapper(addCommunityPermissions);
109             Object paramObj7 = new BooleanWrapper(addGuestPermissions);
110             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
111                     "addStructure",
112                     new Object[] {
113                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
114                         paramObj5, paramObj6, paramObj7
115                     });
116             Object returnObj = null;
117 
118             try {
119                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
120             }
121             catch (Exception e) {
122                 if (e instanceof com.liferay.portal.SystemException) {
123                     throw (com.liferay.portal.SystemException)e;
124                 }
125 
126                 if (e instanceof com.liferay.portal.PortalException) {
127                     throw (com.liferay.portal.PortalException)e;
128                 }
129 
130                 throw new com.liferay.portal.SystemException(e);
131             }
132 
133             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
134         }
135         catch (com.liferay.portal.SystemException se) {
136             _log.error(se, se);
137             throw se;
138         }
139     }
140 
141     public static com.liferay.portlet.journal.model.JournalStructure addStructure(
142         HttpPrincipal httpPrincipal, java.lang.String structureId,
143         boolean autoStructureId, long plid, java.lang.String name,
144         java.lang.String description, java.lang.String xsd,
145         java.lang.String[] communityPermissions,
146         java.lang.String[] guestPermissions)
147         throws com.liferay.portal.SystemException, 
148             com.liferay.portal.PortalException {
149         try {
150             Object paramObj0 = structureId;
151 
152             if (structureId == null) {
153                 paramObj0 = new NullWrapper("java.lang.String");
154             }
155 
156             Object paramObj1 = new BooleanWrapper(autoStructureId);
157             Object paramObj2 = new LongWrapper(plid);
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             Object returnObj = null;
195 
196             try {
197                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
198             }
199             catch (Exception e) {
200                 if (e instanceof com.liferay.portal.SystemException) {
201                     throw (com.liferay.portal.SystemException)e;
202                 }
203 
204                 if (e instanceof com.liferay.portal.PortalException) {
205                     throw (com.liferay.portal.PortalException)e;
206                 }
207 
208                 throw new com.liferay.portal.SystemException(e);
209             }
210 
211             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
212         }
213         catch (com.liferay.portal.SystemException se) {
214             _log.error(se, se);
215             throw se;
216         }
217     }
218 
219     public static void deleteStructure(HttpPrincipal httpPrincipal,
220         long groupId, java.lang.String structureId)
221         throws com.liferay.portal.SystemException, 
222             com.liferay.portal.PortalException {
223         try {
224             Object paramObj0 = new LongWrapper(groupId);
225             Object paramObj1 = structureId;
226 
227             if (structureId == null) {
228                 paramObj1 = new NullWrapper("java.lang.String");
229             }
230 
231             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
232                     "deleteStructure", new Object[] { paramObj0, paramObj1 });
233 
234             try {
235                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
236             }
237             catch (Exception e) {
238                 if (e instanceof com.liferay.portal.SystemException) {
239                     throw (com.liferay.portal.SystemException)e;
240                 }
241 
242                 if (e instanceof com.liferay.portal.PortalException) {
243                     throw (com.liferay.portal.PortalException)e;
244                 }
245 
246                 throw new com.liferay.portal.SystemException(e);
247             }
248         }
249         catch (com.liferay.portal.SystemException se) {
250             _log.error(se, se);
251             throw se;
252         }
253     }
254 
255     public static com.liferay.portlet.journal.model.JournalStructure getStructure(
256         HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
257         throws com.liferay.portal.SystemException, 
258             com.liferay.portal.PortalException {
259         try {
260             Object paramObj0 = new LongWrapper(groupId);
261             Object paramObj1 = structureId;
262 
263             if (structureId == null) {
264                 paramObj1 = new NullWrapper("java.lang.String");
265             }
266 
267             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
268                     "getStructure", new Object[] { paramObj0, paramObj1 });
269             Object returnObj = null;
270 
271             try {
272                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
273             }
274             catch (Exception e) {
275                 if (e instanceof com.liferay.portal.SystemException) {
276                     throw (com.liferay.portal.SystemException)e;
277                 }
278 
279                 if (e instanceof com.liferay.portal.PortalException) {
280                     throw (com.liferay.portal.PortalException)e;
281                 }
282 
283                 throw new com.liferay.portal.SystemException(e);
284             }
285 
286             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
287         }
288         catch (com.liferay.portal.SystemException se) {
289             _log.error(se, se);
290             throw se;
291         }
292     }
293 
294     public static com.liferay.portlet.journal.model.JournalStructure updateStructure(
295         HttpPrincipal httpPrincipal, long groupId,
296         java.lang.String structureId, java.lang.String name,
297         java.lang.String description, java.lang.String xsd)
298         throws com.liferay.portal.SystemException, 
299             com.liferay.portal.PortalException {
300         try {
301             Object paramObj0 = new LongWrapper(groupId);
302             Object paramObj1 = structureId;
303 
304             if (structureId == null) {
305                 paramObj1 = new NullWrapper("java.lang.String");
306             }
307 
308             Object paramObj2 = name;
309 
310             if (name == null) {
311                 paramObj2 = new NullWrapper("java.lang.String");
312             }
313 
314             Object paramObj3 = description;
315 
316             if (description == null) {
317                 paramObj3 = new NullWrapper("java.lang.String");
318             }
319 
320             Object paramObj4 = xsd;
321 
322             if (xsd == null) {
323                 paramObj4 = new NullWrapper("java.lang.String");
324             }
325 
326             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
327                     "updateStructure",
328                     new Object[] {
329                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
330                     });
331             Object returnObj = null;
332 
333             try {
334                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
335             }
336             catch (Exception e) {
337                 if (e instanceof com.liferay.portal.SystemException) {
338                     throw (com.liferay.portal.SystemException)e;
339                 }
340 
341                 if (e instanceof com.liferay.portal.PortalException) {
342                     throw (com.liferay.portal.PortalException)e;
343                 }
344 
345                 throw new com.liferay.portal.SystemException(e);
346             }
347 
348             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
349         }
350         catch (com.liferay.portal.SystemException se) {
351             _log.error(se, se);
352             throw se;
353         }
354     }
355 
356     private static Log _log = LogFactoryUtil.getLog(JournalStructureServiceHttp.class);
357 }