Browse Source

Pull request #14781: REPORT-133888 【fr-fbp回归】文件数据集excel只能被选一次 & REPORT-133908 【fr-fbp回归】DB2 新建存储过程显示数据库连接失败

Merge in DESIGN/design from ~DESTINY.LIN/design:fbp/release to fbp/release

* commit 'a1c8275bde78246e2cf99a34d5ffd32ca21e7ba9':
  REPORT-133888 【fr-fbp回归】文件数据集excel只能被选一次
  REPORT-133908 【fr-fbp回归】DB2 新建存储过程显示数据库连接失败
fbp/merge
Destiny.Lin-林锦龙 4 months ago
parent
commit
682f0c872f
  1. 4
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  2. 13
      designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java
  3. 18
      designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java
  4. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  5. 4
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  6. 3
      designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java
  7. 25
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  8. 3
      designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java

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

@ -332,7 +332,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
List<String> authConnections = getHasAuthConnections(); List<String> authConnections = getHasAuthConnections();
for (String name : authConnections) { for (String name : authConnections) {
if (ComparatorUtils.equals(selectedDSName, name)) { if (ComparatorUtils.equals(selectedDSName, name)) {
return ConnectionRepository.getInstance().getByName(name).getConnection(); return ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(name));
} }
} }
return null; return null;
@ -442,7 +442,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
boolean connect = false; boolean connect = false;
com.fr.data.impl.Connection database = null; com.fr.data.impl.Connection database = null;
try { try {
database = ConnectionRepository.getInstance().getByName(paras.getDatabaseName()).getConnection(); database = ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(paras.getDatabaseName()));
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage(), e); FineLoggerFactory.getLogger().info(e.getMessage(), e);
} }

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

@ -41,11 +41,20 @@ public class LocalConnectionSource extends BaseConnectionSource {
} }
@Override @Override
public void testConnection(ConnectionInfoBean database) throws Exception { public ConnectionInfoBean getByName(String name) {
try {
return ConnectionInfoBeanHelper.createConnectionInfoBean(name, ConnectionConfigProviderFactory.getConfigProvider().getConnection(name));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public String[] testConnection(ConnectionInfoBean database) throws Exception {
try { try {
// 暂时这么处理,后续最好拉到外层包装一下 // 暂时这么处理,后续最好拉到外层包装一下
TransmissionEncryptionManager.setTransEncryptionLevel(1); TransmissionEncryptionManager.setTransEncryptionLevel(1);
ConnectionProcessorFactory.testConnectionWithSchemaReturn(database); return ConnectionProcessorFactory.testConnectionWithSchemaReturn(database);
} catch (DriverNotFoundException e) { } catch (DriverNotFoundException e) {
throw new DriverUnExistException(); throw new DriverUnExistException();
} finally { } finally {

18
designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java

@ -78,13 +78,29 @@ public class ConnectionInfoBeanHelper {
return ans; return ans;
} }
/**
* 根据bean创建连接
*/
public static Connection createConnection(ConnectionInfoBean infoBean) {
try {
if (JDBCConnectionProcessor.KEY.acceptConnectionTypes().contains(infoBean.getConnectionType())) {
return createJDBCConnection(infoBean);
} else {
return ConnectionProcessorFactory.createConnection(infoBean, true);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return null;
}
}
/** /**
* 创建数据连接Bean可自定义是否携带密码 * 创建数据连接Bean可自定义是否携带密码
*/ */
public static ConnectionInfoBean createConnectionInfoBean(String name, Connection connection, boolean withPassword) throws Exception { public static ConnectionInfoBean createConnectionInfoBean(String name, Connection connection, boolean withPassword) throws Exception {
if (connection instanceof NameDatabaseConnection) { if (connection instanceof NameDatabaseConnection) {
name = ((NameDatabaseConnection) connection).getName(); name = ((NameDatabaseConnection) connection).getName();
connection = ConnectionRepository.getInstance().getByName(name).getConnection(); connection = createConnection(ConnectionRepository.getInstance().getByName(name));
} }
if (JDBCConnectionProcessor.KEY.acceptConnections().contains(connection.getClass())) { if (JDBCConnectionProcessor.KEY.acceptConnections().contains(connection.getClass())) {
ConnectionInfoBean bean = new ConnectionInfoBean(); ConnectionInfoBean bean = new ConnectionInfoBean();

4
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -20,6 +20,7 @@ import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane; import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane;
import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane.DoubleClickSelectedNodeOnTreeListener; import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane.DoubleClickSelectedNodeOnTreeListener;
import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper;
import com.fr.design.data.datapane.sqlpane.SQLEditPane; import com.fr.design.data.datapane.sqlpane.SQLEditPane;
import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.data.tabledata.StoreProcedureWorkerListener; import com.fr.design.data.tabledata.StoreProcedureWorkerListener;
@ -187,8 +188,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
} }
private boolean isAutoParameterDatabase() { private boolean isAutoParameterDatabase() {
ConnectionBean bean = ConnectionRepository.getInstance().getByName(connectionTableProcedurePane.getSelectedDatabaseConnnectonName()); Connection connection = ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(connectionTableProcedurePane.getSelectedDatabaseConnnectonName()));
Connection connection = bean == null ? null : bean.getConnection();
return connection != null && ArrayUtils.contains(DRIVERS, connection.getDriver()); return connection != null && ArrayUtils.contains(DRIVERS, connection.getDriver());
} }

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

@ -104,7 +104,7 @@ public class TableViewList extends UIList {
@Override @Override
protected DefaultListModel doInBackground() throws Exception { protected DefaultListModel doInBackground() throws Exception {
Connection datasource = ConnectionRepository.getInstance().getByName(databaseName).getConnection(); Connection datasource = ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(databaseName));
boolean status = false; boolean status = false;
int count = 3; int count = 3;
//总共给3次连接的机会 //总共给3次连接的机会
@ -168,7 +168,7 @@ public class TableViewList extends UIList {
*/ */
private DefaultListModel processDataInAnotherThread(String databaseName, String searchFilter, String... typesFilter) throws Exception { private DefaultListModel processDataInAnotherThread(String databaseName, String searchFilter, String... typesFilter) throws Exception {
DefaultListModel defaultListModel = new DefaultListModel(); DefaultListModel defaultListModel = new DefaultListModel();
Connection datasource = ConnectionRepository.getInstance().getByName(databaseName).getConnection(); Connection datasource = ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(databaseName));
if (datasource == null) { if (datasource == null) {
return defaultListModel; return defaultListModel;
} }

3
designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java

@ -15,6 +15,7 @@ import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.ChoosePane; import com.fr.design.data.datapane.ChoosePane;
import com.fr.design.data.datapane.DataBaseItems; import com.fr.design.data.datapane.DataBaseItems;
import com.fr.design.data.datapane.VerticalChoosePane; import com.fr.design.data.datapane.VerticalChoosePane;
import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
import com.fr.design.editor.DoubleDeckValueEditorPane; import com.fr.design.editor.DoubleDeckValueEditorPane;
import com.fr.design.editor.editor.ColumnIndexEditor; import com.fr.design.editor.editor.ColumnIndexEditor;
@ -178,7 +179,7 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
if (StringUtils.isBlank(para.getDatabaseName())) { if (StringUtils.isBlank(para.getDatabaseName())) {
dbDict.setDatabaseConnection(null); dbDict.setDatabaseConnection(null);
} else { } else {
Connection connection = ConnectionRepository.getInstance().getByName(para.getDatabaseName()).getConnection(); Connection connection = ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(para.getDatabaseName()));
if (connection != null) { if (connection != null) {
database = new NameDatabaseConnection(para.getDatabaseName()); database = new NameDatabaseConnection(para.getDatabaseName());
dbDict.setDatabaseConnection(database); dbDict.setDatabaseConnection(database);

25
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -1092,7 +1092,29 @@ public class FILEChooserPane extends BasicPane {
String lastDirectoryPath = DesignerEnvManager.getEnvManager().getDialogCurrentDirectory(); String lastDirectoryPath = DesignerEnvManager.getEnvManager().getDialogCurrentDirectory();
String prefix = DesignerEnvManager.getEnvManager().getCurrentDirectoryPrefix(); String prefix = DesignerEnvManager.getEnvManager().getCurrentDirectoryPrefix();
FILE lastDirectory = FILEFactory.createFolder(prefix + lastDirectoryPath); FILE lastDirectory = FILEFactory.createFolder(prefix + lastDirectoryPath);
dealCurrentDirectory(model, lastDirectory) ;
}
private void setPlaceListModel4DataFile(AbstractPlaceListModel model) {
if (placesList == null) {
return;
}
placesList.setModel(model);
String lastDirectoryPath = FILEFactory.ENV_PREFIX;
String prefix = ProjectConstants.REPORTLETS_NAME;
FILE lastDirectory;
if (model instanceof FileDataPlaceListModel) {
FileDataFILE file = new FileDataFILE(new FileNode(), false, StringUtils.EMPTY, ((FileDataPlaceListModel) model).getType());
lastDirectory = FILEFactory.createFolder(file, prefix + lastDirectoryPath);
} else {
lastDirectory = FILEFactory.createFolder(prefix + lastDirectoryPath);
}
dealCurrentDirectory(model, lastDirectory);
}
private void dealCurrentDirectory(AbstractPlaceListModel model, FILE lastDirectory) {
model.setCD(lastDirectory); model.setCD(lastDirectory);
if (currentDirectory != null) { if (currentDirectory != null) {
@ -1109,6 +1131,7 @@ public class FILEChooserPane extends BasicPane {
} }
} }
private void setPlaceListModel() { private void setPlaceListModel() {
if (placesList == null) { if (placesList == null) {
return; return;
@ -1140,7 +1163,7 @@ public class FILEChooserPane extends BasicPane {
if (placesList == null) { if (placesList == null) {
return; return;
} }
setPlaceListModel(new FileDataPlaceListModel(type)); setPlaceListModel4DataFile(new FileDataPlaceListModel(type));
} }
protected void setFileCAPlaceListModel() { protected void setFileCAPlaceListModel() {

3
designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java

@ -3,6 +3,7 @@ package com.fanruan.data;
import com.fanruan.config.impl.data.ConnectionConfigProvider; import com.fanruan.config.impl.data.ConnectionConfigProvider;
import com.fanruan.config.impl.data.ConnectionConfigWriter; import com.fanruan.config.impl.data.ConnectionConfigWriter;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
@ -108,7 +109,7 @@ public class ConnectionConfigWrapper implements ConnectionConfigProvider, Connec
@Override @Override
public @Nullable Connection getConnection(@NotNull String connectionName) { public @Nullable Connection getConnection(@NotNull String connectionName) {
Connection connection = WorkContext.getCurrent().isLocal() ? ConnectionConfig.getInstance().getConnection(connectionName) : ConnectionRepository.getInstance().getByName(connectionName).getConnection(); Connection connection = WorkContext.getCurrent().isLocal() ? ConnectionConfig.getInstance().getConnection(connectionName) : ConnectionInfoBeanHelper.createConnection(ConnectionRepository.getInstance().getByName(connectionName));;
if (connection != null) { if (connection != null) {
connection.setConnectionName(connectionName); connection.setConnectionName(connectionName);
} }

Loading…
Cancel
Save