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