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.repository.util;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.repository.LocalRepository;
019    import com.liferay.portal.kernel.repository.capabilities.Capability;
020    import com.liferay.portal.kernel.repository.model.FileEntry;
021    import com.liferay.portal.kernel.repository.model.FileVersion;
022    import com.liferay.portal.kernel.repository.model.Folder;
023    import com.liferay.portal.kernel.util.OrderByComparator;
024    import com.liferay.portal.service.ServiceContext;
025    
026    import java.io.File;
027    import java.io.InputStream;
028    
029    import java.util.List;
030    
031    /**
032     * @author Adolfo P??rez
033     */
034    public class LocalRepositoryWrapper implements LocalRepository {
035    
036            public LocalRepositoryWrapper(LocalRepository localRepository) {
037                    _localRepository = localRepository;
038            }
039    
040            @Override
041            public FileEntry addFileEntry(
042                            long userId, long folderId, String sourceFileName, String mimeType,
043                            String title, String description, String changeLog, File file,
044                            ServiceContext serviceContext)
045                    throws PortalException {
046    
047                    return _localRepository.addFileEntry(
048                            userId, folderId, sourceFileName, mimeType, title, description,
049                            changeLog, file, serviceContext);
050            }
051    
052            @Override
053            public FileEntry addFileEntry(
054                            long userId, long folderId, String sourceFileName, String mimeType,
055                            String title, String description, String changeLog, InputStream is,
056                            long size, ServiceContext serviceContext)
057                    throws PortalException {
058    
059                    return _localRepository.addFileEntry(
060                            userId, folderId, sourceFileName, mimeType, title, description,
061                            changeLog, is, size, serviceContext);
062            }
063    
064            @Override
065            public Folder addFolder(
066                            long userId, long parentFolderId, String name, String description,
067                            ServiceContext serviceContext)
068                    throws PortalException {
069    
070                    return _localRepository.addFolder(
071                            userId, parentFolderId, name, description, serviceContext);
072            }
073    
074            @Override
075            public void checkInFileEntry(
076                            long userId, long fileEntryId, boolean major, String changeLog,
077                            ServiceContext serviceContext)
078                    throws PortalException {
079    
080                    _localRepository.checkInFileEntry(
081                            userId, fileEntryId, major, changeLog, serviceContext);
082            }
083    
084            @Override
085            public void checkInFileEntry(
086                            long userId, long fileEntryId, String lockUuid,
087                            ServiceContext serviceContext)
088                    throws PortalException {
089    
090                    _localRepository.checkInFileEntry(
091                            userId, fileEntryId, lockUuid, serviceContext);
092            }
093    
094            @Override
095            public FileEntry copyFileEntry(
096                            long userId, long groupId, long fileEntryId, long destFolderId,
097                            ServiceContext serviceContext)
098                    throws PortalException {
099    
100                    return _localRepository.copyFileEntry(
101                            userId, groupId, fileEntryId, destFolderId, serviceContext);
102            }
103    
104            @Override
105            public void deleteAll() throws PortalException {
106                    _localRepository.deleteAll();
107            }
108    
109            @Override
110            public void deleteFileEntry(long fileEntryId) throws PortalException {
111                    _localRepository.deleteFileEntry(fileEntryId);
112            }
113    
114            @Override
115            public void deleteFolder(long folderId) throws PortalException {
116                    _localRepository.deleteFolder(folderId);
117            }
118    
119            @Override
120            public <T extends Capability> T getCapability(Class<T> capabilityClass) {
121                    return _localRepository.getCapability(capabilityClass);
122            }
123    
124            @Override
125            public FileEntry getFileEntry(long fileEntryId) throws PortalException {
126                    return _localRepository.getFileEntry(fileEntryId);
127            }
128    
129            @Override
130            public FileEntry getFileEntry(long folderId, String title)
131                    throws PortalException {
132    
133                    return _localRepository.getFileEntry(folderId, title);
134            }
135    
136            @Override
137            public FileEntry getFileEntryByUuid(String uuid) throws PortalException {
138                    return _localRepository.getFileEntryByUuid(uuid);
139            }
140    
141            @Override
142            public FileVersion getFileVersion(long fileVersionId)
143                    throws PortalException {
144    
145                    return _localRepository.getFileVersion(fileVersionId);
146            }
147    
148            @Override
149            public Folder getFolder(long folderId) throws PortalException {
150                    return _localRepository.getFolder(folderId);
151            }
152    
153            @Override
154            public Folder getFolder(long parentFolderId, String name)
155                    throws PortalException {
156    
157                    return _localRepository.getFolder(parentFolderId, name);
158            }
159    
160            @Override
161            public List<FileEntry> getRepositoryFileEntries(
162                            long userId, long rootFolderId, int start, int end,
163                            OrderByComparator<FileEntry> obc)
164                    throws PortalException {
165    
166                    return _localRepository.getRepositoryFileEntries(
167                            userId, rootFolderId, start, end, obc);
168            }
169    
170            @Override
171            public long getRepositoryId() {
172                    return _localRepository.getRepositoryId();
173            }
174    
175            @Override
176            public <T extends Capability> boolean isCapabilityProvided(
177                    Class<T> capabilityClass) {
178    
179                    return _localRepository.isCapabilityProvided(capabilityClass);
180            }
181    
182            @Override
183            public FileEntry moveFileEntry(
184                            long userId, long fileEntryId, long newFolderId,
185                            ServiceContext serviceContext)
186                    throws PortalException {
187    
188                    return _localRepository.moveFileEntry(
189                            userId, fileEntryId, newFolderId, serviceContext);
190            }
191    
192            @Override
193            public Folder moveFolder(
194                            long userId, long folderId, long parentFolderId,
195                            ServiceContext serviceContext)
196                    throws PortalException {
197    
198                    return _localRepository.moveFolder(
199                            userId, folderId, parentFolderId, serviceContext);
200            }
201    
202            @Override
203            public void revertFileEntry(
204                            long userId, long fileEntryId, String version,
205                            ServiceContext serviceContext)
206                    throws PortalException {
207    
208                    _localRepository.revertFileEntry(
209                            userId, fileEntryId, version, serviceContext);
210            }
211    
212            /**
213             * @deprecated As of 7.0.0, with no direct replacement
214             */
215            @Deprecated
216            @Override
217            public void updateAsset(
218                            long userId, FileEntry fileEntry, FileVersion fileVersion,
219                            long[] assetCategoryIds, String[] assetTagNames,
220                            long[] assetLinkEntryIds)
221                    throws PortalException {
222    
223                    _localRepository.updateAsset(
224                            userId, fileEntry, fileVersion, assetCategoryIds, assetTagNames,
225                            assetLinkEntryIds);
226            }
227    
228            @Override
229            public FileEntry updateFileEntry(
230                            long userId, long fileEntryId, String sourceFileName,
231                            String mimeType, String title, String description, String changeLog,
232                            boolean majorVersion, File file, ServiceContext serviceContext)
233                    throws PortalException {
234    
235                    return _localRepository.updateFileEntry(
236                            userId, fileEntryId, sourceFileName, mimeType, title, description,
237                            changeLog, majorVersion, file, serviceContext);
238            }
239    
240            @Override
241            public FileEntry updateFileEntry(
242                            long userId, long fileEntryId, String sourceFileName,
243                            String mimeType, String title, String description, String changeLog,
244                            boolean majorVersion, InputStream is, long size,
245                            ServiceContext serviceContext)
246                    throws PortalException {
247    
248                    return _localRepository.updateFileEntry(
249                            userId, fileEntryId, sourceFileName, mimeType, title, description,
250                            changeLog, majorVersion, is, size, serviceContext);
251            }
252    
253            @Override
254            public Folder updateFolder(
255                            long folderId, long parentFolderId, String name, String description,
256                            ServiceContext serviceContext)
257                    throws PortalException {
258    
259                    return _localRepository.updateFolder(
260                            folderId, parentFolderId, name, description, serviceContext);
261            }
262    
263            private final LocalRepository _localRepository;
264    
265    }