001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.journal.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.BooleanWrapper;
020    import com.liferay.portal.kernel.util.LongWrapper;
021    import com.liferay.portal.kernel.util.MethodWrapper;
022    import com.liferay.portal.kernel.util.NullWrapper;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.http.TunnelUtil;
025    
026    import com.liferay.portlet.journal.service.JournalStructureServiceUtil;
027    
028    /**
029     * <p>
030     * This class provides a HTTP utility for the
031     * {@link com.liferay.portlet.journal.service.JournalStructureServiceUtil} service utility. The
032     * static methods of this class calls the same methods of the service utility.
033     * However, the signatures are different because it requires an additional
034     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
035     * </p>
036     *
037     * <p>
038     * The benefits of using the HTTP utility is that it is fast and allows for
039     * tunneling without the cost of serializing to text. The drawback is that it
040     * only works with Java.
041     * </p>
042     *
043     * <p>
044     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
045     * configure security.
046     * </p>
047     *
048     * <p>
049     * The HTTP utility is only generated for remote services.
050     * </p>
051     *
052     * @author    Brian Wing Shun Chan
053     * @see       JournalStructureServiceSoap
054     * @see       com.liferay.portal.security.auth.HttpPrincipal
055     * @see       com.liferay.portlet.journal.service.JournalStructureServiceUtil
056     * @generated
057     */
058    public class JournalStructureServiceHttp {
059            public static com.liferay.portlet.journal.model.JournalStructure addStructure(
060                    HttpPrincipal httpPrincipal, long groupId,
061                    java.lang.String structureId, boolean autoStructureId,
062                    java.lang.String parentStructureId, java.lang.String name,
063                    java.lang.String description, java.lang.String xsd,
064                    com.liferay.portal.service.ServiceContext serviceContext)
065                    throws com.liferay.portal.kernel.exception.PortalException,
066                            com.liferay.portal.kernel.exception.SystemException {
067                    try {
068                            Object paramObj0 = new LongWrapper(groupId);
069    
070                            Object paramObj1 = structureId;
071    
072                            if (structureId == null) {
073                                    paramObj1 = new NullWrapper("java.lang.String");
074                            }
075    
076                            Object paramObj2 = new BooleanWrapper(autoStructureId);
077    
078                            Object paramObj3 = parentStructureId;
079    
080                            if (parentStructureId == null) {
081                                    paramObj3 = new NullWrapper("java.lang.String");
082                            }
083    
084                            Object paramObj4 = name;
085    
086                            if (name == null) {
087                                    paramObj4 = new NullWrapper("java.lang.String");
088                            }
089    
090                            Object paramObj5 = description;
091    
092                            if (description == null) {
093                                    paramObj5 = new NullWrapper("java.lang.String");
094                            }
095    
096                            Object paramObj6 = xsd;
097    
098                            if (xsd == null) {
099                                    paramObj6 = new NullWrapper("java.lang.String");
100                            }
101    
102                            Object paramObj7 = serviceContext;
103    
104                            if (serviceContext == null) {
105                                    paramObj7 = new NullWrapper(
106                                                    "com.liferay.portal.service.ServiceContext");
107                            }
108    
109                            MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
110                                            "addStructure",
111                                            new Object[] {
112                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
113                                                    paramObj5, paramObj6, paramObj7
114                                            });
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.kernel.exception.PortalException) {
123                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
124                                    }
125    
126                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
127                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
128                                    }
129    
130                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
131                            }
132    
133                            return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
134                    }
135                    catch (com.liferay.portal.kernel.exception.SystemException se) {
136                            _log.error(se, se);
137    
138                            throw se;
139                    }
140            }
141    
142            public static com.liferay.portlet.journal.model.JournalStructure copyStructure(
143                    HttpPrincipal httpPrincipal, long groupId,
144                    java.lang.String oldStructureId, java.lang.String newStructureId,
145                    boolean autoStructureId)
146                    throws com.liferay.portal.kernel.exception.PortalException,
147                            com.liferay.portal.kernel.exception.SystemException {
148                    try {
149                            Object paramObj0 = new LongWrapper(groupId);
150    
151                            Object paramObj1 = oldStructureId;
152    
153                            if (oldStructureId == null) {
154                                    paramObj1 = new NullWrapper("java.lang.String");
155                            }
156    
157                            Object paramObj2 = newStructureId;
158    
159                            if (newStructureId == null) {
160                                    paramObj2 = new NullWrapper("java.lang.String");
161                            }
162    
163                            Object paramObj3 = new BooleanWrapper(autoStructureId);
164    
165                            MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
166                                            "copyStructure",
167                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
168    
169                            Object returnObj = null;
170    
171                            try {
172                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
173                            }
174                            catch (Exception e) {
175                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
176                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
177                                    }
178    
179                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
180                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
181                                    }
182    
183                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
184                            }
185    
186                            return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
187                    }
188                    catch (com.liferay.portal.kernel.exception.SystemException se) {
189                            _log.error(se, se);
190    
191                            throw se;
192                    }
193            }
194    
195            public static void deleteStructure(HttpPrincipal httpPrincipal,
196                    long groupId, java.lang.String structureId)
197                    throws com.liferay.portal.kernel.exception.PortalException,
198                            com.liferay.portal.kernel.exception.SystemException {
199                    try {
200                            Object paramObj0 = new LongWrapper(groupId);
201    
202                            Object paramObj1 = structureId;
203    
204                            if (structureId == null) {
205                                    paramObj1 = new NullWrapper("java.lang.String");
206                            }
207    
208                            MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
209                                            "deleteStructure", new Object[] { paramObj0, paramObj1 });
210    
211                            try {
212                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
213                            }
214                            catch (Exception e) {
215                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
216                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
217                                    }
218    
219                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
220                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
221                                    }
222    
223                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
224                            }
225                    }
226                    catch (com.liferay.portal.kernel.exception.SystemException se) {
227                            _log.error(se, se);
228    
229                            throw se;
230                    }
231            }
232    
233            public static com.liferay.portlet.journal.model.JournalStructure getStructure(
234                    HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
235                    throws com.liferay.portal.kernel.exception.PortalException,
236                            com.liferay.portal.kernel.exception.SystemException {
237                    try {
238                            Object paramObj0 = new LongWrapper(groupId);
239    
240                            Object paramObj1 = structureId;
241    
242                            if (structureId == null) {
243                                    paramObj1 = new NullWrapper("java.lang.String");
244                            }
245    
246                            MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
247                                            "getStructure", new Object[] { paramObj0, paramObj1 });
248    
249                            Object returnObj = null;
250    
251                            try {
252                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
253                            }
254                            catch (Exception e) {
255                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
256                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
257                                    }
258    
259                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
260                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
261                                    }
262    
263                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
264                            }
265    
266                            return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
267                    }
268                    catch (com.liferay.portal.kernel.exception.SystemException se) {
269                            _log.error(se, se);
270    
271                            throw se;
272                    }
273            }
274    
275            public static com.liferay.portlet.journal.model.JournalStructure updateStructure(
276                    HttpPrincipal httpPrincipal, long groupId,
277                    java.lang.String structureId, java.lang.String parentStructureId,
278                    java.lang.String name, java.lang.String description,
279                    java.lang.String xsd,
280                    com.liferay.portal.service.ServiceContext serviceContext)
281                    throws com.liferay.portal.kernel.exception.PortalException,
282                            com.liferay.portal.kernel.exception.SystemException {
283                    try {
284                            Object paramObj0 = new LongWrapper(groupId);
285    
286                            Object paramObj1 = structureId;
287    
288                            if (structureId == null) {
289                                    paramObj1 = new NullWrapper("java.lang.String");
290                            }
291    
292                            Object paramObj2 = parentStructureId;
293    
294                            if (parentStructureId == null) {
295                                    paramObj2 = new NullWrapper("java.lang.String");
296                            }
297    
298                            Object paramObj3 = name;
299    
300                            if (name == null) {
301                                    paramObj3 = new NullWrapper("java.lang.String");
302                            }
303    
304                            Object paramObj4 = description;
305    
306                            if (description == null) {
307                                    paramObj4 = new NullWrapper("java.lang.String");
308                            }
309    
310                            Object paramObj5 = xsd;
311    
312                            if (xsd == null) {
313                                    paramObj5 = new NullWrapper("java.lang.String");
314                            }
315    
316                            Object paramObj6 = serviceContext;
317    
318                            if (serviceContext == null) {
319                                    paramObj6 = new NullWrapper(
320                                                    "com.liferay.portal.service.ServiceContext");
321                            }
322    
323                            MethodWrapper methodWrapper = new MethodWrapper(JournalStructureServiceUtil.class.getName(),
324                                            "updateStructure",
325                                            new Object[] {
326                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
327                                                    paramObj5, paramObj6
328                                            });
329    
330                            Object returnObj = null;
331    
332                            try {
333                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
334                            }
335                            catch (Exception e) {
336                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
337                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
338                                    }
339    
340                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
341                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
342                                    }
343    
344                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
345                            }
346    
347                            return (com.liferay.portlet.journal.model.JournalStructure)returnObj;
348                    }
349                    catch (com.liferay.portal.kernel.exception.SystemException se) {
350                            _log.error(se, se);
351    
352                            throw se;
353                    }
354            }
355    
356            private static Log _log = LogFactoryUtil.getLog(JournalStructureServiceHttp.class);
357    }