001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.kernel.repository.model.FileEntry;
021    import com.liferay.portal.kernel.repository.model.Folder;
022    import com.liferay.portal.kernel.search.Hits;
023    import com.liferay.portal.kernel.search.SearchContext;
024    import com.liferay.portal.kernel.util.ObjectValuePair;
025    import com.liferay.portal.kernel.util.OrderByComparator;
026    import com.liferay.portal.model.Repository;
027    import com.liferay.portal.service.ServiceContext;
028    import com.liferay.portal.theme.ThemeDisplay;
029    
030    import java.io.File;
031    import java.io.InputStream;
032    
033    import java.util.List;
034    
035    /**
036     * @author Eudaldo Alonso
037     * @author Alexander Chow
038     */
039    @ProviderType
040    public interface PortletFileRepository {
041    
042            public void addPortletFileEntries(
043                            long groupId, long userId, String className, long classPK,
044                            String portletId, long folderId,
045                            List<ObjectValuePair<String, InputStream>> inputStreamOVPs)
046                    throws PortalException;
047    
048            public FileEntry addPortletFileEntry(
049                            long groupId, long userId, String className, long classPK,
050                            String portletId, long folderId, File file, String fileName,
051                            String mimeType, boolean indexingEnabled)
052                    throws PortalException;
053    
054            public FileEntry addPortletFileEntry(
055                            long groupId, long userId, String className, long classPK,
056                            String portletId, long folderId, InputStream inputStream,
057                            String fileName, String mimeType, boolean indexingEnabled)
058                    throws PortalException;
059    
060            public Folder addPortletFolder(
061                            long userId, long repositoryId, long parentFolderId,
062                            String folderName, ServiceContext serviceContext)
063                    throws PortalException;
064    
065            public Folder addPortletFolder(
066                            long groupId, long userId, String portletId, long parentFolderId,
067                            String folderName, ServiceContext serviceContext)
068                    throws PortalException;
069    
070            public Repository addPortletRepository(
071                            long groupId, String portletId, ServiceContext serviceContext)
072                    throws PortalException;
073    
074            /**
075             * @deprecated As of 7.0.0, replaced by {@link #deletePortletFolder}
076             */
077            @Deprecated
078            public void deleteFolder(long folderId) throws PortalException;
079    
080            public void deletePortletFileEntries(long groupId, long folderId)
081                    throws PortalException;
082    
083            public void deletePortletFileEntries(
084                            long groupId, long folderId, int status)
085                    throws PortalException;
086    
087            public void deletePortletFileEntry(long fileEntryId) throws PortalException;
088    
089            public void deletePortletFileEntry(
090                            long groupId, long folderId, String fileName)
091                    throws PortalException;
092    
093            public void deletePortletFolder(long folderId) throws PortalException;
094    
095            public void deletePortletRepository(long groupId, String portletId)
096                    throws PortalException;
097    
098            public Repository fetchPortletRepository(long groupId, String portletId);
099    
100            public String getDownloadPortletFileEntryURL(
101                    ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString);
102    
103            public String getDownloadPortletFileEntryURL(
104                    ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString,
105                    boolean absoluteURL);
106    
107            public List<FileEntry> getPortletFileEntries(long groupId, long folderId)
108                    throws PortalException;
109    
110            public List<FileEntry> getPortletFileEntries(
111                            long groupId, long folderId, int status)
112                    throws PortalException;
113    
114            public List<FileEntry> getPortletFileEntries(
115                            long groupId, long folderId, int status, int start, int end,
116                            OrderByComparator<FileEntry> obc)
117                    throws PortalException;
118    
119            public List<FileEntry> getPortletFileEntries(
120                            long groupId, long folderId, OrderByComparator<FileEntry> obc)
121                    throws PortalException;
122    
123            public int getPortletFileEntriesCount(long groupId, long folderId)
124                    throws PortalException;
125    
126            public int getPortletFileEntriesCount(
127                            long groupId, long folderId, int status)
128                    throws PortalException;
129    
130            public FileEntry getPortletFileEntry(long fileEntryId)
131                    throws PortalException;
132    
133            public FileEntry getPortletFileEntry(
134                            long groupId, long folderId, String fileName)
135                    throws PortalException;
136    
137            public FileEntry getPortletFileEntry(String uuid, long groupId)
138                    throws PortalException;
139    
140            public String getPortletFileEntryURL(
141                    ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString);
142    
143            public String getPortletFileEntryURL(
144                    ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString,
145                    boolean absoluteURL);
146    
147            public Folder getPortletFolder(long folderId) throws PortalException;
148    
149            public Folder getPortletFolder(
150                            long repositoryId, long parentFolderId, String folderName)
151                    throws PortalException;
152    
153            public Repository getPortletRepository(long groupId, String portletId)
154                    throws PortalException;
155    
156            public FileEntry movePortletFileEntryToTrash(long userId, long fileEntryId)
157                    throws PortalException;
158    
159            public FileEntry movePortletFileEntryToTrash(
160                            long groupId, long userId, long folderId, String fileName)
161                    throws PortalException;
162    
163            public void restorePortletFileEntryFromTrash(long userId, long fileEntryId)
164                    throws PortalException;
165    
166            public void restorePortletFileEntryFromTrash(
167                            long groupId, long userId, long folderId, String fileName)
168                    throws PortalException;
169    
170            public Hits searchPortletFileEntries(
171                            long repositoryId, SearchContext searchContext)
172                    throws PortalException;
173    
174    }