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