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