How to list files and folders together in liferay? -
i trying list files , folders under root folder of liferay site.
querydefinition querydefinition = new querydefinition(workflowconstants.status_any, queryutil.all_pos, queryutil.all_pos, null); list<object> list = dlfolderlocalserviceutil.getfoldersandfileentriesandfileshortcuts(groupid, folderid, null, true, querydefinition);
is right way? how differentiate files , folders?
you can , differentiate files, folders , shortcuts following:
list <object> foldersandfileentriesandfileshortcuts = dlappserviceutil.getfoldersandfileentriesandfileshortcuts( folder.getgroupid(), folderid, workflowconstants.status_any, true, queryutil.all_pos, queryutil.all_pos); (object folderandfileentryandfileshortcut: foldersandfileentriesandfileshortcuts) { if (folderandfileentryandfileshortcut instanceof fileentry) { fileentry fileentry = (fileentry) folderandfileentryandfileshortcut; } else if (folderandfileentryandfileshortcut instanceof folder) { folder subfolder = (folder) folderandfileentryandfileshortcut; } else if (folderandfileentryandfileshortcut instanceof dlfileshortcut) { dlfileshortcut dlfileshorcut = (dlfileshortcut) folderandfileentryandfileshortcut; } }
Comments
Post a Comment