Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Maximiliano Chiesa
Relating Layout and AssetEntries
August 22, 2012 2:09 PM
Answer

Maximiliano Chiesa

Rank: Junior Member

Posts: 47

Join Date: July 20, 2012

Recent Posts

I want to obtain all the AssetEntries that are contained in a certain Layout.

Is there a way of doing this?

I tried with the following DynamicQuery

DynamicQuery query= DynamicQueryFactoryUtil.forClass(AssetEntry.class, PortalClassLoaderUtil.getClassLoader());
query.add(PropertyFactoryUtil.forName("groupId").eq(new Long(layout.getGroupId())));
List<AssetEntry> results = AssetEntryLocalServiceUtil.dynamicQuery(query);

I use the "groupId" in the query since is the only attribute in common with Layout and AssetEntry that I found.

The problem here is that the list "results" contains a lot of AssetEntries that are contained in other layouts.

Thanks in advance!