2016-08-05 92 views

回答

1

这应该工作

Long parentFolderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID; // if the id of the parent is set to default 
DLFolder dir = DLFolderLocalServiceUtil.getFolder(groupId, parentFolderId, dirName); 

见:DLFolderLocalServiceUtil

groupId是对的ID网站上的请求是从哪里来的,你可以使用themeDisplay得到它:

ThemeDisplay themeDisplay = 
    (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY); 
long groupId = themeDisplay.getLayout().getGroupId(); 

parentFolderId是方含您正在搜索,它是当你使用添加一个新的文件夹设置的文件夹中的文件夹的ID:

DLFolder newFolder=addFolder(long userId, long groupId, long repositoryId, boolean mountPoint, long parentFolderId, String name, 
String description, boolean hidden, ServiceContext serviceContext) 
+0

能否请您介绍'groupId'和'parentFolderId'呢?只有代码答案很难理解。 –