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