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