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