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    
107            public List<FileEntry> getPortletFileEntries(
108                    long groupId, long folderId, int status);
109    
110            public List<FileEntry> getPortletFileEntries(
111                    long groupId, long folderId, int status, int start, int end,
112                    OrderByComparator<FileEntry> obc);
113    
114            public List<FileEntry> getPortletFileEntries(
115                    long groupId, long folderId, OrderByComparator<FileEntry> obc);
116    
117            public int getPortletFileEntriesCount(long groupId, long folderId);
118    
119            public int getPortletFileEntriesCount(
120                    long groupId, long folderId, int status);
121    
122            public FileEntry getPortletFileEntry(long fileEntryId)
123                    throws PortalException;
124    
125            public FileEntry getPortletFileEntry(
126                            long groupId, long folderId, String fileName)
127                    throws PortalException;
128    
129            public FileEntry getPortletFileEntry(String uuid, long groupId)
130                    throws PortalException;
131    
132            public String getPortletFileEntryURL(
133                    ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString);
134    
135            public String getPortletFileEntryURL(
136                    ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString,
137                    boolean absoluteURL);
138    
139            public Folder getPortletFolder(long folderId) throws PortalException;
140    
141            public Folder getPortletFolder(
142                            long repositoryId, long parentFolderId, String folderName)
143                    throws PortalException;
144    
145            public Repository getPortletRepository(long groupId, String portletId)
146                    throws PortalException;
147    
148            public FileEntry movePortletFileEntryToTrash(long userId, long fileEntryId)
149                    throws PortalException;
150    
151            public FileEntry movePortletFileEntryToTrash(
152                            long groupId, long userId, long folderId, String fileName)
153                    throws PortalException;
154    
155            public void restorePortletFileEntryFromTrash(long userId, long fileEntryId)
156                    throws PortalException;
157    
158            public void restorePortletFileEntryFromTrash(
159                            long groupId, long userId, long folderId, String fileName)
160                    throws PortalException;
161    
162    }