1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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   * {@link com.liferay.portlet.journal.service.JournalStructureServiceUtil} service utility. The
47   * static methods of this class calls the same methods of the service utility.
48   * However, the signatures are different because it requires an additional
49   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
50   * </p>
51   *
52   * <p>
53   * The benefits of using the HTTP utility is that it is fast and allows for
54   * tunneling without the cost of serializing to text. The drawback is that it
55   * only works with Java.
56   * </p>
57   *
58   * <p>
59   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
60   * configure security.
61   * </p>
62   *
63   * <p>
64   * The HTTP utility is only generated for remote services.
65   * </p>
66   *
67   * @author    Brian Wing Shun Chan
68   * @see       JournalStructureServiceSoap
69   * @see       com.liferay.portal.security.auth.HttpPrincipal
70   * @see       com.liferay.portlet.journal.service.JournalStructureServiceUtil
71   * @generated
72   */
73  public class JournalStructureServiceHttp {
74      public static com.liferay.portlet.journal.model.JournalStructure addStructure(
75          HttpPrincipal httpPrincipal, long groupId,
76          java.lang.String structureId, boolean autoStructureId,
77          java.lang.String parentStructureId, java.lang.String name,
78          java.lang.String description, java.lang.String xsd,
79          com.liferay.portal.service.ServiceContext serviceContext)
80          throws com.liferay.portal.PortalException,
81              com.liferay.portal.SystemException {
82          try {
83              Object paramObj0 = new LongWrapper(groupId);
84  
85              Object paramObj1 = structureId;
86  
87              if (structureId == null) {
88                  paramObj1 = new NullWrapper("java.lang.String");
89              }
90  
91              Object paramObj2 = new BooleanWrapper(autoStructureId);
92  
93              Object paramObj3 = parentStructureId;
94  
95              if (parentStructureId == null) {
96                  paramObj3 = new NullWrapper("java.lang.String");
97              }
98  
99              Object paramObj4 = name;
100 
101             if (name == null) {
102                 paramObj4 = new NullWrapper("java.lang.String");
103             }
104 
105             Object paramObj5 = description;
106 
107             if (description == null) {
108                 paramObj5 = new NullWrapper("java.lang.String");
109             }
110 
111             Object paramObj6 = xsd;
112 
113             if (xsd == null) {
114                 paramObj6 = new NullWrapper("java.lang.String");
115             }
116 
117             Object paramObj7 = serviceContext;
118 
119             if (serviceContext == null) {
120                 paramObj7 = new NullWrapper(
121                         "com.liferay.portal.service.ServiceContext");
122             }
123 
124             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
125                     "addStructure",
126                     new Object[] {
127                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
128                         paramObj5, paramObj6, paramObj7
129                     });
130 
131             Object returnObj = null;
132 
133             try {
134                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
135             }
136             catch (Exception e) {
137                 if (e instanceof com.liferay.portal.PortalException) {
138                     throw (com.liferay.portal.PortalException)e;
139                 }
140 
141                 if (e instanceof com.liferay.portal.SystemException) {
142                     throw (com.liferay.portal.SystemException)e;
143                 }
144 
145                 throw new com.liferay.portal.SystemException(e);
146             }
147 
148             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
149         }
150         catch (com.liferay.portal.SystemException se) {
151             _log.error(se, se);
152 
153             throw se;
154         }
155     }
156 
157     public static com.liferay.portlet.journal.model.JournalStructure copyStructure(
158         HttpPrincipal httpPrincipal, long groupId,
159         java.lang.String oldStructureId, java.lang.String newStructureId,
160         boolean autoStructureId)
161         throws com.liferay.portal.PortalException,
162             com.liferay.portal.SystemException {
163         try {
164             Object paramObj0 = new LongWrapper(groupId);
165 
166             Object paramObj1 = oldStructureId;
167 
168             if (oldStructureId == null) {
169                 paramObj1 = new NullWrapper("java.lang.String");
170             }
171 
172             Object paramObj2 = newStructureId;
173 
174             if (newStructureId == null) {
175                 paramObj2 = new NullWrapper("java.lang.String");
176             }
177 
178             Object paramObj3 = new BooleanWrapper(autoStructureId);
179 
180             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
181                     "copyStructure",
182                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
183 
184             Object returnObj = null;
185 
186             try {
187                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
188             }
189             catch (Exception e) {
190                 if (e instanceof com.liferay.portal.PortalException) {
191                     throw (com.liferay.portal.PortalException)e;
192                 }
193 
194                 if (e instanceof com.liferay.portal.SystemException) {
195                     throw (com.liferay.portal.SystemException)e;
196                 }
197 
198                 throw new com.liferay.portal.SystemException(e);
199             }
200 
201             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
202         }
203         catch (com.liferay.portal.SystemException se) {
204             _log.error(se, se);
205 
206             throw se;
207         }
208     }
209 
210     public static void deleteStructure(HttpPrincipal httpPrincipal,
211         long groupId, java.lang.String structureId)
212         throws com.liferay.portal.PortalException,
213             com.liferay.portal.SystemException {
214         try {
215             Object paramObj0 = new LongWrapper(groupId);
216 
217             Object paramObj1 = structureId;
218 
219             if (structureId == null) {
220                 paramObj1 = new NullWrapper("java.lang.String");
221             }
222 
223             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
224                     "deleteStructure", new Object[] { paramObj0, paramObj1 });
225 
226             try {
227                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
228             }
229             catch (Exception e) {
230                 if (e instanceof com.liferay.portal.PortalException) {
231                     throw (com.liferay.portal.PortalException)e;
232                 }
233 
234                 if (e instanceof com.liferay.portal.SystemException) {
235                     throw (com.liferay.portal.SystemException)e;
236                 }
237 
238                 throw new com.liferay.portal.SystemException(e);
239             }
240         }
241         catch (com.liferay.portal.SystemException se) {
242             _log.error(se, se);
243 
244             throw se;
245         }
246     }
247 
248     public static com.liferay.portlet.journal.model.JournalStructure getStructure(
249         HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
250         throws com.liferay.portal.PortalException,
251             com.liferay.portal.SystemException {
252         try {
253             Object paramObj0 = new LongWrapper(groupId);
254 
255             Object paramObj1 = structureId;
256 
257             if (structureId == null) {
258                 paramObj1 = new NullWrapper("java.lang.String");
259             }
260 
261             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
262                     "getStructure", new Object[] { paramObj0, paramObj1 });
263 
264             Object returnObj = null;
265 
266             try {
267                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
268             }
269             catch (Exception e) {
270                 if (e instanceof com.liferay.portal.PortalException) {
271                     throw (com.liferay.portal.PortalException)e;
272                 }
273 
274                 if (e instanceof com.liferay.portal.SystemException) {
275                     throw (com.liferay.portal.SystemException)e;
276                 }
277 
278                 throw new com.liferay.portal.SystemException(e);
279             }
280 
281             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
282         }
283         catch (com.liferay.portal.SystemException se) {
284             _log.error(se, se);
285 
286             throw se;
287         }
288     }
289 
290     public static com.liferay.portlet.journal.model.JournalStructure updateStructure(
291         HttpPrincipal httpPrincipal, long groupId,
292         java.lang.String structureId, java.lang.String parentStructureId,
293         java.lang.String name, java.lang.String description,
294         java.lang.String xsd,
295         com.liferay.portal.service.ServiceContext serviceContext)
296         throws com.liferay.portal.PortalException,
297             com.liferay.portal.SystemException {
298         try {
299             Object paramObj0 = new LongWrapper(groupId);
300 
301             Object paramObj1 = structureId;
302 
303             if (structureId == null) {
304                 paramObj1 = new NullWrapper("java.lang.String");
305             }
306 
307             Object paramObj2 = parentStructureId;
308 
309             if (parentStructureId == null) {
310                 paramObj2 = new NullWrapper("java.lang.String");
311             }
312 
313             Object paramObj3 = name;
314 
315             if (name == null) {
316                 paramObj3 = new NullWrapper("java.lang.String");
317             }
318 
319             Object paramObj4 = description;
320 
321             if (description == null) {
322                 paramObj4 = new NullWrapper("java.lang.String");
323             }
324 
325             Object paramObj5 = xsd;
326 
327             if (xsd == null) {
328                 paramObj5 = new NullWrapper("java.lang.String");
329             }
330 
331             Object paramObj6 = serviceContext;
332 
333             if (serviceContext == null) {
334                 paramObj6 = new NullWrapper(
335                         "com.liferay.portal.service.ServiceContext");
336             }
337 
338             MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
339                     "updateStructure",
340                     new Object[] {
341                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
342                         paramObj5, paramObj6
343                     });
344 
345             Object returnObj = null;
346 
347             try {
348                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
349             }
350             catch (Exception e) {
351                 if (e instanceof com.liferay.portal.PortalException) {
352                     throw (com.liferay.portal.PortalException)e;
353                 }
354 
355                 if (e instanceof com.liferay.portal.SystemException) {
356                     throw (com.liferay.portal.SystemException)e;
357                 }
358 
359                 throw new com.liferay.portal.SystemException(e);
360             }
361 
362             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
363         }
364         catch (com.liferay.portal.SystemException se) {
365             _log.error(se, se);
366 
367             throw se;
368         }
369     }
370 
371     private static Log _log = LogFactoryUtil.getLog(JournalStructureServiceHttp.class);
372 }