
In case you are wondering how to determine the absolute path to FileEntry objects in Liferay (i.e. Document and Media Library elements) here is how it works.
First, add the following to your portal-ext.properties:
dl.hook.file.system.root.dir=${liferay.home}/data/document_library
Then, to calculate the absolute path for a FileEntry use the following code:
private String getDLFileAbsPath(FileEntry fileEntry) throws PortalException, SystemException { return PropsUtils.get("dl.hook.file.system.root.dir") + "/" + fileEntry.getCompanyId() + "/" + fileEntry.getFolderId() + "/" + ((DLFileEntry) fileEntry.getModel()).getName() + "/" + fileEntry.getVersion(); }
Note that in order to get the foldername where your FileEntry resides you need to cast FileEntry to DLFileEntry, as shown above.
very useful for my new Liferay plugin
thanks