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 PortalException, 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 PortalException, SystemException;
132    
133            public int getFileEntriesCount(long folderId, long fileEntryTypeId)
134                    throws PortalException, 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 PortalException, 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)
202                    throws PortalException, SystemException;
203    
204            public List<FileEntry> getRepositoryFileEntries(
205                            long userId, long rootFolderId, int start, int end,
206                            OrderByComparator obc)
207                    throws PortalException, SystemException;
208    
209            public List<FileEntry> getRepositoryFileEntries(
210                            long userId, long rootFolderId, String[] mimeTypes, int status,
211                            int start, int end, OrderByComparator obc)
212                    throws PortalException, SystemException;
213    
214            public int getRepositoryFileEntriesCount(long userId, long rootFolderId)
215                    throws PortalException, SystemException;
216    
217            public int getRepositoryFileEntriesCount(
218                            long userId, long rootFolderId, String[] mimeTypes, int status)
219                    throws PortalException, SystemException;
220    
221            public long getRepositoryId();
222    
223            public void getSubfolderIds(List<Long> folderIds, long folderId)
224                    throws PortalException, SystemException;
225    
226            public List<Long> getSubfolderIds(long folderId, boolean recurse)
227                    throws PortalException, SystemException;
228    
229            /**
230             * @deprecated As of 6.2.0, replaced by {@link #checkOutFileEntry(long,
231             *             ServiceContext)}
232             */
233            public Lock lockFileEntry(long fileEntryId)
234                    throws PortalException, SystemException;
235    
236            /**
237             * @deprecated As of 6.2.0, replaced by {@link #checkOutFileEntry(long,
238             *             String, long, ServiceContext)}
239             */
240            public Lock lockFileEntry(
241                            long fileEntryId, String owner, long expirationTime)
242                    throws PortalException, SystemException;
243    
244            public Lock lockFolder(long folderId)
245                    throws PortalException, SystemException;
246    
247            public Lock lockFolder(
248                            long folderId, String owner, boolean inheritable,
249                            long expirationTime)
250                    throws PortalException, SystemException;
251    
252            public FileEntry moveFileEntry(
253                            long fileEntryId, long newFolderId, ServiceContext serviceContext)
254                    throws PortalException, SystemException;
255    
256            public Folder moveFolder(
257                            long folderId, long newParentFolderId,
258                            ServiceContext serviceContext)
259                    throws PortalException, SystemException;
260    
261            public Lock refreshFileEntryLock(
262                            String lockUuid, long companyId, long expirationTime)
263                    throws PortalException, SystemException;
264    
265            public Lock refreshFolderLock(
266                            String lockUuid, long companyId, long expirationTime)
267                    throws PortalException, SystemException;
268    
269            public void revertFileEntry(
270                            long fileEntryId, String version, ServiceContext serviceContext)
271                    throws PortalException, SystemException;
272    
273            public Hits search(long creatorUserId, int status, int start, int end)
274                    throws PortalException, SystemException;
275    
276            public Hits search(
277                            long creatorUserId, long folderId, String[] mimeTypes, int status,
278                            int start, int end)
279                    throws PortalException, SystemException;
280    
281            public Hits search(SearchContext searchContext) throws SearchException;
282    
283            public Hits search(SearchContext searchContext, Query query)
284                    throws SearchException;
285    
286            public void unlockFolder(long folderId, String lockUuid)
287                    throws PortalException, SystemException;
288    
289            public void unlockFolder(long parentFolderId, String title, String lockUuid)
290                    throws PortalException, SystemException;
291    
292            public FileEntry updateFileEntry(
293                            long fileEntryId, String sourceFileName, String mimeType,
294                            String title, String description, String changeLog,
295                            boolean majorVersion, File file, ServiceContext serviceContext)
296                    throws PortalException, SystemException;
297    
298            public FileEntry updateFileEntry(
299                            long fileEntryId, String sourceFileName, String mimeType,
300                            String title, String description, String changeLog,
301                            boolean majorVersion, InputStream is, long size,
302                            ServiceContext serviceContext)
303                    throws PortalException, SystemException;
304    
305            public Folder updateFolder(
306                            long folderId, String title, String description,
307                            ServiceContext serviceContext)
308                    throws PortalException, SystemException;
309    
310            public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
311                    throws PortalException, SystemException;
312    
313            public boolean verifyFileEntryLock(long fileEntryId, String lockUuid)
314                    throws PortalException, SystemException;
315    
316            public boolean verifyInheritableLock(long folderId, String lockUuid)
317                    throws PortalException, SystemException;
318    
319    }