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.FileShortcut;
022    import com.liferay.portal.kernel.repository.model.FileVersion;
023    import com.liferay.portal.kernel.repository.model.Folder;
024    import com.liferay.portal.kernel.util.OrderByComparator;
025    import com.liferay.portal.service.ServiceContext;
026    
027    import java.io.File;
028    import java.io.InputStream;
029    
030    import java.util.List;
031    
032    /**
033     * @author Adolfo P??rez
034     */
035    public class LocalRepositoryWrapper implements LocalRepository {
036    
037            public LocalRepositoryWrapper(LocalRepository localRepository) {
038                    _localRepository = localRepository;
039            }
040    
041            @Override
042            public FileEntry addFileEntry(
043                            long userId, long folderId, String sourceFileName, String mimeType,
044                            String title, String description, String changeLog, File file,
045                            ServiceContext serviceContext)
046                    throws PortalException {
047    
048                    return _localRepository.addFileEntry(
049                            userId, folderId, sourceFileName, mimeType, title, description,
050                            changeLog, file, serviceContext);
051            }
052    
053            @Override
054            public FileEntry addFileEntry(
055                            long userId, long folderId, String sourceFileName, String mimeType,
056                            String title, String description, String changeLog, InputStream is,
057                            long size, ServiceContext serviceContext)
058                    throws PortalException {
059    
060                    return _localRepository.addFileEntry(
061                            userId, folderId, sourceFileName, mimeType, title, description,
062                            changeLog, is, size, serviceContext);
063            }
064    
065            @Override
066            public FileShortcut addFileShortcut(
067                            long userId, long folderId, long toFileEntryId,
068                            ServiceContext serviceContext)
069                    throws PortalException {
070    
071                    return _localRepository.addFileShortcut(
072                            userId, folderId, toFileEntryId, serviceContext);
073            }
074    
075            @Override
076            public Folder addFolder(
077                            long userId, long parentFolderId, String name, String description,
078                            ServiceContext serviceContext)
079                    throws PortalException {
080    
081                    return _localRepository.addFolder(
082                            userId, parentFolderId, name, description, serviceContext);
083            }
084    
085            @Override
086            public void checkInFileEntry(
087                            long userId, long fileEntryId, boolean major, String changeLog,
088                            ServiceContext serviceContext)
089                    throws PortalException {
090    
091                    _localRepository.checkInFileEntry(
092                            userId, fileEntryId, major, changeLog, serviceContext);
093            }
094    
095            @Override
096            public void checkInFileEntry(
097                            long userId, long fileEntryId, String lockUuid,
098                            ServiceContext serviceContext)
099                    throws PortalException {
100    
101                    _localRepository.checkInFileEntry(
102                            userId, fileEntryId, lockUuid, serviceContext);
103            }
104    
105            @Override
106            public FileEntry copyFileEntry(
107                            long userId, long groupId, long fileEntryId, long destFolderId,
108                            ServiceContext serviceContext)
109                    throws PortalException {
110    
111                    return _localRepository.copyFileEntry(
112                            userId, groupId, fileEntryId, destFolderId, serviceContext);
113            }
114    
115            @Override
116            public void deleteAll() throws PortalException {
117                    _localRepository.deleteAll();
118            }
119    
120            @Override
121            public void deleteFileEntry(long fileEntryId) throws PortalException {
122                    _localRepository.deleteFileEntry(fileEntryId);
123            }
124    
125            @Override
126            public void deleteFileShortcut(long fileShortcutId) throws PortalException {
127                    _localRepository.deleteFileShortcut(fileShortcutId);
128            }
129    
130            @Override
131            public void deleteFileShortcuts(long toFileEntryId) throws PortalException {
132                    _localRepository.deleteFileShortcuts(toFileEntryId);
133            }
134    
135            @Override
136            public void deleteFolder(long folderId) throws PortalException {
137                    _localRepository.deleteFolder(folderId);
138            }
139    
140            @Override
141            public <T extends Capability> T getCapability(Class<T> capabilityClass) {
142                    return _localRepository.getCapability(capabilityClass);
143            }
144    
145            @Override
146            public List<FileEntry> getFileEntries(
147                            long folderId, int status, int start, int end,
148                            OrderByComparator<FileEntry> obc)
149                    throws PortalException {
150    
151                    return _localRepository.getFileEntries(
152                            folderId, status, start, end, obc);
153            }
154    
155            @Override
156            public List<FileEntry> getFileEntries(
157                            long folderId, int start, int end, OrderByComparator<FileEntry> obc)
158                    throws PortalException {
159    
160                    return _localRepository.getFileEntries(folderId, start, end, obc);
161            }
162    
163            @Override
164            public int getFileEntriesCount(long folderId) throws PortalException {
165                    return _localRepository.getFileEntriesCount(folderId);
166            }
167    
168            @Override
169            public int getFileEntriesCount(long folderId, int status)
170                    throws PortalException {
171    
172                    return _localRepository.getFileEntriesCount(folderId, status);
173            }
174    
175            @Override
176            public FileEntry getFileEntry(long fileEntryId) throws PortalException {
177                    return _localRepository.getFileEntry(fileEntryId);
178            }
179    
180            @Override
181            public FileEntry getFileEntry(long folderId, String title)
182                    throws PortalException {
183    
184                    return _localRepository.getFileEntry(folderId, title);
185            }
186    
187            @Override
188            public FileEntry getFileEntryByUuid(String uuid) throws PortalException {
189                    return _localRepository.getFileEntryByUuid(uuid);
190            }
191    
192            @Override
193            public FileShortcut getFileShortcut(long fileShortcutId)
194                    throws PortalException {
195    
196                    return _localRepository.getFileShortcut(fileShortcutId);
197            }
198    
199            @Override
200            public FileVersion getFileVersion(long fileVersionId)
201                    throws PortalException {
202    
203                    return _localRepository.getFileVersion(fileVersionId);
204            }
205    
206            @Override
207            public Folder getFolder(long folderId) throws PortalException {
208                    return _localRepository.getFolder(folderId);
209            }
210    
211            @Override
212            public Folder getFolder(long parentFolderId, String name)
213                    throws PortalException {
214    
215                    return _localRepository.getFolder(parentFolderId, name);
216            }
217    
218            @Override
219            public List<FileEntry> getRepositoryFileEntries(
220                            long userId, long rootFolderId, int start, int end,
221                            OrderByComparator<FileEntry> obc)
222                    throws PortalException {
223    
224                    return _localRepository.getRepositoryFileEntries(
225                            userId, rootFolderId, start, end, obc);
226            }
227    
228            @Override
229            public long getRepositoryId() {
230                    return _localRepository.getRepositoryId();
231            }
232    
233            @Override
234            public <T extends Capability> boolean isCapabilityProvided(
235                    Class<T> capabilityClass) {
236    
237                    return _localRepository.isCapabilityProvided(capabilityClass);
238            }
239    
240            @Override
241            public FileEntry moveFileEntry(
242                            long userId, long fileEntryId, long newFolderId,
243                            ServiceContext serviceContext)
244                    throws PortalException {
245    
246                    return _localRepository.moveFileEntry(
247                            userId, fileEntryId, newFolderId, serviceContext);
248            }
249    
250            @Override
251            public Folder moveFolder(
252                            long userId, long folderId, long parentFolderId,
253                            ServiceContext serviceContext)
254                    throws PortalException {
255    
256                    return _localRepository.moveFolder(
257                            userId, folderId, parentFolderId, serviceContext);
258            }
259    
260            @Override
261            public void revertFileEntry(
262                            long userId, long fileEntryId, String version,
263                            ServiceContext serviceContext)
264                    throws PortalException {
265    
266                    _localRepository.revertFileEntry(
267                            userId, fileEntryId, version, serviceContext);
268            }
269    
270            /**
271             * @deprecated As of 7.0.0, with no direct replacement
272             */
273            @Deprecated
274            @Override
275            public void updateAsset(
276                            long userId, FileEntry fileEntry, FileVersion fileVersion,
277                            long[] assetCategoryIds, String[] assetTagNames,
278                            long[] assetLinkEntryIds)
279                    throws PortalException {
280    
281                    _localRepository.updateAsset(
282                            userId, fileEntry, fileVersion, assetCategoryIds, assetTagNames,
283                            assetLinkEntryIds);
284            }
285    
286            @Override
287            public FileEntry updateFileEntry(
288                            long userId, long fileEntryId, String sourceFileName,
289                            String mimeType, String title, String description, String changeLog,
290                            boolean majorVersion, File file, ServiceContext serviceContext)
291                    throws PortalException {
292    
293                    return _localRepository.updateFileEntry(
294                            userId, fileEntryId, sourceFileName, mimeType, title, description,
295                            changeLog, majorVersion, file, serviceContext);
296            }
297    
298            @Override
299            public FileEntry updateFileEntry(
300                            long userId, long fileEntryId, String sourceFileName,
301                            String mimeType, String title, String description, String changeLog,
302                            boolean majorVersion, InputStream is, long size,
303                            ServiceContext serviceContext)
304                    throws PortalException {
305    
306                    return _localRepository.updateFileEntry(
307                            userId, fileEntryId, sourceFileName, mimeType, title, description,
308                            changeLog, majorVersion, is, size, serviceContext);
309            }
310    
311            @Override
312            public FileShortcut updateFileShortcut(
313                            long userId, long fileShortcutId, long folderId, long toFileEntryId,
314                            ServiceContext serviceContext)
315                    throws PortalException {
316    
317                    return _localRepository.updateFileShortcut(
318                            userId, fileShortcutId, folderId, toFileEntryId, serviceContext);
319            }
320    
321            @Override
322            public void updateFileShortcuts(
323                            long oldToFileEntryId, long newToFileEntryId)
324                    throws PortalException {
325    
326                    _localRepository.updateFileShortcuts(
327                            oldToFileEntryId, newToFileEntryId);
328            }
329    
330            @Override
331            public Folder updateFolder(
332                            long folderId, long parentFolderId, String name, String description,
333                            ServiceContext serviceContext)
334                    throws PortalException {
335    
336                    return _localRepository.updateFolder(
337                            folderId, parentFolderId, name, description, serviceContext);
338            }
339    
340            private final LocalRepository _localRepository;
341    
342    }