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