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