001    /**
002     * Copyright (c) 2000-present 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.repository.capabilities.CapabilityProvider;
019    import com.liferay.portal.kernel.repository.model.FileEntry;
020    import com.liferay.portal.kernel.repository.model.FileShortcut;
021    import com.liferay.portal.kernel.repository.model.FileVersion;
022    import com.liferay.portal.kernel.repository.model.Folder;
023    import com.liferay.portal.kernel.util.OrderByComparator;
024    import com.liferay.portal.service.ServiceContext;
025    
026    import java.io.File;
027    import java.io.InputStream;
028    
029    import java.util.List;
030    
031    /**
032     * @author Iv??n Zaera
033     */
034    public interface DocumentRepository extends CapabilityProvider {
035    
036            public FileEntry addFileEntry(
037                            long userId, long folderId, String sourceFileName, String mimeType,
038                            String title, String description, String changeLog, File file,
039                            ServiceContext serviceContext)
040                    throws PortalException;
041    
042            public FileEntry addFileEntry(
043                            long userId, long folderId, String sourceFileName, String mimeType,
044                            String title, String description, String changeLog, InputStream is,
045                            long size, ServiceContext serviceContext)
046                    throws PortalException;
047    
048            public FileShortcut addFileShortcut(
049                            long userId, long folderId, long toFileEntryId,
050                            ServiceContext serviceContext)
051                    throws PortalException;
052    
053            public Folder addFolder(
054                            long userId, long parentFolderId, String name, String description,
055                            ServiceContext serviceContext)
056                    throws PortalException;
057    
058            public void checkInFileEntry(
059                            long userId, long fileEntryId, boolean major, String changeLog,
060                            ServiceContext serviceContext)
061                    throws PortalException;
062    
063            public void checkInFileEntry(
064                            long userId, long fileEntryId, String lockUuid,
065                            ServiceContext serviceContext)
066                    throws PortalException;
067    
068            public FileEntry copyFileEntry(
069                            long userId, long groupId, long fileEntryId, long destFolderId,
070                            ServiceContext serviceContext)
071                    throws PortalException;
072    
073            public void deleteAll() throws PortalException;
074    
075            public void deleteFileEntry(long fileEntryId) throws PortalException;
076    
077            public void deleteFileShortcut(long fileShortcutId) throws PortalException;
078    
079            public void deleteFileShortcuts(long toFileEntryId) throws PortalException;
080    
081            public void deleteFolder(long folderId) throws PortalException;
082    
083            public List<FileEntry> getFileEntries(
084                            long folderId, int status, int start, int end,
085                            OrderByComparator<FileEntry> obc)
086                    throws PortalException;
087    
088            public List<FileEntry> getFileEntries(
089                            long folderId, int start, int end, OrderByComparator<FileEntry> obc)
090                    throws PortalException;
091    
092            public int getFileEntriesCount(long folderId) throws PortalException;
093    
094            public int getFileEntriesCount(long folderId, int status)
095                    throws PortalException;
096    
097            public FileEntry getFileEntry(long fileEntryId) throws PortalException;
098    
099            public FileEntry getFileEntry(long folderId, String title)
100                    throws PortalException;
101    
102            public FileEntry getFileEntryByUuid(String uuid) throws PortalException;
103    
104            public FileShortcut getFileShortcut(long fileShortcutId)
105                    throws PortalException;
106    
107            public FileVersion getFileVersion(long fileVersionId)
108                    throws PortalException;
109    
110            public Folder getFolder(long folderId) throws PortalException;
111    
112            public Folder getFolder(long parentFolderId, String name)
113                    throws PortalException;
114    
115            public List<FileEntry> getRepositoryFileEntries(
116                            long userId, long rootFolderId, int start, int end,
117                            OrderByComparator<FileEntry> obc)
118                    throws PortalException;
119    
120            public long getRepositoryId();
121    
122            public FileEntry moveFileEntry(
123                            long userId, long fileEntryId, long newFolderId,
124                            ServiceContext serviceContext)
125                    throws PortalException;
126    
127            public Folder moveFolder(
128                            long userId, long folderId, long parentFolderId,
129                            ServiceContext serviceContext)
130                    throws PortalException;
131    
132            public void revertFileEntry(
133                            long userId, long fileEntryId, String version,
134                            ServiceContext serviceContext)
135                    throws PortalException;
136    
137            public FileEntry updateFileEntry(
138                            long userId, long fileEntryId, String sourceFileName,
139                            String mimeType, String title, String description, String changeLog,
140                            boolean majorVersion, File file, ServiceContext serviceContext)
141                    throws PortalException;
142    
143            public FileEntry updateFileEntry(
144                            long userId, long fileEntryId, String sourceFileName,
145                            String mimeType, String title, String description, String changeLog,
146                            boolean majorVersion, InputStream is, long size,
147                            ServiceContext serviceContext)
148                    throws PortalException;
149    
150            public FileShortcut updateFileShortcut(
151                            long userId, long fileShortcutId, long folderId, long toFileEntryId,
152                            ServiceContext serviceContext)
153                    throws PortalException;
154    
155            public void updateFileShortcuts(
156                            long oldToFileEntryId, long newToFileEntryId)
157                    throws PortalException;
158    
159            public Folder updateFolder(
160                            long folderId, long parentFolderId, String name, String description,
161                            ServiceContext serviceContext)
162                    throws PortalException;
163    
164    }