forked from fanruan/design
Browse Source
Merge in DESIGN/design from ~HADES/design:release/11.0 to release/11.0 * commit 'ded252677c17a52c06211759e22d73c180a942e8': REPORT-57496 FR11一轮回归-远程设计-预览数据集报错persist/11.0
Hades
3 years ago
2 changed files with 1 additions and 48 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; |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue