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.service.ServiceContext;
028    import com.liferay.portal.kernel.util.OrderByComparator;
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 7.0.0, replaced by {@link #checkInFileEntry(long, long,
098             *             String, ServiceContext)}
099             */
100            @Deprecated
101            public void checkInFileEntry(
102                            long fileEntryId, String lockUuid, ServiceContext serviceContext)
103                    throws PortalException;
104    
105            public FileEntry checkOutFileEntry(
106                            long fileEntryId, ServiceContext serviceContext)
107                    throws PortalException;
108    
109            public FileEntry checkOutFileEntry(
110                            long fileEntryId, String owner, long expirationTime,
111                            ServiceContext serviceContext)
112                    throws PortalException;
113    
114            /**
115             * @deprecated As of 7.0.0, replaced by {@link #copyFileEntry(long, long,
116             *             long, long, ServiceContext)}
117             */
118            @Deprecated
119            public FileEntry copyFileEntry(
120                            long groupId, long fileEntryId, long destFolderId,
121                            ServiceContext serviceContext)
122                    throws PortalException;
123    
124            public void deleteFileEntry(long folderId, String title)
125                    throws PortalException;
126    
127            public void deleteFileVersion(long fileEntryId, String version)
128                    throws PortalException;
129    
130            public void deleteFolder(long parentFolderId, String name)
131                    throws PortalException;
132    
133            public List<FileEntry> getFileEntries(
134                            long folderId, long fileEntryTypeId, int start, int end,
135                            OrderByComparator<FileEntry> obc)
136                    throws PortalException;
137    
138            public List<FileEntry> getFileEntries(
139                            long folderId, String[] mimeTypes, int start, int end,
140                            OrderByComparator<FileEntry> obc)
141                    throws PortalException;
142    
143            public int getFileEntriesAndFileShortcutsCount(
144                            long folderId, int status, String[] mimeTypes)
145                    throws PortalException;
146    
147            public int getFileEntriesCount(long folderId, long fileEntryTypeId)
148                    throws PortalException;
149    
150            public int getFileEntriesCount(long folderId, String[] mimeTypes)
151                    throws PortalException;
152    
153            public List<RepositoryEntry> getFoldersAndFileEntriesAndFileShortcuts(
154                            long folderId, int status, String[] mimetypes,
155                            boolean includeMountFolders, int start, int end,
156                            OrderByComparator<?> obc)
157                    throws PortalException;
158    
159            public int getFoldersAndFileEntriesAndFileShortcutsCount(
160                            long folderId, int status, String[] mimetypes,
161                            boolean includeMountFolders)
162                    throws PortalException;
163    
164            public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
165                    throws PortalException;
166    
167            public List<Folder> getMountFolders(
168                            long parentFolderId, int start, int end,
169                            OrderByComparator<Folder> obc)
170                    throws PortalException;
171    
172            public int getMountFoldersCount(long parentFolderId) throws PortalException;
173    
174            public List<FileEntry> getRepositoryFileEntries(
175                            long userId, long rootFolderId, String[] mimeTypes, int status,
176                            int start, int end, OrderByComparator<FileEntry> obc)
177                    throws PortalException;
178    
179            public int getRepositoryFileEntriesCount(long userId, long rootFolderId)
180                    throws PortalException;
181    
182            public int getRepositoryFileEntriesCount(
183                            long userId, long rootFolderId, String[] mimeTypes, int status)
184                    throws PortalException;
185    
186            public void getSubfolderIds(List<Long> folderIds, long folderId)
187                    throws PortalException;
188    
189            public List<Long> getSubfolderIds(long folderId, boolean recurse)
190                    throws PortalException;
191    
192            public Lock lockFolder(long folderId) throws PortalException;
193    
194            public Lock lockFolder(
195                            long folderId, String owner, boolean inheritable,
196                            long expirationTime)
197                    throws PortalException;
198    
199            /**
200             * @deprecated As of 7.0.0, replaced by {@link #moveFileEntry(long, long,
201             *             long, ServiceContext)}
202             */
203            @Deprecated
204            public FileEntry moveFileEntry(
205                            long fileEntryId, long newFolderId, ServiceContext serviceContext)
206                    throws PortalException;
207    
208            /**
209             * @deprecated As of 7.0.0, replaced by {@link #moveFolder(long, long, long,
210             *             ServiceContext)}
211             */
212            @Deprecated
213            public Folder moveFolder(
214                            long folderId, long newParentFolderId,
215                            ServiceContext serviceContext)
216                    throws PortalException;
217    
218            public Lock refreshFileEntryLock(
219                            String lockUuid, long companyId, long expirationTime)
220                    throws PortalException;
221    
222            public Lock refreshFolderLock(
223                            String lockUuid, long companyId, long expirationTime)
224                    throws PortalException;
225    
226            /**
227             * @deprecated As of 7.0.0, replaced by {@link #revertFileEntry(long, long,
228             *             String, ServiceContext)}
229             */
230            @Deprecated
231            public void revertFileEntry(
232                            long fileEntryId, String version, ServiceContext serviceContext)
233                    throws PortalException;
234    
235            public Hits search(long creatorUserId, int status, int start, int end)
236                    throws PortalException;
237    
238            public Hits search(
239                            long creatorUserId, long folderId, String[] mimeTypes, int status,
240                            int start, int end)
241                    throws PortalException;
242    
243            public Hits search(SearchContext searchContext) throws SearchException;
244    
245            public Hits search(SearchContext searchContext, Query query)
246                    throws SearchException;
247    
248            public void unlockFolder(long folderId, String lockUuid)
249                    throws PortalException;
250    
251            public void unlockFolder(long parentFolderId, String name, String lockUuid)
252                    throws PortalException;
253    
254            /**
255             * @deprecated As of 7.0.0, replaced by {@link #updateFileEntry(long, long,
256             *             String, String, String, String, String, boolean, File,
257             *             ServiceContext)}
258             */
259            @Deprecated
260            public FileEntry updateFileEntry(
261                            long fileEntryId, String sourceFileName, String mimeType,
262                            String title, String description, String changeLog,
263                            boolean majorVersion, File file, ServiceContext serviceContext)
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, InputStream,
269             *             long, 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, InputStream is, long size,
276                            ServiceContext serviceContext)
277                    throws PortalException;
278    
279            public Folder updateFolder(
280                            long folderId, String name, String description,
281                            ServiceContext serviceContext)
282                    throws PortalException;
283    
284            public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
285                    throws PortalException;
286    
287            public boolean verifyFileEntryLock(long fileEntryId, String lockUuid)
288                    throws PortalException;
289    
290            public boolean verifyInheritableLock(long folderId, String lockUuid)
291                    throws PortalException;
292    
293    }