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 public static String getPreviewURL(
182 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
183 String queryString, boolean appendVersion, boolean absoluteURL) {
184
185 return getDL().getPreviewURL(
186 fileEntry, fileVersion, themeDisplay, queryString, appendVersion,
187 absoluteURL);
188 }
189
190 public static <T> OrderByComparator<T> getRepositoryModelOrderByComparator(
191 String orderByCol, String orderByType) {
192
193 return getDL().getRepositoryModelOrderByComparator(
194 orderByCol, orderByType);
195 }
196
197 public static <T> OrderByComparator<T> getRepositoryModelOrderByComparator(
198 String orderByCol, String orderByType, boolean orderByModel) {
199
200 return getDL().getRepositoryModelOrderByComparator(
201 orderByCol, orderByType, orderByModel);
202 }
203
204 public static String getSanitizedFileName(String title, String extension) {
205 return getDL().getSanitizedFileName(title, extension);
206 }
207
208 public static String getTempFileId(long id, String version) {
209 return getDL().getTempFileId(id, version);
210 }
211
212 public static String getTempFileId(
213 long id, String version, String languageId) {
214
215 return getDL().getTempFileId(id, version, languageId);
216 }
217
218
222 @Deprecated
223 public static String getThumbnailSrc(
224 FileEntry fileEntry, DLFileShortcut dlFileShortcut,
225 ThemeDisplay themeDisplay)
226 throws Exception {
227
228 return getDL().getThumbnailSrc(fileEntry, dlFileShortcut, themeDisplay);
229 }
230
231
235 @Deprecated
236 public static String getThumbnailSrc(
237 FileEntry fileEntry, FileVersion fileVersion,
238 DLFileShortcut dlFileShortcut, ThemeDisplay themeDisplay)
239 throws Exception {
240
241 return getDL().getThumbnailSrc(
242 fileEntry, fileVersion, dlFileShortcut, themeDisplay);
243 }
244
245 public static String getThumbnailSrc(
246 FileEntry fileEntry, FileVersion fileVersion,
247 ThemeDisplay themeDisplay)
248 throws Exception {
249
250 return getDL().getThumbnailSrc(fileEntry, fileVersion, themeDisplay);
251 }
252
253 public static String getThumbnailSrc(
254 FileEntry fileEntry, ThemeDisplay themeDisplay)
255 throws Exception {
256
257 return getDL().getThumbnailSrc(fileEntry, themeDisplay);
258 }
259
260 public static String getThumbnailStyle() {
261 return getDL().getThumbnailStyle();
262 }
263
264 public static String getThumbnailStyle(boolean max, int margin) {
265 return getDL().getThumbnailStyle(max, margin);
266 }
267
268 public static String getThumbnailStyle(
269 boolean max, int margin, int height, int width) {
270
271 return getDL().getThumbnailStyle(max, margin, height, width);
272 }
273
274 public static String getTitleWithExtension(FileEntry fileEntry) {
275 return getDL().getTitleWithExtension(fileEntry);
276 }
277
278 public static String getTitleWithExtension(String title, String extension) {
279 return getDL().getTitleWithExtension(title, extension);
280 }
281
282 public static String getUniqueFileName(
283 long groupId, long folderId, String fileName) {
284
285 return getDL().getUniqueFileName(groupId, folderId, fileName);
286 }
287
288 public static String getWebDavURL(
289 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry)
290 throws PortalException {
291
292 return getDL().getWebDavURL(themeDisplay, folder, fileEntry);
293 }
294
295 public static String getWebDavURL(
296 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
297 boolean manualCheckInRequired)
298 throws PortalException {
299
300 return getDL().getWebDavURL(
301 themeDisplay, folder, fileEntry, manualCheckInRequired);
302 }
303
304 public static String getWebDavURL(
305 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
306 boolean manualCheckInRequired, boolean officeExtensionRequired)
307 throws PortalException {
308
309 return getDL().getWebDavURL(
310 themeDisplay, folder, fileEntry, manualCheckInRequired,
311 officeExtensionRequired);
312 }
313
314 public static boolean hasWorkflowDefinitionLink(
315 long companyId, long groupId, long folderId, long fileEntryTypeId)
316 throws Exception {
317
318 return getDL().hasWorkflowDefinitionLink(
319 companyId, groupId, folderId, fileEntryTypeId);
320 }
321
322 public static boolean isAutoGeneratedDLFileEntryTypeDDMStructureKey(
323 String ddmStructureKey) {
324
325 return getDL().isAutoGeneratedDLFileEntryTypeDDMStructureKey(
326 ddmStructureKey);
327 }
328
329 public static boolean isOfficeExtension(String extension) {
330 return getDL().isOfficeExtension(extension);
331 }
332
333 public static boolean isSubscribedToFileEntryType(
334 long companyId, long groupId, long userId, long fileEntryTypeId) {
335
336 return getDL().isSubscribedToFileEntryType(
337 companyId, groupId, userId, fileEntryTypeId);
338 }
339
340 public static boolean isSubscribedToFolder(
341 long companyId, long groupId, long userId, long folderId)
342 throws PortalException {
343
344 return getDL().isSubscribedToFolder(
345 companyId, groupId, userId, folderId);
346 }
347
348 public static boolean isSubscribedToFolder(
349 long companyId, long groupId, long userId, long folderId,
350 boolean recursive)
351 throws PortalException {
352
353 return getDL().isSubscribedToFolder(
354 companyId, groupId, userId, folderId, recursive);
355 }
356
357 public static boolean isValidVersion(String version) {
358 return getDL().isValidVersion(version);
359 }
360
361 public static void startWorkflowInstance(
362 long userId, DLFileVersion dlFileVersion, String syncEventType,
363 ServiceContext serviceContext)
364 throws PortalException {
365
366 getDL().startWorkflowInstance(
367 userId, dlFileVersion, syncEventType, serviceContext);
368 }
369
370 public void setDL(DL dl) {
371 PortalRuntimePermission.checkSetBeanProperty(getClass());
372
373 _dl = dl;
374 }
375
376 private static DL _dl;
377
378 }