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