Hello everybody.
I'm stuck with this seemingly simple task:
Get file names (or size or owner or ID or else) from a WCD/Journal portlet using a document_library (repeatable) field.
I tried search around quite a lot but couldn't find a suitable and ready-to-go solution.
Here's my WCD structure:
<root>
<dynamic-element name='content' type='text_area' index-type='' repeatable='false'>
<meta-data>
<entry name="displayAsTooltip"><![CDATA]></entry>
<entry name="required"><![CDATA]></entry>
<entry name="instructions"><![CDATA[]]></entry>
<entry name="label"><![CDATA]></entry>
<entry name="predefinedValue"><![CDATA[]]></entry>
</meta-data>
</dynamic-element>
<dynamic-element name='files' type='document_library' index-type='' repeatable='true'>
<meta-data>
<entry name="displayAsTooltip"><![CDATA]></entry>
<entry name="required"><![CDATA]></entry>
<entry name="instructions"><![CDATA[]]></entry>
<entry name="label"><![CDATA[DocumentLibraryField]]></entry>
<entry name="predefinedValue"><![CDATA[]]></entry>
</meta-data>
</dynamic-element>
</root>
and the sample template trying to list link and file names:
Content is:<br/>
$content.getData()
<br/>
Files are:
<br/>
<ul>
#foreach ($ListItem in $files.getSiblings())
<li><a href='$ListItem.getData()'> ??</a> </li>
#end
</ul>
Content data is showing up and I can get the "files" fields contents (which are document library links without the host name, as per selection fron WCD editor)
I get something like this:
Content is:
Yocontent
Files are:
?? (<-- Note: link IS working here with url: http://myLiferayHost.here/documents/16292/18041/myUploadedFilename.here.pdf
??
I guess I need some service here, somehing like (velocity):
#set($dlFileEntryUtil = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService"))
#set ($longGroupId = $getterUtil.getLong($groupId))
#set($fileEntry = $dlFileEntryUtil.getFileEntryByUuidAndGroupId($uuid,$longGroupId))
(from
here )
but the question is:
What is the correct way to create a FileEntryXXX velocity object with the correct parameters if I (apparently) have only the (web) file path (such as /documents/16292/18041/myUploadedFilename.here.pdf) ?
Do I need some URL parsing? Or there's a dedicated Liferay way ?
What class and method(s) to use?
Config:
Liferay 6.0.10 from Trunk (30 sept 2010 build)
Java 6
Linux CentOS
P.S= I put an empty property journal.template.velocity.restricted.variables=
in portal-ext.properties
Thanks in advance!
Diego
Please sign in to flag this as inappropriate.