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.model.FileEntry;
019    import com.liferay.portal.kernel.repository.model.FileVersion;
020    import com.liferay.portal.kernel.repository.model.Folder;
021    import com.liferay.portal.kernel.search.Hits;
022    import com.liferay.portal.kernel.search.Query;
023    import com.liferay.portal.kernel.search.SearchContext;
024    import com.liferay.portal.kernel.search.SearchException;
025    import com.liferay.portal.kernel.util.OrderByComparator;
026    import com.liferay.portal.model.Lock;
027    import com.liferay.portal.service.ServiceContext;
028    
029    import java.io.File;
030    import java.io.InputStream;
031    
032    import java.util.List;
033    
034    /**
035     * @author Alexander Chow
036     */
037    public interface Repository extends DocumentRepository {
038    
039            public FileEntry addFileEntry(
040                            long folderId, String sourceFileName, String mimeType, String title,
041                            String description, String changeLog, File file,
042                            ServiceContext serviceContext)
043                    throws PortalException;
044    
045            public FileEntry addFileEntry(
046                            long folderId, String sourceFileName, String mimeType, String title,
047                            String description, String changeLog, InputStream is, long size,
048                            ServiceContext serviceContext)
049                    throws PortalException;
050    
051            public Folder addFolder(
052                            long parentFolderId, String name, String description,
053                            ServiceContext serviceContext)
054                    throws PortalException;
055    
056            public FileVersion cancelCheckOut(long fileEntryId) throws PortalException;
057    
058            public void checkInFileEntry(
059                            long fileEntryId, boolean major, String changeLog,
060                            ServiceContext serviceContext)
061                    throws PortalException;
062    
063            /**
064             * @deprecated As of 6.2.0, replaced by {@link #checkInFileEntry(long,
065             *             String, ServiceContext)}
066             */
067            @Deprecated
068            public void checkInFileEntry(long fileEntryId, String lockUuid)
069                    throws PortalException;
070    
071            public void checkInFileEntry(
072                            long fileEntryId, String lockUuid, ServiceContext serviceContext)
073                    throws PortalException;
074    
075            public FileEntry checkOutFileEntry(
076                            long fileEntryId, ServiceContext serviceContext)
077                    throws PortalException;
078    
079            public FileEntry checkOutFileEntry(
080                            long fileEntryId, String owner, long expirationTime,
081                            ServiceContext serviceContext)
082                    throws PortalException;
083    
084            public FileEntry copyFileEntry(
085                            long groupId, long fileEntryId, long destFolderId,
086                            ServiceContext serviceContext)
087                    throws PortalException;
088    
089            public void deleteFileEntry(long fileEntryId) throws PortalException;
090    
091            public void deleteFileEntry(long folderId, String title)
092                    throws PortalException;
093    
094            public void deleteFileVersion(long fileEntryId, String version)
095                    throws PortalException;
096    
097            public void deleteFolder(long folderId) throws PortalException;
098    
099            public void deleteFolder(long parentFolderId, String name)
100                    throws PortalException;
101    
102            public List<FileEntry> getFileEntries(
103                            long folderId, int start, int end, OrderByComparator<FileEntry> obc)
104                    throws PortalException;
105    
106            public List<FileEntry> getFileEntries(
107                            long folderId, long fileEntryTypeId, int start, int end,
108                            OrderByComparator<FileEntry> obc)
109                    throws PortalException;
110    
111            public List<FileEntry> getFileEntries(
112                            long folderId, String[] mimeTypes, int start, int end,
113                            OrderByComparator<FileEntry> obc)
114                    throws PortalException;
115    
116            public List<Object> getFileEntriesAndFileShortcuts(
117                            long folderId, int status, int start, int end)
118                    throws PortalException;
119    
120            public int getFileEntriesAndFileShortcutsCount(long folderId, int status)
121                    throws PortalException;
122    
123            public int getFileEntriesAndFileShortcutsCount(
124                            long folderId, int status, String[] mimeTypes)
125                    throws PortalException;
126    
127            public int getFileEntriesCount(long folderId) throws PortalException;
128    
129            public int getFileEntriesCount(long folderId, long fileEntryTypeId)
130                    throws PortalException;
131    
132            public int getFileEntriesCount(long folderId, String[] mimeTypes)
133                    throws PortalException;
134    
135            public FileEntry getFileEntry(long fileEntryId) throws PortalException;
136    
137            public FileEntry getFileEntry(long folderId, String title)
138                    throws PortalException;
139    
140            public FileEntry getFileEntryByUuid(String uuid) throws PortalException;
141    
142            public FileVersion getFileVersion(long fileVersionId)
143                    throws PortalException;
144    
145            public Folder getFolder(long folderId) throws PortalException;
146    
147            public Folder getFolder(long parentFolderId, String name)
148                    throws PortalException;
149    
150            public List<Folder> getFolders(
151                            long parentFolderId, boolean includeMountFolders, int start,
152                            int end, OrderByComparator<Folder> obc)
153                    throws PortalException;
154    
155            public List<Folder> getFolders(
156                            long parentFolderId, int status, boolean includeMountFolders,
157                            int start, int end, OrderByComparator<Folder> obc)
158                    throws PortalException;
159    
160            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
161                            long folderId, int status, boolean includeMountFolders, int start,
162                            int end, OrderByComparator<?> obc)
163                    throws PortalException;
164    
165            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
166                            long folderId, int status, String[] mimetypes,
167                            boolean includeMountFolders, int start, int end,
168                            OrderByComparator<?> obc)
169                    throws PortalException;
170    
171            public int getFoldersAndFileEntriesAndFileShortcutsCount(
172                            long folderId, int status, boolean includeMountFolders)
173                    throws PortalException;
174    
175            public int getFoldersAndFileEntriesAndFileShortcutsCount(
176                            long folderId, int status, String[] mimetypes,
177                            boolean includeMountFolders)
178                    throws PortalException;
179    
180            public int getFoldersCount(long parentFolderId, boolean includeMountfolders)
181                    throws PortalException;
182    
183            public int getFoldersCount(
184                            long parentFolderId, int status, boolean includeMountfolders)
185                    throws PortalException;
186    
187            public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
188                    throws PortalException;
189    
190            public List<Folder> getMountFolders(
191                            long parentFolderId, int start, int end,
192                            OrderByComparator<Folder> obc)
193                    throws PortalException;
194    
195            public int getMountFoldersCount(long parentFolderId) throws PortalException;
196    
197            public List<FileEntry> getRepositoryFileEntries(
198                            long userId, long rootFolderId, int start, int end,
199                            OrderByComparator<FileEntry> obc)
200                    throws PortalException;
201    
202            public List<FileEntry> getRepositoryFileEntries(
203                            long userId, long rootFolderId, String[] mimeTypes, int status,
204                            int start, int end, OrderByComparator<FileEntry> obc)
205                    throws PortalException;
206    
207            public int getRepositoryFileEntriesCount(long userId, long rootFolderId)
208                    throws PortalException;
209    
210            public int getRepositoryFileEntriesCount(
211                            long userId, long rootFolderId, String[] mimeTypes, int status)
212                    throws PortalException;
213    
214            public void getSubfolderIds(List<Long> folderIds, long folderId)
215                    throws PortalException;
216    
217            public List<Long> getSubfolderIds(long folderId, boolean recurse)
218                    throws PortalException;
219    
220            /**
221             * @deprecated As of 6.2.0, replaced by {@link #checkOutFileEntry(long,
222             *             ServiceContext)}
223             */
224            @Deprecated
225            public Lock lockFileEntry(long fileEntryId) throws PortalException;
226    
227            /**
228             * @deprecated As of 6.2.0, replaced by {@link #checkOutFileEntry(long,
229             *             String, long, ServiceContext)}
230             */
231            @Deprecated
232            public Lock lockFileEntry(
233                            long fileEntryId, String owner, long expirationTime)
234                    throws PortalException;
235    
236            public Lock lockFolder(long folderId) throws PortalException;
237    
238            public Lock lockFolder(
239                            long folderId, String owner, boolean inheritable,
240                            long expirationTime)
241                    throws PortalException;
242    
243            public FileEntry moveFileEntry(
244                            long fileEntryId, long newFolderId, ServiceContext serviceContext)
245                    throws PortalException;
246    
247            public Folder moveFolder(
248                            long folderId, long newParentFolderId,
249                            ServiceContext serviceContext)
250                    throws PortalException;
251    
252            public Lock refreshFileEntryLock(
253                            String lockUuid, long companyId, long expirationTime)
254                    throws PortalException;
255    
256            public Lock refreshFolderLock(
257                            String lockUuid, long companyId, long expirationTime)
258                    throws PortalException;
259    
260            public void revertFileEntry(
261                            long fileEntryId, String version, ServiceContext serviceContext)
262                    throws PortalException;
263    
264            public Hits search(long creatorUserId, int status, int start, int end)
265                    throws PortalException;
266    
267            public Hits search(
268                            long creatorUserId, long folderId, String[] mimeTypes, int status,
269                            int start, int end)
270                    throws PortalException;
271    
272            public Hits search(SearchContext searchContext) throws SearchException;
273    
274            public Hits search(SearchContext searchContext, Query query)
275                    throws SearchException;
276    
277            public void unlockFolder(long folderId, String lockUuid)
278                    throws PortalException;
279    
280            public void unlockFolder(long parentFolderId, String name, String lockUuid)
281                    throws PortalException;
282    
283            public FileEntry updateFileEntry(
284                            long fileEntryId, String sourceFileName, String mimeType,
285                            String title, String description, String changeLog,
286                            boolean majorVersion, File file, ServiceContext serviceContext)
287                    throws PortalException;
288    
289            public FileEntry updateFileEntry(
290                            long fileEntryId, String sourceFileName, String mimeType,
291                            String title, String description, String changeLog,
292                            boolean majorVersion, InputStream is, long size,
293                            ServiceContext serviceContext)
294                    throws PortalException;
295    
296            public Folder updateFolder(
297                            long folderId, String name, String description,
298                            ServiceContext serviceContext)
299                    throws PortalException;
300    
301            public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
302                    throws PortalException;
303    
304            public boolean verifyFileEntryLock(long fileEntryId, String lockUuid)
305                    throws PortalException;
306    
307            public boolean verifyInheritableLock(long folderId, String lockUuid)
308                    throws PortalException;
309    
310    }