PortletWrapper wrapper = (PortletWrapper)portlet;
if (!wrapper.getAllowView(rundata))
{
if (JetspeedResources.getBoolean("defaultportletcontrol.hide.decorator", true))
{
return new StringElement("");
}
}
}
// Create a new Velocity context and load default
// application pull tools
Context context = TurbineVelocity.getContext();
context.put("data", rundata );
context.put("actions", buildActionList( rundata, portlet ) );
context.put("conf", getConfig() );
context.put("skin", portlet.getPortletConfig().getPortletSkin() );
// Put the request and session based contexts
TurbinePull.populateContext(context, rundata);
if ( portlet.getName().equals(jdata.getCustomized())
&& (!portlet.providesCustomization()) )
{
context.put("portlet",JetspeedTool.getCustomizer(portlet));
context.put("portlet_instance",JetspeedTool.getCustomizer(portlet));
}
else
{
context.put("portlet", portlet );
if (PersistenceManager.getInstance(portlet, jdata) == null)
{
context.put("portlet_instance", portlet );
}
else
{
context.put("portlet_instance", PersistenceManager.getInstance(portlet, jdata) );
}
}
// allow subclasses to add elements to the context
buildContext( rundata, context );
String theme = getConfig().getInitParameter("theme","default.vm");
String s = "";
try
{
String template = TemplateLocator.locateControlTemplate(rundata,theme);
TurbineVelocity.handleRequest(context, template, rundata.getOut());
}
catch( Exception e )
{
logger.error( "Exception while creating content ", e );
s = e.toString();
}
TurbineVelocity.requestFinished(context);
return new StringElement( s );
}