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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.journal.service.JournalStructureServiceUtil;
25  
26  /**
27   * <a href="JournalStructureServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.journal.service.JournalStructureServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       JournalStructureServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.journal.service.JournalStructureServiceUtil
61   * @generated
62   */
63  public class JournalStructureServiceHttp {
64      public static com.liferay.portlet.journal.model.JournalStructure addStructure(
65          HttpPrincipal httpPrincipal, long groupId,
66          java.lang.String structureId, boolean autoStructureId,
67          java.lang.String parentStructureId, java.lang.String name,
68          java.lang.String description, java.lang.String xsd,
69          com.liferay.portal.service.ServiceContext serviceContext)
70          throws com.liferay.portal.PortalException,
71              com.liferay.portal.SystemException {
72          try {
73              MethodKey methodKey = new MethodKey(JournalStructureServiceUtil.class.getName(),
74                      "addStructure", _addStructureParameterTypes0);
75  
76              MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
77                      structureId, autoStructureId, parentStructureId, name,
78                      description, xsd, serviceContext);
79  
80              Object returnObj = null;
81  
82              try {
83                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
84              }
85              catch (Exception e) {
86                  if (e instanceof com.liferay.portal.PortalException) {
87                      throw (com.liferay.portal.PortalException)e;
88                  }
89  
90                  if (e instanceof com.liferay.portal.SystemException) {
91                      throw (com.liferay.portal.SystemException)e;
92                  }
93  
94                  throw new com.liferay.portal.SystemException(e);
95              }
96  
97              return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
98          }
99          catch (com.liferay.portal.SystemException se) {
100             _log.error(se, se);
101 
102             throw se;
103         }
104     }
105 
106     public static com.liferay.portlet.journal.model.JournalStructure copyStructure(
107         HttpPrincipal httpPrincipal, long groupId,
108         java.lang.String oldStructureId, java.lang.String newStructureId,
109         boolean autoStructureId)
110         throws com.liferay.portal.PortalException,
111             com.liferay.portal.SystemException {
112         try {
113             MethodKey methodKey = new MethodKey(JournalStructureServiceUtil.class.getName(),
114                     "copyStructure", _copyStructureParameterTypes1);
115 
116             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
117                     oldStructureId, newStructureId, autoStructureId);
118 
119             Object returnObj = null;
120 
121             try {
122                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
123             }
124             catch (Exception e) {
125                 if (e instanceof com.liferay.portal.PortalException) {
126                     throw (com.liferay.portal.PortalException)e;
127                 }
128 
129                 if (e instanceof com.liferay.portal.SystemException) {
130                     throw (com.liferay.portal.SystemException)e;
131                 }
132 
133                 throw new com.liferay.portal.SystemException(e);
134             }
135 
136             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
137         }
138         catch (com.liferay.portal.SystemException se) {
139             _log.error(se, se);
140 
141             throw se;
142         }
143     }
144 
145     public static void deleteStructure(HttpPrincipal httpPrincipal,
146         long groupId, java.lang.String structureId)
147         throws com.liferay.portal.PortalException,
148             com.liferay.portal.SystemException {
149         try {
150             MethodKey methodKey = new MethodKey(JournalStructureServiceUtil.class.getName(),
151                     "deleteStructure", _deleteStructureParameterTypes2);
152 
153             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
154                     structureId);
155 
156             try {
157                 TunnelUtil.invoke(httpPrincipal, methodHandler);
158             }
159             catch (Exception e) {
160                 if (e instanceof com.liferay.portal.PortalException) {
161                     throw (com.liferay.portal.PortalException)e;
162                 }
163 
164                 if (e instanceof com.liferay.portal.SystemException) {
165                     throw (com.liferay.portal.SystemException)e;
166                 }
167 
168                 throw new com.liferay.portal.SystemException(e);
169             }
170         }
171         catch (com.liferay.portal.SystemException se) {
172             _log.error(se, se);
173 
174             throw se;
175         }
176     }
177 
178     public static com.liferay.portlet.journal.model.JournalStructure getStructure(
179         HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
180         throws com.liferay.portal.PortalException,
181             com.liferay.portal.SystemException {
182         try {
183             MethodKey methodKey = new MethodKey(JournalStructureServiceUtil.class.getName(),
184                     "getStructure", _getStructureParameterTypes3);
185 
186             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
187                     structureId);
188 
189             Object returnObj = null;
190 
191             try {
192                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
193             }
194             catch (Exception e) {
195                 if (e instanceof com.liferay.portal.PortalException) {
196                     throw (com.liferay.portal.PortalException)e;
197                 }
198 
199                 if (e instanceof com.liferay.portal.SystemException) {
200                     throw (com.liferay.portal.SystemException)e;
201                 }
202 
203                 throw new com.liferay.portal.SystemException(e);
204             }
205 
206             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
207         }
208         catch (com.liferay.portal.SystemException se) {
209             _log.error(se, se);
210 
211             throw se;
212         }
213     }
214 
215     public static com.liferay.portlet.journal.model.JournalStructure updateStructure(
216         HttpPrincipal httpPrincipal, long groupId,
217         java.lang.String structureId, java.lang.String parentStructureId,
218         java.lang.String name, java.lang.String description,
219         java.lang.String xsd,
220         com.liferay.portal.service.ServiceContext serviceContext)
221         throws com.liferay.portal.PortalException,
222             com.liferay.portal.SystemException {
223         try {
224             MethodKey methodKey = new MethodKey(JournalStructureServiceUtil.class.getName(),
225                     "updateStructure", _updateStructureParameterTypes4);
226 
227             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
228                     structureId, parentStructureId, name, description, xsd,
229                     serviceContext);
230 
231             Object returnObj = null;
232 
233             try {
234                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
235             }
236             catch (Exception e) {
237                 if (e instanceof com.liferay.portal.PortalException) {
238                     throw (com.liferay.portal.PortalException)e;
239                 }
240 
241                 if (e instanceof com.liferay.portal.SystemException) {
242                     throw (com.liferay.portal.SystemException)e;
243                 }
244 
245                 throw new com.liferay.portal.SystemException(e);
246             }
247 
248             return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
249         }
250         catch (com.liferay.portal.SystemException se) {
251             _log.error(se, se);
252 
253             throw se;
254         }
255     }
256 
257     private static Log _log = LogFactoryUtil.getLog(JournalStructureServiceHttp.class);
258     private static final Class<?>[] _addStructureParameterTypes0 = new Class[] {
259             long.class, java.lang.String.class, boolean.class,
260             java.lang.String.class, java.lang.String.class,
261             java.lang.String.class, java.lang.String.class,
262             com.liferay.portal.service.ServiceContext.class
263         };
264     private static final Class<?>[] _copyStructureParameterTypes1 = new Class[] {
265             long.class, java.lang.String.class, java.lang.String.class,
266             boolean.class
267         };
268     private static final Class<?>[] _deleteStructureParameterTypes2 = new Class[] {
269             long.class, java.lang.String.class
270         };
271     private static final Class<?>[] _getStructureParameterTypes3 = new Class[] {
272             long.class, java.lang.String.class
273         };
274     private static final Class<?>[] _updateStructureParameterTypes4 = new Class[] {
275             long.class, java.lang.String.class, java.lang.String.class,
276             java.lang.String.class, java.lang.String.class,
277             java.lang.String.class,
278             com.liferay.portal.service.ServiceContext.class
279         };
280 }