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