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