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.portlet.documentlibrary.util;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
021    import com.liferay.portal.kernel.repository.model.FileEntry;
022    import com.liferay.portal.kernel.repository.model.FileShortcut;
023    import com.liferay.portal.kernel.repository.model.FileVersion;
024    import com.liferay.portal.kernel.repository.model.Folder;
025    import com.liferay.portal.kernel.search.Hits;
026    import com.liferay.portal.kernel.util.OrderByComparator;
027    import com.liferay.portal.kernel.util.StringPool;
028    import com.liferay.portal.service.ServiceContext;
029    import com.liferay.portal.theme.ThemeDisplay;
030    import com.liferay.portlet.documentlibrary.model.DLFileEntryType;
031    import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
032    import com.liferay.portlet.documentlibrary.model.DLFileVersion;
033    
034    import java.util.List;
035    import java.util.Map;
036    import java.util.Set;
037    
038    import javax.portlet.PortletRequest;
039    import javax.portlet.PortletURL;
040    import javax.portlet.RenderResponse;
041    
042    import javax.servlet.http.HttpServletRequest;
043    
044    /**
045     * @author Eudaldo Alonso
046     */
047    @ProviderType
048    public interface DL {
049    
050            public static final String MANUAL_CHECK_IN_REQUIRED =
051                    "manualCheckInRequired";
052    
053            public static final String MANUAL_CHECK_IN_REQUIRED_PATH =
054                    StringPool.SLASH + MANUAL_CHECK_IN_REQUIRED;
055    
056            public static final String OFFICE_EXTENSION = "officeExtension";
057    
058            public static final String OFFICE_EXTENSION_PATH =
059                    StringPool.SLASH + OFFICE_EXTENSION;
060    
061            public static final String WEBDAV_CHECK_IN_MODE = "webDAVCheckInMode";
062    
063            public void addPortletBreadcrumbEntries(
064                            FileEntry fileEntry, HttpServletRequest request,
065                            RenderResponse renderResponse)
066                    throws Exception;
067    
068            public void addPortletBreadcrumbEntries(
069                            FileShortcut dlFileShortcut, HttpServletRequest request,
070                            RenderResponse renderResponse)
071                    throws Exception;
072    
073            public void addPortletBreadcrumbEntries(
074                            Folder folder, HttpServletRequest request,
075                            LiferayPortletResponse liferayPortletResponse)
076                    throws Exception;
077    
078            public void addPortletBreadcrumbEntries(
079                            Folder folder, HttpServletRequest request, PortletURL portletURL)
080                    throws Exception;
081    
082            public void addPortletBreadcrumbEntries(
083                            Folder folder, HttpServletRequest request,
084                            RenderResponse renderResponse)
085                    throws Exception;
086    
087            public void addPortletBreadcrumbEntries(
088                            long folderId, HttpServletRequest request,
089                            RenderResponse renderResponse)
090                    throws Exception;
091    
092            public int compareVersions(String version1, String version2);
093    
094            public String getAbsolutePath(PortletRequest portletRequest, long folderId)
095                    throws PortalException;
096    
097            public Set<String> getAllMediaGalleryMimeTypes();
098    
099            public String getDDMStructureKey(DLFileEntryType dlFileEntryType);
100    
101            public String getDDMStructureKey(String fileEntryTypeUuid);
102    
103            public String getDeprecatedDDMStructureKey(DLFileEntryType dlFileEntryType);
104    
105            public String getDeprecatedDDMStructureKey(long fileEntryTypeId);
106    
107            public String getDividedPath(long id);
108    
109            public String getDLFileEntryControlPanelLink(
110                            PortletRequest portletRequest, long fileEntryId)
111                    throws PortalException;
112    
113            public String getDLFolderControlPanelLink(
114                            PortletRequest portletRequest, long folderId)
115                    throws PortalException;
116    
117            public String getDownloadURL(
118                    FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
119                    String queryString);
120    
121            public String getDownloadURL(
122                    FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
123                    String queryString, boolean appendVersion, boolean absoluteURL);
124    
125            public Map<String, String> getEmailDefinitionTerms(
126                    PortletRequest portletRequest, String emailFromAddress,
127                    String emailFromName);
128    
129            public Map<String, String> getEmailFromDefinitionTerms(
130                    PortletRequest portletRequest, String emailFromAddress,
131                    String emailFromName);
132    
133            public List<FileEntry> getFileEntries(Hits hits);
134    
135            public String getFileEntryImage(
136                    FileEntry fileEntry, ThemeDisplay themeDisplay);
137    
138            public Set<Long> getFileEntryTypeSubscriptionClassPKs(long userId);
139    
140            public String getFileIcon(String extension);
141    
142            public String getFileIconCssClass(String extension);
143    
144            public String getFileName(long groupId, long folderId, String tempFileName);
145    
146            public String getGenericName(String extension);
147    
148            public String getImagePreviewURL(
149                            FileEntry fileEntry, FileVersion fileVersion,
150                            ThemeDisplay themeDisplay)
151                    throws Exception;
152    
153            public String getImagePreviewURL(
154                            FileEntry fileEntry, ThemeDisplay themeDisplay)
155                    throws Exception;
156    
157            public String getPreviewURL(
158                    FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
159                    String queryString);
160    
161            /**
162             * @deprecated As of 6.2.0, replaced by {@link #getPreviewURL(FileEntry,
163             *             FileVersion, ThemeDisplay, String, boolean, boolean)}
164             */
165            @Deprecated
166            public String getPreviewURL(
167                    FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
168                    String queryString, boolean appendToken);
169    
170            public String getPreviewURL(
171                    FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
172                    String queryString, boolean appendVersion, boolean absoluteURL);
173    
174            public <T> OrderByComparator<T> getRepositoryModelOrderByComparator(
175                    String orderByCol, String orderByType);
176    
177            public String getSanitizedFileName(String title, String extension);
178    
179            public String getTempFileId(long id, String version);
180    
181            public String getTempFileId(long id, String version, String languageId);
182    
183            /**
184             * @deprecated As of 7.0.0, replaced by {@link #getThumbnailSrc(FileEntry,
185             *             ThemeDisplay)}
186             */
187            @Deprecated
188            public String getThumbnailSrc(
189                            FileEntry fileEntry, DLFileShortcut dlFileShortcut,
190                            ThemeDisplay themeDisplay)
191                    throws Exception;
192    
193            /**
194             * @deprecated As of 7.0.0, replaced by {@link #getThumbnailSrc(FileEntry,
195             *             FileVersion, ThemeDisplay)}
196             */
197            @Deprecated
198            public String getThumbnailSrc(
199                            FileEntry fileEntry, FileVersion fileVersion,
200                            DLFileShortcut dlFileShortcut, ThemeDisplay themeDisplay)
201                    throws Exception;
202    
203            public String getThumbnailSrc(
204                            FileEntry fileEntry, FileVersion fileVersion,
205                            ThemeDisplay themeDisplay)
206                    throws Exception;
207    
208            public String getThumbnailSrc(
209                            FileEntry fileEntry, ThemeDisplay themeDisplay)
210                    throws Exception;
211    
212            public String getThumbnailStyle() throws Exception;
213    
214            public String getThumbnailStyle(boolean max, int margin) throws Exception;
215    
216            public String getTitleWithExtension(FileEntry fileEntry);
217    
218            public String getTitleWithExtension(String title, String extension);
219    
220            public String getWebDavURL(
221                            ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry)
222                    throws PortalException;
223    
224            public String getWebDavURL(
225                            ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
226                            boolean manualCheckInRequired)
227                    throws PortalException;
228    
229            public String getWebDavURL(
230                            ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
231                            boolean manualCheckInRequired, boolean officeExtensionRequired)
232                    throws PortalException;
233    
234            public boolean hasWorkflowDefinitionLink(
235                            long companyId, long groupId, long folderId, long fileEntryTypeId)
236                    throws Exception;
237    
238            public boolean isAutoGeneratedDLFileEntryTypeDDMStructureKey(
239                    String ddmStructureKey);
240    
241            public abstract boolean isOfficeExtension(String extension);
242    
243            public boolean isSubscribedToFileEntryType(
244                    long companyId, long groupId, long userId, long fileEntryTypeId);
245    
246            public boolean isSubscribedToFolder(
247                            long companyId, long groupId, long userId, long folderId)
248                    throws PortalException;
249    
250            public boolean isSubscribedToFolder(
251                            long companyId, long groupId, long userId, long folderId,
252                            boolean recursive)
253                    throws PortalException;
254    
255            public boolean isValidVersion(String version);
256    
257            public void startWorkflowInstance(
258                            long userId, DLFileVersion dlFileVersion, String syncEventType,
259                            ServiceContext serviceContext)
260                    throws PortalException;
261    
262    }