Foren
How to get the all layout which are associated with particular category
devaraj s, geändert vor 7 Jahren.
How to get the all layout which are associated with particular category
Regular Member Beiträge: 228 Beitrittsdatum: 21.05.12 Neueste Beiträge
Hi ,
We are using liferay 7 , and I have requirement to get all the layouts programmatically which are associated to particular category . Could anyone suggest me the relation between layout and assetentryTable.
We are using liferay 7 , and I have requirement to get all the layouts programmatically which are associated to particular category . Could anyone suggest me the relation between layout and assetentryTable.
devaraj s, geändert vor 7 Jahren.
RE: How to get the all layout which are associated with particular category
Regular Member Beiträge: 228 Beitrittsdatum: 21.05.12 Neueste Beiträge
I am able to get the layout by assetentry classPK , But How I can know category name for which layout belongs to?
devaraj s, geändert vor 7 Jahren.
RE: How to get the all layout which are associated with particular category
Regular Member Beiträge: 228 Beitrittsdatum: 21.05.12 Neueste Beiträge
Got the solution, below code snippet which might help someone.
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(AssetCategory.class, PortalClassLoaderUtil.getClassLoader());
Criterion criterion = null;
criterion = RestrictionsFactoryUtil.eq("name", "Pillar Admin");
dynamicQuery.add(criterion);
List<assetcategory> assetCategoryList = AssetCategoryLocalServiceUtil.dynamicQuery(dynamicQuery);
List<assetentry> assetentries;
List<layout> listoflayouts=new ArrayList<layout>();
assetentries=AssetEntryLocalServiceUtil.getAssetCategoryAssetEntries(assetCategoryList.get(0).getCategoryId());
for(AssetEntry entry:assetentries)
{
listoflayouts.add(LayoutLocalServiceUtil.getLayout(entry.getClassPK()));
}</layout></layout></assetentry></assetcategory>