001    /**
002     * Copyright (c) 2000-present 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.kernel.repository;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
019    
020    import java.util.List;
021    
022    /**
023     * @author Iv??n Zaera
024     */
025    public class RepositoryProviderUtil {
026    
027            public static LocalRepository getFileEntryLocalRepository(long fileEntryId)
028                    throws PortalException {
029    
030                    return getRepositoryProvider().getFileEntryLocalRepository(fileEntryId);
031            }
032    
033            public static Repository getFileEntryRepository(long fileEntryId)
034                    throws PortalException {
035    
036                    return getRepositoryProvider().getFileEntryRepository(fileEntryId);
037            }
038    
039            public static LocalRepository getFileShortcutLocalRepository(
040                            long fileShortcutId)
041                    throws PortalException {
042    
043                    return getRepositoryProvider().getFileShortcutLocalRepository(
044                            fileShortcutId);
045            }
046    
047            public static Repository getFileShortcutRepository(long fileShortcutId)
048                    throws PortalException {
049    
050                    return getRepositoryProvider().getFileShortcutRepository(
051                            fileShortcutId);
052            }
053    
054            public static LocalRepository getFileVersionLocalRepository(
055                            long fileVersionId)
056                    throws PortalException {
057    
058                    return getRepositoryProvider().getFileVersionLocalRepository(
059                            fileVersionId);
060            }
061    
062            public static Repository getFileVersionRepository(long fileVersionId)
063                    throws PortalException {
064    
065                    return getRepositoryProvider().getFileVersionRepository(fileVersionId);
066            }
067    
068            public static LocalRepository getFolderLocalRepository(long folderId)
069                    throws PortalException {
070    
071                    return getRepositoryProvider().getFolderLocalRepository(folderId);
072            }
073    
074            public static Repository getFolderRepository(long folderId)
075                    throws PortalException {
076    
077                    return getRepositoryProvider().getFolderRepository(folderId);
078            }
079    
080            public static LocalRepository getImageLocalRepository(long imageId)
081                    throws PortalException {
082    
083                    return getRepositoryProvider().getImageLocalRepository(imageId);
084            }
085    
086            public static Repository getImageRepository(long imageId)
087                    throws PortalException {
088    
089                    return getRepositoryProvider().getImageRepository(imageId);
090            }
091    
092            public static List<LocalRepository> getLocalRepositoriesByGroupId(
093                            long groupId)
094                    throws PortalException {
095    
096                    return getRepositoryProvider().getGroupLocalRepositories(groupId);
097            }
098    
099            public static LocalRepository getLocalRepository(long repositoryId)
100                    throws PortalException {
101    
102                    return getRepositoryProvider().getLocalRepository(repositoryId);
103            }
104    
105            public static List<Repository> getRepositoriesByGroupId(long groupId)
106                    throws PortalException {
107    
108                    return getRepositoryProvider().getGroupRepositories(groupId);
109            }
110    
111            public static Repository getRepository(long repositoryId)
112                    throws PortalException {
113    
114                    return getRepositoryProvider().getRepository(repositoryId);
115            }
116    
117            public static RepositoryProvider getRepositoryProvider() {
118                    PortalRuntimePermission.checkGetBeanProperty(RepositoryProvider.class);
119    
120                    return _repositoryProvider;
121            }
122    
123            public static void invalidateRepository(long repositoryId) {
124                    getRepositoryProvider().invalidateRepository(repositoryId);
125            }
126    
127            public void setRepositoryProvider(RepositoryProvider repositoryProvider) {
128                    PortalRuntimePermission.checkSetBeanProperty(getClass());
129    
130                    _repositoryProvider = repositoryProvider;
131            }
132    
133            private static RepositoryProvider _repositoryProvider;
134    
135    }