From 80e049a6275959345f94cf584e278d56d8603b80 Mon Sep 17 00:00:00 2001 From: abel Date: Thu, 27 Dec 2018 14:34:12 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-13573=20=E8=BF=9C=E7=A8=8B=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E6=8A=A5=E8=A1=A8=E6=95=B0=E6=8D=AE=E9=9B=86=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E6=8A=8A=E6=8A=A5=E8=A1=A8=E4=BC=A0=E5=88=B0=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=AB=AF=EF=BC=8C=E6=8A=A5=E8=A1=A8=E6=AF=94=E8=BE=83?= =?UTF-8?q?=E5=A4=A7=EF=BC=8C=E4=BC=9A=E6=9C=89=E6=80=A7=E8=83=BD=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E8=A3=81=E5=89=AA=E4=B8=80=E4=B8=8B=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E5=8F=AA=E6=8A=8A=E9=9C=80=E8=A6=81=E7=9A=84?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=8F=91=E8=BF=87=E5=8E=BB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/DesignTableDataManager.java | 16 +- .../com/fr/design/TableDatasourceTest.java | 165 ------------------ 2 files changed, 2 insertions(+), 179 deletions(-) delete mode 100644 designer-base/src/test/java/com/fr/design/TableDatasourceTest.java diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index ee7df6015..fc5e8b54f 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -3,8 +3,8 @@ package com.fr.design.data; import com.fr.base.FRContext; import com.fr.base.StoreProcedureParameter; import com.fr.base.TableData; -import com.fr.data.AbstractTableDataSource; import com.fr.data.TableDataSource; +import com.fr.data.TableDataSourceTailor; import com.fr.data.core.DataCoreXmlUtils; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.storeproc.ProcedureDataModel; @@ -445,19 +445,7 @@ public abstract class DesignTableDataManager { parameter.setValue(parameterMap.get(parameter.getName())); } } - //这边数据集预览不需要把整个模板都发送过去,只需要把模板中的数据集挑出来,传过去就行了。模板一大,预览数据集很变得很慢。 - TableDataSource wrapper = null; - if (tableDataSource != null) { - wrapper = new AbstractTableDataSource(){}; - for (Iterator it = tableDataSource.getTableDataNameIterator(); it != null && it.hasNext(); ) { - String name = it.next(); - TableData tableData = tableDataSource.getTableData(name); - if (tableData != null) { - wrapper.putTableData(name, tableData); - } - } - } - return DataOperator.getInstance().previewTableData(wrapper, tabledata, parameterMap, rowCount); + return DataOperator.getInstance().previewTableData(TableDataSourceTailor.extractTableData(tableDataSource), tabledata, parameterMap, rowCount); } catch (Exception e) { throw new TableDataException(e.getMessage(), e); } finally { diff --git a/designer-base/src/test/java/com/fr/design/TableDatasourceTest.java b/designer-base/src/test/java/com/fr/design/TableDatasourceTest.java deleted file mode 100644 index ed6aa3657..000000000 --- a/designer-base/src/test/java/com/fr/design/TableDatasourceTest.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.fr.design; - -import com.fr.base.AbstractTableData; -import com.fr.base.TableData; -import com.fr.cert.token.lang.Assert; -import com.fr.data.AbstractTableDataSource; -import com.fr.data.TableDataSource; -import com.fr.general.data.TableDataException; -import com.fr.script.Calculator; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLableReader; -import com.fr.third.javax.xml.stream.XMLStreamException; -import junit.framework.TestCase; - -import java.io.ByteArrayOutputStream; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; - -public class TableDatasourceTest extends TestCase { - - public void testAbstractTableDataSourceReadAndWrite() throws XMLStreamException, TableDataException, UnsupportedEncodingException { - String xml = "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "7.nI9\\uimQ~\n" + - "]]>\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "9UT+>AM9kpGY!\\4\\SXO$EO1[i^/XKmIMmdu\n" + - "!\"Q5sC\"9Ji(qlAa_kVTnCC/+p:XVF.KGR?GMsmI)2\">1s>(/T71G7cFsfA\"UpjYr4R)A14-*\n" + - "qc6ri_1*%/XSsf!PM]ARc+ojE:eo:_gma!ut7eZ6BoFc2b5hu4@TUtuOT);aq6l4Vj\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "YfS3J$NPo=IB3AP?eiop.bk9Qu\n" + - "P:F\\.L&t$31~\n" + - "]]>\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "5++,D>0thk;G<`mPXn.b)QZb5j^mQri%8Ji5q\\\n" + - "\n" + - "\n"; - - AbstractTableDataSource source = new AbstractTableDataSource() { - }; - XMLableReader.createXMLableReader(xml).readXMLObject(source); - TableData tableData = source.getTableData("热销产品"); - Assert.notNull(tableData); - Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getRowCount() == 4); - Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getColumnCount() == 2); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - XMLPrintWriter writer = XMLPrintWriter.create(new OutputStreamWriter(out,"UTF-8")); - source.writeXML(writer); - writer.close(); - TableDataSource another = new AbstractTableDataSource(){}; - XMLableReader.createXMLableReader(new String(out.toByteArray(),"UTF-8")).readXMLObject(another); - tableData = another.getTableData("热销产品"); - Assert.notNull(tableData); - Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getRowCount() == 4); - Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getColumnCount() == 2); - } -}