Browse Source

REPORT-88826 设计器新增不支持的数据库类型未受到限制

【问题原因】
【改动思路】新增数据连接时,点击确认后校验是否为受限制的数据库类型
feature/x
Leo.Qin 2 years ago
parent
commit
de0905d7fa
  1. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java
  2. 26
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java

3
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java

@ -37,6 +37,9 @@ public class ConnectionListDialogActionAdapter extends DialogActionAdapter {
return;
}
try {
// 校验数据库类型
connectionManagerPane.validateDatabaseType(connectionConfig);
connectionManagerPane.update(connectionConfig);
} catch (Exception e) {
connectionListDialog.setDoOKSucceed(false);

26
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java

@ -1,9 +1,14 @@
package com.fr.design.data.datapane.connect;
import com.fr.data.impl.Connection;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.file.ConnectionConfig;
import com.fr.general.NameObject;
import com.fr.license.database.DatabaseTypeValidateUtil;
import com.fr.license.exception.DataBaseNotSupportedException;
import com.fr.stable.Nameable;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -61,4 +66,23 @@ public class ConnectionManagerPane extends LoadingBasicPane implements Connectio
return connectionListPane.isNamePermitted();
}
/**
* 校验是否支持当前选中连接的数据库类型
*/
public void validateDatabaseType(ConnectionConfig connectionConfig) {
ListModelElement selectedValue = this.connectionListPane.getSelectedValue();
if (selectedValue != null) {
Nameable wrapper = selectedValue.wrapper;
try {
Connection connection = (Connection) ((NameObject) wrapper).getObject();
DatabaseTypeValidateUtil.validateDatabaseType(connection.getDriver(), connection.feature());
} catch (DataBaseNotSupportedException e) {
// 仅抛出数据库类型不支持异常
throw e;
} catch (Exception e) {
// ignore
}
}
}
}
Loading…
Cancel
Save