001    /**
002     * Copyright (c) 2000-present 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.repository.capabilities.CapabilityProvider;
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.kernel.util.OrderByComparator;
023    import com.liferay.portal.service.ServiceContext;
024    
025    import java.io.File;
026    import java.io.InputStream;
027    
028    import java.util.List;
029    
030    /**
031     * @author Iv??n Zaera
032     */
033    public interface DocumentRepository extends CapabilityProvider {
034    
035            public FileEntry addFileEntry(
036                            long userId, long folderId, String sourceFileName, String mimeType,
037                            String title, String description, String changeLog, File file,
038                            ServiceContext serviceContext)
039                    throws PortalException;
040    
041            public FileEntry addFileEntry(
042                            long userId, long folderId, String sourceFileName, String mimeType,
043                            String title, String description, String changeLog, InputStream is,
044                            long size, ServiceContext serviceContext)
045                    throws PortalException;
046    
047            public Folder addFolder(
048                            long userId, long parentFolderId, String name, String description,
049                            ServiceContext serviceContext)
050                    throws PortalException;
051    
052            public void checkInFileEntry(
053                            long userId, long fileEntryId, boolean major, String changeLog,
054                            ServiceContext serviceContext)
055                    throws PortalException;
056    
057            public void checkInFileEntry(
058                            long userId, long fileEntryId, String lockUuid,
059                            ServiceContext serviceContext)
060                    throws PortalException;
061    
062            public FileEntry copyFileEntry(
063                            long userId, long groupId, long fileEntryId, long destFolderId,
064                            ServiceContext serviceContext)
065                    throws PortalException;
066    
067            public void deleteAll() throws PortalException;
068    
069            public void deleteFileEntry(long fileEntryId) throws PortalException;
070    
071            public void deleteFolder(long folderId) throws PortalException;
072    
073            public FileEntry getFileEntry(long fileEntryId) throws PortalException;
074    
075            public FileEntry getFileEntry(long folderId, String title)
076                    throws PortalException;
077    
078            public FileEntry getFileEntryByUuid(String uuid) throws PortalException;
079    
080            public FileVersion getFileVersion(long fileVersionId)
081                    throws PortalException;
082    
083            public Folder getFolder(long folderId) throws PortalException;
084    
085            public Folder getFolder(long parentFolderId, String name)
086                    throws PortalException;
087    
088            public List<FileEntry> getRepositoryFileEntries(
089                            long userId, long rootFolderId, int start, int end,
090                            OrderByComparator<FileEntry> obc)
091                    throws PortalException;
092    
093            public long getRepositoryId();
094    
095            public FileEntry moveFileEntry(
096                            long userId, long fileEntryId, long newFolderId,
097                            ServiceContext serviceContext)
098                    throws PortalException;
099    
100            public Folder moveFolder(
101                            long userId, long folderId, long parentFolderId,
102                            ServiceContext serviceContext)
103                    throws PortalException;
104    
105            public void revertFileEntry(
106                            long userId, long fileEntryId, String version,
107                            ServiceContext serviceContext)
108                    throws PortalException;
109    
110            public FileEntry updateFileEntry(
111                            long userId, long fileEntryId, String sourceFileName,
112                            String mimeType, String title, String description, String changeLog,
113                            boolean majorVersion, File file, ServiceContext serviceContext)
114                    throws PortalException;
115    
116            public FileEntry updateFileEntry(
117                            long userId, long fileEntryId, String sourceFileName,
118                            String mimeType, String title, String description, String changeLog,
119                            boolean majorVersion, InputStream is, long size,
120                            ServiceContext serviceContext)
121                    throws PortalException;
122    
123            public Folder updateFolder(
124                            long folderId, long parentFolderId, String name, String description,
125                            ServiceContext serviceContext)
126                    throws PortalException;
127    
128    }