I'm trying to work on some ADT for asset publisher (Documents and Media type), but I often have a message telling me that :
Expression assetRenderer.getDataRepositoryId is undefined
or
Expression assetRenderer.getFileEntryId is undefined
I found some threads where people said that we must add
velocity.engine.restricted.classes=
velocity.engine.restricted.variables=
freemarker.engine.restricted.classes=
freemarker.engine.restricted.variables=
in portal-ext.properties
to get some more classes and variables available, but still I'm not able to call some methods and i don't know why.
I did a
${assetRenderer.getClassName()}
which returns: com.liferay.portlet.documentlibrary.model.DLFileEntry
So I should be able to use any DLFileEntry class public methods (and extended classes), right?
What do I miss?
Asset renderer renders asset entries of the given class (ei.
JournalArticle
orDLFileEntry
in your case). Asset renderer itself is not instance of the given class (in Java sense). It is always instance ofcom.liferay.portlet.asset.model.AssetRenderer
.To get instance of the related
DLFileEntry
, you must useDLFileEntryLocalService
to find it.Please note, that you need to enable the usage of
serviceLocator
explicitly by settingfreemarker.engine.restricted.variables=
inportal-ext.properties
.