001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.repository.proxy;
016    
017    import com.liferay.counter.service.CounterLocalService;
018    import com.liferay.portal.kernel.exception.PortalException;
019    import com.liferay.portal.kernel.exception.SystemException;
020    import com.liferay.portal.kernel.repository.BaseRepository;
021    import com.liferay.portal.kernel.repository.LocalRepository;
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.kernel.util.UnicodeProperties;
031    import com.liferay.portal.model.Lock;
032    import com.liferay.portal.service.CompanyLocalService;
033    import com.liferay.portal.service.ServiceContext;
034    import com.liferay.portal.service.UserLocalService;
035    import com.liferay.portlet.asset.service.AssetEntryLocalService;
036    import com.liferay.portlet.documentlibrary.service.DLAppHelperLocalService;
037    
038    import java.io.File;
039    import java.io.InputStream;
040    
041    import java.util.List;
042    
043    /**
044     * @author Mika Koivisto
045     */
046    public class BaseRepositoryProxyBean
047            extends RepositoryModelProxyBean implements BaseRepository {
048    
049            public BaseRepositoryProxyBean(
050                    BaseRepository baseRepository, ClassLoader classLoader) {
051    
052                    super(classLoader);
053    
054                    _baseRepository = baseRepository;
055            }
056    
057            public FileEntry addFileEntry(
058                            long folderId, String sourceFileName, String mimeType, String title,
059                            String description, String changeLog, File file,
060                            ServiceContext serviceContext)
061                    throws PortalException, SystemException {
062    
063                    FileEntry fileEntry = _baseRepository.addFileEntry(
064                            folderId, sourceFileName, mimeType, title, description, changeLog,
065                            file, serviceContext);
066    
067                    return newFileEntryProxyBean(fileEntry);
068            }
069    
070            public FileEntry addFileEntry(
071                            long folderId, String sourceFileName, String mimeType, String title,
072                            String description, String changeLog, InputStream is, long size,
073                            ServiceContext serviceContext)
074                    throws PortalException, SystemException {
075    
076                    FileEntry fileEntry = _baseRepository.addFileEntry(
077                            folderId, sourceFileName, mimeType, title, description, changeLog,
078                            is, size, serviceContext);
079    
080                    return newFileEntryProxyBean(fileEntry);
081            }
082    
083            public Folder addFolder(
084                            long parentFolderId, String title, String description,
085                            ServiceContext serviceContext)
086                    throws PortalException, SystemException {
087    
088                    Folder folder = _baseRepository.addFolder(
089                            parentFolderId, title, description, serviceContext);
090    
091                    return newFolderProxyBean(folder);
092            }
093    
094            public FileVersion cancelCheckOut(long fileEntryId)
095                    throws PortalException, SystemException {
096    
097                    return _baseRepository.cancelCheckOut(fileEntryId);
098            }
099    
100            public void checkInFileEntry(
101                            long fileEntryId, boolean major, String changeLog,
102                            ServiceContext serviceContext)
103                    throws PortalException, SystemException {
104    
105                    _baseRepository.checkInFileEntry(
106                            fileEntryId, major, changeLog, serviceContext);
107            }
108    
109            public void checkInFileEntry(long fileEntryId, String lockUuid)
110                    throws PortalException, SystemException {
111    
112                    _baseRepository.checkInFileEntry(fileEntryId, lockUuid);
113            }
114    
115            public FileEntry checkOutFileEntry(
116                            long fileEntryId, ServiceContext serviceContext)
117                    throws PortalException, SystemException {
118    
119                    FileEntry fileEntry = _baseRepository.checkOutFileEntry(
120                            fileEntryId, serviceContext);
121    
122                    return newFileEntryProxyBean(fileEntry);
123            }
124    
125            public FileEntry checkOutFileEntry(
126                            long fileEntryId, String owner, long expirationTime,
127                            ServiceContext serviceContext)
128                    throws PortalException, SystemException {
129    
130                    FileEntry fileEntry = _baseRepository.checkOutFileEntry(
131                            fileEntryId, owner, expirationTime, serviceContext);
132    
133                    return newFileEntryProxyBean(fileEntry);
134            }
135    
136            public FileEntry copyFileEntry(
137                            long groupId, long fileEntryId, long destFolderId,
138                            ServiceContext serviceContext)
139                    throws PortalException, SystemException {
140    
141                    return _baseRepository.copyFileEntry(
142                            groupId, fileEntryId, destFolderId, serviceContext);
143            }
144    
145            public void deleteFileEntry(long fileEntryId)
146                    throws PortalException, SystemException {
147    
148                    _baseRepository.deleteFileEntry(fileEntryId);
149            }
150    
151            public void deleteFileEntry(long folderId, String title)
152                    throws PortalException, SystemException {
153    
154                    _baseRepository.deleteFileEntry(folderId, title);
155            }
156    
157            public void deleteFileVersion(long fileEntryId, String version)
158                    throws PortalException, SystemException {
159    
160                    _baseRepository.deleteFileVersion(fileEntryId, version);
161            }
162    
163            public void deleteFolder(long folderId)
164                    throws PortalException, SystemException {
165    
166                    _baseRepository.deleteFolder(folderId);
167            }
168    
169            public void deleteFolder(long parentFolderId, String title)
170                    throws PortalException, SystemException {
171    
172                    _baseRepository.deleteFolder(parentFolderId, title);
173            }
174    
175            public List<FileEntry> getFileEntries(
176                            long folderId, int start, int end, OrderByComparator obc)
177                    throws SystemException {
178    
179                    List<FileEntry> fileEntries = _baseRepository.getFileEntries(
180                            folderId, start, end, obc);
181    
182                    return toFileEntryProxyBeans(fileEntries);
183            }
184    
185            public List<FileEntry> getFileEntries(
186                            long folderId, long documentTypeId, int start, int end,
187                            OrderByComparator obc)
188                    throws SystemException {
189    
190                    List<FileEntry> fileEntries = _baseRepository.getFileEntries(
191                            folderId, documentTypeId, start, end, obc);
192    
193                    return toFileEntryProxyBeans(fileEntries);
194            }
195    
196            public List<FileEntry> getFileEntries(
197                            long folderId, String[] mimeTypes, int start, int end,
198                            OrderByComparator obc)
199                    throws PortalException, SystemException {
200    
201                    List<FileEntry> fileEntries = _baseRepository.getFileEntries(
202                            folderId, mimeTypes, start, end, obc);
203    
204                    return toFileEntryProxyBeans(fileEntries);
205            }
206    
207            public List<Object> getFileEntriesAndFileShortcuts(
208                            long folderId, int status, int start, int end)
209                    throws SystemException {
210    
211                    List<Object> objects = _baseRepository.getFileEntriesAndFileShortcuts(
212                            folderId, status, start, end);
213    
214                    return toObjectProxyBeans(objects);
215            }
216    
217            public int getFileEntriesAndFileShortcutsCount(long folderId, int status)
218                    throws SystemException {
219    
220                    return _baseRepository.getFileEntriesAndFileShortcutsCount(
221                            folderId, status);
222            }
223    
224            public int getFileEntriesAndFileShortcutsCount(
225                            long folderId, int status, String[] mimeTypes)
226                    throws PortalException, SystemException {
227    
228                    return _baseRepository.getFileEntriesAndFileShortcutsCount(
229                            folderId, status, mimeTypes);
230            }
231    
232            public int getFileEntriesCount(long folderId) throws SystemException {
233                    return _baseRepository.getFileEntriesCount(folderId);
234            }
235    
236            public int getFileEntriesCount(long folderId, long documentTypeId)
237                    throws SystemException {
238    
239                    return _baseRepository.getFileEntriesCount(folderId, documentTypeId);
240            }
241    
242            public int getFileEntriesCount(long folderId, String[] mimeTypes)
243                    throws PortalException, SystemException {
244    
245                    return _baseRepository.getFileEntriesCount(folderId, mimeTypes);
246            }
247    
248            public FileEntry getFileEntry(long fileEntryId)
249                    throws PortalException, SystemException {
250    
251                    FileEntry fileEntry = _baseRepository.getFileEntry(fileEntryId);
252    
253                    return newFileEntryProxyBean(fileEntry);
254            }
255    
256            public FileEntry getFileEntry(long folderId, String title)
257                    throws PortalException, SystemException {
258    
259                    FileEntry fileEntry = _baseRepository.getFileEntry(folderId, title);
260    
261                    return newFileEntryProxyBean(fileEntry);
262            }
263    
264            public FileEntry getFileEntryByUuid(String uuid)
265                    throws PortalException, SystemException {
266    
267                    FileEntry fileEntry = _baseRepository.getFileEntryByUuid(uuid);
268    
269                    return newFileEntryProxyBean(fileEntry);
270            }
271    
272            public FileVersion getFileVersion(long fileVersionId)
273                    throws PortalException, SystemException {
274    
275                    FileVersion fileVersion = _baseRepository.getFileVersion(fileVersionId);
276    
277                    return newFileVersionProxyBean(fileVersion);
278            }
279    
280            public Folder getFolder(long folderId)
281                    throws PortalException, SystemException {
282    
283                    Folder folder = _baseRepository.getFolder(folderId);
284    
285                    return newFolderProxyBean(folder);
286            }
287    
288            public Folder getFolder(long parentFolderId, String title)
289                    throws PortalException, SystemException {
290    
291                    Folder folder = _baseRepository.getFolder(parentFolderId, title);
292    
293                    return newFolderProxyBean(folder);
294            }
295    
296            public List<Folder> getFolders(
297                            long parentFolderId, boolean includeMountfolders, int start,
298                            int end, OrderByComparator obc)
299                    throws PortalException, SystemException {
300    
301                    List<Folder> folders = _baseRepository.getFolders(
302                            parentFolderId, includeMountfolders, start, end, obc);
303    
304                    return toFolderProxyBeans(folders);
305            }
306    
307            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
308                            long folderId, int status, boolean includeMountFolders, int start,
309                            int end, OrderByComparator obc)
310                    throws SystemException {
311    
312                    List<Object> objects =
313                            _baseRepository.getFoldersAndFileEntriesAndFileShortcuts(
314                                    folderId, status, includeMountFolders, start, end, obc);
315    
316                    return toObjectProxyBeans(objects);
317            }
318    
319            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
320                            long folderId, int status, String[] mimeTypes,
321                            boolean includeMountFolders, int start, int end,
322                            OrderByComparator obc)
323                    throws PortalException, SystemException {
324    
325                    List<Object> objects =
326                            _baseRepository.getFoldersAndFileEntriesAndFileShortcuts(
327                                    folderId, status, mimeTypes, includeMountFolders, start, end,
328                                    obc);
329    
330                    return toObjectProxyBeans(objects);
331            }
332    
333            public int getFoldersAndFileEntriesAndFileShortcutsCount(
334                            long folderId, int status, boolean includeMountFolders)
335                    throws SystemException {
336    
337                    return _baseRepository.getFoldersAndFileEntriesAndFileShortcutsCount(
338                            folderId, status, includeMountFolders);
339            }
340    
341            public int getFoldersAndFileEntriesAndFileShortcutsCount(
342                            long folderId, int status, String[] mimeTypes,
343                            boolean includeMountFolders)
344                    throws PortalException, SystemException {
345    
346                    return _baseRepository.getFoldersAndFileEntriesAndFileShortcutsCount(
347                            folderId, status, mimeTypes, includeMountFolders);
348            }
349    
350            public int getFoldersCount(long parentFolderId, boolean includeMountfolders)
351                    throws PortalException, SystemException {
352    
353                    return _baseRepository.getFoldersCount(
354                            parentFolderId, includeMountfolders);
355            }
356    
357            public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
358                    throws SystemException {
359    
360                    return _baseRepository.getFoldersFileEntriesCount(folderIds, status);
361            }
362    
363            public LocalRepository getLocalRepository() {
364                    LocalRepository localRepository = _baseRepository.getLocalRepository();
365    
366                    return newLocalRepositoryProxyBean(localRepository);
367            }
368    
369            public List<Folder> getMountFolders(
370                            long parentFolderId, int start, int end, OrderByComparator obc)
371                    throws SystemException {
372    
373                    List<Folder> folders = _baseRepository.getMountFolders(
374                            parentFolderId, start, end, obc);
375    
376                    return toFolderProxyBeans(folders);
377            }
378    
379            public int getMountFoldersCount(long parentFolderId)
380                    throws SystemException {
381    
382                    return _baseRepository.getMountFoldersCount(parentFolderId);
383            }
384    
385            public BaseRepository getProxyBean() {
386                    return _baseRepository;
387            }
388    
389            public List<FileEntry> getRepositoryFileEntries(
390                            long userId, long rootFolderId, int start, int end,
391                            OrderByComparator obc)
392                    throws SystemException {
393    
394                    List<FileEntry> fileEntries = _baseRepository.getRepositoryFileEntries(
395                            userId, rootFolderId, start, end, obc);
396    
397                    return toFileEntryProxyBeans(fileEntries);
398            }
399    
400            public List<FileEntry> getRepositoryFileEntries(
401                            long userId, long rootFolderId, String[] mimeTypes, int status,
402                            int start, int end, OrderByComparator obc)
403                    throws PortalException, SystemException {
404    
405                    List<FileEntry> fileEntries = _baseRepository.getRepositoryFileEntries(
406                            userId, rootFolderId, mimeTypes, status, start, end, obc);
407    
408                    return toFileEntryProxyBeans(fileEntries);
409            }
410    
411            public int getRepositoryFileEntriesCount(long userId, long rootFolderId)
412                    throws SystemException {
413    
414                    return _baseRepository.getRepositoryFileEntriesCount(
415                            userId, rootFolderId);
416            }
417    
418            public int getRepositoryFileEntriesCount(
419                            long userId, long rootFolderId, String[] mimeTypes, int status)
420                    throws PortalException, SystemException {
421    
422                    return _baseRepository.getRepositoryFileEntriesCount(
423                            userId, rootFolderId, mimeTypes, status);
424            }
425    
426            public long getRepositoryId() {
427                    return _baseRepository.getRepositoryId();
428            }
429    
430            public void getSubfolderIds(List<Long> folderIds, long folderId)
431                    throws SystemException {
432    
433                    _baseRepository.getSubfolderIds(folderIds, folderId);
434            }
435    
436            public List<Long> getSubfolderIds(long folderId, boolean recurse)
437                    throws SystemException {
438    
439                    return _baseRepository.getSubfolderIds(folderId, recurse);
440            }
441    
442            public String[] getSupportedConfigurations() {
443                    return _baseRepository.getSupportedConfigurations();
444            }
445    
446            public String[][] getSupportedParameters() {
447                    return _baseRepository.getSupportedParameters();
448            }
449    
450            public void initRepository() throws PortalException, SystemException {
451                    _baseRepository.initRepository();
452            }
453    
454            /**
455             * @deprecated {@link #checkOutFileEntry(long, ServiceContext)}
456             */
457            public Lock lockFileEntry(long fileEntryId)
458                    throws PortalException, SystemException {
459    
460                    Lock lock = _baseRepository.lockFileEntry(fileEntryId);
461    
462                    return (Lock)newProxyInstance(lock, Lock.class);
463            }
464    
465            /**
466             * @deprecated {@link #checkOutFileEntry(long, String, long,
467             *             ServiceContext)}
468             */
469            public Lock lockFileEntry(
470                            long fileEntryId, String owner, long expirationTime)
471                    throws PortalException, SystemException {
472    
473                    Lock lock = _baseRepository.lockFileEntry(
474                            fileEntryId, owner, expirationTime);
475    
476                    return (Lock)newProxyInstance(lock, Lock.class);
477            }
478    
479            public Lock lockFolder(long folderId)
480                    throws PortalException, SystemException {
481    
482                    Lock lock = _baseRepository.lockFolder(folderId);
483    
484                    return (Lock)newProxyInstance(lock, Lock.class);
485            }
486    
487            public Lock lockFolder(
488                            long folderId, String owner, boolean inheritable,
489                            long expirationTime)
490                    throws PortalException, SystemException {
491    
492                    Lock lock = _baseRepository.lockFolder(
493                            folderId, owner, inheritable, expirationTime);
494    
495                    return (Lock)newProxyInstance(lock, Lock.class);
496            }
497    
498            public FileEntry moveFileEntry(
499                            long fileEntryId, long newFolderId, ServiceContext serviceContext)
500                    throws PortalException, SystemException {
501    
502                    FileEntry fileEntry = _baseRepository.moveFileEntry(
503                            fileEntryId, newFolderId, serviceContext);
504    
505                    return newFileEntryProxyBean(fileEntry);
506            }
507    
508            public Folder moveFolder(
509                            long folderId, long newParentFolderId,
510                            ServiceContext serviceContext)
511                    throws PortalException, SystemException {
512    
513                    Folder folder = _baseRepository.moveFolder(
514                            folderId, newParentFolderId, serviceContext);
515    
516                    return newFolderProxyBean(folder);
517            }
518    
519            public Lock refreshFileEntryLock(String lockUuid, long expirationTime)
520                    throws PortalException, SystemException {
521    
522                    Lock lock = _baseRepository.refreshFileEntryLock(
523                            lockUuid, expirationTime);
524    
525                    return (Lock)newProxyInstance(lock, Lock.class);
526            }
527    
528            public Lock refreshFolderLock(String lockUuid, long expirationTime)
529                    throws PortalException, SystemException {
530    
531                    Lock lock = _baseRepository.refreshFolderLock(lockUuid, expirationTime);
532    
533                    return (Lock)newProxyInstance(lock, Lock.class);
534            }
535    
536            public void revertFileEntry(
537                            long fileEntryId, String version, ServiceContext serviceContext)
538                    throws PortalException, SystemException {
539    
540                    _baseRepository.revertFileEntry(fileEntryId, version, serviceContext);
541            }
542    
543            public Hits search(SearchContext searchContext) throws SearchException {
544                    return _baseRepository.search(searchContext);
545            }
546    
547            public Hits search(SearchContext searchContext, Query query)
548                    throws SearchException {
549    
550                    return _baseRepository.search(searchContext, query);
551            }
552    
553            public void setAssetEntryLocalService(
554                    AssetEntryLocalService assetEntryLocalService) {
555    
556                    _baseRepository.setAssetEntryLocalService(assetEntryLocalService);
557            }
558    
559            public void setCompanyId(long companyId) {
560                    _baseRepository.setCompanyId(companyId);
561            }
562    
563            public void setCompanyLocalService(
564                    CompanyLocalService companyLocalService) {
565    
566                    _baseRepository.setCompanyLocalService(companyLocalService);
567            }
568    
569            public void setCounterLocalService(
570                    CounterLocalService counterLocalService) {
571    
572                    _baseRepository.setCounterLocalService(counterLocalService);
573            }
574    
575            public void setDLAppHelperLocalService(
576                    DLAppHelperLocalService dlAppHelperLocalService) {
577    
578                    _baseRepository.setDLAppHelperLocalService(dlAppHelperLocalService);
579            }
580    
581            public void setGroupId(long groupId) {
582                    _baseRepository.setGroupId(groupId);
583            }
584    
585            public void setRepositoryId(long repositoryId) {
586                    _baseRepository.setRepositoryId(repositoryId);
587            }
588    
589            public void setTypeSettingsProperties(
590                    UnicodeProperties typeSettingsProperties) {
591    
592                    _baseRepository.setTypeSettingsProperties(typeSettingsProperties);
593            }
594    
595            public void setUserLocalService(UserLocalService userLocalService) {
596                    _baseRepository.setUserLocalService(userLocalService);
597            }
598    
599            public void unlockFolder(long folderId, String lockUuid)
600                    throws PortalException, SystemException {
601    
602                    _baseRepository.unlockFolder(folderId, lockUuid);
603            }
604    
605            public void unlockFolder(long parentFolderId, String title, String lockUuid)
606                    throws PortalException, SystemException {
607    
608                    _baseRepository.unlockFolder(parentFolderId, title, lockUuid);
609            }
610    
611            public FileEntry updateFileEntry(
612                            long fileEntryId, String sourceFileName, String mimeType,
613                            String title, String description, String changeLog,
614                            boolean majorVersion, File file, ServiceContext serviceContext)
615                    throws PortalException, SystemException {
616    
617                    FileEntry fileEntry = _baseRepository.updateFileEntry(
618                            fileEntryId, sourceFileName, mimeType, title, description,
619                            changeLog, majorVersion, file, serviceContext);
620    
621                    return newFileEntryProxyBean(fileEntry);
622            }
623    
624            public FileEntry updateFileEntry(
625                            long fileEntryId, String sourceFileName, String mimeType,
626                            String title, String description, String changeLog,
627                            boolean majorVersion, InputStream is, long size,
628                            ServiceContext serviceContext)
629                    throws PortalException, SystemException {
630    
631                    FileEntry fileEntry = _baseRepository.updateFileEntry(
632                            fileEntryId, sourceFileName, mimeType, title, description,
633                            changeLog, majorVersion, is, size, serviceContext);
634    
635                    return newFileEntryProxyBean(fileEntry);
636            }
637    
638            public Folder updateFolder(
639                            long folderId, String title, String description,
640                            ServiceContext serviceContext)
641                    throws PortalException, SystemException {
642    
643                    Folder folder = _baseRepository.updateFolder(
644                            folderId, title, description, serviceContext);
645    
646                    return newFolderProxyBean(folder);
647            }
648    
649            public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
650                    throws PortalException, SystemException {
651    
652                    return _baseRepository.verifyFileEntryCheckOut(fileEntryId, lockUuid);
653            }
654    
655            public boolean verifyFileEntryLock(long fileEntryId, String lockUuid)
656                    throws PortalException, SystemException {
657    
658                    return _baseRepository.verifyFileEntryLock(fileEntryId, lockUuid);
659            }
660    
661            public boolean verifyInheritableLock(long folderId, String lockUuid)
662                    throws PortalException, SystemException {
663    
664                    return _baseRepository.verifyInheritableLock(folderId, lockUuid);
665            }
666    
667            private BaseRepository _baseRepository;
668    
669    }