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