Compare commits

..

17 Commits

Author SHA1 Message Date
Bruce.Deng-邓铖臻 836d277c79 Pull request #64: REPORT-94658 【降本增效】后台导出demo优化 1 year ago
Bruce.Deng-邓铖臻 3c84822025 Pull request #61: 无jira任务,release/10.0合到persist/10.0 2 years ago
Icey.Zhang c974449e23 Pull request #52: 10.0.16-0526号版本插件代码合并 4 years ago
Lanlan c21ebed9f4 Pull request #45: 误删自定义函数,恢复 4 years ago
Okcean ce7482718d Pull request #40: 10.0.14-0311号版本插件代码合并 4 years ago
Okcean 26e083a658 Pull request #36: 1127插件代码合并 4 years ago
Bruce.Deng d1776fa526 Pull request #31: 无JIRA任务 插件发布,release合persist 4 years ago
Leo.Tsai ca629a1ff6 Pull request #27: Release/10.0 4 years ago
Leo.Cai 99ff96fea6 代码做了修改,而且要导入一个新的JAR包:slf4j-simple-1.7.25.jar,JAR包下载参见文档https://help.finereport.com/doc-view-735.html 的3.1节 4 years ago
Lanlan e1f402023f Pull request #25: 无JIRA任务 插件发布,release合persist 5 years ago
Lanlan 5a3d9301af Merge pull request #23 in PG/plugin-report-doc-demo from release/10.0 to persist/10.0 5 years ago
susie 34ec362f64 Merge pull request #21 in PG/plugin-report-doc-demo from ~HARRISON/plugin-report-doc-demo:persist/10.0 to persist/10.0 5 years ago
Harrison c81c49f7ad DEMO-3230 Release10 module无法引用 5 years ago
Lanlan 9a474478b3 Merge pull request #19 in PG/plugin-report-doc-demo from release/10.0 to persist/10.0 5 years ago
Lanlan 10e88848e4 Merge pull request #12 in PG/plugin-report-doc-demo from release/10.0 to persist/10.0 5 years ago
Lanlan d6274eea84 Merge pull request #10 in PG/plugin-report-doc-demo from release/10.0 to persist/10.0 5 years ago
Lanlan de51123131 Merge pull request #8 in PG/plugin-report-doc-demo from release/10.0 to persist/10.0 5 years ago
  1. 79
      src/main/java/com/fr/data/WebServiceTableData.java

79
src/main/java/com/fr/data/WebServiceTableData.java

@ -1,71 +1,36 @@
package com.fr.data;
import com.fr.general.data.TableDataException;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ParameterProvider;
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import com.fr.data.AbstractTableData;
import com.fr.general.data.TableDataException;
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.List;
public class WebServiceTableData extends SimpleTableData {
public class WebServiceTableData extends AbstractTableData{
private String[][] data;
/**
* 初始化列名数组
*
* @return {col1,col2,col3...}
* @throws TableDataException
*/
@Override
public String[] initColumnNames() {
String[] columnNames = new String[10];
for (int i = 0; i < 10; i++) {
columnNames[i] = "column#" + i;
}
return columnNames;
public WebServiceTableData() {
this.data = this.createData();
}
/**
* 加载数据
*
* @return 行列数据
*/
@Override
public List<Object[]> loadData() {
String tableName = ((ParameterProvider) (parameters.get().toArray())[0]).getValue().toString();
FineLoggerFactory.getLogger().info("Query SQL of ParamTableDataDemo: \n" + tableName);
// 保存得到的结果集
ArrayList<Object[]> valueList = new ArrayList();
try {
// 调用 Web 服务获取数据
String[][] data = createData();
//获取列数
public int getColumnCount() throws TableDataException {
return data[0].length;
}
// 如果数据为空,直接返回空列表
if (data == null || data.length == 0) {
return valueList;
}
//获取列的名称为数组中第一行的值
public String getColumnName(int columnIndex) throws TableDataException {
return data[0][columnIndex];
}
// 获得总列数
int colNum = data[0].length;
//获取行数为数据的长度-1
public int getRowCount() throws TableDataException {
return data.length - 1;
}
// 用对象保存数据
Object[] objArray = null;
for (int rowIndex = 1; rowIndex < data.length; rowIndex++) {
objArray = new Object[colNum];
for (int i = 0; i < colNum; i++) {
objArray[i] = data[rowIndex][i];
}
// 在valueList中加入这一行数据
valueList.add(objArray);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return valueList;
//获取值
public Object getValueAt(int rowIndex, int columnIndex) {
return data[rowIndex + 1][columnIndex];
}
public String[][] createData() {

Loading…
Cancel
Save