Browse Source

Pull request #14353: REPORT-114392 FR-FBP版本本地设计适配 修复数据连接测试连接

Merge in DESIGN/design from ~DESTINY.LIN/design:mss/2.0 to mss/2.0

* commit '39162ae879324bb54bf5fd8b521a00834c7fcd87':
  REPORT-114392 FR-FBP版本本地设计适配 修复数据连接测试连接
mss/2.0
Destiny.Lin-林锦龙 6 months ago
parent
commit
379b0aee64
  1. 3
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  2. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  3. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java
  4. 2
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  5. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java
  6. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  7. 2
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

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

@ -40,6 +40,7 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth; import com.fr.workspace.server.connection.DBConnectAuth;
import com.fr.workspace.server.entity.connection.ConnectionBean;
import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.JList; import javax.swing.JList;
@ -443,7 +444,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
return TableData.EMPTY_TABLEDATA; return TableData.EMPTY_TABLEDATA;
} }
try { try {
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(database)); ConnectionRepository.getInstance().testConnection(new ConnectionBean(database));
connect = true; connect = true;
} catch (Exception ignored) { } catch (Exception ignored) {
connect= false; connect= false;

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

@ -30,6 +30,7 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.entity.connection.ConnectionBean;
import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -431,7 +432,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
// 返回连接结果 // 返回连接结果
DriverPage.updateCache(); DriverPage.updateCache();
final Exception[] exception = new Exception[1]; final Exception[] exception = new Exception[1];
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(database)); ConnectionRepository.getInstance().testConnection(new ConnectionBean(database));
return null; return null;
} }

5
designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java

@ -18,11 +18,6 @@ import java.sql.SQLException;
*/ */
public class LocalConnectionSource extends BaseConnectionSource { public class LocalConnectionSource extends BaseConnectionSource {
@Override
public void testConnection(ConnectionInfoBean database) throws Exception {
dataOperator.testConnectionWithException(ConnectionProcessorFactory.createConnection(database));
}
@Override @Override
public void add(ConnectionInfoBean bean) throws Exception { public void add(ConnectionInfoBean bean) throws Exception {
Connection connection = ConnectionProcessorFactory.createConnection(bean); Connection connection = ConnectionProcessorFactory.createConnection(bean);

2
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -590,7 +590,7 @@ public class PreviewTablePane extends BasicPane {
private void testDBTableDataConnection(TableData tableData) throws Exception { private void testDBTableDataConnection(TableData tableData) throws Exception {
if (tableData instanceof DBTableData) { if (tableData instanceof DBTableData) {
try { try {
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(tableData.getName(), ((DBTableData) tableData).getDatabase())); ConnectionRepository.getInstance().testConnection(new ConnectionBean(((DBTableData) tableData).getDatabase(), tableData.getName()));
} catch (Exception e) { } catch (Exception e) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), e); throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), e);
} }

3
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java

@ -15,6 +15,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.workspace.server.entity.connection.ConnectionBean;
import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.Icon; import javax.swing.Icon;
@ -194,7 +195,7 @@ public final class MultiResultTableDataWrapper implements TableDataWrapper {
if (tableData instanceof StoreProcedure) { if (tableData instanceof StoreProcedure) {
try { try {
connectionBar.start(); connectionBar.start();
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(((StoreProcedure) getTableData()).getDatabaseConnection())); ConnectionRepository.getInstance().testConnection(new ConnectionBean(((StoreProcedure) getTableData()).getDatabaseConnection()));
} catch (Exception e){ } catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));

3
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

@ -15,6 +15,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.workspace.server.entity.connection.ConnectionBean;
import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.Icon; import javax.swing.Icon;
@ -181,7 +182,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
PreviewTablePane.resetPreviewTable(); PreviewTablePane.resetPreviewTable();
connectionBar.start(); connectionBar.start();
try { try {
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(((StoreProcedure) getTableData()).getDatabaseConnection())); ConnectionRepository.getInstance().testConnection(new ConnectionBean(((StoreProcedure) getTableData()).getDatabaseConnection()));
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
connectionBar.close(); connectionBar.close();

2
designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

@ -104,7 +104,7 @@ public class TableViewList extends UIList {
//总共给3次连接的机会 //总共给3次连接的机会
while (!status && count > 0) { while (!status && count > 0) {
try { try {
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(databaseName, datasource)); ConnectionRepository.getInstance().testConnection(new ConnectionBean(datasource, databaseName));
status = true; status = true;
break; break;
} catch (Exception e) { } catch (Exception e) {

Loading…
Cancel
Save