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