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, byte[] bytes, 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, File file, String fileName,
057                            String mimeType, boolean indexingEnabled)
058                    throws PortalException;
059    
060            public FileEntry addPortletFileEntry(
061                            long groupId, long userId, String className, long classPK,
062                            String portletId, long folderId, InputStream inputStream,
063                            String fileName, String mimeType, boolean indexingEnabled)
064                    throws PortalException;
065    
066            public Folder addPortletFolder(
067                            long userId, long repositoryId, long parentFolderId,
068                            String folderName, ServiceContext serviceContext)
069                    throws PortalException;
070    
071            public Folder addPortletFolder(
072                            long groupId, long userId, String portletId, long parentFolderId,
073                            String folderName, ServiceContext serviceContext)
074                    throws PortalException;
075    
076            public Repository addPortletRepository(
077                            long groupId, String portletId, ServiceContext serviceContext)
078                    throws PortalException;
079    
080            /**
081             * @deprecated As of 7.0.0, replaced by {@link #deletePortletFolder}
082             */
083            @Deprecated
084            public void deleteFolder(long folderId) throws PortalException;
085    
086            public void deletePortletFileEntries(long groupId, long folderId)
087                    throws PortalException;
088    
089            public void deletePortletFileEntries(
090                            long groupId, long folderId, int status)
091                    throws PortalException;
092    
093            public void deletePortletFileEntry(long fileEntryId) throws PortalException;
094    
095            public void deletePortletFileEntry(
096                            long groupId, long folderId, String fileName)
097                    throws PortalException;
098    
099            public void deletePortletFolder(long folderId) throws PortalException;
100    
101            public void deletePortletRepository(long groupId, String portletId)
102                    throws PortalException;
103    
104            public Repository fetchPortletRepository(long groupId, String portletId);
105    
106            public String getDownloadPortletFileEntryURL(
107                    ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString);
108    
109            public String getDownloadPortletFileEntryURL(
110                    ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString,
111                    boolean absoluteURL);
112    
113            public List<FileEntry> getPortletFileEntries(long groupId, long folderId)
114                    throws PortalException;
115    
116            public List<FileEntry> getPortletFileEntries(
117                            long groupId, long folderId, int status)
118                    throws PortalException;
119    
120            public List<FileEntry> getPortletFileEntries(
121                            long groupId, long folderId, int status, int start, int end,
122                            OrderByComparator<FileEntry> obc)
123                    throws PortalException;
124    
125            public List<FileEntry> getPortletFileEntries(
126                            long groupId, long folderId, OrderByComparator<FileEntry> obc)
127                    throws PortalException;
128    
129            public int getPortletFileEntriesCount(long groupId, long folderId)
130                    throws PortalException;
131    
132            public int getPortletFileEntriesCount(
133                            long groupId, long folderId, int status)
134                    throws PortalException;
135    
136            public FileEntry getPortletFileEntry(long fileEntryId)
137                    throws PortalException;
138    
139            public FileEntry getPortletFileEntry(
140                            long groupId, long folderId, String fileName)
141                    throws PortalException;
142    
143            public FileEntry getPortletFileEntry(String uuid, long groupId)
144                    throws PortalException;
145    
146            public String getPortletFileEntryURL(
147                    ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString);
148    
149            public String getPortletFileEntryURL(
150                    ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString,
151                    boolean absoluteURL);
152    
153            public Folder getPortletFolder(long folderId) throws PortalException;
154    
155            public Folder getPortletFolder(
156                            long repositoryId, long parentFolderId, String folderName)
157                    throws PortalException;
158    
159            public Repository getPortletRepository(long groupId, String portletId)
160                    throws PortalException;
161    
162            public String getUniqueFileName(
163                    long groupId, long folderId, String fileName);
164    
165            public FileEntry movePortletFileEntryToTrash(long userId, long fileEntryId)
166                    throws PortalException;
167    
168            public FileEntry movePortletFileEntryToTrash(
169                            long groupId, long userId, long folderId, String fileName)
170                    throws PortalException;
171    
172            public Folder movePortletFolder(
173                            long groupId, long userId, long folderId, long parentFolderId,
174                            ServiceContext serviceContext)
175                    throws PortalException;
176    
177            public void restorePortletFileEntryFromTrash(long userId, long fileEntryId)
178                    throws PortalException;
179    
180            public void restorePortletFileEntryFromTrash(
181                            long groupId, long userId, long folderId, String fileName)
182                    throws PortalException;
183    
184            public Hits searchPortletFileEntries(
185                            long repositoryId, SearchContext searchContext)
186                    throws PortalException;
187    
188    }