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.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            public FileEntry addFileEntry(
049                    long userId, long folderId, String sourceFileName, String mimeType,
050                    String title, String description, String changeLog, File file,
051                    ServiceContext serviceContext) {
052    
053                    throw new UnsupportedOperationException();
054            }
055    
056            public FileEntry addFileEntry(
057                    long userId, long folderId, String sourceFileName, String mimeType,
058                    String title, String description, String changeLog, InputStream is,
059                    long size, ServiceContext serviceContext) {
060    
061                    throw new UnsupportedOperationException();
062            }
063    
064            public Folder addFolder(
065                    long userId, long parentFolderId, String title, String description,
066                    ServiceContext serviceContext) {
067    
068                    throw new UnsupportedOperationException();
069            }
070    
071            public void deleteAll() {
072                    throw new UnsupportedOperationException();
073            }
074    
075            public void deleteFileEntry(long fileEntryId)
076                    throws PortalException, SystemException {
077    
078                    _repository.deleteFileEntry(fileEntryId);
079            }
080    
081            public void deleteFolder(long folderId)
082                    throws PortalException, SystemException {
083    
084                    _repository.deleteFolder(folderId);
085            }
086    
087            public FileEntry getFileEntry(long fileEntryId)
088                    throws PortalException, SystemException {
089    
090                    return _repository.getFileEntry(fileEntryId);
091            }
092    
093            public FileEntry getFileEntry(long folderId, String title)
094                    throws PortalException, SystemException {
095    
096                    return _repository.getFileEntry(folderId, title);
097            }
098    
099            public FileEntry getFileEntryByUuid(String uuid)
100                    throws PortalException, SystemException {
101    
102                    return _repository.getFileEntryByUuid(uuid);
103            }
104    
105            public FileVersion getFileVersion(long fileVersionId)
106                    throws PortalException, SystemException {
107    
108                    return _repository.getFileVersion(fileVersionId);
109            }
110    
111            public Folder getFolder(long folderId)
112                    throws PortalException, SystemException {
113    
114                    return _repository.getFolder(folderId);
115            }
116    
117            public Folder getFolder(long parentFolderId, String title)
118                    throws PortalException, SystemException {
119    
120                    return _repository.getFolder(parentFolderId, title);
121            }
122    
123            public long getRepositoryId() {
124                    return _repository.getRepositoryId();
125            }
126    
127            public FileEntry moveFileEntry(
128                    long userId, long fileEntryId, long newFolderId,
129                    ServiceContext serviceContext) {
130    
131                    throw new UnsupportedOperationException();
132            }
133    
134            public void updateAsset(
135                    long userId, FileEntry fileEntry, FileVersion fileVersion,
136                    long[] assetCategoryIds, String[] assetTagNames,
137                    long[] assetLinkEntryIds) {
138    
139                    throw new UnsupportedOperationException();
140            }
141    
142            public FileEntry updateFileEntry(
143                    long userId, long fileEntryId, String sourceFileName, String mimeType,
144                    String title, String description, String changeLog,
145                    boolean majorVersion, File file, ServiceContext serviceContext) {
146    
147                    throw new UnsupportedOperationException();
148            }
149    
150            public FileEntry updateFileEntry(
151                    long userId, long fileEntryId, String sourceFileName, String mimeType,
152                    String title, String description, String changeLog,
153                    boolean majorVersion, InputStream is, long size,
154                    ServiceContext serviceContext) {
155    
156                    throw new UnsupportedOperationException();
157            }
158    
159            public Folder updateFolder(
160                    long folderId, long parentFolderId, String title, String description,
161                    ServiceContext serviceContext) {
162    
163                    throw new UnsupportedOperationException();
164            }
165    
166            private Repository _repository;
167    
168    }