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