001    /**
002     * Copyright (c) 2000-2012 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.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 void cancelCheckOut(long fileEntryId)
095                    throws PortalException, SystemException {
096    
097                    _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 deleteFolder(long folderId)
158                    throws PortalException, SystemException {
159    
160                    _baseRepository.deleteFolder(folderId);
161            }
162    
163            public void deleteFolder(long parentFolderId, String title)
164                    throws PortalException, SystemException {
165    
166                    _baseRepository.deleteFolder(parentFolderId, title);
167            }
168    
169            public List<FileEntry> getFileEntries(
170                            long folderId, int start, int end, OrderByComparator obc)
171                    throws SystemException {
172    
173                    List<FileEntry> fileEntries = _baseRepository.getFileEntries(
174                            folderId, start, end, obc);
175    
176                    return toFileEntryProxyBeans(fileEntries);
177            }
178    
179            public List<FileEntry> getFileEntries(
180                            long folderId, long documentTypeId, int start, int end,
181                            OrderByComparator obc)
182                    throws SystemException {
183    
184                    List<FileEntry> fileEntries = _baseRepository.getFileEntries(
185                            folderId, documentTypeId, start, end, obc);
186    
187                    return toFileEntryProxyBeans(fileEntries);
188            }
189    
190            public List<FileEntry> getFileEntries(
191                            long folderId, String[] mimeTypes, int start, int end,
192                            OrderByComparator obc)
193                    throws PortalException, SystemException {
194    
195                    List<FileEntry> fileEntries = _baseRepository.getFileEntries(
196                            folderId, mimeTypes, start, end, obc);
197    
198                    return toFileEntryProxyBeans(fileEntries);
199            }
200    
201            public List<Object> getFileEntriesAndFileShortcuts(
202                            long folderId, int status, int start, int end)
203                    throws SystemException {
204    
205                    List<Object> objects = _baseRepository.getFileEntriesAndFileShortcuts(
206                            folderId, status, start, end);
207    
208                    return toObjectProxyBeans(objects);
209            }
210    
211            public int getFileEntriesAndFileShortcutsCount(long folderId, int status)
212                    throws SystemException {
213    
214                    return _baseRepository.getFileEntriesAndFileShortcutsCount(
215                            folderId, status);
216            }
217    
218            public int getFileEntriesAndFileShortcutsCount(
219                            long folderId, int status, String[] mimeTypes)
220                    throws PortalException, SystemException {
221    
222                    return _baseRepository.getFileEntriesAndFileShortcutsCount(
223                            folderId, status, mimeTypes);
224            }
225    
226            public int getFileEntriesCount(long folderId)
227                    throws SystemException {
228    
229                    return _baseRepository.getFileEntriesCount(folderId);
230            }
231    
232            public int getFileEntriesCount(long folderId, long documentTypeId)
233                    throws SystemException {
234    
235                    return _baseRepository.getFileEntriesCount(folderId, documentTypeId);
236            }
237    
238            public int getFileEntriesCount(long folderId, String[] mimeTypes)
239                    throws PortalException, SystemException {
240    
241                    return _baseRepository.getFileEntriesCount(folderId, mimeTypes);
242            }
243    
244            public FileEntry getFileEntry(long fileEntryId)
245                    throws PortalException, SystemException {
246    
247                    FileEntry fileEntry = _baseRepository.getFileEntry(fileEntryId);
248    
249                    return newFileEntryProxyBean(fileEntry);
250            }
251    
252            public FileEntry getFileEntry(long folderId, String title)
253                    throws PortalException, SystemException {
254    
255                    FileEntry fileEntry = _baseRepository.getFileEntry(folderId, title);
256    
257                    return newFileEntryProxyBean(fileEntry);
258            }
259    
260            public FileEntry getFileEntryByUuid(String uuid)
261                    throws PortalException, SystemException {
262    
263                    FileEntry fileEntry = _baseRepository.getFileEntryByUuid(uuid);
264    
265                    return newFileEntryProxyBean(fileEntry);
266            }
267    
268            public FileVersion getFileVersion(long fileVersionId)
269                    throws PortalException, SystemException {
270    
271                    FileVersion fileVersion = _baseRepository.getFileVersion(fileVersionId);
272    
273                    return newFileVersionProxyBean(fileVersion);
274            }
275    
276            public Folder getFolder(long folderId)
277                    throws PortalException, SystemException {
278    
279                    Folder folder = _baseRepository.getFolder(folderId);
280    
281                    return newFolderProxyBean(folder);
282            }
283    
284            public Folder getFolder(long parentFolderId, String title)
285                    throws PortalException, SystemException {
286    
287                    Folder folder = _baseRepository.getFolder(parentFolderId, title);
288    
289                    return newFolderProxyBean(folder);
290            }
291    
292            public List<Folder> getFolders(
293                            long parentFolderId, boolean includeMountfolders, int start,
294                            int end, OrderByComparator obc)
295                    throws PortalException, SystemException {
296    
297                    List<Folder> folders = _baseRepository.getFolders(
298                            parentFolderId, includeMountfolders, start, end, obc);
299    
300                    return toFolderProxyBeans(folders);
301            }
302    
303            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
304                            long folderId, int status, boolean includeMountFolders, int start,
305                            int end, OrderByComparator obc)
306                    throws SystemException {
307    
308                    List<Object> objects =
309                            _baseRepository.getFoldersAndFileEntriesAndFileShortcuts(
310                                    folderId, status, includeMountFolders, start, end, obc);
311    
312                    return toObjectProxyBeans(objects);
313            }
314    
315            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
316                            long folderId, int status, String[] mimeTypes,
317                            boolean includeMountFolders, int start, int end,
318                            OrderByComparator obc)
319                    throws PortalException, SystemException {
320    
321                    List<Object> objects =
322                            _baseRepository.getFoldersAndFileEntriesAndFileShortcuts(
323                                    folderId, status, mimeTypes, includeMountFolders, start, end,
324                                    obc);
325    
326                    return toObjectProxyBeans(objects);
327            }
328    
329            public int getFoldersAndFileEntriesAndFileShortcutsCount(
330                            long folderId, int status, boolean includeMountFolders)
331                    throws SystemException {
332    
333                    return _baseRepository.getFoldersAndFileEntriesAndFileShortcutsCount(
334                            folderId, status, includeMountFolders);
335            }
336    
337            public int getFoldersAndFileEntriesAndFileShortcutsCount(
338                            long folderId, int status, String[] mimeTypes,
339                            boolean includeMountFolders)
340                    throws PortalException, SystemException {
341    
342                    return _baseRepository.getFoldersAndFileEntriesAndFileShortcutsCount(
343                            folderId, status, mimeTypes, includeMountFolders);
344            }
345    
346            public int getFoldersCount(long parentFolderId, boolean includeMountfolders)
347                    throws PortalException, SystemException {
348    
349                    return _baseRepository.getFoldersCount(
350                            parentFolderId, includeMountfolders);
351            }
352    
353            public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
354                    throws SystemException {
355    
356                    return _baseRepository.getFoldersFileEntriesCount(folderIds, status);
357            }
358    
359            public LocalRepository getLocalRepository() {
360                    LocalRepository localRepository = _baseRepository.getLocalRepository();
361    
362                    return newLocalRepositoryProxyBean(localRepository);
363            }
364    
365            public List<Folder> getMountFolders(
366                            long parentFolderId, int start, int end, OrderByComparator obc)
367                    throws SystemException {
368    
369                    List<Folder> folders = _baseRepository.getMountFolders(
370                            parentFolderId, start, end, obc);
371    
372                    return toFolderProxyBeans(folders);
373            }
374    
375            public int getMountFoldersCount(long parentFolderId)
376                    throws SystemException {
377    
378                    return _baseRepository.getMountFoldersCount(parentFolderId);
379            }
380    
381            public BaseRepository getProxyBean() {
382                    return _baseRepository;
383            }
384    
385            public List<FileEntry> getRepositoryFileEntries(
386                            long userId, long rootFolderId, int start, int end,
387                            OrderByComparator obc)
388                    throws SystemException {
389    
390                    List<FileEntry> fileEntries = _baseRepository.getRepositoryFileEntries(
391                            userId, rootFolderId, start, end, obc);
392    
393                    return toFileEntryProxyBeans(fileEntries);
394            }
395    
396            public List<FileEntry> getRepositoryFileEntries(
397                            long userId, long rootFolderId, String[] mimeTypes, int status,
398                            int start, int end, OrderByComparator obc)
399                    throws PortalException, SystemException {
400    
401                    List<FileEntry> fileEntries = _baseRepository.getRepositoryFileEntries(
402                            userId, rootFolderId, mimeTypes, status, start, end, obc);
403    
404                    return toFileEntryProxyBeans(fileEntries);
405            }
406    
407            public int getRepositoryFileEntriesCount(long userId, long rootFolderId)
408                    throws SystemException {
409    
410                    return _baseRepository.getRepositoryFileEntriesCount(
411                            userId, rootFolderId);
412            }
413    
414            public int getRepositoryFileEntriesCount(
415                            long userId, long rootFolderId, String[] mimeTypes, int status)
416                    throws PortalException, SystemException {
417    
418                    return _baseRepository.getRepositoryFileEntriesCount(
419                            userId, rootFolderId, mimeTypes, status);
420            }
421    
422            public long getRepositoryId() {
423                    return _baseRepository.getRepositoryId();
424            }
425    
426            public void getSubfolderIds(List<Long> folderIds, long folderId)
427                    throws SystemException {
428    
429                    _baseRepository.getSubfolderIds(folderIds, folderId);
430            }
431    
432            public List<Long> getSubfolderIds(long folderId, boolean recurse)
433                    throws SystemException {
434    
435                    return _baseRepository.getSubfolderIds(folderId, recurse);
436            }
437    
438            public String[] getSupportedConfigurations() {
439                    return _baseRepository.getSupportedConfigurations();
440            }
441    
442            public String[][] getSupportedParameters() {
443                    return _baseRepository.getSupportedParameters();
444            }
445    
446            public void initRepository() throws PortalException, SystemException {
447                    _baseRepository.initRepository();
448            }
449    
450            public Lock lockFileEntry(long fileEntryId)
451                    throws PortalException, SystemException {
452    
453                    Lock lock = _baseRepository.lockFileEntry(fileEntryId);
454    
455                    return (Lock)newProxyInstance(lock, Lock.class);
456            }
457    
458            public Lock lockFileEntry(
459                            long fileEntryId, String owner, long expirationTime)
460                    throws PortalException, SystemException {
461    
462                    Lock lock = _baseRepository.lockFileEntry(
463                            fileEntryId, owner, expirationTime);
464    
465                    return (Lock)newProxyInstance(lock, Lock.class);
466            }
467    
468            public Lock lockFolder(long folderId)
469                    throws PortalException, SystemException {
470    
471                    Lock lock = _baseRepository.lockFolder(folderId);
472    
473                    return (Lock)newProxyInstance(lock, Lock.class);
474            }
475    
476            public Lock lockFolder(
477                            long folderId, String owner, boolean inheritable,
478                            long expirationTime)
479                    throws PortalException, SystemException {
480    
481                    Lock lock = _baseRepository.lockFolder(
482                            folderId, owner, inheritable, expirationTime);
483    
484                    return (Lock)newProxyInstance(lock, Lock.class);
485            }
486    
487            public FileEntry moveFileEntry(
488                            long fileEntryId, long newFolderId, ServiceContext serviceContext)
489                    throws PortalException, SystemException {
490    
491                    FileEntry fileEntry = _baseRepository.moveFileEntry(
492                            fileEntryId, newFolderId, serviceContext);
493    
494                    return newFileEntryProxyBean(fileEntry);
495            }
496    
497            public Folder moveFolder(
498                            long folderId, long newParentFolderId,
499                            ServiceContext serviceContext)
500                    throws PortalException, SystemException {
501    
502                    Folder folder = _baseRepository.moveFolder(
503                            folderId, newParentFolderId, serviceContext);
504    
505                    return newFolderProxyBean(folder);
506            }
507    
508            public Lock refreshFileEntryLock(String lockUuid, long expirationTime)
509                    throws PortalException, SystemException {
510    
511                    Lock lock = _baseRepository.refreshFileEntryLock(
512                            lockUuid, expirationTime);
513    
514                    return (Lock)newProxyInstance(lock, Lock.class);
515            }
516    
517            public Lock refreshFolderLock(String lockUuid, long expirationTime)
518                    throws PortalException, SystemException {
519    
520                    Lock lock = _baseRepository.refreshFolderLock(lockUuid, expirationTime);
521    
522                    return (Lock)newProxyInstance(lock, Lock.class);
523            }
524    
525            public void revertFileEntry(
526                            long fileEntryId, String version, ServiceContext serviceContext)
527                    throws PortalException, SystemException {
528    
529                    _baseRepository.revertFileEntry(fileEntryId, version, serviceContext);
530            }
531    
532            public Hits search(SearchContext searchContext) throws SearchException {
533                    return _baseRepository.search(searchContext);
534            }
535    
536            public Hits search(SearchContext searchContext, Query query)
537                    throws SearchException {
538    
539                    return _baseRepository.search(searchContext, query);
540            }
541    
542            public void setAssetEntryLocalService(
543                    AssetEntryLocalService assetEntryLocalService) {
544    
545                    _baseRepository.setAssetEntryLocalService(assetEntryLocalService);
546            }
547    
548            public void setCompanyId(long companyId) {
549                    _baseRepository.setCompanyId(companyId);
550            }
551    
552            public void setCompanyLocalService(
553                    CompanyLocalService companyLocalService) {
554    
555                    _baseRepository.setCompanyLocalService(companyLocalService);
556            }
557    
558            public void setCounterLocalService(
559                    CounterLocalService counterLocalService) {
560    
561                    _baseRepository.setCounterLocalService(counterLocalService);
562            }
563    
564            public void setDLAppHelperLocalService(
565                    DLAppHelperLocalService dlAppHelperLocalService) {
566    
567                    _baseRepository.setDLAppHelperLocalService(dlAppHelperLocalService);
568            }
569    
570            public void setGroupId(long groupId) {
571                    _baseRepository.setGroupId(groupId);
572            }
573    
574            public void setRepositoryId(long repositoryId) {
575                    _baseRepository.setRepositoryId(repositoryId);
576            }
577    
578            public void setTypeSettingsProperties(
579                    UnicodeProperties typeSettingsProperties) {
580    
581                    _baseRepository.setTypeSettingsProperties(typeSettingsProperties);
582            }
583    
584            public void setUserLocalService(UserLocalService userLocalService) {
585                    _baseRepository.setUserLocalService(userLocalService);
586            }
587    
588            public void unlockFileEntry(long fileEntryId)
589                    throws PortalException, SystemException {
590    
591                    _baseRepository.unlockFileEntry(fileEntryId);
592            }
593    
594            public void unlockFileEntry(long fileEntryId, String lockUuid)
595                    throws PortalException, SystemException {
596    
597                    _baseRepository.unlockFileEntry(fileEntryId, lockUuid);
598            }
599    
600            public void unlockFolder(long folderId, String lockUuid)
601                    throws PortalException, SystemException {
602    
603                    _baseRepository.unlockFolder(folderId, lockUuid);
604            }
605    
606            public void unlockFolder(long parentFolderId, String title, String lockUuid)
607                    throws PortalException, SystemException {
608    
609                    _baseRepository.unlockFolder(parentFolderId, title, lockUuid);
610            }
611    
612            public FileEntry updateFileEntry(
613                            long fileEntryId, String sourceFileName, String mimeType,
614                            String title, String description, String changeLog,
615                            boolean majorVersion, File file, ServiceContext serviceContext)
616                    throws PortalException, SystemException {
617    
618                    FileEntry fileEntry = _baseRepository.updateFileEntry(
619                            fileEntryId, sourceFileName, mimeType, title, description,
620                            changeLog, majorVersion, file, serviceContext);
621    
622                    return newFileEntryProxyBean(fileEntry);
623            }
624    
625            public FileEntry updateFileEntry(
626                            long fileEntryId, String sourceFileName, String mimeType,
627                            String title, String description, String changeLog,
628                            boolean majorVersion, InputStream is, long size,
629                            ServiceContext serviceContext)
630                    throws PortalException, SystemException {
631    
632                    FileEntry fileEntry = _baseRepository.updateFileEntry(
633                            fileEntryId, sourceFileName, mimeType, title, description,
634                            changeLog, majorVersion, is, size, serviceContext);
635    
636                    return newFileEntryProxyBean(fileEntry);
637            }
638    
639            public Folder updateFolder(
640                            long folderId, String title, String description,
641                            ServiceContext serviceContext)
642                    throws PortalException, SystemException {
643    
644                    Folder folder = _baseRepository.updateFolder(
645                            folderId, title, description, serviceContext);
646    
647                    return newFolderProxyBean(folder);
648            }
649    
650            public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
651                    throws PortalException, SystemException {
652    
653                    return _baseRepository.verifyFileEntryCheckOut(fileEntryId, lockUuid);
654            }
655    
656            public boolean verifyFileEntryLock(long fileEntryId, String lockUuid)
657                    throws PortalException, SystemException {
658    
659                    return _baseRepository.verifyFileEntryLock(fileEntryId, lockUuid);
660            }
661    
662            public boolean verifyInheritableLock(long folderId, String lockUuid)
663                    throws PortalException, SystemException {
664    
665                    return _baseRepository.verifyInheritableLock(folderId, lockUuid);
666            }
667    
668            private BaseRepository _baseRepository;
669    
670    }