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.util.OrderByComparator;
023    import com.liferay.portal.service.ServiceContext;
024    
025    import java.io.File;
026    import java.io.InputStream;
027    
028    import java.util.List;
029    
030    /**
031     * @author Alexander Chow
032     */
033    public interface LocalRepository {
034    
035            public FileEntry addFileEntry(
036                            long userId, long folderId, String sourceFileName, String mimeType,
037                            String title, String description, String changeLog, File file,
038                            ServiceContext serviceContext)
039                    throws PortalException, SystemException;
040    
041            public FileEntry addFileEntry(
042                            long userId, long folderId, String sourceFileName, String mimeType,
043                            String title, String description, String changeLog, InputStream is,
044                            long size, ServiceContext serviceContext)
045                    throws PortalException, SystemException;
046    
047            public Folder addFolder(
048                            long userId, long parentFolderId, String title, String description,
049                            ServiceContext serviceContext)
050                    throws PortalException, SystemException;
051    
052            public void deleteAll() throws PortalException, SystemException;
053    
054            public void deleteFileEntry(long fileEntryId)
055                    throws PortalException, SystemException;
056    
057            public void deleteFolder(long folderId)
058                    throws PortalException, SystemException;
059    
060            public List<FileEntry> getFileEntries(
061                            long folderId, int start, int end, OrderByComparator obc)
062                    throws SystemException;
063    
064            public List<Object> getFileEntriesAndFileShortcuts(
065                            long folderId, int status, int start, int end)
066                    throws SystemException;
067    
068            public int getFileEntriesAndFileShortcutsCount(long folderId, int status)
069                    throws SystemException;
070    
071            public int getFileEntriesCount(long folderId)
072                    throws SystemException;
073    
074            public FileEntry getFileEntry(long fileEntryId)
075                    throws PortalException, SystemException;
076    
077            public FileEntry getFileEntry(long folderId, String title)
078                    throws PortalException, SystemException;
079    
080            public FileEntry getFileEntryByUuid(String uuid)
081                    throws PortalException, SystemException;
082    
083            public FileVersion getFileVersion(long fileVersionId)
084                    throws PortalException, SystemException;
085    
086            public Folder getFolder(long folderId)
087                    throws PortalException, SystemException;
088    
089            public Folder getFolder(long parentFolderId, String title)
090                    throws PortalException, SystemException;
091    
092            public List<Folder> getFolders(
093                            long parentFolderId, boolean includeMountfolders, int start,
094                            int end, OrderByComparator obc)
095                    throws PortalException, SystemException;
096    
097            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
098                            long folderId, int status, boolean includeMountFolders, int start,
099                            int end, OrderByComparator obc)
100                    throws SystemException;
101    
102            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
103                            long folderId, int status, String[] mimeTypes,
104                            boolean includeMountFolders, int start, int end,
105                            OrderByComparator obc)
106                    throws PortalException, SystemException;
107    
108            public int getFoldersAndFileEntriesAndFileShortcutsCount(
109                            long folderId, int status, boolean includeMountFolders)
110                    throws SystemException;
111    
112            public int getFoldersAndFileEntriesAndFileShortcutsCount(
113                            long folderId, int status, String[] mimeTypes,
114                            boolean includeMountFolders)
115                    throws PortalException, SystemException;
116    
117            public int getFoldersCount(long parentFolderId, boolean includeMountfolders)
118                    throws PortalException, SystemException;
119    
120            public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
121                    throws SystemException;
122    
123            public List<Folder> getMountFolders(
124                            long parentFolderId, int start, int end, OrderByComparator obc)
125                    throws SystemException;
126    
127            public int getMountFoldersCount(long parentFolderId) throws SystemException;
128    
129            public long getRepositoryId();
130    
131            public FileEntry moveFileEntry(
132                            long userId, long fileEntryId, long newFolderId,
133                            ServiceContext serviceContext)
134                    throws PortalException, SystemException;
135    
136            public void updateAsset(
137                            long userId, FileEntry fileEntry, FileVersion fileVersion,
138                            long[] assetCategoryIds, String[] assetTagNames,
139                            long[] assetLinkEntryIds)
140                    throws PortalException, SystemException;
141    
142            public FileEntry updateFileEntry(
143                            long userId, long fileEntryId, String sourceFileName,
144                            String mimeType, String title, String description, String changeLog,
145                            boolean majorVersion, File file, ServiceContext serviceContext)
146                    throws PortalException, SystemException;
147    
148            public FileEntry updateFileEntry(
149                            long userId, long fileEntryId, String sourceFileName,
150                            String mimeType, String title, String description, String changeLog,
151                            boolean majorVersion, InputStream is, long size,
152                            ServiceContext serviceContext)
153                    throws PortalException, SystemException;
154    
155            public Folder updateFolder(
156                            long folderId, long parentFolderId, String title,
157                            String description, ServiceContext serviceContext)
158                    throws PortalException, SystemException;
159    
160    }