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.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.kernel.util.StringPool;
027 import com.liferay.portal.theme.ThemeDisplay;
028 import com.liferay.portlet.documentlibrary.model.DLFileEntryType;
029 import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
030
031 import java.util.List;
032 import java.util.Locale;
033 import java.util.Map;
034 import java.util.Set;
035
036 import javax.portlet.PortletPreferences;
037 import javax.portlet.PortletRequest;
038 import javax.portlet.PortletURL;
039 import javax.portlet.RenderResponse;
040
041 import javax.servlet.http.HttpServletRequest;
042
043
047 public class DLUtil {
048
049 public static final String MANUAL_CHECK_IN_REQUIRED =
050 "manualCheckInRequired";
051
052 public static final String MANUAL_CHECK_IN_REQUIRED_PATH =
053 StringPool.SLASH + MANUAL_CHECK_IN_REQUIRED;
054
055 public static final String OFFICE_EXTENSION = "officeExtension";
056
057 public static final String OFFICE_EXTENSION_PATH =
058 StringPool.SLASH + OFFICE_EXTENSION;
059
060 public static final String WEBDAV_CHECK_IN_MODE = "webDAVCheckInMode";
061
062 public static void addPortletBreadcrumbEntries(
063 DLFileShortcut dlFileShortcut, HttpServletRequest request,
064 RenderResponse renderResponse)
065 throws Exception {
066
067 getDL().addPortletBreadcrumbEntries(
068 dlFileShortcut, request, renderResponse);
069 }
070
071 public static void addPortletBreadcrumbEntries(
072 FileEntry fileEntry, HttpServletRequest request,
073 RenderResponse renderResponse)
074 throws Exception {
075
076 getDL().addPortletBreadcrumbEntries(fileEntry, request, renderResponse);
077 }
078
079 public static void addPortletBreadcrumbEntries(
080 Folder folder, HttpServletRequest request,
081 LiferayPortletResponse liferayPortletResponse)
082 throws Exception {
083
084 getDL().addPortletBreadcrumbEntries(
085 folder, request, liferayPortletResponse);
086 }
087
088 public static void addPortletBreadcrumbEntries(
089 Folder folder, HttpServletRequest request, PortletURL portletURL)
090 throws Exception {
091
092 getDL().addPortletBreadcrumbEntries(folder, request, portletURL);
093 }
094
095 public static void addPortletBreadcrumbEntries(
096 Folder folder, HttpServletRequest request,
097 RenderResponse renderResponse)
098 throws Exception {
099
100 getDL().addPortletBreadcrumbEntries(folder, request, renderResponse);
101 }
102
103 public static void addPortletBreadcrumbEntries(
104 long folderId, HttpServletRequest request,
105 RenderResponse renderResponse)
106 throws Exception {
107
108 getDL().addPortletBreadcrumbEntries(folderId, request, renderResponse);
109 }
110
111 public static int compareVersions(String version1, String version2) {
112 return getDL().compareVersions(version1, version2);
113 }
114
115 public static String getAbsolutePath(
116 PortletRequest portletRequest, long folderId)
117 throws PortalException, SystemException {
118
119 return getDL().getAbsolutePath(portletRequest, folderId);
120 }
121
122 public static Set<String> getAllMediaGalleryMimeTypes() {
123 return getDL().getAllMediaGalleryMimeTypes();
124 }
125
126 public static String getDDMStructureKey(DLFileEntryType dlFileEntryType) {
127 return getDL().getDDMStructureKey(dlFileEntryType);
128 }
129
130 public static String getDDMStructureKey(String fileEntryTypeUuid) {
131 return getDL().getDDMStructureKey(fileEntryTypeUuid);
132 }
133
134 public static String getDeprecatedDDMStructureKey(
135 DLFileEntryType dlFileEntryType) {
136
137 return getDL().getDeprecatedDDMStructureKey(dlFileEntryType);
138 }
139
140 public static String getDeprecatedDDMStructureKey(long fileEntryTypeId) {
141 return getDL().getDeprecatedDDMStructureKey(fileEntryTypeId);
142 }
143
144 public static String getDividedPath(long id) {
145 return getDL().getDividedPath(id);
146 }
147
148 public static DL getDL() {
149 PortalRuntimePermission.checkGetBeanProperty(DLUtil.class);
150
151 return _dl;
152 }
153
154 public static String getDLControlPanelLink(
155 PortletRequest portletRequest, long folderId)
156 throws PortalException, SystemException {
157
158 return getDL().getDLControlPanelLink(portletRequest, folderId);
159 }
160
161 public static Map<Locale, String> getEmailFileEntryAddedBodyMap(
162 PortletPreferences preferences) {
163
164 return getDL().getEmailFileEntryAddedBodyMap(preferences);
165 }
166
167 public static boolean getEmailFileEntryAddedEnabled(
168 PortletPreferences preferences) {
169
170 return getDL().getEmailFileEntryAddedEnabled(preferences);
171 }
172
173 public static Map<Locale, String> getEmailFileEntryAddedSubjectMap(
174 PortletPreferences preferences) {
175
176 return getDL().getEmailFileEntryAddedSubjectMap(preferences);
177 }
178
179 public static Map<Locale, String> getEmailFileEntryUpdatedBodyMap(
180 PortletPreferences preferences) {
181
182 return getDL().getEmailFileEntryUpdatedBodyMap(preferences);
183 }
184
185 public static boolean getEmailFileEntryUpdatedEnabled(
186 PortletPreferences preferences) {
187
188 return getDL().getEmailFileEntryUpdatedEnabled(preferences);
189 }
190
191 public static Map<Locale, String> getEmailFileEntryUpdatedSubjectMap(
192 PortletPreferences preferences) {
193
194 return getDL().getEmailFileEntryUpdatedSubjectMap(preferences);
195 }
196
197 public static String getEmailFromAddress(
198 PortletPreferences preferences, long companyId)
199 throws SystemException {
200
201 return getDL().getEmailFromAddress(preferences, companyId);
202 }
203
204 public static String getEmailFromName(
205 PortletPreferences preferences, long companyId)
206 throws SystemException {
207
208 return getDL().getEmailFromName(preferences, companyId);
209 }
210
211 public static List<Object> getEntries(Hits hits) {
212 return getDL().getEntries(hits);
213 }
214
215 public static String getFileEntryImage(
216 FileEntry fileEntry, ThemeDisplay themeDisplay) {
217
218 return getDL().getFileEntryImage(fileEntry, themeDisplay);
219 }
220
221 public static Set<Long> getFileEntryTypeSubscriptionClassPKs(long userId)
222 throws SystemException {
223
224 return getDL().getFileEntryTypeSubscriptionClassPKs(userId);
225 }
226
227 public static String getFileIcon(String extension) {
228 return getDL().getFileIcon(extension);
229 }
230
231 public static String getGenericName(String extension) {
232 return getDL().getGenericName(extension);
233 }
234
235 public static String[] getMediaGalleryMimeTypes(
236 PortletPreferences portletPreferences, PortletRequest portletRequest) {
237
238 return getDL().getMediaGalleryMimeTypes(
239 portletPreferences, portletRequest);
240 }
241
242 public static String getPreviewURL(
243 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
244 String queryString) {
245
246 return getDL().getPreviewURL(
247 fileEntry, fileVersion, themeDisplay, queryString);
248 }
249
250
254 public static String getPreviewURL(
255 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
256 String queryString, boolean appendToken) {
257
258 return getDL().getPreviewURL(
259 fileEntry, fileVersion, themeDisplay, queryString, appendToken);
260 }
261
262 public static String getPreviewURL(
263 FileEntry fileEntry, FileVersion fileVersion, ThemeDisplay themeDisplay,
264 String queryString, boolean appendVersion, boolean absoluteURL) {
265
266 return getDL().getPreviewURL(
267 fileEntry, fileVersion, themeDisplay, queryString, appendVersion,
268 absoluteURL);
269 }
270
271 public static OrderByComparator getRepositoryModelOrderByComparator(
272 String orderByCol, String orderByType) {
273
274 return getDL().getRepositoryModelOrderByComparator(
275 orderByCol, orderByType);
276 }
277
278 public static String getTempFileId(long id, String version) {
279 return getDL().getTempFileId(id, version);
280 }
281
282 public static String getTempFileId(
283 long id, String version, String languageId) {
284
285 return getDL().getTempFileId(id, version, languageId);
286 }
287
288 public static String getThumbnailSrc(
289 FileEntry fileEntry, DLFileShortcut dlFileShortcut,
290 ThemeDisplay themeDisplay)
291 throws Exception {
292
293 return getDL().getThumbnailSrc(fileEntry, dlFileShortcut, themeDisplay);
294 }
295
296 public static String getThumbnailSrc(
297 FileEntry fileEntry, FileVersion fileVersion,
298 DLFileShortcut dlFileShortcut, ThemeDisplay themeDisplay)
299 throws Exception {
300
301 return getDL().getThumbnailSrc(
302 fileEntry, fileVersion, dlFileShortcut, themeDisplay);
303 }
304
305 public static String getThumbnailStyle() throws Exception {
306 return getDL().getThumbnailStyle();
307 }
308
309 public static String getThumbnailStyle(boolean max, int margin)
310 throws Exception {
311
312 return getDL().getThumbnailStyle(max, margin);
313 }
314
315 public static String getTitleWithExtension(FileEntry fileEntry) {
316 return getDL().getTitleWithExtension(fileEntry);
317 }
318
319 public static String getTitleWithExtension(String title, String extension) {
320 return getDL().getTitleWithExtension(title, extension);
321 }
322
323 public static String getWebDavURL(
324 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry)
325 throws PortalException, SystemException {
326
327 return getDL().getWebDavURL(themeDisplay, folder, fileEntry);
328 }
329
330 public static String getWebDavURL(
331 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
332 boolean manualCheckInRequired)
333 throws PortalException, SystemException {
334
335 return getDL().getWebDavURL(
336 themeDisplay, folder, fileEntry, manualCheckInRequired);
337 }
338
339 public static String getWebDavURL(
340 ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
341 boolean manualCheckInRequired, boolean officeExtensionRequired)
342 throws PortalException, SystemException {
343
344 return getDL().getWebDavURL(
345 themeDisplay, folder, fileEntry, manualCheckInRequired,
346 officeExtensionRequired);
347 }
348
349 public static boolean hasWorkflowDefinitionLink(
350 long companyId, long groupId, long folderId, long fileEntryTypeId)
351 throws Exception {
352
353 return getDL().hasWorkflowDefinitionLink(
354 companyId, groupId, folderId, fileEntryTypeId);
355 }
356
357 public static boolean isAutoGeneratedDLFileEntryTypeDDMStructureKey(
358 String ddmStructureKey) {
359
360 return getDL().isAutoGeneratedDLFileEntryTypeDDMStructureKey(
361 ddmStructureKey);
362 }
363
364 public static boolean isOfficeExtension(String extension) {
365 return getDL().isOfficeExtension(extension);
366 }
367
368 public static boolean isSubscribedToFileEntryType(
369 long companyId, long groupId, long userId, long fileEntryTypeId)
370 throws SystemException {
371
372 return getDL().isSubscribedToFileEntryType(
373 companyId, groupId, userId, fileEntryTypeId);
374 }
375
376 public static boolean isSubscribedToFolder(
377 long companyId, long groupId, long userId, long folderId)
378 throws PortalException, SystemException {
379
380 return getDL().isSubscribedToFolder(
381 companyId, groupId, userId, folderId);
382 }
383
384 public static boolean isSubscribedToFolder(
385 long companyId, long groupId, long userId, long folderId,
386 boolean recursive)
387 throws PortalException, SystemException {
388
389 return getDL().isSubscribedToFolder(
390 companyId, groupId, userId, folderId, recursive);
391 }
392
393 public void setDL(DL dl) {
394 PortalRuntimePermission.checkSetBeanProperty(getClass());
395
396 _dl = dl;
397 }
398
399 private static DL _dl;
400
401 }