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.util.OrderByComparator;
026    import com.liferay.portal.service.ServiceContext;
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 major, String changeLog,
089                            ServiceContext serviceContext)
090                    throws PortalException {
091    
092                    _localRepository.checkInFileEntry(
093                            userId, fileEntryId, major, 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 getFoldersCount(long parentFolderId, boolean includeMountfolders)
268                    throws PortalException {
269    
270                    return _localRepository.getFoldersCount(
271                            parentFolderId, includeMountfolders);
272            }
273    
274            @Override
275            public int getFoldersCount(
276                            long parentFolderId, int status, boolean includeMountfolders)
277                    throws PortalException {
278    
279                    return _localRepository.getFoldersCount(
280                            parentFolderId, status, includeMountfolders);
281            }
282    
283            @Override
284            public List<FileEntry> getRepositoryFileEntries(
285                            long userId, long rootFolderId, int start, int end,
286                            OrderByComparator<FileEntry> obc)
287                    throws PortalException {
288    
289                    return _localRepository.getRepositoryFileEntries(
290                            userId, rootFolderId, start, end, obc);
291            }
292    
293            @Override
294            public long getRepositoryId() {
295                    return _localRepository.getRepositoryId();
296            }
297    
298            @Override
299            public <T extends Capability> boolean isCapabilityProvided(
300                    Class<T> capabilityClass) {
301    
302                    return _localRepository.isCapabilityProvided(capabilityClass);
303            }
304    
305            @Override
306            public FileEntry moveFileEntry(
307                            long userId, long fileEntryId, long newFolderId,
308                            ServiceContext serviceContext)
309                    throws PortalException {
310    
311                    return _localRepository.moveFileEntry(
312                            userId, fileEntryId, newFolderId, serviceContext);
313            }
314    
315            @Override
316            public Folder moveFolder(
317                            long userId, long folderId, long parentFolderId,
318                            ServiceContext serviceContext)
319                    throws PortalException {
320    
321                    return _localRepository.moveFolder(
322                            userId, folderId, parentFolderId, serviceContext);
323            }
324    
325            @Override
326            public void revertFileEntry(
327                            long userId, long fileEntryId, String version,
328                            ServiceContext serviceContext)
329                    throws PortalException {
330    
331                    _localRepository.revertFileEntry(
332                            userId, fileEntryId, version, serviceContext);
333            }
334    
335            /**
336             * @deprecated As of 7.0.0, with no direct replacement
337             */
338            @Deprecated
339            @Override
340            public void updateAsset(
341                            long userId, FileEntry fileEntry, FileVersion fileVersion,
342                            long[] assetCategoryIds, String[] assetTagNames,
343                            long[] assetLinkEntryIds)
344                    throws PortalException {
345    
346                    _localRepository.updateAsset(
347                            userId, fileEntry, fileVersion, assetCategoryIds, assetTagNames,
348                            assetLinkEntryIds);
349            }
350    
351            @Override
352            public FileEntry updateFileEntry(
353                            long userId, long fileEntryId, String sourceFileName,
354                            String mimeType, String title, String description, String changeLog,
355                            boolean majorVersion, File file, ServiceContext serviceContext)
356                    throws PortalException {
357    
358                    return _localRepository.updateFileEntry(
359                            userId, fileEntryId, sourceFileName, mimeType, title, description,
360                            changeLog, majorVersion, file, serviceContext);
361            }
362    
363            @Override
364            public FileEntry updateFileEntry(
365                            long userId, long fileEntryId, String sourceFileName,
366                            String mimeType, String title, String description, String changeLog,
367                            boolean majorVersion, InputStream is, long size,
368                            ServiceContext serviceContext)
369                    throws PortalException {
370    
371                    return _localRepository.updateFileEntry(
372                            userId, fileEntryId, sourceFileName, mimeType, title, description,
373                            changeLog, majorVersion, is, size, serviceContext);
374            }
375    
376            @Override
377            public FileShortcut updateFileShortcut(
378                            long userId, long fileShortcutId, long folderId, long toFileEntryId,
379                            ServiceContext serviceContext)
380                    throws PortalException {
381    
382                    return _localRepository.updateFileShortcut(
383                            userId, fileShortcutId, folderId, toFileEntryId, serviceContext);
384            }
385    
386            @Override
387            public void updateFileShortcuts(
388                            long oldToFileEntryId, long newToFileEntryId)
389                    throws PortalException {
390    
391                    _localRepository.updateFileShortcuts(
392                            oldToFileEntryId, newToFileEntryId);
393            }
394    
395            @Override
396            public Folder updateFolder(
397                            long folderId, long parentFolderId, String name, String description,
398                            ServiceContext serviceContext)
399                    throws PortalException {
400    
401                    return _localRepository.updateFolder(
402                            folderId, parentFolderId, name, description, serviceContext);
403            }
404    
405            private final LocalRepository _localRepository;
406    
407    }