001    /**
002     * Copyright (c) 2000-2013 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.kernel.repository;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.repository.model.FileEntry;
020    import com.liferay.portal.kernel.repository.model.FileVersion;
021    import com.liferay.portal.kernel.repository.model.Folder;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import java.io.File;
025    import java.io.InputStream;
026    
027    /**
028     * This class is designed for third party repository implementations. Since the
029     * paradigm of remote and local services exists only within Liferay, the
030     * assumption is that all permission checking will be delegated to the specific
031     * repository.
032     *
033     * There are also many calls within this class that pass in a user ID as a
034     * parameter. These methods should only be called for administration of Liferay
035     * repositories and are hence not supported in all third party repositories.
036     * This includes moving between document library hooks and LAR import/export.
037     * Calling these methods will throw an
038     * <code>UnsupportedOperationException</code>.
039     *
040     * @author Alexander Chow
041     */
042    public class DefaultLocalRepositoryImpl implements LocalRepository {
043    
044            public DefaultLocalRepositoryImpl(Repository repository) {
045                    _repository = repository;
046            }
047    
048            @Override
049            public FileEntry addFileEntry(
050                    long userId, long folderId, String sourceFileName, String mimeType,
051                    String title, String description, String changeLog, File file,
052                    ServiceContext serviceContext) {
053    
054                    throw new UnsupportedOperationException();
055            }
056    
057            @Override
058            public FileEntry addFileEntry(
059                    long userId, long folderId, String sourceFileName, String mimeType,
060                    String title, String description, String changeLog, InputStream is,
061                    long size, ServiceContext serviceContext) {
062    
063                    throw new UnsupportedOperationException();
064            }
065    
066            @Override
067            public Folder addFolder(
068                    long userId, long parentFolderId, String title, String description,
069                    ServiceContext serviceContext) {
070    
071                    throw new UnsupportedOperationException();
072            }
073    
074            @Override
075            public void deleteAll() {
076                    throw new UnsupportedOperationException();
077            }
078    
079            @Override
080            public void deleteFileEntry(long fileEntryId)
081                    throws PortalException, SystemException {
082    
083                    _repository.deleteFileEntry(fileEntryId);
084            }
085    
086            @Override
087            public void deleteFolder(long folderId)
088                    throws PortalException, SystemException {
089    
090                    _repository.deleteFolder(folderId);
091            }
092    
093            @Override
094            public FileEntry getFileEntry(long fileEntryId)
095                    throws PortalException, SystemException {
096    
097                    return _repository.getFileEntry(fileEntryId);
098            }
099    
100            @Override
101            public FileEntry getFileEntry(long folderId, String title)
102                    throws PortalException, SystemException {
103    
104                    return _repository.getFileEntry(folderId, title);
105            }
106    
107            @Override
108            public FileEntry getFileEntryByUuid(String uuid)
109                    throws PortalException, SystemException {
110    
111                    return _repository.getFileEntryByUuid(uuid);
112            }
113    
114            @Override
115            public FileVersion getFileVersion(long fileVersionId)
116                    throws PortalException, SystemException {
117    
118                    return _repository.getFileVersion(fileVersionId);
119            }
120    
121            @Override
122            public Folder getFolder(long folderId)
123                    throws PortalException, SystemException {
124    
125                    return _repository.getFolder(folderId);
126            }
127    
128            @Override
129            public Folder getFolder(long parentFolderId, String title)
130                    throws PortalException, SystemException {
131    
132                    return _repository.getFolder(parentFolderId, title);
133            }
134    
135            @Override
136            public long getRepositoryId() {
137                    return _repository.getRepositoryId();
138            }
139    
140            @Override
141            public FileEntry moveFileEntry(
142                    long userId, long fileEntryId, long newFolderId,
143                    ServiceContext serviceContext) {
144    
145                    throw new UnsupportedOperationException();
146            }
147    
148            @Override
149            public Folder moveFolder(
150                    long userId, long folderId, long parentFolderId,
151                    ServiceContext serviceContext) {
152    
153                    throw new UnsupportedOperationException();
154            }
155    
156            @Override
157            public void updateAsset(
158                    long userId, FileEntry fileEntry, FileVersion fileVersion,
159                    long[] assetCategoryIds, String[] assetTagNames,
160                    long[] assetLinkEntryIds) {
161    
162                    throw new UnsupportedOperationException();
163            }
164    
165            @Override
166            public FileEntry updateFileEntry(
167                    long userId, long fileEntryId, String sourceFileName, String mimeType,
168                    String title, String description, String changeLog,
169                    boolean majorVersion, File file, ServiceContext serviceContext) {
170    
171                    throw new UnsupportedOperationException();
172            }
173    
174            @Override
175            public FileEntry updateFileEntry(
176                    long userId, long fileEntryId, String sourceFileName, String mimeType,
177                    String title, String description, String changeLog,
178                    boolean majorVersion, InputStream is, long size,
179                    ServiceContext serviceContext) {
180    
181                    throw new UnsupportedOperationException();
182            }
183    
184            @Override
185            public Folder updateFolder(
186                    long folderId, long parentFolderId, String title, String description,
187                    ServiceContext serviceContext) {
188    
189                    throw new UnsupportedOperationException();
190            }
191    
192            private Repository _repository;
193    
194    }