Foros de discusión
How to get the all layout which are associated with particular category
devaraj s, modificado hace 7 años.
How to get the all layout which are associated with particular category
Regular Member Mensajes: 228 Fecha de incorporación: 21/05/12 Mensajes recientes
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, modificado hace 7 años.
RE: How to get the all layout which are associated with particular category
Regular Member Mensajes: 228 Fecha de incorporación: 21/05/12 Mensajes recientes
I am able to get the layout by assetentry classPK , But How I can know category name for which layout belongs to?
devaraj s, modificado hace 7 años.
RE: How to get the all layout which are associated with particular category
Regular Member Mensajes: 228 Fecha de incorporación: 21/05/12 Mensajes recientes
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>