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.document.library.kernel.util;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.document.library.kernel.model.DLFileEntryType;
020    import com.liferay.document.library.kernel.model.DLFileShortcut;
021    import com.liferay.document.library.kernel.model.DLFileVersion;
022    import com.liferay.portal.kernel.exception.PortalException;
023    import com.liferay.portal.kernel.repository.model.FileEntry;
024    import com.liferay.portal.kernel.repository.model.FileVersion;
025    import com.liferay.portal.kernel.repository.model.Folder;
026    import com.liferay.portal.kernel.search.Hits;
027    import com.liferay.portal.kernel.service.ServiceContext;
028    import com.liferay.portal.kernel.theme.ThemeDisplay;
029    import com.liferay.portal.kernel.util.OrderByComparator;
030    import com.liferay.portal.kernel.util.StringPool;
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            public String getPreviewURL(
125                    FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
126                    String queryString, boolean appendVersion, boolean absoluteURL);
127    
128            public <T> OrderByComparator<T> getRepositoryModelOrderByComparator(
129                    String orderByCol, String orderByType);
130    
131            public <T> OrderByComparator<T> getRepositoryModelOrderByComparator(
132                    String orderByCol, String orderByType, boolean orderByModel);
133    
134            public String getSanitizedFileName(String title, String extension);
135    
136            public String getTempFileId(long id, String version);
137    
138            public String getTempFileId(long id, String version, String languageId);
139    
140            /**
141             * @deprecated As of 7.0.0, replaced by {@link #getThumbnailSrc(FileEntry,
142             *             ThemeDisplay)}
143             */
144            @Deprecated
145            public String getThumbnailSrc(
146                            FileEntry fileEntry, DLFileShortcut dlFileShortcut,
147                            ThemeDisplay themeDisplay)
148                    throws Exception;
149    
150            /**
151             * @deprecated As of 7.0.0, replaced by {@link #getThumbnailSrc(FileEntry,
152             *             FileVersion, ThemeDisplay)}
153             */
154            @Deprecated
155            public String getThumbnailSrc(
156                            FileEntry fileEntry, FileVersion fileVersion,
157                            DLFileShortcut dlFileShortcut, ThemeDisplay themeDisplay)
158                    throws Exception;
159    
160            public String getThumbnailSrc(
161                            FileEntry fileEntry, FileVersion fileVersion,
162                            ThemeDisplay themeDisplay)
163                    throws Exception;
164    
165            public String getThumbnailSrc(
166                            FileEntry fileEntry, ThemeDisplay themeDisplay)
167                    throws Exception;
168    
169            public String getThumbnailStyle();
170    
171            public String getThumbnailStyle(boolean max, int margin);
172    
173            public String getThumbnailStyle(
174                    boolean max, int margin, int height, int width);
175    
176            public String getTitleWithExtension(FileEntry fileEntry);
177    
178            public String getTitleWithExtension(String title, String extension);
179    
180            public String getUniqueFileName(
181                    long groupId, long folderId, String fileName);
182    
183            public String getWebDavURL(
184                            ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry)
185                    throws PortalException;
186    
187            public String getWebDavURL(
188                            ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
189                            boolean manualCheckInRequired)
190                    throws PortalException;
191    
192            public String getWebDavURL(
193                            ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
194                            boolean manualCheckInRequired, boolean officeExtensionRequired)
195                    throws PortalException;
196    
197            public boolean hasWorkflowDefinitionLink(
198                            long companyId, long groupId, long folderId, long fileEntryTypeId)
199                    throws Exception;
200    
201            public boolean isAutoGeneratedDLFileEntryTypeDDMStructureKey(
202                    String ddmStructureKey);
203    
204            public abstract boolean isOfficeExtension(String extension);
205    
206            public boolean isSubscribedToFileEntryType(
207                    long companyId, long groupId, long userId, long fileEntryTypeId);
208    
209            public boolean isSubscribedToFolder(
210                            long companyId, long groupId, long userId, long folderId)
211                    throws PortalException;
212    
213            public boolean isSubscribedToFolder(
214                            long companyId, long groupId, long userId, long folderId,
215                            boolean recursive)
216                    throws PortalException;
217    
218            public boolean isValidVersion(String version);
219    
220            public void startWorkflowInstance(
221                            long userId, DLFileVersion dlFileVersion, String syncEventType,
222                            ServiceContext serviceContext)
223                    throws PortalException;
224    
225    }