001
014
015 package com.liferay.portlet.bookmarks.model.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portlet.bookmarks.model.BookmarksFolder;
022 import com.liferay.portlet.bookmarks.service.BookmarksFolderLocalServiceUtil;
023
024
027 public class BookmarksEntryImpl extends BookmarksEntryBaseImpl {
028
029 public BookmarksEntryImpl() {
030 }
031
032 @Override
033 public String buildTreePath() throws PortalException, SystemException {
034 StringBundler sb = new StringBundler();
035
036 buildTreePath(sb, getFolder());
037
038 return sb.toString();
039 }
040
041 @Override
042 public BookmarksFolder getFolder() throws PortalException, SystemException {
043 if (getFolderId() <= 0) {
044 return new BookmarksFolderImpl();
045 }
046
047 return BookmarksFolderLocalServiceUtil.getFolder(getFolderId());
048 }
049
050 protected void buildTreePath(StringBundler sb, BookmarksFolder folder)
051 throws PortalException, SystemException {
052
053 if (folder == null) {
054 sb.append(StringPool.SLASH);
055 }
056 else {
057 buildTreePath(sb, folder.getParentFolder());
058
059 sb.append(folder.getFolderId());
060 sb.append(StringPool.SLASH);
061 }
062 }
063
064 }