How to get Web Content by Structure name in Liferay Portlet? -
i need web content created specific structure in jsp portlet.
i try use structurename throw excepcion
classloader cl = portalclassloaderutil.getclassloader(); dynamicquery dynamicquery = dynamicqueryfactoryutil.forclass(journalarticle.class, cl) .add(propertyfactoryutil.forname("structurename").eq("empresa")); list <journalarticle> journalarticles = journalarticlelocalserviceutil.dynamicquery(dynamicquery);
how web content structure?
you need use structureid field when query journalarticles , passing structurekey value way
dynamicquery dynamicquerystructure = dynamicqueryfactoryutil.forclass( ddmstructure.class).add(propertyfactoryutil.forname("name").like( "%>empresa</name>%")); list<ddmstructure> structures = ddmstructurelocalserviceutil.dynamicquery(dynamicquerystructure, 0, 1); if(!structures.isempty()) { string structurekey = structures.get(0).getstructurekey(); classloader cl = portalclassloaderutil.getclassloader(); dynamicquery dynamicquery = dynamicqueryfactoryutil.forclass(journalarticle.class, cl) .add(propertyfactoryutil.forname("structureid").eq(structurekey)); list<journalarticle> journalarticles = journalarticlelocalserviceutil.dynamicquery(dynamicquery); }
Comments
Post a Comment