001    /**
002     * Copyright (c) 2000-2013 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.portal.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.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.RepositoryServiceUtil;
023    
024    /**
025     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.RepositoryServiceUtil} service utility. The
028     * static methods of this class calls the same methods of the service utility.
029     * However, the signatures are different because it requires an additional
030     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
031     * </p>
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author    Brian Wing Shun Chan
049     * @see       RepositoryServiceSoap
050     * @see       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.RepositoryServiceUtil
052     * @generated
053     */
054    public class RepositoryServiceHttp {
055            public static com.liferay.portal.model.Repository addRepository(
056                    HttpPrincipal httpPrincipal, long groupId, long classNameId,
057                    long parentFolderId, java.lang.String name,
058                    java.lang.String description, java.lang.String portletId,
059                    com.liferay.portal.kernel.util.UnicodeProperties typeSettingsProperties,
060                    com.liferay.portal.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
065                                            "addRepository", _addRepositoryParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
068                                            classNameId, parentFolderId, name, description, portletId,
069                                            typeSettingsProperties, serviceContext);
070    
071                            Object returnObj = null;
072    
073                            try {
074                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
075                            }
076                            catch (Exception e) {
077                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
078                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
079                                    }
080    
081                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
082                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
083                                    }
084    
085                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
086                            }
087    
088                            return (com.liferay.portal.model.Repository)returnObj;
089                    }
090                    catch (com.liferay.portal.kernel.exception.SystemException se) {
091                            _log.error(se, se);
092    
093                            throw se;
094                    }
095            }
096    
097            public static void checkRepository(HttpPrincipal httpPrincipal,
098                    long repositoryId)
099                    throws com.liferay.portal.kernel.exception.PortalException,
100                            com.liferay.portal.kernel.exception.SystemException {
101                    try {
102                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
103                                            "checkRepository", _checkRepositoryParameterTypes1);
104    
105                            MethodHandler methodHandler = new MethodHandler(methodKey,
106                                            repositoryId);
107    
108                            try {
109                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
110                            }
111                            catch (Exception e) {
112                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
113                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
114                                    }
115    
116                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
117                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
118                                    }
119    
120                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
121                            }
122                    }
123                    catch (com.liferay.portal.kernel.exception.SystemException se) {
124                            _log.error(se, se);
125    
126                            throw se;
127                    }
128            }
129    
130            public static void deleteRepository(HttpPrincipal httpPrincipal,
131                    long repositoryId)
132                    throws com.liferay.portal.kernel.exception.PortalException,
133                            com.liferay.portal.kernel.exception.SystemException {
134                    try {
135                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
136                                            "deleteRepository", _deleteRepositoryParameterTypes2);
137    
138                            MethodHandler methodHandler = new MethodHandler(methodKey,
139                                            repositoryId);
140    
141                            try {
142                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
143                            }
144                            catch (Exception e) {
145                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
146                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
147                                    }
148    
149                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
150                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
151                                    }
152    
153                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
154                            }
155                    }
156                    catch (com.liferay.portal.kernel.exception.SystemException se) {
157                            _log.error(se, se);
158    
159                            throw se;
160                    }
161            }
162    
163            public static com.liferay.portal.kernel.repository.LocalRepository getLocalRepositoryImpl(
164                    HttpPrincipal httpPrincipal, long repositoryId)
165                    throws com.liferay.portal.kernel.exception.PortalException,
166                            com.liferay.portal.kernel.exception.SystemException {
167                    try {
168                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
169                                            "getLocalRepositoryImpl",
170                                            _getLocalRepositoryImplParameterTypes3);
171    
172                            MethodHandler methodHandler = new MethodHandler(methodKey,
173                                            repositoryId);
174    
175                            Object returnObj = null;
176    
177                            try {
178                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
179                            }
180                            catch (Exception e) {
181                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
182                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
183                                    }
184    
185                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
186                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
187                                    }
188    
189                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
190                            }
191    
192                            return (com.liferay.portal.kernel.repository.LocalRepository)returnObj;
193                    }
194                    catch (com.liferay.portal.kernel.exception.SystemException se) {
195                            _log.error(se, se);
196    
197                            throw se;
198                    }
199            }
200    
201            public static com.liferay.portal.kernel.repository.LocalRepository getLocalRepositoryImpl(
202                    HttpPrincipal httpPrincipal, long folderId, long fileEntryId,
203                    long fileVersionId)
204                    throws com.liferay.portal.kernel.exception.PortalException,
205                            com.liferay.portal.kernel.exception.SystemException {
206                    try {
207                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
208                                            "getLocalRepositoryImpl",
209                                            _getLocalRepositoryImplParameterTypes4);
210    
211                            MethodHandler methodHandler = new MethodHandler(methodKey,
212                                            folderId, fileEntryId, fileVersionId);
213    
214                            Object returnObj = null;
215    
216                            try {
217                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
218                            }
219                            catch (Exception e) {
220                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
221                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
222                                    }
223    
224                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
225                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
226                                    }
227    
228                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
229                            }
230    
231                            return (com.liferay.portal.kernel.repository.LocalRepository)returnObj;
232                    }
233                    catch (com.liferay.portal.kernel.exception.SystemException se) {
234                            _log.error(se, se);
235    
236                            throw se;
237                    }
238            }
239    
240            public static com.liferay.portal.model.Repository getRepository(
241                    HttpPrincipal httpPrincipal, long repositoryId)
242                    throws com.liferay.portal.kernel.exception.PortalException,
243                            com.liferay.portal.kernel.exception.SystemException {
244                    try {
245                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
246                                            "getRepository", _getRepositoryParameterTypes5);
247    
248                            MethodHandler methodHandler = new MethodHandler(methodKey,
249                                            repositoryId);
250    
251                            Object returnObj = null;
252    
253                            try {
254                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
255                            }
256                            catch (Exception e) {
257                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
258                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
259                                    }
260    
261                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
262                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
263                                    }
264    
265                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
266                            }
267    
268                            return (com.liferay.portal.model.Repository)returnObj;
269                    }
270                    catch (com.liferay.portal.kernel.exception.SystemException se) {
271                            _log.error(se, se);
272    
273                            throw se;
274                    }
275            }
276    
277            public static com.liferay.portal.kernel.repository.Repository getRepositoryImpl(
278                    HttpPrincipal httpPrincipal, long repositoryId)
279                    throws com.liferay.portal.kernel.exception.PortalException,
280                            com.liferay.portal.kernel.exception.SystemException {
281                    try {
282                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
283                                            "getRepositoryImpl", _getRepositoryImplParameterTypes6);
284    
285                            MethodHandler methodHandler = new MethodHandler(methodKey,
286                                            repositoryId);
287    
288                            Object returnObj = null;
289    
290                            try {
291                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
292                            }
293                            catch (Exception e) {
294                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
295                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
296                                    }
297    
298                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
299                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
300                                    }
301    
302                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
303                            }
304    
305                            return (com.liferay.portal.kernel.repository.Repository)returnObj;
306                    }
307                    catch (com.liferay.portal.kernel.exception.SystemException se) {
308                            _log.error(se, se);
309    
310                            throw se;
311                    }
312            }
313    
314            public static com.liferay.portal.kernel.repository.Repository getRepositoryImpl(
315                    HttpPrincipal httpPrincipal, long folderId, long fileEntryId,
316                    long fileVersionId)
317                    throws com.liferay.portal.kernel.exception.PortalException,
318                            com.liferay.portal.kernel.exception.SystemException {
319                    try {
320                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
321                                            "getRepositoryImpl", _getRepositoryImplParameterTypes7);
322    
323                            MethodHandler methodHandler = new MethodHandler(methodKey,
324                                            folderId, fileEntryId, fileVersionId);
325    
326                            Object returnObj = null;
327    
328                            try {
329                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
330                            }
331                            catch (Exception e) {
332                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
333                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
334                                    }
335    
336                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
337                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
338                                    }
339    
340                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
341                            }
342    
343                            return (com.liferay.portal.kernel.repository.Repository)returnObj;
344                    }
345                    catch (com.liferay.portal.kernel.exception.SystemException se) {
346                            _log.error(se, se);
347    
348                            throw se;
349                    }
350            }
351    
352            public static java.lang.String[] getSupportedConfigurations(
353                    HttpPrincipal httpPrincipal, long classNameId)
354                    throws com.liferay.portal.kernel.exception.SystemException {
355                    try {
356                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
357                                            "getSupportedConfigurations",
358                                            _getSupportedConfigurationsParameterTypes8);
359    
360                            MethodHandler methodHandler = new MethodHandler(methodKey,
361                                            classNameId);
362    
363                            Object returnObj = null;
364    
365                            try {
366                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
367                            }
368                            catch (Exception e) {
369                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
370                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
371                                    }
372    
373                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
374                            }
375    
376                            return (java.lang.String[])returnObj;
377                    }
378                    catch (com.liferay.portal.kernel.exception.SystemException se) {
379                            _log.error(se, se);
380    
381                            throw se;
382                    }
383            }
384    
385            public static java.lang.String[] getSupportedParameters(
386                    HttpPrincipal httpPrincipal, long classNameId,
387                    java.lang.String configuration)
388                    throws com.liferay.portal.kernel.exception.SystemException {
389                    try {
390                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
391                                            "getSupportedParameters",
392                                            _getSupportedParametersParameterTypes9);
393    
394                            MethodHandler methodHandler = new MethodHandler(methodKey,
395                                            classNameId, configuration);
396    
397                            Object returnObj = null;
398    
399                            try {
400                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
401                            }
402                            catch (Exception e) {
403                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
404                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
405                                    }
406    
407                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
408                            }
409    
410                            return (java.lang.String[])returnObj;
411                    }
412                    catch (com.liferay.portal.kernel.exception.SystemException se) {
413                            _log.error(se, se);
414    
415                            throw se;
416                    }
417            }
418    
419            public static com.liferay.portal.kernel.util.UnicodeProperties getTypeSettingsProperties(
420                    HttpPrincipal httpPrincipal, long repositoryId)
421                    throws com.liferay.portal.kernel.exception.PortalException,
422                            com.liferay.portal.kernel.exception.SystemException {
423                    try {
424                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
425                                            "getTypeSettingsProperties",
426                                            _getTypeSettingsPropertiesParameterTypes10);
427    
428                            MethodHandler methodHandler = new MethodHandler(methodKey,
429                                            repositoryId);
430    
431                            Object returnObj = null;
432    
433                            try {
434                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
435                            }
436                            catch (Exception e) {
437                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
438                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
439                                    }
440    
441                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
442                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
443                                    }
444    
445                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
446                            }
447    
448                            return (com.liferay.portal.kernel.util.UnicodeProperties)returnObj;
449                    }
450                    catch (com.liferay.portal.kernel.exception.SystemException se) {
451                            _log.error(se, se);
452    
453                            throw se;
454                    }
455            }
456    
457            public static void updateRepository(HttpPrincipal httpPrincipal,
458                    long repositoryId, java.lang.String name, java.lang.String description)
459                    throws com.liferay.portal.kernel.exception.PortalException,
460                            com.liferay.portal.kernel.exception.SystemException {
461                    try {
462                            MethodKey methodKey = new MethodKey(RepositoryServiceUtil.class,
463                                            "updateRepository", _updateRepositoryParameterTypes11);
464    
465                            MethodHandler methodHandler = new MethodHandler(methodKey,
466                                            repositoryId, name, description);
467    
468                            try {
469                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
470                            }
471                            catch (Exception e) {
472                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
473                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
474                                    }
475    
476                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
477                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
478                                    }
479    
480                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
481                            }
482                    }
483                    catch (com.liferay.portal.kernel.exception.SystemException se) {
484                            _log.error(se, se);
485    
486                            throw se;
487                    }
488            }
489    
490            private static Log _log = LogFactoryUtil.getLog(RepositoryServiceHttp.class);
491            private static final Class<?>[] _addRepositoryParameterTypes0 = new Class[] {
492                            long.class, long.class, long.class, java.lang.String.class,
493                            java.lang.String.class, java.lang.String.class,
494                            com.liferay.portal.kernel.util.UnicodeProperties.class,
495                            com.liferay.portal.service.ServiceContext.class
496                    };
497            private static final Class<?>[] _checkRepositoryParameterTypes1 = new Class[] {
498                            long.class
499                    };
500            private static final Class<?>[] _deleteRepositoryParameterTypes2 = new Class[] {
501                            long.class
502                    };
503            private static final Class<?>[] _getLocalRepositoryImplParameterTypes3 = new Class[] {
504                            long.class
505                    };
506            private static final Class<?>[] _getLocalRepositoryImplParameterTypes4 = new Class[] {
507                            long.class, long.class, long.class
508                    };
509            private static final Class<?>[] _getRepositoryParameterTypes5 = new Class[] {
510                            long.class
511                    };
512            private static final Class<?>[] _getRepositoryImplParameterTypes6 = new Class[] {
513                            long.class
514                    };
515            private static final Class<?>[] _getRepositoryImplParameterTypes7 = new Class[] {
516                            long.class, long.class, long.class
517                    };
518            private static final Class<?>[] _getSupportedConfigurationsParameterTypes8 = new Class[] {
519                            long.class
520                    };
521            private static final Class<?>[] _getSupportedParametersParameterTypes9 = new Class[] {
522                            long.class, java.lang.String.class
523                    };
524            private static final Class<?>[] _getTypeSettingsPropertiesParameterTypes10 = new Class[] {
525                            long.class
526                    };
527            private static final Class<?>[] _updateRepositoryParameterTypes11 = new Class[] {
528                            long.class, java.lang.String.class, java.lang.String.class
529                    };
530    }