Browse Source

REPORT-130891 【FBP数据源】url方式预览文件数据集失败

fbp/merge
Destiny.Lin 5 months ago
parent
commit
ab386c6ed9
  1. 12
      designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java
  2. 16
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

12
designer-base/src/main/java/com/fr/design/data/tabledata/LocalTableDataSource.java

@ -1,8 +1,10 @@
package com.fr.design.data.tabledata;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.decision.webservice.bean.dataset.FileDataSetBean;
import com.fr.decision.webservice.bean.entry.FileNodeBean;
import com.fr.decision.webservice.v10.datasource.dataset.processor.impl.FileProcessor;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.server.repository.tabledata.BaseTableDataSource;
@ -49,4 +51,14 @@ public class LocalTableDataSource extends BaseTableDataSource {
public List<FileNodeBean> getFileList(String fileType) {
return FileProcessor.KEY.getFileList(fileType, StringUtils.EMPTY);
}
@Override
public boolean testFilePath(FileDataSetBean fileDataSetBean) {
try {
return FileProcessor.KEY.testFilePath(fileDataSetBean);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
}
}
}

16
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

@ -14,6 +14,7 @@ import com.fr.data.impl.ExcelTableData;
import com.fr.data.impl.FileTableData;
import com.fr.data.impl.TextTableData;
import com.fr.data.impl.XMLTableData;
import com.fr.decision.webservice.bean.dataset.FileDataSetBean;
import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.data.datapane.preview.PreviewTablePane;
@ -47,6 +48,7 @@ import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.server.repository.tabledata.TableDataRepository;
import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;
@ -233,22 +235,20 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
params = getEditorPaneParameter();
URLDataSource url = new URLDataSource(urlText.getText().trim(), params);
InputStream in = null;
boolean result = false;
try {
in = url.getSourceStream(params);
String urlText = ParameterHelper.analyze4Templatee(url.getUrl(), params);
FileDataSetBean bean = new FileDataSetBean();
bean.setFilePath(urlText);
result = TableDataRepository.getInstance().testFilePath(bean);
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (in == null) {
if (!result) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
} else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully"));
try {
in.close();
} catch (IOException e) {
in = null;
}
}
}
};

Loading…
Cancel
Save