From de0905d7fa1ed0ef8c684b599b46d89f995a062b Mon Sep 17 00:00:00 2001 From: "Leo.Qin" Date: Thu, 2 Feb 2023 18:00:03 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-88826=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8D=E6=94=AF=E6=8C=81=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E7=B1=BB=E5=9E=8B=E6=9C=AA=E5=8F=97=E5=88=B0?= =?UTF-8?q?=E9=99=90=E5=88=B6=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=E3=80=91=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D?= =?UTF-8?q?=E8=B7=AF=E3=80=91=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E6=97=B6=EF=BC=8C=E7=82=B9=E5=87=BB=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E5=90=8E=E6=A0=A1=E9=AA=8C=E6=98=AF=E5=90=A6=E4=B8=BA=E5=8F=97?= =?UTF-8?q?=E9=99=90=E5=88=B6=E7=9A=84=E6=95=B0=E6=8D=AE=E5=BA=93=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConnectionListDialogActionAdapter.java | 3 +++ .../connect/ConnectionManagerPane.java | 26 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java index 947cb6e75f..635076b596 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java +++ b/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); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java index 33925dcd36..0c1d88022e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java +++ b/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 + } + } + } + } \ No newline at end of file