return logger;
}
@Override
public void createContent() throws Exception {
IParameterProvider requestParams = parameterProviders.get( MethodParams.REQUEST );
IParameterProvider pathParams = parameterProviders.get( MethodParams.PATH );
String solution = getRequestParameterAsString( MethodParams.SOLUTION, "" ),
path = getRequestParameterAsString( MethodParams.PATH, "" ),
file = getRequestParameterAsString( MethodParams.FILE, "" );
String root = getRequestParameterAsString( MethodParams.ROOT, "" );
String viewId = getRequestParameterAsString( MethodParams.VIEWID, "" );
String filePath = getPathParameterAsString( MethodParams.PATH, "" );
boolean inferScheme = requestParams.hasParameter( MethodParams.INFER_SCHEME )
&& getRequestParameterAsString( MethodParams.INFER_SCHEME, "" ).equals( "false" );
boolean absolute = requestParams.hasParameter( MethodParams.ABSOLUTE )
&& getRequestParameterAsString( MethodParams.ABSOLUTE, "" ).equals( "true" );
boolean bypassCacheRead = requestParams.hasParameter( MethodParams.BYPASS_CACHE )
&& getRequestParameterAsString( MethodParams.BYPASS_CACHE, "" ).equals( "true" );
boolean debug = requestParams.hasParameter( MethodParams.DEBUG )
&& getRequestParameterAsString( MethodParams.DEBUG, "" ).equals( "true" );
String style = getRequestParameterAsString( MethodParams.STYLE, "" );
RenderApi renderer = new RenderApi();
long start = System.currentTimeMillis();
UUID uuid = CpfAuditHelper.startAudit( getPluginName(), filePath, getObjectName(),
this.userSession, this, requestParams );
if ( create ) {
String result = renderer.newDashboard( filePath, debug, true, getRequest(), getResponse() );
IOUtils.write( result, getResponse().getOutputStream() );
} else if ( edit ) {
//TODO: file to path
String result = renderer.edit( "", "", filePath, debug, true, getRequest(), getResponse() );
IOUtils.write( result, getResponse().getOutputStream() );
} else if ( resource ) {
// TODO review later if there is a viable solution to making resources being
// called via cde resources rest api (pentaho/plugin/pentaho-cdf-dd/api/resources?resource=)
// this has to take into consideration:
// 1 - token replacement (see cde-core#CdfRunJsDashboardWriteContext.replaceTokens())
// 2 - resources being called from other resources (ex: resource plugin-samples/template.css calls resource
// images/button-contact-png)
new ResourcesApi().getResource( pathParams.getStringParameter( MethodParams.COMMAND, "" ), getResponse() );
} else {
String result = renderer
.render( "", "", filePath, inferScheme, root, absolute, bypassCacheRead, debug, viewId, style, getRequest() );
getResponse().setContentType( MimeTypes.HTML );