Forums de discussion

Error template freemarker use method getPreviewURL

Patricia Hevia, modifié il y a 9 années.

Error template freemarker use method getPreviewURL

Junior Member Publications: 69 Date d'inscription: 24/03/11 Publications récentes
Hello,

I am developing templates with freemarker, I use this code:
<#assign dlFolderLocalService = serviceLocator.findService('com.liferay.portlet.documentlibrary.service.DLFolderLocalService')/>

<#assign dlFolder = dlFolderLocalService.getDLFolderByUuidAndGroupId(dummy.folderId, getterUtil.getLong(groupId))/>

<#assign dlFileLocalService = serviceLocator.findService('com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService') />

<#assign fileEntries = dlFileLocalService.getFileEntries(getterUtil.getLong(groupId), dlFolder.folderId)/>

<# assign urlFile = dlUtil.getPreviewURL (fileEntries[0], fileEntries[0].getVersion (), themeDisplay, "") />

But I get the following error:
An error occurred while processing the template.
No signature of method matches the arguments getPreviewURL


Can anyone help me?

Thank you very much!.
thumbnail
Zsigmond Rab, modifié il y a 9 années.

RE: Error template freemarker use method getPreviewURL

Liferay Master Publications: 728 Date d'inscription: 05/01/10 Publications récentes
Hi Patricia,

I don't know if this is really the cause of the error or it's a typo only here, but there is a missing comma in the call of getPreviewURL.

Regards,
Zsigmond
Patricia Hevia, modifié il y a 9 années.

RE: Error template freemarker use method getPreviewURL

Junior Member Publications: 69 Date d'inscription: 24/03/11 Publications récentes
Hello,

Thanks, I added the comma but still gives the same error!.

Regards,
thumbnail
Zsigmond Rab, modifié il y a 9 années.

RE: Error template freemarker use method getPreviewURL

Liferay Master Publications: 728 Date d'inscription: 05/01/10 Publications récentes
Hi Patricia,

I don't know immediately what else can be the problem

Is there any exception in the log, or you get only the message on the UI?

Is it possible that the fileEntries is empty or there is any problem with an of the parameters?

Regards,
Zsigmond
thumbnail
Pier Paolo Ramon, modifié il y a 9 années.

R: Error template freemarker use method getPreviewURL

Junior Member Publications: 90 Date d'inscription: 25/05/10 Publications récentes
Are you sure it is on the LOCAL service? Usually byUuidAndGroupId is in the remote/secure/non-local ones.

Sent from my iPhone with Liferay.com Forums
thumbnail
Pier Paolo Ramon, modifié il y a 9 années.

R: Error template freemarker use method getPreviewURL

Junior Member Publications: 90 Date d'inscription: 25/05/10 Publications récentes
Ooops, read it wrong…

Sent from my iPhone with Liferay.com Forums
thumbnail
Sushil Patidar, modifié il y a 9 années.

RE: Error template freemarker use method getPreviewURL

Expert Publications: 467 Date d'inscription: 31/10/11 Publications récentes
Hi,
You are supplying wrong paramater in the following line
&lt;# assign urlFile = dlUtil.getPreviewURL (fileEntries[0], fileEntries[0].getVersion (), themeDisplay, "") /&gt;


The second argument of the getPreviewURL method takes parameter of the type FileVersion, while the parameter you are supplying fileEntries[0].getVersion () is of string type.

Regards
thumbnail
Mohammad Azharuddin, modifié il y a 7 années.

RE: Error template freemarker use method getPreviewURL

Expert Publications: 492 Date d'inscription: 17/09/12 Publications récentes
HI

how you got DLUtil object in template

I am getting error with below snippet

<#assign dlUtil = staticUtil["com.liferay.document.library.kernel.util.DLUtil"] />