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