001
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.security.pacl.permission.PortalRuntimePermission;
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.Set;
031
032 import javax.portlet.PortletPreferences;
033 import javax.portlet.PortletRequest;
034 import javax.portlet.PortletURL;
035 import javax.portlet.RenderResponse;
036
037 import javax.servlet.http.HttpServletRequest;
038
039
043 public class DLUtil {
044
045 public static final String MANUAL_CHECK_IN_REQUIRED =
046 "manualCheckInRequired";
047
048 public static final String MANUAL_CHECK_IN_REQUIRED_PATH =
049 StringPool.SLASH + MANUAL_CHECK_IN_REQUIRED;
050
051 public static final String OFFICE_EXTENSION = "officeExtension";
052
053 public static final String OFFICE_EXTENSION_PATH =
054 StringPool.SLASH + OFFICE_EXTENSION;
055
056 public static final String WEBDAV_CHECK_IN_MODE = "webDAVCheckInMode";
057
058 public static void addPortletBreadcrumbEntries(
059 DLFileShortcut dlFileShortcut, HttpServletRequest request,
060 RenderResponse renderResponse)
061 throws Exception {
062
063 getDL().addPortletBreadcrumbEntries(
064 dlFileShortcut, request, renderResponse);
065 }
066
067 public static void addPortletBreadcrumbEntries(
068 FileEntry fileEntry, HttpServletRequest request,
069 RenderResponse renderResponse)
070 throws Exception {
071
072 getDL().addPortletBreadcrumbEntries(fileEntry, request, renderResponse);
073 }
074
075 public static void addPortletBreadcrumbEntries(
076 Folder folder, HttpServletRequest request,
077 LiferayPortletResponse liferayPortletResponse)
078 throws Exception {
079
080 getDL().addPortletBreadcrumbEntries(
081 folder, request, liferayPortletResponse);
082 }
083
084 public static void addPortletBreadcrumbEntries(
085 Folder folder, HttpServletRequest request, PortletURL portletURL)
086 throws Exception {
087
088 getDL().addPortletBreadcrumbEntries(folder, request, portletURL);
089 }
090
091 public static void addPortletBreadcrumbEntries(
092 Folder folder, HttpServletRequest request,
093 RenderResponse renderResponse)
094 throws Exception {
095
096 getDL().addPortletBreadcrumbEntries(folder, request, renderResponse);
097 }
098
099 public static void addPortletBreadcrumbEntries(
100 long folderId, HttpServletRequest request,
101 RenderResponse renderResponse)
102 throws Exception {
103
104 getDL().addPortletBreadcrumbEntries(folderId, request, renderResponse);
105 }
106
107 public static int compareVersions(String version1, String version2) {
108 return getDL().compareVersions(version1, version2);
109 }
110
111 public static String getAbsolutePath(
112 PortletRequest portletRequest, long folderId)
113 throws PortalException, SystemException {
114
115 return getDL().getAbsolutePath(portletRequest, folderId);
116 }
117
118 public static Set<String> getAllMediaGalleryMimeTypes() {
119 return getDL().getAllMediaGalleryMimeTypes();
120 }
121
122 public static String getDDMStructureKey(DLFileEntryType dlFileEntryType) {
123 return getDL().getDDMStructureKey(dlFileEntryType);
124 }
125
126 public static String getDDMStructureKey(String fileEntryTypeUuid) {
127 return getDL().getDDMStructureKey(fileEntryTypeUuid);
128 }
129
130 public static String getDeprecatedDDMStructureKey(
131 DLFileEntryType dlFileEntryType) {
132
133 return getDL().getDeprecatedDDMStructureKey(dlFileEntryType);
134 }
135
136 public static String getDeprecatedDDMStructureKey(long fileEntryTypeId) {
137 return getDL().getDeprecatedDDMStructureKey(fileEntryTypeId);
138 }
139
140 public static String getDividedPath(long id) {
141 return getDL().getDividedPath(id);
142 }
143
144 public static DL getDL() {
145 PortalRuntimePermission.checkGetBeanProperty(DLUtil.class);
146
147 return _dl;
148 }
149
150 public static String getDLControlPanelLink(
151 PortletRequest portletRequest, long folderId)
152 throws PortalException, SystemException {
153
154 return getDL().getDLControlPanelLink(portletRequest, folderId);
155 }
156
157 public static String getFileEntryImage(
158 FileEntry fileEntry, ThemeDisplay themeDisplay) {
159
160 return getDL().getFileEntryImage(fileEntry, themeDisplay);
161 }
162
163 public static String getFileIcon(String extension) {
164 return getDL().getFileIcon(extension);
165 }
166
167 public static String getGenericName(String extension) {
168 return getDL().getGenericName(extension);
169 }
170
171 public static String[] getMediaGalleryMimeTypes(
172 PortletPreferences portletPreferences, PortletRequest portletRequest) {
173
174 return getDL().getMediaGalleryMimeTypes(
175 portletPreferences, portletRequest);
176 }
177
178 public static String getPreviewURL(
179 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
180 String queryString) {
181
182 return getDL().getPreviewURL(
183 fileEntry, fileVersion, themeDisplay, queryString);
184 }
185
186
190 public static String getPreviewURL(
191 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
192 String queryString, boolean appendToken) {
193
194 return getDL().getPreviewURL(
195 fileEntry, fileVersion, themeDisplay, queryString, appendToken);
196 }
197
198 public static String getPreviewURL(
199 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
200 String queryString, boolean appendVersion, boolean absoluteURL) {
201
202 return getDL().getPreviewURL(
203 fileEntry, fileVersion, themeDisplay, queryString, appendVersion,
204 absoluteURL);
205 }
206
207 public static OrderByComparator getRepositoryModelOrderByComparator(
208 String orderByCol, String orderByType) {
209
210 return getDL().getRepositoryModelOrderByComparator(
211 orderByCol, orderByType);
212 }
213
214 public static String getTempFileId(long id, String version) {
215 return getDL().getTempFileId(id, version);
216 }
217
218 public static String getTempFileId(
219 long id, String version, String languageId) {
220
221 return getDL().getTempFileId(id, version, languageId);
222 }
223
224 public static String getThumbnailSrc(
225 FileEntry fileEntry, DLFileShortcut dlFileShortcut,
226 ThemeDisplay themeDisplay)
227 throws Exception {
228
229 return getDL().getThumbnailSrc(fileEntry, dlFileShortcut, themeDisplay);
230 }
231
232 public static String getThumbnailSrc(
233 FileEntry fileEntry, FileVersion fileVersion,
234 DLFileShortcut dlFileShortcut, ThemeDisplay themeDisplay)
235 throws Exception {
236
237 return getDL().getThumbnailSrc(
238 fileEntry, fileVersion, dlFileShortcut, themeDisplay);
239 }
240
241 public static String getThumbnailStyle() throws Exception {
242 return getDL().getThumbnailStyle();
243 }
244
245 public static String getThumbnailStyle(boolean max, int margin)
246 throws Exception {
247
248 return getDL().getThumbnailStyle(max, margin);
249 }
250
251 public static String getTitleWithExtension(FileEntry fileEntry) {
252 return getDL().getTitleWithExtension(fileEntry);
253 }
254
255 public static String getTitleWithExtension(String title, String extension) {
256 return getDL().getTitleWithExtension(title, extension);
257 }
258
259 public static String getWebDavURL(
260 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry)
261 throws PortalException, SystemException {
262
263 return getDL().getWebDavURL(themeDisplay, folder, fileEntry);
264 }
265
266 public static String getWebDavURL(
267 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
268 boolean manualCheckInRequired)
269 throws PortalException, SystemException {
270
271 return getDL().getWebDavURL(
272 themeDisplay, folder, fileEntry, manualCheckInRequired);
273 }
274
275 public static String getWebDavURL(
276 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
277 boolean manualCheckInRequired, boolean officeExtensionRequired)
278 throws PortalException, SystemException {
279
280 return getDL().getWebDavURL(
281 themeDisplay, folder, fileEntry, manualCheckInRequired,
282 officeExtensionRequired);
283 }
284
285 public static boolean hasWorkflowDefinitionLink(
286 long companyId, long groupId, long folderId, long fileEntryTypeId)
287 throws Exception {
288
289 return getDL().hasWorkflowDefinitionLink(
290 companyId, groupId, folderId, fileEntryTypeId);
291 }
292
293 public static boolean isAutoGeneratedDLFileEntryTypeDDMStructureKey(
294 String ddmStructureKey) {
295
296 return getDL().isAutoGeneratedDLFileEntryTypeDDMStructureKey(
297 ddmStructureKey);
298 }
299
300 public static boolean isOfficeExtension(String extension) {
301 return getDL().isOfficeExtension(extension);
302 }
303
304 public void setDL(DL dl) {
305 PortalRuntimePermission.checkSetBeanProperty(getClass());
306
307 _dl = dl;
308 }
309
310 private static DL _dl;
311
312 }