001    /**
002     * Copyright (c) 2000-2013 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.exception.SystemException;
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.search.Hits;
023    import com.liferay.portal.kernel.search.Query;
024    import com.liferay.portal.kernel.search.SearchContext;
025    import com.liferay.portal.kernel.search.SearchException;
026    import com.liferay.portal.kernel.util.OrderByComparator;
027    import com.liferay.portal.model.Lock;
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 {
039    
040            public FileEntry addFileEntry(
041                            long folderId, String sourceFileName, String mimeType, String title,
042                            String description, String changeLog, File file,
043                            ServiceContext serviceContext)
044                    throws PortalException, SystemException;
045    
046            public FileEntry addFileEntry(
047                            long folderId, String sourceFileName, String mimeType, String title,
048                            String description, String changeLog, InputStream is, long size,
049                            ServiceContext serviceContext)
050                    throws PortalException, SystemException;
051    
052            public Folder addFolder(
053                            long parentFolderId, String title, String description,
054                            ServiceContext serviceContext)
055                    throws PortalException, SystemException;
056    
057            public FileVersion cancelCheckOut(long fileEntryId)
058                    throws PortalException, SystemException;
059    
060            public void checkInFileEntry(
061                            long fileEntryId, boolean major, String changeLog,
062                            ServiceContext serviceContext)
063                    throws PortalException, SystemException;
064    
065            /**
066             * @deprecated As of 6.2.0, replaced by {@link #checkInFileEntry(long,
067             *             String, ServiceContext)}
068             */
069            public void checkInFileEntry(long fileEntryId, String lockUuid)
070                    throws PortalException, SystemException;
071    
072            public void checkInFileEntry(
073                            long fileEntryId, String lockUuid, ServiceContext serviceContext)
074                    throws PortalException, SystemException;
075    
076            public FileEntry checkOutFileEntry(
077                            long fileEntryId, ServiceContext serviceContext)
078                    throws PortalException, SystemException;
079    
080            public FileEntry checkOutFileEntry(
081                            long fileEntryId, String owner, long expirationTime,
082                            ServiceContext serviceContext)
083                    throws PortalException, SystemException;
084    
085            public FileEntry copyFileEntry(
086                            long groupId, long fileEntryId, long destFolderId,
087                            ServiceContext serviceContext)
088                    throws PortalException, SystemException;
089    
090            public void deleteFileEntry(long fileEntryId)
091                    throws PortalException, SystemException;
092    
093            public void deleteFileEntry(long folderId, String title)
094                    throws PortalException, SystemException;
095    
096            public void deleteFileVersion(long fileEntryId, String version)
097                    throws PortalException, SystemException;
098    
099            public void deleteFolder(long folderId)
100                    throws PortalException, SystemException;
101    
102            public void deleteFolder(long parentFolderId, String title)
103                    throws PortalException, SystemException;
104    
105            public List<FileEntry> getFileEntries(
106                            long folderId, int start, int end, OrderByComparator obc)
107                    throws PortalException, SystemException;
108    
109            public List<FileEntry> getFileEntries(
110                            long folderId, long fileEntryTypeId, int start, int end,
111                            OrderByComparator obc)
112                    throws PortalException, SystemException;
113    
114            public List<FileEntry> getFileEntries(
115                            long folderId, String[] mimeTypes, int start, int end,
116                            OrderByComparator obc)
117                    throws PortalException, SystemException;
118    
119            public List<Object> getFileEntriesAndFileShortcuts(
120                            long folderId, int status, int start, int end)
121                    throws PortalException, SystemException;
122    
123            public int getFileEntriesAndFileShortcutsCount(long folderId, int status)
124                    throws SystemException;
125    
126            public int getFileEntriesAndFileShortcutsCount(
127                            long folderId, int status, String[] mimeTypes)
128                    throws PortalException, SystemException;
129    
130            public int getFileEntriesCount(long folderId)
131                    throws SystemException;
132    
133            public int getFileEntriesCount(long folderId, long fileEntryTypeId)
134                    throws SystemException;
135    
136            public int getFileEntriesCount(long folderId, String[] mimeTypes)
137                    throws PortalException, SystemException;
138    
139            public FileEntry getFileEntry(long fileEntryId)
140                    throws PortalException, SystemException;
141    
142            public FileEntry getFileEntry(long folderId, String title)
143                    throws PortalException, SystemException;
144    
145            public FileEntry getFileEntryByUuid(String uuid)
146                    throws PortalException, SystemException;
147    
148            public FileVersion getFileVersion(long fileVersionId)
149                    throws PortalException, SystemException;
150    
151            public Folder getFolder(long folderId)
152                    throws PortalException, SystemException;
153    
154            public Folder getFolder(long parentFolderId, String title)
155                    throws PortalException, SystemException;
156    
157            public List<Folder> getFolders(
158                            long parentFolderId, boolean includeMountFolders, int start,
159                            int end, OrderByComparator obc)
160                    throws PortalException, SystemException;
161    
162            public List<Folder> getFolders(
163                            long parentFolderId, int status, boolean includeMountFolders,
164                            int start, int end, OrderByComparator obc)
165                    throws PortalException, SystemException;
166    
167            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
168                            long folderId, int status, boolean includeMountFolders, int start,
169                            int end, OrderByComparator obc)
170                    throws PortalException, SystemException;
171    
172            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
173                            long folderId, int status, String[] mimetypes,
174                            boolean includeMountFolders, int start, int end,
175                            OrderByComparator obc)
176                    throws PortalException, SystemException;
177    
178            public int getFoldersAndFileEntriesAndFileShortcutsCount(
179                            long folderId, int status, boolean includeMountFolders)
180                    throws PortalException, SystemException;
181    
182            public int getFoldersAndFileEntriesAndFileShortcutsCount(
183                            long folderId, int status, String[] mimetypes,
184                            boolean includeMountFolders)
185                    throws PortalException, SystemException;
186    
187            public int getFoldersCount(long parentFolderId, boolean includeMountfolders)
188                    throws PortalException, SystemException;
189    
190            public int getFoldersCount(
191                            long parentFolderId, int status, boolean includeMountfolders)
192                    throws PortalException, SystemException;
193    
194            public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
195                    throws SystemException;
196    
197            public List<Folder> getMountFolders(
198                            long parentFolderId, int start, int end, OrderByComparator obc)
199                    throws PortalException, SystemException;
200    
201            public int getMountFoldersCount(long parentFolderId) throws SystemException;
202    
203            public List<FileEntry> getRepositoryFileEntries(
204                            long userId, long rootFolderId, int start, int end,
205                            OrderByComparator obc)
206                    throws PortalException, SystemException;
207    
208            public List<FileEntry> getRepositoryFileEntries(
209                            long userId, long rootFolderId, String[] mimeTypes, int status,
210                            int start, int end, OrderByComparator obc)
211                    throws PortalException, SystemException;
212    
213            public int getRepositoryFileEntriesCount(long userId, long rootFolderId)
214                    throws PortalException, SystemException;
215    
216            public int getRepositoryFileEntriesCount(
217                            long userId, long rootFolderId, String[] mimeTypes, int status)
218                    throws PortalException, SystemException;
219    
220            public long getRepositoryId();
221    
222            public void getSubfolderIds(List<Long> folderIds, long folderId)
223                    throws PortalException, SystemException;
224    
225            public List<Long> getSubfolderIds(long folderId, boolean recurse)
226                    throws PortalException, SystemException;
227    
228            /**
229             * @deprecated As of 6.2.0, replaced by {@link #checkOutFileEntry(long,
230             *             ServiceContext)}
231             */
232            public Lock lockFileEntry(long fileEntryId)
233                    throws PortalException, SystemException;
234    
235            /**
236             * @deprecated As of 6.2.0, replaced by {@link #checkOutFileEntry(long,
237             *             String, long, ServiceContext)}
238             */
239            public Lock lockFileEntry(
240                            long fileEntryId, String owner, long expirationTime)
241                    throws PortalException, SystemException;
242    
243            public Lock lockFolder(long folderId)
244                    throws PortalException, SystemException;
245    
246            public Lock lockFolder(
247                            long folderId, String owner, boolean inheritable,
248                            long expirationTime)
249                    throws PortalException, SystemException;
250    
251            public FileEntry moveFileEntry(
252                            long fileEntryId, long newFolderId, ServiceContext serviceContext)
253                    throws PortalException, SystemException;
254    
255            public Folder moveFolder(
256                            long folderId, long newParentFolderId,
257                            ServiceContext serviceContext)
258                    throws PortalException, SystemException;
259    
260            public Lock refreshFileEntryLock(
261                            String lockUuid, long companyId, long expirationTime)
262                    throws PortalException, SystemException;
263    
264            public Lock refreshFolderLock(
265                            String lockUuid, long companyId, long expirationTime)
266                    throws PortalException, SystemException;
267    
268            public void revertFileEntry(
269                            long fileEntryId, String version, ServiceContext serviceContext)
270                    throws PortalException, SystemException;
271    
272            public Hits search(long creatorUserId, int status, int start, int end)
273                    throws PortalException, SystemException;
274    
275            public Hits search(
276                            long creatorUserId, long folderId, String[] mimeTypes, int status,
277                            int start, int end)
278                    throws PortalException, SystemException;
279    
280            public Hits search(SearchContext searchContext) throws SearchException;
281    
282            public Hits search(SearchContext searchContext, Query query)
283                    throws SearchException;
284    
285            public void unlockFolder(long folderId, String lockUuid)
286                    throws PortalException, SystemException;
287    
288            public void unlockFolder(long parentFolderId, String title, String lockUuid)
289                    throws PortalException, SystemException;
290    
291            public FileEntry updateFileEntry(
292                            long fileEntryId, String sourceFileName, String mimeType,
293                            String title, String description, String changeLog,
294                            boolean majorVersion, File file, ServiceContext serviceContext)
295                    throws PortalException, SystemException;
296    
297            public FileEntry updateFileEntry(
298                            long fileEntryId, String sourceFileName, String mimeType,
299                            String title, String description, String changeLog,
300                            boolean majorVersion, InputStream is, long size,
301                            ServiceContext serviceContext)
302                    throws PortalException, SystemException;
303    
304            public Folder updateFolder(
305                            long folderId, String title, String description,
306                            ServiceContext serviceContext)
307                    throws PortalException, SystemException;
308    
309            public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
310                    throws PortalException, SystemException;
311    
312            public boolean verifyFileEntryLock(long fileEntryId, String lockUuid)
313                    throws PortalException, SystemException;
314    
315            public boolean verifyInheritableLock(long folderId, String lockUuid)
316                    throws PortalException, SystemException;
317    
318    }