Henry.Wang
3 years ago
29 changed files with 264 additions and 130 deletions
@ -1,47 +0,0 @@ |
|||||||
package com.fr.design.data.tabledata.tabledatapane.db; |
|
||||||
|
|
||||||
import com.fr.data.impl.DBTableData; |
|
||||||
import com.fr.esd.event.DSMapping; |
|
||||||
import com.fr.esd.event.DsNameTarget; |
|
||||||
import com.fr.esd.event.StrategyEventsNotifier; |
|
||||||
import com.fr.esd.event.xml.XMLSavedHook; |
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
|
|
||||||
public class DBTableDataSavedHook implements XMLSavedHook<DBTableData> { |
|
||||||
|
|
||||||
private static final long serialVersionUID = 4925391747683335372L; |
|
||||||
|
|
||||||
private final String tplPath; |
|
||||||
private String origName; |
|
||||||
|
|
||||||
private String origConnection; |
|
||||||
|
|
||||||
private String origQuery; |
|
||||||
|
|
||||||
public DBTableDataSavedHook(String tplPath, DBTableData origDBTableData) { |
|
||||||
this.tplPath = tplPath; |
|
||||||
this.origName = origDBTableData.getDsName(); |
|
||||||
this.origConnection = origDBTableData.getDatabase().toString(); |
|
||||||
this.origQuery = origDBTableData.getQuery(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void doAfterSaved(DBTableData saved) { |
|
||||||
String dsName = saved.getDsName(); |
|
||||||
String conn = saved.getDatabase().toString(); |
|
||||||
String query = saved.getQuery(); |
|
||||||
|
|
||||||
|
|
||||||
//检查数据集名称、数据链接和sql是否修改,如果修改需要触发缓存监听事件
|
|
||||||
if (!dsName.equals(origName) || !conn.equals(origConnection) || !query.equals(origQuery)) { |
|
||||||
if (StringUtils.isNotEmpty(tplPath) && StringUtils.isNotEmpty(origName)) { |
|
||||||
//新建数据集的origName为null,不用触发
|
|
||||||
StrategyEventsNotifier.modifyDataSet(new DSMapping(tplPath, new DsNameTarget(origName))); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
this.origName = dsName; |
|
||||||
this.origConnection = conn; |
|
||||||
this.origQuery = query; |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1 @@ |
|||||||
|
report-engine-key=fine-report-engine-10.0.jar |
Loading…
Reference in new issue