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