public MutablePortletEntity getPortletEntity( ObjectID id )
{
Criteria c = new Criteria();
c.addEqualTo("id", id.toString());
Query q = QueryFactory.newQuery(PortletEntityImpl.class, c);
MutablePortletEntity portletEntity = (MutablePortletEntity) getPersistenceBrokerTemplate().getObjectByQuery(q);
if (portletEntity == null)
{
return null;
}
else
{
String portletUniqueName = portletEntity.getPortletUniqueName();
PortletDefinitionComposite parentPortletDef = registry.getPortletDefinitionByUniqueName(portletUniqueName);
if(parentPortletDef != null)
{
((PortletEntityCtrl) portletEntity).setPortletDefinition(parentPortletDef);
return (MutablePortletEntity) portletEntity;
}
else
{
logger.warn("No parent portlet definition could be located using unique name: "+portletUniqueName+
". Unless you plan on redploying this portlet definition, it is highly recommended "+
"that you delete the orphaned portlet entity with the id: "+portletEntity.getId());
return (MutablePortletEntity) portletEntity;
}
}
}