Browse Source

REPORT-138311 【fr-fbp冒烟】【数据源】关联数据集选择后预览 无法弹出参数的弹窗,直接报错或者空白

fbp/master
Destiny.Lin 2 months ago
parent
commit
c385f65542
  1. 4
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  2. 4
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java
  3. 100
      designer-realize/src/main/java/com/fanruan/data/DesignTableDataConfigWrapper.java

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

@ -622,6 +622,10 @@ public abstract class DesignTableDataManager {
private static boolean checkBean(PreviewSourceBean bean, TableData tableData) {
if (bean.getDataName().isEmpty()) {
if (tableData instanceof ConditionTableData || tableData instanceof RecursionTableData) {
if (bean.getDataSource() instanceof TableDataSourceTailor.EmptyTableDataSource) {
// 用tabledata传的时候不能是EmptyTableDataSource,因此这里得重新弄个source
bean.setDataSource(new TableDataSourceTailor.TableDataOnlySource());
}
bean.getDataSource().putTableData(StringUtils.EMPTY, tableData);
return true;
}

4
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java vendored

@ -12,6 +12,7 @@ import com.fanruan.config.impl.data.ConnectionConfigWriter;
import com.fanruan.config.impl.data.ConnectionConfigWriterFactory;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fanruan.data.ConnectionConfigWrapper;
import com.fanruan.data.DesignTableDataConfigWrapper;
import com.fanruan.datasource.connection.processor.ElasticSearchConnectionProcessor;
import com.fanruan.datasource.connection.processor.FTPConnectionProcessor;
import com.fanruan.datasource.connection.processor.LocalFileConnectionProcessor;
@ -42,7 +43,6 @@ import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JNDIC
import com.fr.decision.webservice.v10.datasource.dataset.processor.impl.DataSetProcessorFactory;
import com.fr.design.data.datapane.connect.LocalConnectionSource;
import com.fr.design.data.tabledata.LocalTableDataSource;
import com.fr.file.TableDataConfigWrapper;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import com.fr.workspace.server.repository.connection.ConnectionWriterShell;
import com.fr.workspace.server.repository.connection.LocalConnectionShell;
@ -83,7 +83,7 @@ public class DesignDatasourceComponent extends DatasourceComponent {
public void start() {
// 服务器数据集与数据连接设计器这边先手动切为finedb存储,后续数据中心适配后再切为他们提供的wrapper
ConnectionConfigProviderFactory.registerConnectionConfigProvider(ConnectionConfigWrapper.getInstance());
TableDataConfigProviderFactory.getInstance().registerTableDataConfigProvider(new TableDataConfigWrapper());
TableDataConfigProviderFactory.getInstance().registerTableDataConfigProvider(new DesignTableDataConfigWrapper());
registerDriverClassLoader();
ConnectionConfigWriterFactory.registerConnectionConfigWriter((ConnectionConfigWriter) ConnectionConfigProviderFactory.getConfigProvider());
Carina.getApplicationContext().singleton(ConnectionWriterShell.class).set(ConnectionConfigWriterFactory.getConfigWriter());

100
designer-realize/src/main/java/com/fanruan/data/DesignTableDataConfigWrapper.java

@ -0,0 +1,100 @@
package com.fanruan.data;
import com.fanruan.config.impl.data.TableDataConfigProvider;
import com.fr.base.TableData;
import com.fr.decision.webservice.bean.dataset.ServerDataSetBean;
import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper;
import com.fr.design.data.datapane.preview.TableDataBeanHelper;
import com.fr.file.TableDataConfig;
import com.fr.log.FineLoggerFactory;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerAdaptor;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.repository.tabledata.TableDataRepository;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
/**
* 设计器的TableData配置Wrapper
* <p>防止底层错误调用</p>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/10/25
*/
public class DesignTableDataConfigWrapper implements TableDataConfigProvider {
@Override
public Map<String, TableData> getTableDatas() {
return TableDataConfig.getInstance().getTableDatas();
}
@Override
public void removeTableData(String tableDataName) {
Configurations.update(new WorkerAdaptor(TableDataConfig.class) {
@Override
public void run() {
TableDataConfig.getInstance().removeTableData(tableDataName);
}
});
}
@Nullable
@Override
public TableData getTableData(String name) {
if (WorkContext.getCurrent().isLocal()) {
return TableDataConfig.getInstance().getTableData(name);
}
ServerDataSetBean bean = TableDataRepository.getInstance().getTableData(name);
try {
if (bean == null) {
return null;
}
return TableDataBeanHelper.getTableDataSet(ConnectionInfoBeanHelper.getCurrentConnectionMap(), bean.getDatasetType(), bean.getDatasetData());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return null;
}
}
@Override
public void addTableData(String name, TableData tableData) {
Configurations.update(new WorkerAdaptor(TableDataConfig.class) {
@Override
public void run() {
TableDataConfig.getInstance().addTableData(name, tableData);
}
});
}
@Override
public void renameTableData(String oldName, String newName) {
Configurations.update(new WorkerAdaptor(TableDataConfig.class) {
@Override
public void run() {
TableDataConfig.getInstance().renameTableData(oldName, newName);
}
});
}
@Override
public void updateTableData(String tableDataName, TableData tableData) {
Configurations.update(new WorkerAdaptor(TableDataConfig.class) {
@Override
public void run() {
TableDataConfig.getInstance().removeTableData(tableDataName);
TableDataConfig.getInstance().addTableData(tableDataName, tableData);
}
});
}
@Override
public void removeAllTableData() {
Configurations.update(new WorkerAdaptor(TableDataConfig.class) {
@Override
public void run() {
TableDataConfig.getInstance().removeAllTableData();
}
});
}
}
Loading…
Cancel
Save