Compare commits

...

5 Commits

Author SHA1 Message Date
roger 62be575ec8 REPORT-113769 程序数据集代码问题:修改WebService程序数据集帮助文档中的示例代码 10 months ago
Bruce.Deng-邓铖臻 e47c617a34 Pull request #66: REPORT-109627 导出api使用maven引入jar版本问题 1 year ago
Bruce.Deng 7c9d423df1 REPORT-109627 导出api使用maven引入jar版本问题 1 year ago
kerry-王周勇 1393efc5f7 Pull request #62: REPORT-96002【来源客户BUG REPORT-94898】FR11程序网络报表的demo类,更新文档和demo代码 2 years ago
kerry ee67e4df63 REPORT-96002【来源客户BUG REPORT-94898】FR11程序网络报表的demo类,更新文档和demo代码 2 years ago
  1. 3
      plugin.xml
  2. 10
      pom.xml
  3. 9
      readme.md
  4. 79
      src/main/java/com/fr/data/WebServiceTableData.java
  5. 14
      src/main/java/com/fr/demo/SimpleReportletDemoFrm.java

3
plugin.xml

@ -4,12 +4,13 @@
<name><![CDATA[文档demo代码集成]]></name> <name><![CDATA[文档demo代码集成]]></name>
<active>yes</active> <active>yes</active>
<hidden>no</hidden> <hidden>no</hidden>
<version>1.1.1</version> <version>1.1.2</version>
<env-version>10.0~</env-version> <env-version>10.0~</env-version>
<jartime>2018-08-02</jartime> <jartime>2018-08-02</jartime>
<vendor>finereport</vendor> <vendor>finereport</vendor>
<description><![CDATA[集成帮助文档中的demo代码]]></description> <description><![CDATA[集成帮助文档中的demo代码]]></description>
<change-notes><![CDATA[ <change-notes><![CDATA[
[2023-11-28] 插件适配11<br>
[2018-01-25] 发布。<br> [2018-01-25] 发布。<br>
[2018-08-02] 插件适配10 [2018-08-02] 插件适配10
]]></change-notes> ]]></change-notes>

10
pom.xml

@ -3,10 +3,10 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.fr.plugin</groupId> <groupId>com.fr.plugin</groupId>
<artifactId>starter</artifactId> <artifactId>starter</artifactId>
<version>10.0</version> <version>11.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<common-version>10.0-RELEASE-SNAPSHOT</common-version> <common-version>11.0-RELEASE-SNAPSHOT</common-version>
<web-inf-bucket>${project.basedir}/webroot/WEB-INF</web-inf-bucket> <web-inf-bucket>${project.basedir}/webroot/WEB-INF</web-inf-bucket>
</properties> </properties>
<dependencies> <dependencies>
@ -28,6 +28,12 @@
<version>${common-version}</version> <version>${common-version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.fr.cbb</groupId>
<artifactId>fine-cbb</artifactId>
<version>${common-version}</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>com.fr.webui</groupId> <groupId>com.fr.webui</groupId>
<artifactId>fine-webui</artifactId> <artifactId>fine-webui</artifactId>

9
readme.md

@ -19,8 +19,7 @@
## 修改依赖的jar版本 ## 修改依赖的jar版本
只需要更改pom.xml中的common-version属性即可。 只需要更改pom.xml中的common-version属性即可。
|common-version|含义| | common-version | 含义 |
|--------------|----| |-----------------------|-------------|
|10.0-RELEASE-SNAPSHOT|10.0的测试版本快照| | 11.0-RELEASE-SNAPSHOT | 11.0的测试版本快照 |
|10.0-SNAPSHOT|10.0的正式版本快照| | 11.0-PERSIST-SNAPSHOT | 11.0的正式版本快照 |
|10.0|10.0的正式版本|

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

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

14
src/main/java/com/fr/demo/SimpleReportletDemoFrm.java

@ -1,16 +1,15 @@
package com.fr.demo; package com.fr.demo;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.fr.form.main.DashboardTemplate;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.FormIO; import com.fr.form.main.FormIO;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.web.weblet.Formlet; import com.fr.web.weblet.Formlet;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
public class SimpleReportletDemoFrm extends Formlet { public class SimpleReportletDemoFrm extends Formlet {
@Override @Override
public void setParameterMap(Map arg0) { public void setParameterMap(Map arg0) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
@ -18,17 +17,20 @@ public class SimpleReportletDemoFrm extends Formlet {
} }
@Override @Override
protected Form createForm(HttpServletRequest request) throws Exception { protected DashboardTemplate createDashboard(HttpServletRequest req) throws Exception {
Form form = null; Form form = null;
//模板的相对路径 //模板的相对路径
String tplPath = "//doc//frm//决策报表入门.frm"; String tplPath = "//doc//frm//决策报表入门.frm";
this.setTplPath(tplPath); this.setTplPath(tplPath);
try { try {
form = FormIO.readForm(tplPath); form = FormIO.readForm(tplPath);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return form; return form;
} }
}
}

Loading…
Cancel
Save