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