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