我正在使用activiti-5.19。 Activiti管理仪表板有一个名为report的选项卡。我想在activiti 5.19中生成报告。如何在activiti 5.19中生成报告。任何帮助表示赞赏。
答案 0 :(得分:0)
使用JDK 8,您必须加载 mozilla_compat.js 兼容性脚本。见JDK 8 Scripting guide - Importing Java Packages and Classes
例如,演示报告employeeProductivity.bpmn20.xml应修改如下。
// Load compatibility script
load("nashorn:mozilla_compat.js");
importPackage(java.sql);
importPackage(java.lang);
importPackage(java.util);
importPackage(org.activiti.explorer.reporting);
var reportData = {
"title": "My Report",
"datasets": [
{
"type": "lineChart",
"description": "My first chart",
"xaxis": "Category",
"yaxis": "Total sales",
"data":
{"2010": 50, "2011": 33, "2012": 17, "2013": 87}
}
]
};
execution.setVariable("reportData", new java.lang.String(JSON.stringify(reportData)).getBytes("UTF-8"));
您也可以使用 JavaImporter 代替 importPackage 作为替代方案,在这种情况下,演示报告employeeProductivity.bpmn20.xml应修改如下
// Create a JavaImporter object with specified packages and classes to import
var imports = new JavaImporter(java.sql, java.lang, java.util, org.activiti.explorer.reporting);
// Pass the JavaImporter object to the "with" statement and access the classes
// from the imported packages by their simple names within the statement's body
with (imports) {
var reportData = {
"title": "My Report",
"datasets": [
{
"type": "lineChart",
"description": "My first chart",
"xaxis": "Category",
"yaxis": "Total sales",
"data":
{"2010": 50, "2011": 33, "2012": 17, "2013": 87}
}
]
};
}
execution.setVariable("reportData", new java.lang.String(JSON.stringify(reportData)).getBytes("UTF-8"));