001
014
015 package com.liferay.portlet.documentlibrary.model.impl;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portlet.documentlibrary.model.DLFileEntry;
020 import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
021 import com.liferay.portlet.documentlibrary.model.DLFolder;
022 import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
023 import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil;
024
025
028 public class DLFileShortcutImpl
029 extends DLFileShortcutModelImpl implements DLFileShortcut {
030
031 public DLFileShortcutImpl() {
032 }
033
034 public DLFolder getFolder() {
035 DLFolder folder = null;
036
037 if (getFolderId() > 0) {
038 try {
039 folder = DLFolderLocalServiceUtil.getFolder(getFolderId());
040 }
041 catch (Exception e) {
042 folder = new DLFolderImpl();
043
044 _log.error(e);
045 }
046 }
047 else {
048 folder = new DLFolderImpl();
049 }
050
051 return folder;
052 }
053
054 public String getToTitle() {
055 String toTitle = null;
056
057 try {
058 DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.getFileEntry(
059 getGroupId(), getToFolderId(), getToName());
060
061 toTitle = fileEntry.getTitle();
062 }
063 catch (Exception e) {
064 _log.error(e);
065 }
066
067 return toTitle;
068 }
069
070 private static Log _log = LogFactoryUtil.getLog(DLFileShortcutImpl.class);
071
072 }