001    /**
002     * Copyright (c) 2000-2011 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<Object> getFileEntriesAndFileShortcuts(
102                            long folderId, int status, int start, int end)
103                    throws SystemException;
104    
105            public int getFileEntriesAndFileShortcutsCount(long folderId, int status)
106                    throws SystemException;
107    
108            public int getFileEntriesCount(long folderId)
109                    throws SystemException;
110    
111            public int getFileEntriesCount(long folderId, long fileEntryTypeId)
112                    throws SystemException;
113    
114            public FileEntry getFileEntry(long fileEntryId)
115                    throws PortalException, SystemException;
116    
117            public FileEntry getFileEntry(long folderId, String title)
118                    throws PortalException, SystemException;
119    
120            public FileEntry getFileEntryByUuid(String uuid)
121                    throws PortalException, SystemException;
122    
123            public FileVersion getFileVersion(long fileVersionId)
124                    throws PortalException, SystemException;
125    
126            public Folder getFolder(long folderId)
127                    throws PortalException, SystemException;
128    
129            public Folder getFolder(long parentFolderId, String title)
130                    throws PortalException, SystemException;
131    
132            public List<Folder> getFolders(
133                            long parentFolderId, boolean includeMountFolders, int start,
134                            int end, OrderByComparator obc)
135                    throws SystemException;
136    
137            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
138                            long folderId, int status, boolean includeMountFolders, int start,
139                            int end, OrderByComparator obc)
140                    throws SystemException;
141    
142            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
143                            long folderId, int status, String[] mimetypes,
144                            boolean includeMountFolders, int start, int end,
145                            OrderByComparator obc)
146                    throws SystemException;
147    
148            public int getFoldersAndFileEntriesAndFileShortcutsCount(
149                            long folderId, int status, boolean includeMountFolders)
150                    throws SystemException;
151    
152            public int getFoldersAndFileEntriesAndFileShortcutsCount(
153                            long folderId, int status, String[] mimetypes,
154                            boolean includeMountFolders)
155                    throws SystemException;
156    
157            public int getFoldersCount(long parentFolderId, boolean includeMountfolders)
158                    throws SystemException;
159    
160            public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
161                    throws SystemException;
162    
163            public List<Folder> getMountFolders(
164                            long parentFolderId, int start, int end, OrderByComparator obc)
165                    throws SystemException;
166    
167            public int getMountFoldersCount(long parentFolderId) throws SystemException;
168    
169            public List<FileEntry> getRepositoryFileEntries(
170                            long userId, long rootFolderId, int start, int end,
171                            OrderByComparator obc)
172                    throws SystemException;
173    
174            public int getRepositoryFileEntriesCount(long userId, long rootFolderId)
175                    throws SystemException;
176    
177            public long getRepositoryId();
178    
179            public void getSubfolderIds(List<Long> folderIds, long folderId)
180                    throws SystemException;
181    
182            public List<Long> getSubfolderIds(long folderId, boolean recurse)
183                    throws SystemException;
184    
185            public Lock lockFolder(long folderId)
186                    throws PortalException, SystemException;
187    
188            public Lock lockFolder(
189                            long folderId, String owner, boolean inheritable,
190                            long expirationTime)
191                    throws PortalException, SystemException;
192    
193            public FileEntry moveFileEntry(
194                            long fileEntryId, long newFolderId, ServiceContext serviceContext)
195                    throws PortalException, SystemException;
196    
197            public Folder moveFolder(
198                            long folderId, long newParentFolderId,
199                            ServiceContext serviceContext)
200                    throws PortalException, SystemException;
201    
202            public Lock refreshFileEntryLock(String lockUuid, long expirationTime)
203                    throws PortalException, SystemException;
204    
205            public Lock refreshFolderLock(String lockUuid, long expirationTime)
206                    throws PortalException, SystemException;
207    
208            public void revertFileEntry(
209                            long fileEntryId, String version, ServiceContext serviceContext)
210                    throws PortalException, SystemException;
211    
212            public Hits search(SearchContext searchContext) throws SearchException;
213    
214            public Hits search(SearchContext searchContext, Query query)
215                    throws SearchException;
216    
217            public void unlockFolder(long folderId, String lockUuid)
218                    throws PortalException, SystemException;
219    
220            public void unlockFolder(long parentFolderId, String title, String lockUuid)
221                    throws PortalException, SystemException;
222    
223            public FileEntry updateFileEntry(
224                            long fileEntryId, String sourceFileName, String mimeType,
225                            String title, String description, String changeLog,
226                            boolean majorVersion, File file, ServiceContext serviceContext)
227                    throws PortalException, SystemException;
228    
229            public FileEntry updateFileEntry(
230                            long fileEntryId, String sourceFileName, String mimeType,
231                            String title, String description, String changeLog,
232                            boolean majorVersion, InputStream is, long size,
233                            ServiceContext serviceContext)
234                    throws PortalException, SystemException;
235    
236            public Folder updateFolder(
237                            long folderId, String title, String description,
238                            ServiceContext serviceContext)
239                    throws PortalException, SystemException;
240    
241            public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
242                    throws PortalException, SystemException;
243    
244            public boolean verifyInheritableLock(long folderId, String lockUuid)
245                    throws PortalException, SystemException;
246    
247    }