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 int getFileEntriesAndFileShortcutsCount(
141                            long folderId, int status, String[] mimeTypes)
142                    throws PortalException;
143    
144            public int getFileEntriesCount(long folderId, long fileEntryTypeId)
145                    throws PortalException;
146    
147            public int getFileEntriesCount(long folderId, String[] mimeTypes)
148                    throws PortalException;
149    
150            public List<RepositoryEntry> getFoldersAndFileEntriesAndFileShortcuts(
151                            long folderId, int status, boolean includeMountFolders, int start,
152                            int end, OrderByComparator<?> obc)
153                    throws PortalException;
154    
155            public List<RepositoryEntry> getFoldersAndFileEntriesAndFileShortcuts(
156                            long folderId, int status, String[] mimetypes,
157                            boolean includeMountFolders, int start, int end,
158                            OrderByComparator<?> obc)
159                    throws PortalException;
160    
161            public int getFoldersAndFileEntriesAndFileShortcutsCount(
162                            long folderId, int status, boolean includeMountFolders)
163                    throws PortalException;
164    
165            public int getFoldersAndFileEntriesAndFileShortcutsCount(
166                            long folderId, int status, String[] mimetypes,
167                            boolean includeMountFolders)
168                    throws PortalException;
169    
170            public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
171                    throws PortalException;
172    
173            public List<Folder> getMountFolders(
174                            long parentFolderId, int start, int end,
175                            OrderByComparator<Folder> obc)
176                    throws PortalException;
177    
178            public int getMountFoldersCount(long parentFolderId) throws PortalException;
179    
180            public List<FileEntry> getRepositoryFileEntries(
181                            long userId, long rootFolderId, String[] mimeTypes, int status,
182                            int start, int end, OrderByComparator<FileEntry> obc)
183                    throws PortalException;
184    
185            public int getRepositoryFileEntriesCount(long userId, long rootFolderId)
186                    throws PortalException;
187    
188            public int getRepositoryFileEntriesCount(
189                            long userId, long rootFolderId, String[] mimeTypes, int status)
190                    throws PortalException;
191    
192            public void getSubfolderIds(List<Long> folderIds, long folderId)
193                    throws PortalException;
194    
195            public List<Long> getSubfolderIds(long folderId, boolean recurse)
196                    throws PortalException;
197    
198            public Lock lockFolder(long folderId) throws PortalException;
199    
200            public Lock lockFolder(
201                            long folderId, String owner, boolean inheritable,
202                            long expirationTime)
203                    throws PortalException;
204    
205            /**
206             * @deprecated As of 7.0.0, replaced by {@link #moveFileEntry(long, long,
207             *             long, ServiceContext)}
208             */
209            @Deprecated
210            public FileEntry moveFileEntry(
211                            long fileEntryId, long newFolderId, ServiceContext serviceContext)
212                    throws PortalException;
213    
214            /**
215             * @deprecated As of 7.0.0, replaced by {@link #moveFolder(long, long, long,
216             *             ServiceContext)}
217             */
218            @Deprecated
219            public Folder moveFolder(
220                            long folderId, long newParentFolderId,
221                            ServiceContext serviceContext)
222                    throws PortalException;
223    
224            public Lock refreshFileEntryLock(
225                            String lockUuid, long companyId, long expirationTime)
226                    throws PortalException;
227    
228            public Lock refreshFolderLock(
229                            String lockUuid, long companyId, long expirationTime)
230                    throws PortalException;
231    
232            /**
233             * @deprecated As of 7.0.0, replaced by {@link #revertFileEntry(long, long,
234             *             String, ServiceContext)}
235             */
236            @Deprecated
237            public void revertFileEntry(
238                            long fileEntryId, String version, ServiceContext serviceContext)
239                    throws PortalException;
240    
241            public Hits search(long creatorUserId, int status, int start, int end)
242                    throws PortalException;
243    
244            public Hits search(
245                            long creatorUserId, long folderId, String[] mimeTypes, int status,
246                            int start, int end)
247                    throws PortalException;
248    
249            public Hits search(SearchContext searchContext) throws SearchException;
250    
251            public Hits search(SearchContext searchContext, Query query)
252                    throws SearchException;
253    
254            public void unlockFolder(long folderId, String lockUuid)
255                    throws PortalException;
256    
257            public void unlockFolder(long parentFolderId, String name, String lockUuid)
258                    throws PortalException;
259    
260            /**
261             * @deprecated As of 7.0.0, replaced by {@link #updateFileEntry(long, long,
262             *             String, String, String, String, String, boolean, File,
263             *             ServiceContext)}
264             */
265            @Deprecated
266            public FileEntry updateFileEntry(
267                            long fileEntryId, String sourceFileName, String mimeType,
268                            String title, String description, String changeLog,
269                            boolean majorVersion, File file, ServiceContext serviceContext)
270                    throws PortalException;
271    
272            /**
273             * @deprecated As of 7.0.0, replaced by {@link #updateFileEntry(long, long,
274             *             String, String, String, String, String, boolean, InputStream,
275             *             long, ServiceContext)}
276             */
277            @Deprecated
278            public FileEntry updateFileEntry(
279                            long fileEntryId, String sourceFileName, String mimeType,
280                            String title, String description, String changeLog,
281                            boolean majorVersion, InputStream is, long size,
282                            ServiceContext serviceContext)
283                    throws PortalException;
284    
285            public Folder updateFolder(
286                            long folderId, String name, String description,
287                            ServiceContext serviceContext)
288                    throws PortalException;
289    
290            public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
291                    throws PortalException;
292    
293            public boolean verifyFileEntryLock(long fileEntryId, String lockUuid)
294                    throws PortalException;
295    
296            public boolean verifyInheritableLock(long folderId, String lockUuid)
297                    throws PortalException;
298    
299    }