Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Luis Rodríguez Fernández
How to get a DLFileEntry from a velocity script?
October 2, 2009 7:34 AM
Answer

Luis Rodríguez Fernández

Rank: Junior Member

Posts: 86

Join Date: June 26, 2009

Recent Posts

Hi everyone!

We get the typical "News" section in our portal. The detail of each one is made by date, title, content and one or more documents from the document library.

The problem is that we can't get each of theses documents. We have tried with the next code:

#set($dlFileEntryUtil = $serviceLocator.findExceptionSafeService('com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryUtil'))

#set($fileEntry = $dlFileEntry.getFileEntryByUuidAndGroupId($fileEntryUuid,$fileEntryGroupId))

It seems that we can get the service but their methods don't work!

Any idea?

Thanks,

Luis

--
So far the Universe is winning

Rick Cook
--
Alexander Chow
RE: How to get a DLFileEntry from a velocity script?
October 2, 2009 11:12 AM
Answer

Alexander Chow

Community Moderator

Rank: Liferay Master

Posts: 518

Join Date: July 19, 2005

Recent Posts

Luis Rodríguez Fernández:

#set($dlFileEntryUtil = $serviceLocator.findExceptionSafeService('com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryUtil'))

#set($fileEntry = $dlFileEntry.getFileEntryByUuidAndGroupId($fileEntryUuid,$fileEntryGroupId))


It looks like you have a typo. Try:

#set($fileEntry = $dlFileEntryUtil.getFileEntryByUuidAndGroupId($fileEntryUuid,$fileEntryGroupId))
Thomas Ballerstedt
RE: How to get a DLFileEntry from a velocity script?
October 8, 2009 9:25 AM
Answer

Thomas Ballerstedt

Rank: Junior Member

Posts: 28

Join Date: February 1, 2005

Recent Posts

Hi,

please try as follows:


#set($dlFileEntryUtil = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService"))
#set ($longGroupId = $getterUtil.getLong($groupId))
#set($fileEntry = $dlFileEntryUtil.getFileEntryByUuidAndGroupId($uuid,$longGroupId))


Above works for me. Using .findExceptionSafeService instead, doesn't work with my environment either. I don't know why.
Using $getterUtil.getLong($groupId)) for long Types maybe important too.

I'm running liferay 5.2.3 at rev. 33675 from svn.branch

Good luck.

Cheers,
Thomas
Luis Rodríguez Fernández
RE: How to get a DLFileEntry from a velocity script?
October 13, 2009 3:35 AM
Answer

Luis Rodríguez Fernández

Rank: Junior Member

Posts: 86

Join Date: June 26, 2009

Recent Posts

Thanks!!!

Both were right. I had a typo error and with 5.2.3 I can't use serviceLocator.findSafeExceptionService.

Regards,

Luis
Arya Nugroho
RE: How to get a DLFileEntry from a velocity script?
October 26, 2011 3:37 AM
Answer

Arya Nugroho

Rank: New Member

Posts: 11

Join Date: October 11, 2011

Recent Posts

hi, what if I want to get values ​​from fields other web content created by xml schema, where the fields are taken only web content in a particular tag with a velocity template script on my web content?


thanks a lot,
regards