use of org.pivot4j.ui.html.HtmlRenderCallback in project bamboobsc by billchen198318.
the class Pivot4JUtils method rendererHtml.
public static String rendererHtml(String mondrianUrl, String mdx, boolean showDimensionTitle, boolean showParentMembers) throws Exception {
if (StringUtils.isBlank(mondrianUrl) || StringUtils.isBlank(mdx)) {
throw new java.lang.IllegalArgumentException("mondrian url and MDX cannot blank.");
}
String body = "";
OlapConnection connection = OlapUtils.getConnection(mondrianUrl);
OlapDataSource dataSource = new SingleConnectionOlapDataSource(connection);
try {
PivotModel model = getPivotModel(dataSource, mdx);
TableRenderer renderer = getTableRenderer(showDimensionTitle, showParentMembers);
StringWriter writer = new StringWriter();
renderer.render(model, new HtmlRenderCallback(writer));
//writer.write(body);
body = writer.toString();
writer.flush();
writer.close();
} catch (Exception e) {
throw e;
} finally {
OlapUtils.nullConnection(connection);
connection = null;
dataSource = null;
}
return body;
}
Aggregations