...
1、实现:smartbi.catalogtree.ICatalogTreeListener 接口
示例:
代码块 | ||||||
---|---|---|---|---|---|---|
| ||||||
package bof.audit.service; import smartbi.catalogtree.ICatalogElement; import smartbi.catalogtree.ICatalogTreeListener; public class ReportChangePostHandler implements ICatalogTreeListener { public void onCatalogElementCreated(ICatalogElement element) { String type = element.getType(); // type类型如下: // 1.可视化查询:BUSINESS_VIEW // 2.SQL查询:TEXT_BUSINESS_VIEW // 3.存储过程查询:PROC_BUSINESS_VIEW // 4.原生SQL查询:RAWSQL_BUSINESS_VIEW // 4.灵活分析:SIMPLE_REPORT // 5.指标类报表:METRIC_REPORT // 6.复杂报表: FREE_REPORT // 7.分析报表: BI3OLAP_REPORT // 8.仪表分析: Dashboard // 9.地图分析: DashboardMap // 10.portal页面: PAGE //TODO 扩展处理 } public void onCatalogElementDeleted(ICatalogElement element) { // TODO Auto-generated method stub //TODO 扩展处理 } public void onCatalogElementMoved(String nodeId, String originalParentId, String destParentId) { // TODO Auto-generated method stub } public void onCatalogElementDeleting(ICatalogElement element) { //TODO 扩展处理 } public void onCatalogElementUpdated(ICatalogElement element) { // TODO Auto-generated method stub } } |
...
module类,在服务器启动的时候注册,activate方法会在服务器启动的时候执行;module类的写法和配置可参考 第六课:高级应用 之六:自定义Module 章节。
代码块 | ||||
---|---|---|---|---|
| ||||
package bof.audit.service;
import java.util.List;
import org.h2.util.New;
import bof.audit.service.ReportChangePostHandler;
import smartbi.catalogtree.CatalogTreeModule;
import smartbi.catalogtree.ICatalogElement;
import smartbi.framework.IFrameworkListener;
import smartbi.framework.IModule;
import smartbi.sdk.service.catalog.CatalogService;
import smartbi.usermanager.local.LocalClientConnector;
public class AuditModule implements IModule, IFrameworkListener {
private static AuditModule instance;
private CatalogTreeModule catalogTreeModule;
public static AuditModule getInstance() {
if (instance == null)
instance = new AuditModule();
return instance;
}
public CatalogTreeModule getCatalogTreeModule() {
return catalogTreeModule;
}
public void setCatalogTreeModule(CatalogTreeModule catalogTreeModule) {
this.catalogTreeModule = catalogTreeModule;
}
private static LocalClientConnector conn;
protected AuditModule() {
conn = new LocalClientConnector();
}
public void activate() {
catalogTreeModule.addCatalogTreeListener(new ReportChangePostHandler());
}
@Override
public void afterStartup() {
// TODO Auto-generated method stub
}
} |
Spring声明文件applicationContext.xml
代码块 | ||
---|---|---|
| ||
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="framework" class="smartbi.framework.Framework" factory-method="getInstance">
<property name="modules">
<map>
<entry><key><value>AuditModule</value></key><ref bean="AuditModule" /></entry>
</map>
</property>
</bean>
<bean id="rmi" class="smartbi.framework.rmi.RMIModule" factory-method="getInstance">
<property name="modules">
<map>
<entry><key><value>AuditModule</value></key><ref bean="AuditModule" /></entry>
</map>
</property>
</bean>
<bean id="AuditModule" class="bof.audit.service.AuditModule" factory-method="getInstance">
<property name="catalogTreeModule" ref="catalogtree"/>
</bean>
</beans> |
以下说明前端扩展方法:
1、找到报表对象的前端处理文件
...