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