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