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