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