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            /**
074             * Cancels the file entry check out. If the file entry is not checked out,
075             * invoking this method results in no changes.
076             *
077             * @param  fileEntryId the primary key of the file entry to cancel the check
078             *         out
079             * @return the file entry if the cancel checkout operation was successful;
080             *         <code>null</code> if the file entry was not checked out
081             * @see    #checkInFileEntry(long, long, boolean, String, ServiceContext)
082             * @see    #checkOutFileEntry(long, ServiceContext)
083             */
084            public FileVersion cancelCheckOut(long fileEntryId) throws PortalException;
085    
086            /**
087             * @deprecated As of 7.0.0, replaced by {@link #checkInFileEntry(long, long,
088             *             boolean, String, ServiceContext)}
089             */
090            @Deprecated
091            public void checkInFileEntry(
092                            long fileEntryId, boolean major, String changeLog,
093                            ServiceContext serviceContext)
094                    throws PortalException;
095    
096            /**
097             * @deprecated As of 6.2.0, replaced by {@link #checkInFileEntry(long,
098             *             String, ServiceContext)}
099             */
100            @Deprecated
101            public void checkInFileEntry(long fileEntryId, String lockUuid)
102                    throws PortalException;
103    
104            /**
105             * @deprecated As of 7.0.0, replaced by {@link #checkInFileEntry(long, long,
106             *             String, ServiceContext)}
107             */
108            @Deprecated
109            public void checkInFileEntry(
110                            long fileEntryId, String lockUuid, ServiceContext serviceContext)
111                    throws PortalException;
112    
113            public FileEntry checkOutFileEntry(
114                            long fileEntryId, ServiceContext serviceContext)
115                    throws PortalException;
116    
117            public FileEntry checkOutFileEntry(
118                            long fileEntryId, String owner, long expirationTime,
119                            ServiceContext serviceContext)
120                    throws PortalException;
121    
122            /**
123             * @deprecated As of 7.0.0, replaced by {@link #copyFileEntry(long, long,
124             *             long, long, ServiceContext)}
125             */
126            @Deprecated
127            public FileEntry copyFileEntry(
128                            long groupId, long fileEntryId, long destFolderId,
129                            ServiceContext serviceContext)
130                    throws PortalException;
131    
132            public void deleteFileEntry(long folderId, String title)
133                    throws PortalException;
134    
135            public void deleteFileVersion(long fileEntryId, String version)
136                    throws PortalException;
137    
138            public void deleteFolder(long parentFolderId, String name)
139                    throws PortalException;
140    
141            public List<FileEntry> getFileEntries(
142                            long folderId, long fileEntryTypeId, int start, int end,
143                            OrderByComparator<FileEntry> obc)
144                    throws PortalException;
145    
146            public List<FileEntry> getFileEntries(
147                            long folderId, String[] mimeTypes, int start, int end,
148                            OrderByComparator<FileEntry> obc)
149                    throws PortalException;
150    
151            public int getFileEntriesAndFileShortcutsCount(
152                            long folderId, int status, String[] mimeTypes)
153                    throws PortalException;
154    
155            public int getFileEntriesCount(long folderId, long fileEntryTypeId)
156                    throws PortalException;
157    
158            public int getFileEntriesCount(long folderId, String[] mimeTypes)
159                    throws PortalException;
160    
161            public List<RepositoryEntry> getFoldersAndFileEntriesAndFileShortcuts(
162                            long folderId, int status, String[] mimetypes,
163                            boolean includeMountFolders, int start, int end,
164                            OrderByComparator<?> obc)
165                    throws PortalException;
166    
167            public int getFoldersAndFileEntriesAndFileShortcutsCount(
168                            long folderId, int status, String[] mimetypes,
169                            boolean includeMountFolders)
170                    throws PortalException;
171    
172            public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
173                    throws PortalException;
174    
175            public List<Folder> getMountFolders(
176                            long parentFolderId, int start, int end,
177                            OrderByComparator<Folder> obc)
178                    throws PortalException;
179    
180            public int getMountFoldersCount(long parentFolderId) throws PortalException;
181    
182            public List<FileEntry> getRepositoryFileEntries(
183                            long userId, long rootFolderId, String[] mimeTypes, int status,
184                            int start, int end, OrderByComparator<FileEntry> obc)
185                    throws PortalException;
186    
187            public int getRepositoryFileEntriesCount(long userId, long rootFolderId)
188                    throws PortalException;
189    
190            public int getRepositoryFileEntriesCount(
191                            long userId, long rootFolderId, String[] mimeTypes, int status)
192                    throws PortalException;
193    
194            public void getSubfolderIds(List<Long> folderIds, long folderId)
195                    throws PortalException;
196    
197            public List<Long> getSubfolderIds(long folderId, boolean recurse)
198                    throws PortalException;
199    
200            public Lock lockFolder(long folderId) throws PortalException;
201    
202            public Lock lockFolder(
203                            long folderId, String owner, boolean inheritable,
204                            long expirationTime)
205                    throws PortalException;
206    
207            /**
208             * @deprecated As of 7.0.0, replaced by {@link #moveFileEntry(long, long,
209             *             long, ServiceContext)}
210             */
211            @Deprecated
212            public FileEntry moveFileEntry(
213                            long fileEntryId, long newFolderId, ServiceContext serviceContext)
214                    throws PortalException;
215    
216            /**
217             * @deprecated As of 7.0.0, replaced by {@link #moveFolder(long, long, long,
218             *             ServiceContext)}
219             */
220            @Deprecated
221            public Folder moveFolder(
222                            long folderId, long newParentFolderId,
223                            ServiceContext serviceContext)
224                    throws PortalException;
225    
226            public Lock refreshFileEntryLock(
227                            String lockUuid, long companyId, long expirationTime)
228                    throws PortalException;
229    
230            public Lock refreshFolderLock(
231                            String lockUuid, long companyId, long expirationTime)
232                    throws PortalException;
233    
234            /**
235             * @deprecated As of 7.0.0, replaced by {@link #revertFileEntry(long, long,
236             *             String, ServiceContext)}
237             */
238            @Deprecated
239            public void revertFileEntry(
240                            long fileEntryId, String version, ServiceContext serviceContext)
241                    throws PortalException;
242    
243            public Hits search(long creatorUserId, int status, int start, int end)
244                    throws PortalException;
245    
246            public Hits search(
247                            long creatorUserId, long folderId, String[] mimeTypes, int status,
248                            int start, int end)
249                    throws PortalException;
250    
251            public Hits search(SearchContext searchContext) throws SearchException;
252    
253            public Hits search(SearchContext searchContext, Query query)
254                    throws SearchException;
255    
256            public void unlockFolder(long folderId, String lockUuid)
257                    throws PortalException;
258    
259            public void unlockFolder(long parentFolderId, String name, String lockUuid)
260                    throws PortalException;
261    
262            /**
263             * @deprecated As of 7.0.0, replaced by {@link #updateFileEntry(long, long,
264             *             String, String, String, String, String, boolean, File,
265             *             ServiceContext)}
266             */
267            @Deprecated
268            public FileEntry updateFileEntry(
269                            long fileEntryId, String sourceFileName, String mimeType,
270                            String title, String description, String changeLog,
271                            boolean majorVersion, File file, ServiceContext serviceContext)
272                    throws PortalException;
273    
274            /**
275             * @deprecated As of 7.0.0, replaced by {@link #updateFileEntry(long, long,
276             *             String, String, String, String, String, boolean, InputStream,
277             *             long, ServiceContext)}
278             */
279            @Deprecated
280            public FileEntry updateFileEntry(
281                            long fileEntryId, String sourceFileName, String mimeType,
282                            String title, String description, String changeLog,
283                            boolean majorVersion, InputStream is, long size,
284                            ServiceContext serviceContext)
285                    throws PortalException;
286    
287            public Folder updateFolder(
288                            long folderId, String name, String description,
289                            ServiceContext serviceContext)
290                    throws PortalException;
291    
292            public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
293                    throws PortalException;
294    
295            public boolean verifyFileEntryLock(long fileEntryId, String lockUuid)
296                    throws PortalException;
297    
298            public boolean verifyInheritableLock(long folderId, String lockUuid)
299                    throws PortalException;
300    
301    }