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