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.portletfilerepository;
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.Folder;
021    import com.liferay.portal.kernel.util.ObjectValuePair;
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 Eudaldo Alonso
032     * @author Alexander Chow
033     */
034    public interface PortletFileRepository {
035    
036            public void addPortletFileEntries(
037                            long groupId, long userId, String className, long classPK,
038                            String portletId, long folderId,
039                            List<ObjectValuePair<String, InputStream>> inputStreamOVPs)
040                    throws PortalException, SystemException;
041    
042            public FileEntry addPortletFileEntry(
043                            long groupId, long userId, String className, long classPK,
044                            String portletId, long folderId, File file, String fileName,
045                            String mimeType)
046                    throws PortalException, SystemException;
047    
048            public FileEntry addPortletFileEntry(
049                            long groupId, long userId, String className, long classPK,
050                            String portletId, long folderId, InputStream inputStream,
051                            String fileName, String mimeType)
052                    throws PortalException, SystemException;
053    
054            public void deleteFolder(long folderId)
055                    throws PortalException, SystemException;
056    
057            public void deletePortletFileEntries(long groupId, long folderId)
058                    throws PortalException, SystemException;
059    
060            public void deletePortletFileEntries(
061                            long groupId, long folderId, int status)
062                    throws PortalException, SystemException;
063    
064            public void deletePortletFileEntry(long fileEntryId)
065                    throws PortalException, SystemException;
066    
067            public void deletePortletFileEntry(
068                            long groupId, long folderId, String fileName)
069                    throws PortalException, SystemException;
070    
071            public void deletePortletRepository(long groupId, String portletId)
072                    throws PortalException, SystemException;
073    
074            public List<FileEntry> getPortletFileEntries(long groupId, long folderId)
075                    throws SystemException;
076    
077            public List<FileEntry> getPortletFileEntries(
078                            long groupId, long folderId, int status)
079                    throws SystemException;
080    
081            public List<FileEntry> getPortletFileEntries(
082                            long groupId, long folderId, int status, int start, int end,
083                            OrderByComparator obc)
084                    throws SystemException;
085    
086            public int getPortletFileEntriesCount(long groupId, long folderId)
087                    throws SystemException;
088    
089            public int getPortletFileEntriesCount(
090                            long groupId, long folderId, int status)
091                    throws SystemException;
092    
093            public FileEntry getPortletFileEntry(long fileEntryId)
094                    throws PortalException, SystemException;
095    
096            public FileEntry getPortletFileEntry(
097                            long groupId, long folderId, String fileName)
098                    throws PortalException, SystemException;
099    
100            public Folder getPortletFolder(long folderId)
101                    throws PortalException, SystemException;
102    
103            public Folder getPortletFolder(
104                            long userId, long repositoryId, long parentFolderId,
105                            String folderName, ServiceContext serviceContext)
106                    throws PortalException, SystemException;
107    
108            public long getPortletRepositoryId(
109                            long groupId, String portletId, ServiceContext serviceContext)
110                    throws PortalException, SystemException;
111    
112            public void movePortletFileEntryToTrash(long userId, long fileEntryId)
113                    throws PortalException, SystemException;
114    
115            public void movePortletFileEntryToTrash(
116                            long groupId, long userId, long folderId, String fileName)
117                    throws PortalException, SystemException;
118    
119            public void restorePortletFileEntryFromTrash(long userId, long fileEntryId)
120                    throws PortalException, SystemException;
121    
122            public void restorePortletFileEntryFromTrash(
123                            long groupId, long userId, long folderId, String fileName)
124                    throws PortalException, SystemException;
125    
126    }