001    /**
002     * Copyright (c) 2000-2012 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 com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
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.util.OrderByComparator;
024    import com.liferay.portal.theme.ThemeDisplay;
025    import com.liferay.portlet.documentlibrary.model.DLFileEntryType;
026    import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
027    
028    import java.util.Set;
029    
030    import javax.portlet.PortletPreferences;
031    import javax.portlet.PortletRequest;
032    import javax.portlet.PortletURL;
033    import javax.portlet.RenderResponse;
034    
035    import javax.servlet.http.HttpServletRequest;
036    
037    /**
038     * @author Eudaldo Alnso
039     */
040    public interface DL {
041    
042            public void addPortletBreadcrumbEntries(
043                            DLFileShortcut dlFileShortcut, HttpServletRequest request,
044                            RenderResponse renderResponse)
045                    throws Exception;
046    
047            public void addPortletBreadcrumbEntries(
048                            FileEntry fileEntry, HttpServletRequest request,
049                            RenderResponse renderResponse)
050                    throws Exception;
051    
052            public void addPortletBreadcrumbEntries(
053                            Folder folder, HttpServletRequest request,
054                            LiferayPortletResponse liferayPortletResponse)
055                    throws Exception;
056    
057            public void addPortletBreadcrumbEntries(
058                            Folder folder, HttpServletRequest request, PortletURL portletURL)
059                    throws Exception;
060    
061            public void addPortletBreadcrumbEntries(
062                            Folder folder, HttpServletRequest request,
063                            RenderResponse renderResponse)
064                    throws Exception;
065    
066            public void addPortletBreadcrumbEntries(
067                            long folderId, HttpServletRequest request,
068                            RenderResponse renderResponse)
069                    throws Exception;
070    
071            public int compareVersions(String version1, String version2);
072    
073            public String getAbsolutePath(PortletRequest portletRequest, long folderId)
074                    throws PortalException, SystemException;
075    
076            public Set<String> getAllMediaGalleryMimeTypes();
077    
078            public String getDDMStructureKey(DLFileEntryType dlFileEntryType);
079    
080            public String getDDMStructureKey(String fileEntryTypeUuid);
081    
082            public String getDeprecatedDDMStructureKey(DLFileEntryType dlFileEntryType);
083    
084            public String getDeprecatedDDMStructureKey(long fileEntryTypeId);
085    
086            public String getDividedPath(long id);
087    
088            public String getDLControlPanelLink(
089                            PortletRequest portletRequest, long folderId)
090                    throws PortalException, SystemException;
091    
092            public String getFileEntryImage(
093                    FileEntry fileEntry, ThemeDisplay themeDisplay);
094    
095            public String getFileIcon(String extension);
096    
097            public String getGenericName(String extension);
098    
099            public String[] getMediaGalleryMimeTypes(
100                    PortletPreferences portletPreferences, PortletRequest portletRequest);
101    
102            public String getPreviewURL(
103                    FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
104                    String queryString);
105    
106            /**
107             * @deprecated {@link #getPreviewURL(FileEntry, FileVersion, ThemeDisplay,
108             *             String, boolean, boolean)}
109             */
110            public String getPreviewURL(
111                    FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
112                    String queryString, boolean appendToken);
113    
114            public String getPreviewURL(
115                    FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
116                    String queryString, boolean appendVersion, boolean absoluteURL);
117    
118            public OrderByComparator getRepositoryModelOrderByComparator(
119                    String orderByCol, String orderByType);
120    
121            public String getTempFileId(long id, String version);
122    
123            public String getTempFileId(long id, String version, String languageId);
124    
125            public String getThumbnailSrc(
126                            FileEntry fileEntry, DLFileShortcut dlFileShortcut,
127                            ThemeDisplay themeDisplay)
128                    throws Exception;
129    
130            public String getThumbnailSrc(
131                            FileEntry fileEntry, FileVersion fileVersion,
132                            DLFileShortcut dlFileShortcut, ThemeDisplay themeDisplay)
133                    throws Exception;
134    
135            public String getThumbnailStyle() throws Exception;
136    
137            public String getThumbnailStyle(boolean max, int margin)
138                    throws Exception;
139    
140            public String getTitleWithExtension(FileEntry fileEntry);
141    
142            public String getTitleWithExtension(String title, String extension);
143    
144            public String getWebDavURL(
145                            ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry)
146                    throws PortalException, SystemException;
147    
148            public String getWebDavURL(
149                            ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
150                            boolean manualCheckInRequired)
151                    throws PortalException, SystemException;
152    
153            public String getWebDavURL(
154                            ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
155                            boolean manualCheckInRequired, boolean officeExtensionRequired)
156                    throws PortalException, SystemException;
157    
158            public boolean hasWorkflowDefinitionLink(
159                            long companyId, long groupId, long folderId, long fileEntryTypeId)
160                    throws Exception;
161    
162            public boolean isAutoGeneratedDLFileEntryTypeDDMStructureKey(
163                    String ddmStructureKey);
164    
165            public abstract boolean isOfficeExtension(String extension);
166    
167    }