Browse Source

REPORT-69285 数据连接安全关键字检查拦截

security/10.0
rinoux 3 years ago
parent
commit
06346c31cd
  1. 28
      designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java

28
designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java

@ -3,19 +3,26 @@ package com.fr.design.os.impl;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.file.ConnectionConfig;
import com.fr.report.LockItem;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import com.fr.report.LockItem;
import javax.swing.JOptionPane;
import java.util.concurrent.atomic.AtomicBoolean;
import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager;
/**
* 数据连接窗口
*
* @author pengda
* @date 2019/10/9
*/
@ -52,10 +59,17 @@ public class DatabaseDialogAction implements OSBasedAction {
databaseListDialog.setDoOKSucceed(false);
return;
}
AtomicBoolean saved = new AtomicBoolean(true);
Configurations.modify(new WorkerFacade(ConnectionConfig.class) {
@Override
public void run() {
databaseManagerPane.update(datasourceManager);
try {
databaseManagerPane.update(datasourceManager);
} catch (Exception e) {
saved.set(false);
FineJOptionPane.showMessageDialog(databaseManagerPane, e.getMessage(), Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE);
}
}
}.addCallBack(new CallBackAdaptor() {
@Override
@ -66,9 +80,13 @@ public class DatabaseDialogAction implements OSBasedAction {
@Override
public void afterCommit() {
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
// 定义数据连接弹窗关闭后,解锁
EditLockUtils.unlock(LockItem.CONNECTION);
if (saved.get()) {
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
// 定义数据连接弹窗关闭后,解锁
EditLockUtils.unlock(LockItem.CONNECTION);
} else {
databaseListDialog.setDoOKSucceed(false);
}
}
}));
}

Loading…
Cancel
Save