Browse Source

REPORT-114392 FR-FBP版本本地设计适配 数据连接适配

mss/2.0
Destiny.Lin 4 months ago
parent
commit
11a0b47dcb
  1. 2
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  2. 2
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  3. 11
      designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java
  4. 4
      designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java
  5. 2
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  6. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java
  7. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  8. 2
      designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java
  9. 2
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

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

@ -444,7 +444,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
return TableData.EMPTY_TABLEDATA;
}
try {
ConnectionRepository.getInstance().testConnection(new ConnectionBean(database));
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(database));
connect = true;
} catch (Exception ignored) {
connect= false;

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

@ -432,7 +432,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
// 返回连接结果
DriverPage.updateCache();
final Exception[] exception = new Exception[1];
ConnectionRepository.getInstance().testConnection(new ConnectionBean(database));
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(database));
return null;
}

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

@ -6,6 +6,7 @@ import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
import com.fr.security.encryption.transmission.TransmissionEncryptionManager;
import com.fr.workspace.server.repository.connection.BaseConnectionSource;
import java.sql.SQLException;
@ -18,6 +19,16 @@ import java.sql.SQLException;
*/
public class LocalConnectionSource extends BaseConnectionSource {
@Override
public void testConnection(ConnectionInfoBean database) throws Exception {
try {
// 暂时这么处理,后续最好拉到外层包装一下
TransmissionEncryptionManager.setTransEncryptionLevel(1);
dataOperator.testConnectionWithException(ConnectionProcessorFactory.createConnection(database));
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
}
@Override
public void add(ConnectionInfoBean bean) throws Exception {
Connection connection = ConnectionProcessorFactory.createConnection(bean);

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

@ -127,6 +127,10 @@ public class ConnectionInfoBeanHelper {
}
private static String encrypt(String password) {
// 如果是空密码或者默认密码,就返回默认的星号回去
if (StringUtils.isEmpty(password) || StringUtils.equals(password, DecisionServiceConstants.DEFAULT_PASSWORD)) {
return DecisionServiceConstants.DEFAULT_PASSWORD;
}
return TransmissionEncryptionManager.getInstance().getEncryption(WorkplaceConstants.getEncryptionMode()).encrypt(password, WorkplaceConstants.getEncryptionKey());
}

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 {
if (tableData instanceof DBTableData) {
try {
ConnectionRepository.getInstance().testConnection(new ConnectionBean(((DBTableData) tableData).getDatabase(), tableData.getName()));
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(tableData.getName(), ((DBTableData) tableData).getDatabase()));
} catch (Exception e) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), e);
}

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

@ -195,7 +195,7 @@ public final class MultiResultTableDataWrapper implements TableDataWrapper {
if (tableData instanceof StoreProcedure) {
try {
connectionBar.start();
ConnectionRepository.getInstance().testConnection(new ConnectionBean(((StoreProcedure) getTableData()).getDatabaseConnection()));
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(((StoreProcedure) getTableData()).getDatabaseConnection()));
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));

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

@ -182,7 +182,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
PreviewTablePane.resetPreviewTable();
connectionBar.start();
try {
ConnectionRepository.getInstance().testConnection(new ConnectionBean(((StoreProcedure) getTableData()).getDatabaseConnection()));
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(((StoreProcedure) getTableData()).getDatabaseConnection()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
connectionBar.close();

2
designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java vendored

@ -2,6 +2,7 @@ package com.fr.design.env;
import com.fanruan.workplace.http.HttpConstants;
import com.fanruan.workplace.http.RepositoryManager;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister;
@ -57,6 +58,7 @@ public class HttpWorkspaceConnector implements WorkspaceConnector {
if (StringUtils.isEmpty(bean.getAccessToken())) {
throw new RuntimeException("Empty token, try connect again and check server");
}
FineLoggerFactory.getLogger().info("[connector] infos:{}", bean.getAccessToken());
WorkspaceConnection connection = new WorkspaceConnection(
UUID.randomUUID().toString(),
connectionInfo.getUserName(),

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

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

Loading…
Cancel
Save