001
014
015 package com.liferay.portlet.documentlibrary.util;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
019 import com.liferay.portal.kernel.repository.model.FileEntry;
020 import com.liferay.portal.kernel.repository.model.FileShortcut;
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.security.pacl.permission.PortalRuntimePermission;
025 import com.liferay.portal.kernel.util.OrderByComparator;
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 import javax.portlet.PortletURL;
038 import javax.portlet.RenderRequest;
039 import javax.portlet.RenderResponse;
040
041 import javax.servlet.http.HttpServletRequest;
042
043
047 public class DLUtil {
048
049 public static void addPortletBreadcrumbEntries(
050 FileEntry fileEntry, HttpServletRequest request,
051 RenderResponse renderResponse)
052 throws Exception {
053
054 getDL().addPortletBreadcrumbEntries(fileEntry, request, renderResponse);
055 }
056
057 public static void addPortletBreadcrumbEntries(
058 FileShortcut fileShortcut, HttpServletRequest request,
059 RenderResponse renderResponse)
060 throws Exception {
061
062 getDL().addPortletBreadcrumbEntries(
063 fileShortcut, request, renderResponse);
064 }
065
066 public static void addPortletBreadcrumbEntries(
067 Folder folder, HttpServletRequest request,
068 LiferayPortletResponse liferayPortletResponse)
069 throws Exception {
070
071 getDL().addPortletBreadcrumbEntries(
072 folder, request, liferayPortletResponse);
073 }
074
075 public static void addPortletBreadcrumbEntries(
076 Folder folder, HttpServletRequest request, PortletURL portletURL)
077 throws Exception {
078
079 getDL().addPortletBreadcrumbEntries(folder, request, portletURL);
080 }
081
082 public static void addPortletBreadcrumbEntries(
083 Folder folder, HttpServletRequest request,
084 RenderResponse renderResponse)
085 throws Exception {
086
087 getDL().addPortletBreadcrumbEntries(folder, request, renderResponse);
088 }
089
090 public static void addPortletBreadcrumbEntries(
091 long folderId, HttpServletRequest request,
092 RenderResponse renderResponse)
093 throws Exception {
094
095 getDL().addPortletBreadcrumbEntries(folderId, request, renderResponse);
096 }
097
098 public static int compareVersions(String version1, String version2) {
099 return getDL().compareVersions(version1, version2);
100 }
101
102 public static String getAbsolutePath(
103 PortletRequest portletRequest, long folderId)
104 throws PortalException {
105
106 return getDL().getAbsolutePath(portletRequest, folderId);
107 }
108
109 public static Set<String> getAllMediaGalleryMimeTypes() {
110 return getDL().getAllMediaGalleryMimeTypes();
111 }
112
113 public static String getDDMStructureKey(DLFileEntryType dlFileEntryType) {
114 return getDL().getDDMStructureKey(dlFileEntryType);
115 }
116
117 public static String getDDMStructureKey(String fileEntryTypeUuid) {
118 return getDL().getDDMStructureKey(fileEntryTypeUuid);
119 }
120
121 public static String getDeprecatedDDMStructureKey(
122 DLFileEntryType dlFileEntryType) {
123
124 return getDL().getDeprecatedDDMStructureKey(dlFileEntryType);
125 }
126
127 public static String getDeprecatedDDMStructureKey(long fileEntryTypeId) {
128 return getDL().getDeprecatedDDMStructureKey(fileEntryTypeId);
129 }
130
131 public static String getDividedPath(long id) {
132 return getDL().getDividedPath(id);
133 }
134
135 public static DL getDL() {
136 PortalRuntimePermission.checkGetBeanProperty(DLUtil.class);
137
138 return _dl;
139 }
140
141 public static String getDLFileEntryControlPanelLink(
142 PortletRequest portletRequest, long fileEntryId)
143 throws PortalException {
144
145 return getDL().getDLFileEntryControlPanelLink(
146 portletRequest, fileEntryId);
147 }
148
149 public static String getDLFolderControlPanelLink(
150 PortletRequest portletRequest, long folderId)
151 throws PortalException {
152
153 return getDL().getDLFolderControlPanelLink(portletRequest, folderId);
154 }
155
156 public static String getDownloadURL(
157 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
158 String queryString) {
159
160 return getDL().getDownloadURL(
161 fileEntry, fileVersion, themeDisplay, queryString);
162 }
163
164 public static String getDownloadURL(
165 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
166 String queryString, boolean appendVersion, boolean absoluteURL) {
167
168 return getDL().getDownloadURL(
169 fileEntry, fileVersion, themeDisplay, queryString, appendVersion,
170 absoluteURL);
171 }
172
173 public static Map<String, String> getEmailDefinitionTerms(
174 RenderRequest request, String emailFromAddress, String emailFromName) {
175
176 return getDL().getEmailDefinitionTerms(
177 request, emailFromAddress, emailFromName);
178 }
179
180 public static Map<String, String> getEmailFromDefinitionTerms(
181 RenderRequest request, String emailFromAddress, String emailFromName) {
182
183 return getDL().getEmailFromDefinitionTerms(
184 request, emailFromAddress, emailFromName);
185 }
186
187 public static List<FileEntry> getFileEntries(Hits hits) {
188 return getDL().getFileEntries(hits);
189 }
190
191 public static String getFileEntryImage(
192 FileEntry fileEntry, ThemeDisplay themeDisplay) {
193
194 return getDL().getFileEntryImage(fileEntry, themeDisplay);
195 }
196
197 public static Set<Long> getFileEntryTypeSubscriptionClassPKs(long userId) {
198 return getDL().getFileEntryTypeSubscriptionClassPKs(userId);
199 }
200
201 public static String getFileIcon(String extension) {
202 return getDL().getFileIcon(extension);
203 }
204
205 public static String getFileIconCssClass(String extension) {
206 return getDL().getFileIconCssClass(extension);
207 }
208
209 public static String getFileName(
210 long groupId, long folderId, String tempFileName) {
211
212 return getDL().getFileName(groupId, folderId, tempFileName);
213 }
214
215 public static String getGenericName(String extension) {
216 return getDL().getGenericName(extension);
217 }
218
219 public static String getImagePreviewURL(
220 FileEntry fileEntry, FileVersion fileVersion,
221 ThemeDisplay themeDisplay)
222 throws Exception {
223
224 return getDL().getImagePreviewURL(fileEntry, fileVersion, themeDisplay);
225 }
226
227 public static String getImagePreviewURL(
228 FileEntry fileEntry, ThemeDisplay themeDisplay)
229 throws Exception {
230
231 return getDL().getImagePreviewURL(fileEntry, themeDisplay);
232 }
233
234 public static String getPreviewURL(
235 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
236 String queryString) {
237
238 return getDL().getPreviewURL(
239 fileEntry, fileVersion, themeDisplay, queryString);
240 }
241
242
246 @Deprecated
247 public static String getPreviewURL(
248 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
249 String queryString, boolean appendToken) {
250
251 return getDL().getPreviewURL(
252 fileEntry, fileVersion, themeDisplay, queryString, appendToken);
253 }
254
255 public static String getPreviewURL(
256 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
257 String queryString, boolean appendVersion, boolean absoluteURL) {
258
259 return getDL().getPreviewURL(
260 fileEntry, fileVersion, themeDisplay, queryString, appendVersion,
261 absoluteURL);
262 }
263
264 public static <T> OrderByComparator<T> getRepositoryModelOrderByComparator(
265 String orderByCol, String orderByType) {
266
267 return getDL().getRepositoryModelOrderByComparator(
268 orderByCol, orderByType);
269 }
270
271 public static String getSanitizedFileName(String title, String extension) {
272 return getDL().getSanitizedFileName(title, extension);
273 }
274
275 public static String getTempFileId(long id, String version) {
276 return getDL().getTempFileId(id, version);
277 }
278
279 public static String getTempFileId(
280 long id, String version, String languageId) {
281
282 return getDL().getTempFileId(id, version, languageId);
283 }
284
285
289 @Deprecated
290 public static String getThumbnailSrc(
291 FileEntry fileEntry, DLFileShortcut dlFileShortcut,
292 ThemeDisplay themeDisplay)
293 throws Exception {
294
295 return getDL().getThumbnailSrc(fileEntry, dlFileShortcut, themeDisplay);
296 }
297
298
302 @Deprecated
303 public static String getThumbnailSrc(
304 FileEntry fileEntry, FileVersion fileVersion,
305 DLFileShortcut dlFileShortcut, ThemeDisplay themeDisplay)
306 throws Exception {
307
308 return getDL().getThumbnailSrc(
309 fileEntry, fileVersion, dlFileShortcut, themeDisplay);
310 }
311
312 public static String getThumbnailSrc(
313 FileEntry fileEntry, FileVersion fileVersion,
314 ThemeDisplay themeDisplay)
315 throws Exception {
316
317 return getDL().getThumbnailSrc(fileEntry, fileVersion, themeDisplay);
318 }
319
320 public static String getThumbnailSrc(
321 FileEntry fileEntry, ThemeDisplay themeDisplay)
322 throws Exception {
323
324 return getDL().getThumbnailSrc(fileEntry, themeDisplay);
325 }
326
327 public static String getThumbnailStyle() throws Exception {
328 return getDL().getThumbnailStyle();
329 }
330
331 public static String getThumbnailStyle(boolean max, int margin)
332 throws Exception {
333
334 return getDL().getThumbnailStyle(max, margin);
335 }
336
337 public static String getTitleWithExtension(FileEntry fileEntry) {
338 return getDL().getTitleWithExtension(fileEntry);
339 }
340
341 public static String getTitleWithExtension(String title, String extension) {
342 return getDL().getTitleWithExtension(title, extension);
343 }
344
345 public static String getWebDavURL(
346 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry)
347 throws PortalException {
348
349 return getDL().getWebDavURL(themeDisplay, folder, fileEntry);
350 }
351
352 public static String getWebDavURL(
353 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
354 boolean manualCheckInRequired)
355 throws PortalException {
356
357 return getDL().getWebDavURL(
358 themeDisplay, folder, fileEntry, manualCheckInRequired);
359 }
360
361 public static String getWebDavURL(
362 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
363 boolean manualCheckInRequired, boolean officeExtensionRequired)
364 throws PortalException {
365
366 return getDL().getWebDavURL(
367 themeDisplay, folder, fileEntry, manualCheckInRequired,
368 officeExtensionRequired);
369 }
370
371 public static boolean hasWorkflowDefinitionLink(
372 long companyId, long groupId, long folderId, long fileEntryTypeId)
373 throws Exception {
374
375 return getDL().hasWorkflowDefinitionLink(
376 companyId, groupId, folderId, fileEntryTypeId);
377 }
378
379 public static boolean isAutoGeneratedDLFileEntryTypeDDMStructureKey(
380 String ddmStructureKey) {
381
382 return getDL().isAutoGeneratedDLFileEntryTypeDDMStructureKey(
383 ddmStructureKey);
384 }
385
386 public static boolean isOfficeExtension(String extension) {
387 return getDL().isOfficeExtension(extension);
388 }
389
390 public static boolean isSubscribedToFileEntryType(
391 long companyId, long groupId, long userId, long fileEntryTypeId) {
392
393 return getDL().isSubscribedToFileEntryType(
394 companyId, groupId, userId, fileEntryTypeId);
395 }
396
397 public static boolean isSubscribedToFolder(
398 long companyId, long groupId, long userId, long folderId)
399 throws PortalException {
400
401 return getDL().isSubscribedToFolder(
402 companyId, groupId, userId, folderId);
403 }
404
405 public static boolean isSubscribedToFolder(
406 long companyId, long groupId, long userId, long folderId,
407 boolean recursive)
408 throws PortalException {
409
410 return getDL().isSubscribedToFolder(
411 companyId, groupId, userId, folderId, recursive);
412 }
413
414 public static boolean isValidVersion(String version) {
415 return getDL().isValidVersion(version);
416 }
417
418 public static void startWorkflowInstance(
419 long userId, DLFileVersion dlFileVersion, String syncEventType,
420 ServiceContext serviceContext)
421 throws PortalException {
422
423 getDL().startWorkflowInstance(
424 userId, dlFileVersion, syncEventType, serviceContext);
425 }
426
427 public void setDL(DL dl) {
428 PortalRuntimePermission.checkSetBeanProperty(getClass());
429
430 _dl = dl;
431 }
432
433 private static DL _dl;
434
435 }