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