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.FileShortcut;
021    import com.liferay.portal.kernel.repository.model.FileVersion;
022    import com.liferay.portal.kernel.repository.model.Folder;
023    import com.liferay.portal.kernel.repository.model.RepositoryEntry;
024    import com.liferay.portal.kernel.util.OrderByComparator;
025    import com.liferay.portal.service.ServiceContext;
026    
027    import java.io.File;
028    import java.io.InputStream;
029    
030    import java.util.List;
031    
032    /**
033     * @author Iv??n Zaera
034     */
035    public interface DocumentRepository extends CapabilityProvider {
036    
037            public FileEntry addFileEntry(
038                            long userId, long folderId, String sourceFileName, String mimeType,
039                            String title, String description, String changeLog, File file,
040                            ServiceContext serviceContext)
041                    throws PortalException;
042    
043            public FileEntry addFileEntry(
044                            long userId, long folderId, String sourceFileName, String mimeType,
045                            String title, String description, String changeLog, InputStream is,
046                            long size, ServiceContext serviceContext)
047                    throws PortalException;
048    
049            public FileShortcut addFileShortcut(
050                            long userId, long folderId, long toFileEntryId,
051                            ServiceContext serviceContext)
052                    throws PortalException;
053    
054            public Folder addFolder(
055                            long userId, long parentFolderId, String name, String description,
056                            ServiceContext serviceContext)
057                    throws PortalException;
058    
059            public void checkInFileEntry(
060                            long userId, long fileEntryId, boolean major, String changeLog,
061                            ServiceContext serviceContext)
062                    throws PortalException;
063    
064            public void checkInFileEntry(
065                            long userId, long fileEntryId, String lockUuid,
066                            ServiceContext serviceContext)
067                    throws PortalException;
068    
069            public FileEntry copyFileEntry(
070                            long userId, long groupId, long fileEntryId, long destFolderId,
071                            ServiceContext serviceContext)
072                    throws PortalException;
073    
074            public void deleteAll() throws PortalException;
075    
076            public void deleteFileEntry(long fileEntryId) throws PortalException;
077    
078            public void deleteFileShortcut(long fileShortcutId) throws PortalException;
079    
080            public void deleteFileShortcuts(long toFileEntryId) throws PortalException;
081    
082            public void deleteFolder(long folderId) throws PortalException;
083    
084            public List<FileEntry> getFileEntries(
085                            long folderId, int status, int start, int end,
086                            OrderByComparator<FileEntry> obc)
087                    throws PortalException;
088    
089            public List<FileEntry> getFileEntries(
090                            long folderId, int start, int end, OrderByComparator<FileEntry> obc)
091                    throws PortalException;
092    
093            public List<RepositoryEntry> getFileEntriesAndFileShortcuts(
094                            long folderId, int status, int start, int end)
095                    throws PortalException;
096    
097            public int getFileEntriesAndFileShortcutsCount(long folderId, int status)
098                    throws PortalException;
099    
100            public int getFileEntriesCount(long folderId) throws PortalException;
101    
102            public int getFileEntriesCount(long folderId, int status)
103                    throws PortalException;
104    
105            public FileEntry getFileEntry(long fileEntryId) throws PortalException;
106    
107            public FileEntry getFileEntry(long folderId, String title)
108                    throws PortalException;
109    
110            public FileEntry getFileEntryByUuid(String uuid) throws PortalException;
111    
112            public FileShortcut getFileShortcut(long fileShortcutId)
113                    throws PortalException;
114    
115            public FileVersion getFileVersion(long fileVersionId)
116                    throws PortalException;
117    
118            public Folder getFolder(long folderId) throws PortalException;
119    
120            public Folder getFolder(long parentFolderId, String name)
121                    throws PortalException;
122    
123            public List<Folder> getFolders(
124                            long parentFolderId, boolean includeMountFolders, int start,
125                            int end, OrderByComparator<Folder> obc)
126                    throws PortalException;
127    
128            public List<Folder> getFolders(
129                            long parentFolderId, int status, boolean includeMountFolders,
130                            int start, int end, OrderByComparator<Folder> obc)
131                    throws PortalException;
132    
133            public List<RepositoryEntry> getFoldersAndFileEntriesAndFileShortcuts(
134                            long folderId, int status, boolean includeMountFolders, int start,
135                            int end, OrderByComparator<?> obc)
136                    throws PortalException;
137    
138            public int getFoldersCount(long parentFolderId, boolean includeMountfolders)
139                    throws PortalException;
140    
141            public int getFoldersCount(
142                            long parentFolderId, int status, boolean includeMountfolders)
143                    throws PortalException;
144    
145            public List<FileEntry> getRepositoryFileEntries(
146                            long userId, long rootFolderId, int start, int end,
147                            OrderByComparator<FileEntry> obc)
148                    throws PortalException;
149    
150            public long getRepositoryId();
151    
152            public FileEntry moveFileEntry(
153                            long userId, long fileEntryId, long newFolderId,
154                            ServiceContext serviceContext)
155                    throws PortalException;
156    
157            public Folder moveFolder(
158                            long userId, long folderId, long parentFolderId,
159                            ServiceContext serviceContext)
160                    throws PortalException;
161    
162            public void revertFileEntry(
163                            long userId, long fileEntryId, String version,
164                            ServiceContext serviceContext)
165                    throws PortalException;
166    
167            public FileEntry updateFileEntry(
168                            long userId, long fileEntryId, String sourceFileName,
169                            String mimeType, String title, String description, String changeLog,
170                            boolean majorVersion, File file, ServiceContext serviceContext)
171                    throws PortalException;
172    
173            public FileEntry updateFileEntry(
174                            long userId, long fileEntryId, String sourceFileName,
175                            String mimeType, String title, String description, String changeLog,
176                            boolean majorVersion, InputStream is, long size,
177                            ServiceContext serviceContext)
178                    throws PortalException;
179    
180            public FileShortcut updateFileShortcut(
181                            long userId, long fileShortcutId, long folderId, long toFileEntryId,
182                            ServiceContext serviceContext)
183                    throws PortalException;
184    
185            public void updateFileShortcuts(
186                            long oldToFileEntryId, long newToFileEntryId)
187                    throws PortalException;
188    
189            public Folder updateFolder(
190                            long folderId, long parentFolderId, String name, String description,
191                            ServiceContext serviceContext)
192                    throws PortalException;
193    
194    }