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