1
14
15 package com.liferay.portlet.documentlibrary.model.impl;
16
17 import com.liferay.portal.PortalException;
18 import com.liferay.portal.SystemException;
19 import com.liferay.portal.kernel.util.StringPool;
20 import com.liferay.portal.kernel.util.StringUtil;
21 import com.liferay.portlet.documentlibrary.model.DLFolder;
22 import com.liferay.portlet.documentlibrary.model.DLFolderConstants;
23 import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil;
24
25
30 public class DLFolderImpl extends DLFolderModelImpl implements DLFolder {
31
32 public DLFolderImpl() {
33 }
34
35 public String getPath() throws PortalException, SystemException {
36 StringBuilder sb = new StringBuilder();
37
38 DLFolder folder = this;
39
40 while (true) {
41 sb.insert(0, folder.getName());
42 sb.insert(0, StringPool.SLASH);
43
44 if (folder.getParentFolderId() !=
45 DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
46
47 folder = DLFolderLocalServiceUtil.getFolder(
48 folder.getParentFolderId());
49 }
50 else {
51 break;
52 }
53 }
54
55 return sb.toString();
56 }
57
58 public String[] getPathArray() throws PortalException, SystemException {
59 String path = getPath();
60
61
63 path = path.substring(1, path.length());
64
65 return StringUtil.split(path, StringPool.SLASH);
66 }
67
68 public boolean isRoot() {
69 if (getParentFolderId() == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
70 return true;
71 }
72 else {
73 return false;
74 }
75 }
76
77 }