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.capabilities;
016    
017    import com.liferay.document.library.kernel.model.DLFolderConstants;
018    import com.liferay.portal.kernel.exception.PortalException;
019    import com.liferay.portal.kernel.lock.Lock;
020    import com.liferay.portal.kernel.repository.Repository;
021    import com.liferay.portal.kernel.repository.capabilities.CapabilityProvider;
022    import com.liferay.portal.kernel.repository.event.RepositoryEventTrigger;
023    import com.liferay.portal.kernel.repository.event.RepositoryEventType;
024    import com.liferay.portal.kernel.repository.model.FileEntry;
025    import com.liferay.portal.kernel.repository.model.FileShortcut;
026    import com.liferay.portal.kernel.repository.model.FileVersion;
027    import com.liferay.portal.kernel.repository.model.Folder;
028    import com.liferay.portal.kernel.repository.model.RepositoryEntry;
029    import com.liferay.portal.kernel.search.Hits;
030    import com.liferay.portal.kernel.search.Query;
031    import com.liferay.portal.kernel.search.SearchContext;
032    import com.liferay.portal.kernel.search.SearchException;
033    import com.liferay.portal.kernel.service.ServiceContext;
034    import com.liferay.portal.kernel.util.OrderByComparator;
035    
036    import java.io.File;
037    import java.io.InputStream;
038    
039    import java.util.List;
040    
041    /**
042     * @author Adolfo P??rez
043     */
044    public class CapabilityRepository
045            extends BaseCapabilityRepository<Repository> implements Repository {
046    
047            public CapabilityRepository(
048                    Repository repository, CapabilityProvider capabilityProvider,
049                    RepositoryEventTrigger repositoryEventTrigger) {
050    
051                    super(repository, capabilityProvider);
052    
053                    _repositoryEventTrigger = repositoryEventTrigger;
054            }
055    
056            @Override
057            public FileEntry addFileEntry(
058                            long userId, long folderId, String sourceFileName, String mimeType,
059                            String title, String description, String changeLog, File file,
060                            ServiceContext serviceContext)
061                    throws PortalException {
062    
063                    Repository repository = getRepository();
064    
065                    FileEntry fileEntry = repository.addFileEntry(
066                            userId, folderId, sourceFileName, mimeType, title, description,
067                            changeLog, file, serviceContext);
068    
069                    _repositoryEventTrigger.trigger(
070                            RepositoryEventType.Add.class, FileEntry.class, fileEntry);
071    
072                    return fileEntry;
073            }
074    
075            @Override
076            public FileEntry addFileEntry(
077                            long userId, long folderId, String sourceFileName, String mimeType,
078                            String title, String description, String changeLog, InputStream is,
079                            long size, ServiceContext serviceContext)
080                    throws PortalException {
081    
082                    Repository repository = getRepository();
083    
084                    FileEntry fileEntry = repository.addFileEntry(
085                            userId, folderId, sourceFileName, mimeType, title, description,
086                            changeLog, is, size, serviceContext);
087    
088                    _repositoryEventTrigger.trigger(
089                            RepositoryEventType.Add.class, FileEntry.class, fileEntry);
090    
091                    return fileEntry;
092            }
093    
094            /**
095             * @deprecated As of 7.0.0, see {@link #addFileEntry(long, long, String,
096             *             String, String, String, String, File, ServiceContext)}
097             */
098            @Deprecated
099            @Override
100            public FileEntry addFileEntry(
101                            long folderId, String sourceFileName, String mimeType, String title,
102                            String description, String changeLog, File file,
103                            ServiceContext serviceContext)
104                    throws PortalException {
105    
106                    return addFileEntry(
107                            com.liferay.portal.kernel.repository.util.RepositoryUserUtil.
108                                    getUserId(),
109                            folderId, sourceFileName, mimeType, title, description, changeLog,
110                            file, serviceContext);
111            }
112    
113            /**
114             * @deprecated As of 7.0.0, see {@link #addFileEntry(long, long, String,
115             *             String, String, String, String, InputStream, long,
116             *             ServiceContext)}
117             */
118            @Deprecated
119            @Override
120            public FileEntry addFileEntry(
121                            long folderId, String sourceFileName, String mimeType, String title,
122                            String description, String changeLog, InputStream is, long size,
123                            ServiceContext serviceContext)
124                    throws PortalException {
125    
126                    return addFileEntry(
127                            com.liferay.portal.kernel.repository.util.RepositoryUserUtil.
128                                    getUserId(),
129                            folderId, sourceFileName, mimeType, title, description, changeLog,
130                            is, size, serviceContext);
131            }
132    
133            @Override
134            public FileShortcut addFileShortcut(
135                            long userId, long folderId, long toFileEntryId,
136                            ServiceContext serviceContext)
137                    throws PortalException {
138    
139                    Repository repository = getRepository();
140    
141                    FileShortcut fileShortcut = repository.addFileShortcut(
142                            userId, folderId, toFileEntryId, serviceContext);
143    
144                    _repositoryEventTrigger.trigger(
145                            RepositoryEventType.Add.class, FileShortcut.class, fileShortcut);
146    
147                    return fileShortcut;
148            }
149    
150            @Override
151            public Folder addFolder(
152                            long userId, long parentFolderId, String name, String description,
153                            ServiceContext serviceContext)
154                    throws PortalException {
155    
156                    Repository repository = getRepository();
157    
158                    Folder folder = repository.addFolder(
159                            userId, parentFolderId, name, description, serviceContext);
160    
161                    _repositoryEventTrigger.trigger(
162                            RepositoryEventType.Add.class, Folder.class, folder);
163    
164                    return folder;
165            }
166    
167            /**
168             * @deprecated As of 7.0.0, replaced by {@link #addFolder(long, long,
169             *             String, String, ServiceContext)}
170             */
171            @Deprecated
172            @Override
173            public Folder addFolder(
174                            long parentFolderId, String name, String description,
175                            ServiceContext serviceContext)
176                    throws PortalException {
177    
178                    return addFolder(
179                            com.liferay.portal.kernel.repository.util.RepositoryUserUtil.
180                                    getUserId(),
181                            parentFolderId, name, description, serviceContext);
182            }
183    
184            @Override
185            public FileVersion cancelCheckOut(long fileEntryId) throws PortalException {
186                    Repository repository = getRepository();
187    
188                    FileVersion fileVersion = repository.cancelCheckOut(fileEntryId);
189    
190                    if (fileVersion != null) {
191                            _repositoryEventTrigger.trigger(
192                                    RepositoryEventType.Update.class, FileEntry.class,
193                                    fileVersion.getFileEntry());
194                    }
195    
196                    return fileVersion;
197            }
198    
199            /**
200             * @deprecated As of 7.0.0, replaced by {@link #checkInFileEntry(long, long,
201             *             boolean, String, ServiceContext)}
202             */
203            @Deprecated
204            @Override
205            public void checkInFileEntry(
206                            long fileEntryId, boolean major, String changeLog,
207                            ServiceContext serviceContext)
208                    throws PortalException {
209    
210                    checkInFileEntry(
211                            com.liferay.portal.kernel.repository.util.RepositoryUserUtil.
212                                    getUserId(),
213                            fileEntryId, major, changeLog, serviceContext);
214            }
215    
216            @Override
217            public void checkInFileEntry(
218                            long userId, long fileEntryId, boolean majorVersion,
219                            String changeLog, ServiceContext serviceContext)
220                    throws PortalException {
221    
222                    Repository repository = getRepository();
223    
224                    repository.checkInFileEntry(
225                            userId, fileEntryId, majorVersion, changeLog, serviceContext);
226    
227                    FileEntry fileEntry = repository.getFileEntry(fileEntryId);
228    
229                    _repositoryEventTrigger.trigger(
230                            RepositoryEventType.Update.class, FileEntry.class, fileEntry);
231            }
232    
233            @Override
234            public void checkInFileEntry(
235                            long userId, long fileEntryId, String lockUuid,
236                            ServiceContext serviceContext)
237                    throws PortalException {
238    
239                    Repository repository = getRepository();
240    
241                    repository.checkInFileEntry(
242                            userId, fileEntryId, lockUuid, serviceContext);
243    
244                    FileEntry fileEntry = repository.getFileEntry(fileEntryId);
245    
246                    _repositoryEventTrigger.trigger(
247                            RepositoryEventType.Update.class, FileEntry.class, fileEntry);
248            }
249    
250            /**
251             * @deprecated As of 7.0.0, replaced by {@link #checkInFileEntry(long, long,
252             *             String, ServiceContext)}
253             */
254            @Deprecated
255            @Override
256            public void checkInFileEntry(
257                            long fileEntryId, String lockUuid, ServiceContext serviceContext)
258                    throws PortalException {
259    
260                    checkInFileEntry(
261                            com.liferay.portal.kernel.repository.util.RepositoryUserUtil.
262                                    getUserId(),
263                            fileEntryId, lockUuid, serviceContext);
264            }
265    
266            @Override
267            public FileEntry checkOutFileEntry(
268                            long fileEntryId, ServiceContext serviceContext)
269                    throws PortalException {
270    
271                    Repository repository = getRepository();
272    
273                    FileEntry fileEntry = repository.checkOutFileEntry(
274                            fileEntryId, serviceContext);
275    
276                    _repositoryEventTrigger.trigger(
277                            RepositoryEventType.Update.class, FileEntry.class, fileEntry);
278    
279                    return fileEntry;
280            }
281    
282            @Override
283            public FileEntry checkOutFileEntry(
284                            long fileEntryId, String owner, long expirationTime,
285                            ServiceContext serviceContext)
286                    throws PortalException {
287    
288                    Repository repository = getRepository();
289    
290                    FileEntry fileEntry = repository.checkOutFileEntry(
291                            fileEntryId, owner, expirationTime, serviceContext);
292    
293                    _repositoryEventTrigger.trigger(
294                            RepositoryEventType.Update.class, FileEntry.class, fileEntry);
295    
296                    return fileEntry;
297            }
298    
299            @Override
300            public FileEntry copyFileEntry(
301                            long userId, long groupId, long fileEntryId, long destFolderId,
302                            ServiceContext serviceContext)
303                    throws PortalException {
304    
305                    Repository repository = getRepository();
306    
307                    FileEntry fileEntry = repository.copyFileEntry(
308                            userId, groupId, fileEntryId, destFolderId, serviceContext);
309    
310                    _repositoryEventTrigger.trigger(
311                            RepositoryEventType.Add.class, FileEntry.class, fileEntry);
312    
313                    return fileEntry;
314            }
315    
316            /**
317             * @deprecated As of 7.0.0, replaced by {@link #copyFileEntry(long, long,
318             *             long, long, ServiceContext)}
319             */
320            @Deprecated
321            @Override
322            public FileEntry copyFileEntry(
323                            long groupId, long fileEntryId, long destFolderId,
324                            ServiceContext serviceContext)
325                    throws PortalException {
326    
327                    return copyFileEntry(
328                            com.liferay.portal.kernel.repository.util.RepositoryUserUtil.
329                                    getUserId(),
330                            groupId, fileEntryId, destFolderId, serviceContext);
331            }
332    
333            @Override
334            public void deleteAll() throws PortalException {
335                    Repository repository = getRepository();
336    
337                    _repositoryEventTrigger.trigger(
338                            RepositoryEventType.Delete.class, Repository.class, repository);
339    
340                    repository.deleteAll();
341            }
342    
343            @Override
344            public void deleteFileEntry(long fileEntryId) throws PortalException {
345                    Repository repository = getRepository();
346    
347                    FileEntry fileEntry = repository.getFileEntry(fileEntryId);
348    
349                    _repositoryEventTrigger.trigger(
350                            RepositoryEventType.Delete.class, FileEntry.class, fileEntry);
351    
352                    repository.deleteFileEntry(fileEntryId);
353            }
354    
355            @Override
356            public void deleteFileEntry(long folderId, String title)
357                    throws PortalException {
358    
359                    Repository repository = getRepository();
360    
361                    FileEntry fileEntry = repository.getFileEntry(folderId, title);
362    
363                    _repositoryEventTrigger.trigger(
364                            RepositoryEventType.Delete.class, FileEntry.class, fileEntry);
365    
366                    repository.deleteFileEntry(folderId, title);
367            }
368    
369            @Override
370            public void deleteFileShortcut(long fileShortcutId) throws PortalException {
371                    Repository repository = getRepository();
372    
373                    FileShortcut fileShortcut = repository.getFileShortcut(fileShortcutId);
374    
375                    _repositoryEventTrigger.trigger(
376                            RepositoryEventType.Delete.class, FileShortcut.class, fileShortcut);
377    
378                    repository.deleteFileShortcut(fileShortcutId);
379            }
380    
381            @Override
382            public void deleteFileShortcuts(long toFileEntryId) throws PortalException {
383                    Repository repository = getRepository();
384    
385                    FileEntry fileEntry = repository.getFileEntry(toFileEntryId);
386    
387                    List<FileShortcut> fileShortcuts = fileEntry.getFileShortcuts();
388    
389                    for (FileShortcut fileShortcut : fileShortcuts) {
390                            _repositoryEventTrigger.trigger(
391                                    RepositoryEventType.Delete.class, FileShortcut.class,
392                                    fileShortcut);
393                    }
394    
395                    repository.deleteFileShortcuts(toFileEntryId);
396            }
397    
398            @Override
399            public void deleteFileVersion(long fileEntryId, String version)
400                    throws PortalException {
401    
402                    Repository repository = getRepository();
403    
404                    FileEntry fileEntry = repository.getFileEntry(fileEntryId);
405    
406                    _repositoryEventTrigger.trigger(
407                            RepositoryEventType.Update.class, FileEntry.class, fileEntry);
408    
409                    repository.deleteFileVersion(fileEntryId, version);
410            }
411    
412            @Override
413            public void deleteFolder(long folderId) throws PortalException {
414                    Repository repository = getRepository();
415    
416                    Folder folder = repository.getFolder(folderId);
417    
418                    _repositoryEventTrigger.trigger(
419                            RepositoryEventType.Delete.class, Folder.class, folder);
420    
421                    repository.deleteFolder(folderId);
422            }
423    
424            @Override
425            public void deleteFolder(long parentFolderId, String name)
426                    throws PortalException {
427    
428                    Repository repository = getRepository();
429    
430                    Folder folder = repository.getFolder(parentFolderId, name);
431    
432                    _repositoryEventTrigger.trigger(
433                            RepositoryEventType.Delete.class, Folder.class, folder);
434    
435                    repository.deleteFolder(parentFolderId, name);
436            }
437    
438            @Override
439            public List<FileEntry> getFileEntries(
440                            long folderId, int status, int start, int end,
441                            OrderByComparator<FileEntry> obc)
442                    throws PortalException {
443    
444                    return getRepository().getFileEntries(
445                            folderId, status, start, end, obc);
446            }
447    
448            @Override
449            public List<FileEntry> getFileEntries(
450                            long folderId, int start, int end, OrderByComparator<FileEntry> obc)
451                    throws PortalException {
452    
453                    return getRepository().getFileEntries(folderId, start, end, obc);
454            }
455    
456            @Override
457            public List<FileEntry> getFileEntries(
458                            long folderId, long fileEntryTypeId, int start, int end,
459                            OrderByComparator<FileEntry> obc)
460                    throws PortalException {
461    
462                    return getRepository().getFileEntries(
463                            folderId, fileEntryTypeId, start, end, obc);
464            }
465    
466            @Override
467            public List<FileEntry> getFileEntries(
468                            long folderId, String[] mimeTypes, int start, int end,
469                            OrderByComparator<FileEntry> obc)
470                    throws PortalException {
471    
472                    return getRepository().getFileEntries(
473                            folderId, mimeTypes, start, end, obc);
474            }
475    
476            @Override
477            public List<RepositoryEntry> getFileEntriesAndFileShortcuts(
478                            long folderId, int status, int start, int end)
479                    throws PortalException {
480    
481                    return getRepository().getFileEntriesAndFileShortcuts(
482                            folderId, status, start, end);
483            }
484    
485            @Override
486            public int getFileEntriesAndFileShortcutsCount(long folderId, int status)
487                    throws PortalException {
488    
489                    return getRepository().getFileEntriesAndFileShortcutsCount(
490                            folderId, status);
491            }
492    
493            @Override
494            public int getFileEntriesAndFileShortcutsCount(
495                            long folderId, int status, String[] mimeTypes)
496                    throws PortalException {
497    
498                    return getRepository().getFileEntriesAndFileShortcutsCount(
499                            folderId, status, mimeTypes);
500            }
501    
502            @Override
503            public int getFileEntriesCount(long folderId) throws PortalException {
504                    return getRepository().getFileEntriesCount(folderId);
505            }
506    
507            @Override
508            public int getFileEntriesCount(long folderId, int status)
509                    throws PortalException {
510    
511                    return getRepository().getFileEntriesCount(folderId, status);
512            }
513    
514            @Override
515            public int getFileEntriesCount(long folderId, long fileEntryTypeId)
516                    throws PortalException {
517    
518                    return getRepository().getFileEntriesCount(folderId, fileEntryTypeId);
519            }
520    
521            @Override
522            public int getFileEntriesCount(long folderId, String[] mimeTypes)
523                    throws PortalException {
524    
525                    return getRepository().getFileEntriesCount(folderId, mimeTypes);
526            }
527    
528            @Override
529            public FileEntry getFileEntry(long fileEntryId) throws PortalException {
530                    return getRepository().getFileEntry(fileEntryId);
531            }
532    
533            @Override
534            public FileEntry getFileEntry(long folderId, String title)
535                    throws PortalException {
536    
537                    return getRepository().getFileEntry(folderId, title);
538            }
539    
540            @Override
541            public FileEntry getFileEntryByUuid(String uuid) throws PortalException {
542                    return getRepository().getFileEntryByUuid(uuid);
543            }
544    
545            @Override
546            public FileShortcut getFileShortcut(long fileShortcutId)
547                    throws PortalException {
548    
549                    return getRepository().getFileShortcut(fileShortcutId);
550            }
551    
552            @Override
553            public FileVersion getFileVersion(long fileVersionId)
554                    throws PortalException {
555    
556                    return getRepository().getFileVersion(fileVersionId);
557            }
558    
559            @Override
560            public Folder getFolder(long folderId) throws PortalException {
561                    return getRepository().getFolder(folderId);
562            }
563    
564            @Override
565            public Folder getFolder(long parentFolderId, String name)
566                    throws PortalException {
567    
568                    return getRepository().getFolder(parentFolderId, name);
569            }
570    
571            @Override
572            public List<Folder> getFolders(
573                            long parentFolderId, boolean includeMountFolders, int start,
574                            int end, OrderByComparator<Folder> obc)
575                    throws PortalException {
576    
577                    return getRepository().getFolders(
578                            parentFolderId, includeMountFolders, start, end, obc);
579            }
580    
581            @Override
582            public List<Folder> getFolders(
583                            long parentFolderId, int status, boolean includeMountFolders,
584                            int start, int end, OrderByComparator<Folder> obc)
585                    throws PortalException {
586    
587                    return getRepository().getFolders(
588                            parentFolderId, status, includeMountFolders, start, end, obc);
589            }
590    
591            @Override
592            public List<RepositoryEntry> getFoldersAndFileEntriesAndFileShortcuts(
593                            long folderId, int status, boolean includeMountFolders, int start,
594                            int end, OrderByComparator<?> obc)
595                    throws PortalException {
596    
597                    return getRepository().getFoldersAndFileEntriesAndFileShortcuts(
598                            folderId, status, includeMountFolders, start, end, obc);
599            }
600    
601            @Override
602            public List<RepositoryEntry> getFoldersAndFileEntriesAndFileShortcuts(
603                            long folderId, int status, String[] mimetypes,
604                            boolean includeMountFolders, int start, int end,
605                            OrderByComparator<?> obc)
606                    throws PortalException {
607    
608                    return getRepository().getFoldersAndFileEntriesAndFileShortcuts(
609                            folderId, status, mimetypes, includeMountFolders, start, end, obc);
610            }
611    
612            @Override
613            public int getFoldersAndFileEntriesAndFileShortcutsCount(
614                            long folderId, int status, boolean includeMountFolders)
615                    throws PortalException {
616    
617                    return getRepository().getFoldersAndFileEntriesAndFileShortcutsCount(
618                            folderId, status, includeMountFolders);
619            }
620    
621            @Override
622            public int getFoldersAndFileEntriesAndFileShortcutsCount(
623                            long folderId, int status, String[] mimetypes,
624                            boolean includeMountFolders)
625                    throws PortalException {
626    
627                    return getRepository().getFoldersAndFileEntriesAndFileShortcutsCount(
628                            folderId, status, mimetypes, includeMountFolders);
629            }
630    
631            @Override
632            public int getFoldersCount(long parentFolderId, boolean includeMountfolders)
633                    throws PortalException {
634    
635                    return getRepository().getFoldersCount(
636                            parentFolderId, includeMountfolders);
637            }
638    
639            @Override
640            public int getFoldersCount(
641                            long parentFolderId, int status, boolean includeMountfolders)
642                    throws PortalException {
643    
644                    return getRepository().getFoldersCount(
645                            parentFolderId, status, includeMountfolders);
646            }
647    
648            @Override
649            public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
650                    throws PortalException {
651    
652                    return getRepository().getFoldersFileEntriesCount(folderIds, status);
653            }
654    
655            @Override
656            public List<Folder> getMountFolders(
657                            long parentFolderId, int start, int end,
658                            OrderByComparator<Folder> obc)
659                    throws PortalException {
660    
661                    return getRepository().getMountFolders(parentFolderId, start, end, obc);
662            }
663    
664            @Override
665            public int getMountFoldersCount(long parentFolderId)
666                    throws PortalException {
667    
668                    return getRepository().getMountFoldersCount(parentFolderId);
669            }
670    
671            @Override
672            public List<FileEntry> getRepositoryFileEntries(
673                            long userId, long rootFolderId, int start, int end,
674                            OrderByComparator<FileEntry> obc)
675                    throws PortalException {
676    
677                    return getRepository().getRepositoryFileEntries(
678                            userId, rootFolderId, start, end, obc);
679            }
680    
681            @Override
682            public List<FileEntry> getRepositoryFileEntries(
683                            long userId, long rootFolderId, String[] mimeTypes, int status,
684                            int start, int end, OrderByComparator<FileEntry> obc)
685                    throws PortalException {
686    
687                    return getRepository().getRepositoryFileEntries(
688                            userId, rootFolderId, mimeTypes, status, start, end, obc);
689            }
690    
691            @Override
692            public int getRepositoryFileEntriesCount(long userId, long rootFolderId)
693                    throws PortalException {
694    
695                    return getRepository().getRepositoryFileEntriesCount(
696                            userId, rootFolderId);
697            }
698    
699            @Override
700            public int getRepositoryFileEntriesCount(
701                            long userId, long rootFolderId, String[] mimeTypes, int status)
702                    throws PortalException {
703    
704                    return getRepository().getRepositoryFileEntriesCount(
705                            userId, rootFolderId, mimeTypes, status);
706            }
707    
708            @Override
709            public long getRepositoryId() {
710                    return getRepository().getRepositoryId();
711            }
712    
713            @Override
714            public void getSubfolderIds(List<Long> folderIds, long folderId)
715                    throws PortalException {
716    
717                    getRepository().getSubfolderIds(folderIds, folderId);
718            }
719    
720            @Override
721            public List<Long> getSubfolderIds(long folderId, boolean recurse)
722                    throws PortalException {
723    
724                    return getRepository().getSubfolderIds(folderId, recurse);
725            }
726    
727            @Override
728            public Lock lockFolder(long folderId) throws PortalException {
729                    return getRepository().lockFolder(folderId);
730            }
731    
732            @Override
733            public Lock lockFolder(
734                            long folderId, String owner, boolean inheritable,
735                            long expirationTime)
736                    throws PortalException {
737    
738                    return getRepository().lockFolder(
739                            folderId, owner, inheritable, expirationTime);
740            }
741    
742            @Override
743            public FileEntry moveFileEntry(
744                            long userId, long fileEntryId, long newFolderId,
745                            ServiceContext serviceContext)
746                    throws PortalException {
747    
748                    Repository repository = getRepository();
749    
750                    FileEntry fileEntry = repository.moveFileEntry(
751                            userId, fileEntryId, newFolderId, serviceContext);
752    
753                    _repositoryEventTrigger.trigger(
754                            RepositoryEventType.Move.class, FileEntry.class, fileEntry);
755    
756                    return fileEntry;
757            }
758    
759            /**
760             * @deprecated As of 7.0.0, replaced by {@link #moveFileEntry(long, long,
761             *             long, ServiceContext)}
762             */
763            @Deprecated
764            @Override
765            public FileEntry moveFileEntry(
766                            long fileEntryId, long newFolderId, ServiceContext serviceContext)
767                    throws PortalException {
768    
769                    return moveFileEntry(
770                            com.liferay.portal.kernel.repository.util.RepositoryUserUtil.
771                                    getUserId(),
772                            fileEntryId, newFolderId, serviceContext);
773            }
774    
775            @Override
776            public Folder moveFolder(
777                            long userId, long folderId, long parentFolderId,
778                            ServiceContext serviceContext)
779                    throws PortalException {
780    
781                    Repository repository = getRepository();
782    
783                    Folder folder = repository.moveFolder(
784                            userId, folderId, parentFolderId, serviceContext);
785    
786                    _repositoryEventTrigger.trigger(
787                            RepositoryEventType.Move.class, Folder.class, folder);
788    
789                    return folder;
790            }
791    
792            /**
793             * @deprecated As of 7.0.0, replaced by {@link #moveFolder(long, long, long,
794             *             ServiceContext)}
795             */
796            @Deprecated
797            @Override
798            public Folder moveFolder(
799                            long folderId, long newParentFolderId,
800                            ServiceContext serviceContext)
801                    throws PortalException {
802    
803                    return moveFolder(
804                            com.liferay.portal.kernel.repository.util.RepositoryUserUtil.
805                                    getUserId(),
806                            folderId, newParentFolderId, serviceContext);
807            }
808    
809            @Override
810            public Lock refreshFileEntryLock(
811                            String lockUuid, long companyId, long expirationTime)
812                    throws PortalException {
813    
814                    return getRepository().refreshFileEntryLock(
815                            lockUuid, companyId, expirationTime);
816            }
817    
818            @Override
819            public Lock refreshFolderLock(
820                            String lockUuid, long companyId, long expirationTime)
821                    throws PortalException {
822    
823                    return getRepository().refreshFolderLock(
824                            lockUuid, companyId, expirationTime);
825            }
826    
827            @Override
828            public void revertFileEntry(
829                            long userId, long fileEntryId, String version,
830                            ServiceContext serviceContext)
831                    throws PortalException {
832    
833                    Repository repository = getRepository();
834    
835                    repository.revertFileEntry(
836                            userId, fileEntryId, version, serviceContext);
837    
838                    FileEntry fileEntry = getFileEntry(fileEntryId);
839    
840                    _repositoryEventTrigger.trigger(
841                            RepositoryEventType.Update.class, FileEntry.class, fileEntry);
842            }
843    
844            /**
845             * @deprecated As of 7.0.0, replaced by {@link #revertFileEntry(long, long,
846             *             String, ServiceContext)}
847             */
848            @Deprecated
849            @Override
850            public void revertFileEntry(
851                            long fileEntryId, String version, ServiceContext serviceContext)
852                    throws PortalException {
853    
854                    Repository repository = getRepository();
855    
856                    repository.revertFileEntry(fileEntryId, version, serviceContext);
857    
858                    FileEntry fileEntry = getFileEntry(fileEntryId);
859    
860                    _repositoryEventTrigger.trigger(
861                            RepositoryEventType.Update.class, FileEntry.class, fileEntry);
862            }
863    
864            @Override
865            public Hits search(long creatorUserId, int status, int start, int end)
866                    throws PortalException {
867    
868                    return getRepository().search(creatorUserId, status, start, end);
869            }
870    
871            @Override
872            public Hits search(
873                            long creatorUserId, long folderId, String[] mimeTypes, int status,
874                            int start, int end)
875                    throws PortalException {
876    
877                    return getRepository().search(
878                            creatorUserId, folderId, mimeTypes, status, start, end);
879            }
880    
881            @Override
882            public Hits search(SearchContext searchContext) throws SearchException {
883                    return getRepository().search(searchContext);
884            }
885    
886            @Override
887            public Hits search(SearchContext searchContext, Query query)
888                    throws SearchException {
889    
890                    return getRepository().search(searchContext, query);
891            }
892    
893            @Override
894            public void unlockFolder(long folderId, String lockUuid)
895                    throws PortalException {
896    
897                    getRepository().unlockFolder(folderId, lockUuid);
898            }
899    
900            @Override
901            public void unlockFolder(long parentFolderId, String name, String lockUuid)
902                    throws PortalException {
903    
904                    getRepository().unlockFolder(parentFolderId, name, lockUuid);
905            }
906    
907            @Override
908            public FileEntry updateFileEntry(
909                            long userId, long fileEntryId, String sourceFileName,
910                            String mimeType, String title, String description, String changeLog,
911                            boolean majorVersion, File file, ServiceContext serviceContext)
912                    throws PortalException {
913    
914                    Repository repository = getRepository();
915    
916                    FileEntry fileEntry = repository.updateFileEntry(
917                            userId, fileEntryId, sourceFileName, mimeType, title, description,
918                            changeLog, majorVersion, file, serviceContext);
919    
920                    _repositoryEventTrigger.trigger(
921                            RepositoryEventType.Update.class, FileEntry.class, fileEntry);
922    
923                    return fileEntry;
924            }
925    
926            @Override
927            public FileEntry updateFileEntry(
928                            long userId, long fileEntryId, String sourceFileName,
929                            String mimeType, String title, String description, String changeLog,
930                            boolean majorVersion, InputStream is, long size,
931                            ServiceContext serviceContext)
932                    throws PortalException {
933    
934                    Repository repository = getRepository();
935    
936                    FileEntry fileEntry = repository.updateFileEntry(
937                            userId, fileEntryId, sourceFileName, mimeType, title, description,
938                            changeLog, majorVersion, is, size, serviceContext);
939    
940                    _repositoryEventTrigger.trigger(
941                            RepositoryEventType.Update.class, FileEntry.class, fileEntry);
942    
943                    return fileEntry;
944            }
945    
946            /**
947             * @deprecated As of 7.0.0, replaced by {@link #updateFileEntry(long, long,
948             *             String, String, String, String, String, boolean, File,
949             *             ServiceContext)}
950             */
951            @Deprecated
952            @Override
953            public FileEntry updateFileEntry(
954                            long fileEntryId, String sourceFileName, String mimeType,
955                            String title, String description, String changeLog,
956                            boolean majorVersion, File file, ServiceContext serviceContext)
957                    throws PortalException {
958    
959                    Repository repository = getRepository();
960    
961                    FileEntry fileEntry = repository.updateFileEntry(
962                            fileEntryId, sourceFileName, mimeType, title, description,
963                            changeLog, majorVersion, file, serviceContext);
964    
965                    _repositoryEventTrigger.trigger(
966                            RepositoryEventType.Update.class, FileEntry.class, fileEntry);
967    
968                    return fileEntry;
969            }
970    
971            /**
972             * @deprecated As of 7.0.0, replaced by {@link #updateFileEntry(long, long,
973             *             String, String, String, String, String, boolean, InputStream,
974             *             long, ServiceContext)}
975             */
976            @Deprecated
977            @Override
978            public FileEntry updateFileEntry(
979                            long fileEntryId, String sourceFileName, String mimeType,
980                            String title, String description, String changeLog,
981                            boolean majorVersion, InputStream is, long size,
982                            ServiceContext serviceContext)
983                    throws PortalException {
984    
985                    Repository repository = getRepository();
986    
987                    FileEntry fileEntry = repository.updateFileEntry(
988                            fileEntryId, sourceFileName, mimeType, title, description,
989                            changeLog, majorVersion, is, size, serviceContext);
990    
991                    _repositoryEventTrigger.trigger(
992                            RepositoryEventType.Update.class, FileEntry.class, fileEntry);
993    
994                    return fileEntry;
995            }
996    
997            @Override
998            public FileShortcut updateFileShortcut(
999                            long userId, long fileShortcutId, long folderId, long toFileEntryId,
1000                            ServiceContext serviceContext)
1001                    throws PortalException {
1002    
1003                    Repository repository = getRepository();
1004    
1005                    FileShortcut fileShortcut = repository.updateFileShortcut(
1006                            userId, fileShortcutId, folderId, toFileEntryId, serviceContext);
1007    
1008                    _repositoryEventTrigger.trigger(
1009                            RepositoryEventType.Update.class, FileShortcut.class, fileShortcut);
1010    
1011                    return fileShortcut;
1012            }
1013    
1014            @Override
1015            public void updateFileShortcuts(
1016                            long oldToFileEntryId, long newToFileEntryId)
1017                    throws PortalException {
1018    
1019                    Repository repository = getRepository();
1020    
1021                    FileEntry oldToFileEntry = repository.getFileEntry(oldToFileEntryId);
1022    
1023                    List<FileShortcut> fileShortcuts = oldToFileEntry.getFileShortcuts();
1024    
1025                    for (FileShortcut fileShortcut : fileShortcuts) {
1026                            _repositoryEventTrigger.trigger(
1027                                    RepositoryEventType.Update.class, FileShortcut.class,
1028                                    fileShortcut);
1029                    }
1030    
1031                    repository.updateFileShortcuts(oldToFileEntryId, newToFileEntryId);
1032            }
1033    
1034            @Override
1035            public Folder updateFolder(
1036                            long folderId, long parentFolderId, String name, String description,
1037                            ServiceContext serviceContext)
1038                    throws PortalException {
1039    
1040                    Repository repository = getRepository();
1041    
1042                    Folder folder = repository.updateFolder(
1043                            folderId, parentFolderId, name, description, serviceContext);
1044    
1045                    _repositoryEventTrigger.trigger(
1046                            RepositoryEventType.Update.class, Folder.class, folder);
1047    
1048                    return folder;
1049            }
1050    
1051            @Override
1052            public Folder updateFolder(
1053                            long folderId, String name, String description,
1054                            ServiceContext serviceContext)
1055                    throws PortalException {
1056    
1057                    Repository repository = getRepository();
1058    
1059                    Folder folder = repository.updateFolder(
1060                            folderId, name, description, serviceContext);
1061    
1062                    if (folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
1063                            _repositoryEventTrigger.trigger(
1064                                    RepositoryEventType.Update.class, Folder.class, folder);
1065                    }
1066    
1067                    return folder;
1068            }
1069    
1070            @Override
1071            public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
1072                    throws PortalException {
1073    
1074                    return getRepository().verifyFileEntryCheckOut(fileEntryId, lockUuid);
1075            }
1076    
1077            @Override
1078            public boolean verifyFileEntryLock(long fileEntryId, String lockUuid)
1079                    throws PortalException {
1080    
1081                    return getRepository().verifyFileEntryLock(fileEntryId, lockUuid);
1082            }
1083    
1084            @Override
1085            public boolean verifyInheritableLock(long folderId, String lockUuid)
1086                    throws PortalException {
1087    
1088                    return getRepository().verifyInheritableLock(folderId, lockUuid);
1089            }
1090    
1091            private final RepositoryEventTrigger _repositoryEventTrigger;
1092    
1093    }