Browse Source

无JIRA任务 将文档示例代码上传doc插件

persist/10.0
zack 6 years ago
parent
commit
4cef0ea288
  1. 27
      README.md
  2. BIN
      lib/report/finereport10.0_jar_openjdk1.8 (4).zip
  3. 66
      lib/report/jarfile-checksum.txt
  4. 0
      plugin-report-doc-demo/lib/report/.gitkeep
  5. 24
      plugin-report-doc-demo/plugin.xml
  6. 26
      plugin-report-doc-demo/readme.md
  7. 84
      plugin-report-doc-demo/src/com/fr/data/DataModelDemo.java
  8. 70
      plugin-report-doc-demo/src/com/fr/data/GetXmlDate.java
  9. 158
      plugin-report-doc-demo/src/com/fr/data/ParamTableDataDemo.java
  10. 58
      plugin-report-doc-demo/src/com/fr/data/WebServiceTableData.java
  11. 202
      plugin-report-doc-demo/src/com/fr/data/XMLDemoTableData.java
  12. 226
      plugin-report-doc-demo/src/com/fr/data/XMLParseDemoDataModel.java
  13. 115
      plugin-report-doc-demo/src/com/fr/data/XMLRead.java
  14. 40
      plugin-report-doc-demo/src/com/fr/demo/NewDateDemo.java
  15. 65
      plugin-report-doc-demo/src/com/fr/demo/ReadFromDatabase.java
  16. 50
      plugin-report-doc-demo/src/com/fr/demo/SaveReportToDatabase.java
  17. 42
      plugin-report-doc-demo/src/com/fr/demo/SimpleReportletDemo.java
  18. 86
      plugin-report-doc-demo/src/com/fr/function/JFreeToChart.java
  19. 19
      plugin-report-doc-demo/src/com/fr/function/StringCat.java
  20. 73
      plugin-report-doc-demo/src/com/fr/function/StringImage.java
  21. 25
      plugin-report-doc-demo/src/com/fr/io/ExcelToCpt.java
  22. 106
      plugin-report-doc-demo/src/com/fr/io/ExportApi.java
  23. 73
      plugin-report-doc-demo/src/com/fr/openapi/remote/TemplateRead.java
  24. 76
      plugin-report-doc-demo/src/com/fr/output/FTPUpload.java
  25. 100
      plugin-report-doc-demo/src/com/fr/output/OutputExcel.java
  26. 15
      plugin-report-doc-demo/src/com/fr/plugin/core/MyLocaleFinder.java
  27. 18
      plugin-report-doc-demo/src/com/fr/plugin/core/secondary/ResourcePathTransformerImpl.java
  28. 23
      plugin-report-doc-demo/src/com/fr/plugin/core/secondary/SiteTransformerImpl.java
  29. 16
      plugin-report-doc-demo/src/main/java/com/fr/learn/Leaner.java
  30. 8
      plugin-report-doc-demo/src/main/java/com/fr/learn/Learner4Debug.java
  31. 45
      src/com/fr/data/ArrayTableDataDemo.java
  32. 133
      src/com/fr/data/Commit3.java
  33. 51
      src/com/fr/data/CustomTableData.java
  34. 51
      src/com/fr/data/DemoSubmitJob1.java
  35. 64
      src/com/fr/data/DemoSubmitJob2.java
  36. 59
      src/com/fr/data/DemoTotalSubmitJob.java
  37. 81
      src/com/fr/data/GetXmlData.java
  38. 114
      src/com/fr/data/MobileTableWsdlDataDemo.java
  39. 147
      src/com/fr/data/MobileWsdlTableDataDemo.java
  40. 105
      src/com/fr/data/MobileWsdlTableDataDemo1.java
  41. 65
      src/com/fr/data/MobileWsdlTableDataDemo2.java
  42. 114
      src/com/fr/data/MobileWsdlTableDataDemoPara.java
  43. 112
      src/com/fr/data/ParamSAPDataTest.java
  44. 69
      src/com/fr/data/WebServiceWsdlTableDataDemo2.java
  45. 27
      src/com/fr/data/XMLColumnNameType4Demo.java
  46. 126
      src/com/fr/data/impl/Commit1.java
  47. 131
      src/com/fr/data/impl/Commit3.java
  48. 79
      src/com/fr/demo/ChangeRowAndCol.java
  49. 50
      src/com/fr/demo/CreateReportletDemo.java
  50. 50
      src/com/fr/demo/SaveReportToDatabase.java
  51. 71
      src/com/fr/demo/SetCellElementStyle.java
  52. 55
      src/com/fr/demo/TotalVerifyJobDemo.java
  53. 53
      src/com/fr/demo/URLParameterDemo.java
  54. 68
      src/com/fr/demo/VerifyJobDemo.java
  55. 91
      src/com/fr/function/BinaryImage.java
  56. 15
      src/com/fr/function/CellSum.java
  57. 58
      src/com/fr/function/ConnectSAPServer.java
  58. 67
      src/com/fr/function/FlagHtmlColor.java
  59. 23
      src/com/fr/function/GETIP.java
  60. 15
      src/com/fr/function/Lunar.java
  61. 40
      src/com/fr/function/ParamSAPDataTest.java
  62. 105
      src/com/fr/function/ReportCheck.java
  63. 381
      src/com/fr/function/SolarToLunar.java
  64. 19
      src/com/fr/function/StringCat.java
  65. 73
      src/com/fr/function/StringImage.java
  66. 45
      src/com/fr/function/SubSection.java
  67. 25
      src/com/fr/function/Ubm.java
  68. 35
      src/com/fr/function/Upc.java
  69. 105
      src/com/fr/function/Widget2Image.java
  70. 25
      src/com/fr/io/ExcelToCpt.java
  71. 46
      src/com/fr/io/ExcelToCptpage.java
  72. 66
      src/com/fr/io/ExcuteDemo.java
  73. 91
      src/com/fr/io/ExportBatch.java
  74. 88
      src/com/fr/io/ExportExcel.java
  75. 58
      src/com/fr/io/ExportReports.java
  76. 36
      src/com/fr/io/JavaPrint.java
  77. 78
      src/com/fr/io/SetParameterWindow.java
  78. 71
      src/com/fr/io/SimpleDemo.java
  79. 12
      src/com/fr/log/LogApi.java
  80. 76
      src/com/fr/output/FTPUpload.java
  81. 100
      src/com/fr/output/OutputExcel.java
  82. 26
      src/com/fr/plugin/chart/IndependentChartProviderImpl.java
  83. 22
      src/com/fr/plugin/chart/IndependentChartUIProviderImpl.java
  84. 23
      src/com/fr/plugin/core/ActionCMDImpl.java
  85. 18
      src/com/fr/plugin/core/AttachmentDownloaderImpl.java
  86. 18
      src/com/fr/plugin/core/CellValueProcessorImpl.java
  87. 10
      src/com/fr/plugin/core/CssFileHandlerImpl.java
  88. 7
      src/com/fr/plugin/core/DebugLogProviderImpl.java
  89. 18
      src/com/fr/plugin/core/DialectCreatorImpl.java
  90. 13
      src/com/fr/plugin/core/EmailProcessorImpl.java
  91. 11
      src/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java
  92. 6
      src/com/fr/plugin/core/ExcelExportProcessorImpl.java
  93. 10
      src/com/fr/plugin/core/FunctionDefineProviderImpl.java
  94. 13
      src/com/fr/plugin/core/GraphDrawProcessorImpl.java
  95. 10
      src/com/fr/plugin/core/HttpAuthProcessorImpl.java
  96. 10
      src/com/fr/plugin/core/JavaScriptFileHandlerImpl.java
  97. 25
      src/com/fr/plugin/core/LogDBRecordProcessorImpl.java
  98. 6
      src/com/fr/plugin/core/LogProviderImpl.java
  99. 12
      src/com/fr/plugin/core/PrintCellValueProviderImpl.java
  100. 33
      src/com/fr/plugin/core/RequestParameterCollectorImpl.java
  101. Some files were not shown because too many files have changed in this diff Show More

27
README.md

@ -1,3 +1,26 @@
# 文档demo代码插件 # 工程配置指南
## 只是为了验证文档demo代码是否能够编译,插件本身无任何作用。 ## 安装maven
用于构建开发工程,文档参考:http://wiki.jikexueyuan.com/project/maven/environment-setup.html
## 安装ant
用于构建插件安装包,文档参考:http://wiki.jikexueyuan.com/project/ant/environment-setup.html
## 配置开发工程
直接使用IntelliJ IDEA打开这个目录即可。
如果需要复制jar包到webroot/WEB-INF/lib下,可以执行命令:```mvn install```
## 启动设计器
如果希望正常的进行插件开发,使用```com.fr.learn.Leaner```启动设计器。
如果希望进行设计器调试,则使用```com.fr.learn.Leaner4Debug```启动设计器。
## 修改依赖的jar版本
只需要更改pom.xml中的common-version属性即可。
|common-version|含义|
|--------------|----|
|10.0-RELEASE-SNAPSHOT|10.0的测试版本快照|
|10.0-SNAPSHOT|10.0的正式版本快照|
|10.0|10.0的正式版本|

BIN
lib/report/finereport10.0_jar_openjdk1.8 (4).zip

Binary file not shown.

66
lib/report/jarfile-checksum.txt

@ -0,0 +1,66 @@
2019.05.13.10.06.19.145
fine-activator-10.0.jar:
md5: E828716332418D06CE49B37258A2350F
sha1: 172FE266DE7D225ACC8B0AED422FD3575112AF0A
sha256: 6B8013B0ED49D74B32145A629C8E1ACA16B29C878F08BF283B5EDEA954A1D743
fine-report-engine-10.0.jar:
md5: 83CE5DA622F48BEBEE13C5241836D63D
sha1: 4DB9CFE12A7E0613CDD487C43ED9E66D72191EFE
sha256: C33445E5476EDA90FC0A9AA4FCE12475F4722A8C5A011ACADEAA78DD0B9021AF
fine-decision-10.0.jar:
md5: C24FE72252925ADC5E3C4B96595D426E
sha1: B70E52E4F0FD4D63032AB6388EE2061F658FC8A3
sha256: 9931C71C23260345F2553AF56D471B9A714D400599E9DBB09CF581AC218D3FEF
fine-schedule-report-10.0.jar:
md5: F6C1EA00AE1D1C43BA109623D903C249
sha1: 3344068CC5F80371822BAC1969BB42D5876FC604
sha256: 6BAF89CEA65DF28A39870DB51C428A94DC3429DDC58936447EFB1A4FD6EE76D2
fine-accumulator-10.0.jar:
md5: 804BC008D4F6C42CCB67CA3F2C75D17C
sha1: 722B13912C4C1EE20558E2F080580BA4DEB601F4
sha256: 0FF0F2F27A3B14763DA0797C13DC2DBB1BDFAC078B6C851DC0DA024EE681AC31
fine-datasource-10.0.jar:
md5: 799981EDF0AD4C456BEFCA656FEE3B42
sha1: B18BCC80250E6EA551EADC424D6154C8DB8EFCDB
sha256: 336C134008B4988AC220DC59886A582CB317DD1422292BC3F58B2AE78A8CF6A6
fine-third-10.0.jar:
md5: 101845D814038520CAE85D9B830722A0
sha1: BB5C1848C064B39A9A6E843AD59DE4E12887F602
sha256: 67D59E45B2A0C6248726BBFD2B3457F2AF137E68A499408CB24490E544E7A885
fine-decision-report-10.0.jar:
md5: 24A08C7BB5A3145D9B2BB8093564B7EE
sha1: E06CAD71E6DAAA1E5207608AA6C420A102AA067E
sha256: F8B949AA10EAFB9A7C2887D584B082DB040611343C9EF422D619590FCFE98690
fine-webui-10.0.jar:
md5: 24DEA1184A0568C1408F3575CA6EB009
sha1: D4D0248C46D2BA00613DAACB1C3D2A5E6CA83B46
sha256: 20BF932B52DD0C6887886B067183A63706AC51D8082F58031A687A5D6E5D3DEE
fine-schedule-10.0.jar:
md5: 71688380E36E66D4E099C40C07AC5C2B
sha1: 51E2104F97E3232712256D20CEC732E6CB84F49F
sha256: 4AF2F6B2AAE5CBEDD9BA2F591BB0082BC12F309A4A1DE6409D881A0798AA2CBE
fine-core-10.0.jar:
md5: E314C8AF61CFC114034BA616286FFC78
sha1: 3E4B3227FF225E849176844A97F2A7EB292569A8
sha256: 4D57691E3963739651BF2FE9FEA9D82180765A900A3B7AAFE8383340A71034C5
fine-report-designer-10.0.jar:
md5: CE43A1D12E9E838ED9EF145F76B5E7F5
sha1: A103E9CC7D217FE889FC6B25AA121C02FB69D4F1
sha256: 84B7D8A3602AB952CA5C74584CEC8CE4D85F03999BD788F3E2FAC9F440A3FCAC
fine-swift-log-adaptor-10.0.jar:
md5: 1FF70C228CEC0133E5CA38193E328107
sha1: 76D1DEFF0AA44F350A0B5F7242DD32601448F60D
sha256: BF4AFBD00E91FCBEDAC950F993D39524BC46433F00940E95DEBB2A469E1AB052

0
plugin-report-doc-demo/lib/report/.gitkeep

24
plugin-report-doc-demo/plugin.xml

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plugin>
<id>com.fr.plugin.doc.demo.v10</id>
<name><![CDATA[文档demo代码集成]]></name>
<active>yes</active>
<hidden>no</hidden>
<version>1.2</version>
<env-version>10.0~</env-version>
<jartime>2018-08-02</jartime>
<vendor>finereport</vendor>
<description><![CDATA[集成帮助文档中的demo代码]]></description>
<change-notes><![CDATA[
[2018-01-25] 发布。<br>
[2018-08-02] 插件适配10
]]></change-notes>
<function-recorder class="com.fr.plugin.core.MyLocaleFinder"/>
<extra-core>
<SiteTransformer class="com.fr.plugin.core.secondary.SiteTransformerImpl"/>
</extra-core>
<extra-designer>
</extra-designer>
</plugin>

26
plugin-report-doc-demo/readme.md

@ -1,26 +0,0 @@
# 工程配置指南
## 安装maven
用于构建开发工程,文档参考:http://wiki.jikexueyuan.com/project/maven/environment-setup.html
## 安装ant
用于构建插件安装包,文档参考:http://wiki.jikexueyuan.com/project/ant/environment-setup.html
## 配置开发工程
直接使用IntelliJ IDEA打开这个目录即可。
如果需要复制jar包到webroot/WEB-INF/lib下,可以执行命令:```mvn install```
## 启动设计器
如果希望正常的进行插件开发,使用```com.fr.learn.Leaner```启动设计器。
如果希望进行设计器调试,则使用```com.fr.learn.Leaner4Debug```启动设计器。
## 修改依赖的jar版本
只需要更改pom.xml中的common-version属性即可。
|common-version|含义|
|--------------|----|
|10.0-RELEASE-SNAPSHOT|10.0的测试版本快照|
|10.0-SNAPSHOT|10.0的正式版本快照|
|10.0|10.0的正式版本|

84
plugin-report-doc-demo/src/com/fr/data/DataModelDemo.java

@ -1,84 +0,0 @@
package com.fr.data;
import examples.ejb.ejb20.basic.beanManaged.Account;
import examples.ejb.ejb20.basic.beanManaged.AccountHome;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
/**
* @author fanruan
*/
public class DataModelDemo extends AbstractTableData {
private String[] columnNames;
private ArrayList valueList = null;
public DataModelDemo() {
String[] columnNames = {"Name", "Score"};
this.columnNames = columnNames;
}
// 实现其他四个方法
@Override
public int getColumnCount() {
return columnNames.length;
}
@Override
public String getColumnName(int columnIndex) {
return columnNames[columnIndex];
}
@Override
public int getRowCount() {
init();
return valueList.size();
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
init();
return ((Object[]) valueList.get(rowIndex))[columnIndex];
}
// 准备数据
public void init() {
// 确保只被执行一次
if (valueList != null) {
return;
}
// 保存得到的结果集
valueList = new ArrayList();
Context ctx = null;
Account ac = null;
AccountHome home = null;
try {
// Contact the AccountBean container (the "AccountHome") through
// JNDI.
ctx = new InitialContext();
home = (AccountHome) ctx
.lookup("java:/comp/env/BeanManagedAccountEJB");
double balanceGreaterThan = 100;
Collection col = home.findBigAccounts(balanceGreaterThan);
if (col != null) {
// 用对象保存数据
Object[] objArray = null;
Iterator iter = col.iterator();
while (iter.hasNext()) {
Account bigAccount = (Account) iter.next();
objArray = new Object[2];
objArray[0] = bigAccount.getPrimaryKey();
objArray[1] = bigAccount.balance();
// 在valueList中加入这一行数据
valueList.add(objArray);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}

70
plugin-report-doc-demo/src/com/fr/data/GetXmlDate.java

@ -1,70 +0,0 @@
package com.fr.data;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLableReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
public class GetXmlDate {
// 定义返回值数组
private String[] Value = new String[3];
// 定义查询的name值
private String[] Name = null;
protected String[] readerXMLSource(InputStream in, String[] name)
throws Exception {
Name = name;
InputStreamReader reader = new InputStreamReader(in, "utf-8");
readXMLSource(reader);
return Value;
}
protected void readXMLSource(Reader reader) throws Exception {
XMLableReader xmlReader = XMLableReader.createXMLableReader(reader);
if (xmlReader != null) {
xmlReader.readXMLObject(new Content());
}
}
private class Content implements XMLReadable {
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
if (reader.getTagName().equals("Field")) {
Field field = new Field();
reader.readXMLObject(field);
// 获得name对应的value值
if (Name[0].equals(field.name)) {
Value[0] = field.value;
} else if (Name[1].equals(field.name)) {
Value[1] = field.value;
} else if (Name[2].equals(field.name)) {
Value[2] = field.value;
}
}
}
}
}
// 定义每个field的结构
private class Field implements XMLReadable {
private String name;
private String type;
private String value;
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
String tagName = reader.getTagName();
if (tagName.equals("Name")) {
this.name = reader.getElementValue();
} else if (tagName.equals("Type")) {
this.type = reader.getElementValue();
} else if (tagName.equals("Value")) {
this.value = reader.getElementValue();
}
}
}
}
}

158
plugin-report-doc-demo/src/com/fr/data/ParamTableDataDemo.java

@ -1,158 +0,0 @@
package com.fr.data;
import com.fr.base.FRContext;
import com.fr.file.DatasourceManager;
import com.fr.stable.ParameterProvider;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.util.ArrayList;
/**
* 带参数的程序数据集Demo
*
* @author fanruan
*/
public class ParamTableDataDemo extends AbstractTableData {
/**
* 列名数组保存程序数据集所有列名
*/
private String[] columnNames;
/**
* 定义程序数据集的列数量
*/
private int columnNum = 10;
/**
* 保存查询表的实际列数量
*/
private int colNum = 0;
/**
* 保存查询得到列值
*/
private ArrayList valueList = null;
/**
* 构造函数定义表结构该表有10个数据列列名为column#0column#1column#9
*/
public ParamTableDataDemo() {
columnNames = new String[columnNum];
for (int i = 0; i < columnNum; i++) {
columnNames[i] = "column#" + String.valueOf(i);
}
}
/**
* 实现其他四个方法
*
* @return columnNum
*/
@Override
public int getColumnCount() {
return columnNum;
}
@Override
public String getColumnName(int columnIndex) {
return columnNames[columnIndex];
}
@Override
public int getRowCount() {
init();
return valueList.size();
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
init();
if (columnIndex >= colNum) {
return null;
}
return ((Object[]) valueList.get(rowIndex))[columnIndex];
}
/**
* 准备数据
*/
private void init() {
// 确保只被执行一次
if (valueList != null) {
return;
}
// 保存得到的数据库表名
String tableName = ((ParameterProvider) (parameters.get().toArray())[0]).getValue().toString();
// 构造SQL语句,并打印出来
String sql = "select * from " + tableName;
FRContext.getLogger().info("Query SQL of ParamTableDataDemo: \n" + sql);
// 保存得到的结果集
valueList = new ArrayList();
// 下面开始建立数据库连接,按照刚才的SQL语句进行查询
com.fr.data.impl.Connection conn = DatasourceManager.getInstance().getConnection("FRDemo");
try {
Connection con = conn.createConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
// 获得记录的详细信息,然后获得总列数
ResultSetMetaData rsmd = rs.getMetaData();
colNum = rsmd.getColumnCount();
// 用对象保存数据
Object[] objArray = null;
while (rs.next()) {
objArray = new Object[colNum];
for (int i = 0; i < colNum; i++) {
objArray[i] = rs.getObject(i + 1);
}
// 在valueList中加入这一行数据
valueList.add(objArray);
}
// 释放数据库资源
rs.close();
stmt.close();
con.close();
// 打印一共取到的数据行数量
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取数据库连接 driverName和 url 可以换成您需要的
*
* @return Connection
*/
public Connection getConnection() {
String driverName = "org.sqlite.JDBC";
String url = "jdbc:sqlite://E:\\8.0-master\\env\\WebReport\\FRDemo.db";
String username = "";
String password = "";
Connection con;
try {
Class.forName(driverName);
con = DriverManager.getConnection(url, username, password);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return con;
}
/**
* 释放一些资源因为可能会有重复调用所以需释放valueList将上次查询的结果释放掉
*
* @throws Exception e
*/
@Override
public void release() throws Exception {
super.release();
this.valueList = null;
}
}

58
plugin-report-doc-demo/src/com/fr/data/WebServiceTableData.java

@ -1,58 +0,0 @@
package com.fr.data;
import com.fr.general.data.TableDataException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
public class WebServiceTableData extends AbstractTableData {
private String[][] data;
public WebServiceTableData() {
this.data = this.getWebServiceTableData();
}
//获取列数
@Override
public int getColumnCount() throws TableDataException {
return data[0].length;
}
//获取列的名称为数组中第一行的值
@Override
public String getColumnName(int columnIndex) throws TableDataException {
return data[0][columnIndex];
}
//获取行数为数据的长度-1
@Override
public int getRowCount() throws TableDataException {
return data.length - 1;
}
//获取值
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return data[rowIndex + 1][columnIndex];
}
public String[][] getWebServiceTableData() {
try {
String endpoint = "http://localhost:8080/axis/TestWS2TDClient.jws";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://localhost:8080/axis/TestWS2TDClient.jws",
"getTD"));
return (String[][]) call.invoke(new Object[]{});
} catch (Exception e) {
e.printStackTrace();
}
return new String[][]{};
}
}

202
plugin-report-doc-demo/src/com/fr/data/XMLDemoTableData.java

@ -1,202 +0,0 @@
package com.fr.data;
import com.fr.base.Parameter;
import com.fr.config.holder.impl.xml.XmlColConf;
import com.fr.general.data.DataModel;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* XMLDemoTableData
* <p>
* 这是一个按参数来解析不同地址XML文件的demo
* <p>
* AbstractParameterTableData 包装了有参数数据集的基本实现
*/
public class XMLDemoTableData extends AbstractParameterTableData {
// 构造函数
public XMLDemoTableData() {
// 定义需要的参数,这里定义一个参数,参数名为filename,给其一个默认值"Northwind.xml"
this.parameters = new XmlColConf<Collection<ParameterProvider>>(new ArrayList(), ParameterProvider.class);
parameters.add(new Parameter("filename", "Northwind"));
}
/**
* 返回获取数据的执行对象
* 系统取数时调用此方法来返回一个获取数据的执行对象
* 注意 当数据集需要根据不同参数来多次取数时此方法在一个计算过程中会被多次调用
*/
@SuppressWarnings("unchecked")
public DataModel createDataModel(Calculator calculator) {
// 获取传进来的参数
ParameterProvider[] params = super.processParameters(calculator);
// 根据传进来的参数,等到文件的路径
String filename = null;
for (int i = 0; i < params.length; i++) {
if (params[i] == null) continue;
if ("filename".equals(params[i].getName())) {
filename = (String) params[i].getValue();
}
}
String filePath;
if (StringUtils.isBlank(filename)) {
filePath = "D://DefaultFile.xml";
} else {
filePath = "D://" + filename + ".xml";
}
// 定义需要解析的数据列,机器
// XMLColumnNameType4Demo[] columns = new XMLColumnNameType4Demo[7];
// columns[0] = new XMLColumnNameType4Demo("CustomerID", XMLParseDemoDataModel.COLUMN_TYPE_STRING);
// columns[1] = new XMLColumnNameType4Demo("CompanyName", XMLParseDemoDataModel.COLUMN_TYPE_STRING);
// columns[2] = new XMLColumnNameType4Demo("ContactName", XMLParseDemoDataModel.COLUMN_TYPE_STRING);
// columns[3] = new XMLColumnNameType4Demo("ContactTitle", XMLParseDemoDataModel.COLUMN_TYPE_STRING);
// columns[4] = new XMLColumnNameType4Demo("Address", XMLParseDemoDataModel.COLUMN_TYPE_STRING);
// columns[5] = new XMLColumnNameType4Demo("City", XMLParseDemoDataModel.COLUMN_TYPE_STRING);
// columns[6] = new XMLColumnNameType4Demo("Phone", XMLParseDemoDataModel.COLUMN_TYPE_STRING);
List list = new ArrayList();
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
InputStream in;
try {
in = new BufferedInputStream(new FileInputStream(new File(filePath)));
XMLEventReader reader = inputFactory.createXMLEventReader(in);
readCol(reader, list);
in.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
XMLColumnNameType4Demo[] columns = (XMLColumnNameType4Demo[]) list.toArray(new XMLColumnNameType4Demo[0]);
// 定义解析的数据在xml文件结构中的位置
String[] xpath = new String[2];
xpath[0] = "Northwind";
xpath[1] = "Customers";
/*
* 说明
* 提供的样例xml文件的格式是
* <Notrhwind>
* <Customers>
* <CustomerID>ALFKI</CustomerID>
* <CompanyName>Alfreds Futterkiste</CompanyName>
* <ContactName>Maria Anders</ContactName>
* <ContactTitle>Sales Representative</ContactTitle>
* <Address>Obere Str. 57</Address>
* <City>Berlin</City>
* <PostalCode>12209</PostalCode>
* <Country>Germany</Country>
* <Phone>030-0074321</Phone>
* <Fax>030-0076545</Fax>
* </Customers>
* </Northwind>
*
* 上面定义的意义就是
* /Northwind/Customers路径所表示的一个Customers节点为一条数据它包含的节点中的CustomerID...等等是需要获取的列值
*/
// 构造一个实际去取值的执行对象
return new XMLParseDemoDataModel(filePath, xpath, columns);
}
private int deep = 0;
private static final int COL_DEEP = 3;
private boolean flag = false;
private void readCol(XMLEventReader reader, List list)
throws XMLStreamException {
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
//deep是控制层数的,只把xml中对应的层的加入到列名中
deep++;
//表示已经进入到了列名那一层
if (deep == COL_DEEP) {
flag = true;
}
//如果在高层,并且已经进入到了col层,则退出
if (deep < COL_DEEP && flag) {
return;
}
if (deep != COL_DEEP) {
continue;
}
// println("name: " + event.asStartElement().getName());
XMLColumnNameType4Demo column = new XMLColumnNameType4Demo(event.asStartElement().getName().toString(), XMLParseDemoDataModel.COLUMN_TYPE_STRING);
list.add(column);
readCol(reader, list);
} else if (event.isCharacters()) {
//对数据值不做处理
} else if (event.isEndElement()) {
deep--;
return;
}
}
}
private void readCol0(XMLEventReader reader)
throws XMLStreamException {
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
//deep是控制层数的,只把xml中对应的层的加入到列名中
deep++;
//表示已经进入到了列名那一层
if (deep == COL_DEEP) {
flag = true;
}
//如果在高层,并且已经进入到了col层,则退出
if (deep < COL_DEEP && flag) {
return;
}
if (deep != COL_DEEP) {
continue;
}
System.out.println("name: " + event.asStartElement().getName());
readCol0(reader);
} else if (event.isCharacters()) {
//对数据值不做处理
} else if (event.isEndElement()) {
deep--;
return;
}
}
}
public static void main(String[] args) {
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
// in = new FileReader(new File(filePath));
// XMLEventReader reader = inputFactory.createXMLEventReader(in);
// readCol(reader,list);
BufferedInputStream in;
try {
in = new BufferedInputStream(new FileInputStream(new File("D:/tmp/f.xml")));
byte[] ba = new byte[3];
in.read(ba, 0, 3);
// System.out.println(in)
XMLEventReader reader = inputFactory.createXMLEventReader(in);
new XMLDemoTableData().readCol0(reader);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

226
plugin-report-doc-demo/src/com/fr/data/XMLParseDemoDataModel.java

@ -1,226 +0,0 @@
package com.fr.data;
import com.fr.base.FRContext;
import com.fr.general.ComparatorUtils;
import com.fr.general.data.TableDataException;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* XMLParseDemoDataModel
* <p>
* DataModel是获取数据的接口
* <p>
* 这里通过init方法一次性取数后构造一个二维表对象来实现DataModel的各个取数方法
*/
public class XMLParseDemoDataModel extends AbstractDataModel {
// 数据类型标识
public static final int COLUMN_TYPE_STRING = 0;
public static final int COLUMN_TYPE_INTEGER = 1;
public static final int COLUMN_TYPE_BOOLEAN = 2;
// 缓存取出来的数据
protected List row_list = null;
// 数据对应的节点路径
private String[] xPath;
// 节点路径下包含的需要取数的节点
private XMLColumnNameType4Demo[] columns;
private String filePath;
public XMLParseDemoDataModel(String filename, String[] xPath,
XMLColumnNameType4Demo[] columns) {
this.filePath = filename;
this.xPath = xPath;
this.columns = columns;
}
/**
* 取出列的数量
*/
public int getColumnCount() throws TableDataException {
return columns.length;
}
/**
* 取出相应的列的名称
*/
public String getColumnName(int columnIndex) throws TableDataException {
if (columnIndex < 0 || columnIndex >= columns.length)
return null;
String columnName = columns[columnIndex] == null ? null
: columns[columnIndex].getName();
return columnName;
}
/**
* 取出得到的结果集的总的行数
*/
public int getRowCount() throws TableDataException {
this.init();
return row_list.size();
}
/**
* 取出相应位置的值
*/
public Object getValueAt(int rowIndex, int columnIndex)
throws TableDataException {
this.init();
if (rowIndex < 0 || rowIndex >= row_list.size() || columnIndex < 0
|| columnIndex >= columns.length)
return null;
return ((Object[]) row_list.get(rowIndex))[columnIndex];
}
/**
* 释放一些资源取数结束后调用此方法来释放资源
*/
public void release() throws Exception {
if (this.row_list != null) {
this.row_list.clear();
this.row_list = null;
}
}
/** ************************************************** */
/** ***********以上是实现DataModel的方法*************** */
/** ************************************************** */
/** ************************************************** */
/** ************以下为解析XML文件的方法**************** */
/**
* *************************************************
*/
// 一次性将数据取出来
protected void init() throws TableDataException {
if (this.row_list != null)
return;
this.row_list = new ArrayList();
try {
// 使用SAX解析XML文件, 使用方法请参见JAVA SAX解析
SAXParserFactory f = SAXParserFactory.newInstance();
SAXParser parser = f.newSAXParser();
parser.parse(new File(XMLParseDemoDataModel.this.filePath),
new DemoHandler());
} catch (Exception e) {
e.printStackTrace();
FRContext.getLogger().error(e.getMessage(), e);
}
}
/**
* 基本原理就是解析器在遍历文件时 发现节点开始标记时调用startElement方法 读取节点内部内容时调用characters方法
* 发现节点结束标记时调用endElement
*/
private class DemoHandler extends DefaultHandler {
private List levelList = new ArrayList(); // 记录当前节点的路径
private Object[] values; // 缓存一条记录
private int recordIndex = -1; // 当前记录所对应的列的序号,-1表示不需要记录
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
// 记录下
levelList.add(qName);
if (isRecordWrapTag()) {
// 开始一条新数据的记录
values = new Object[XMLParseDemoDataModel.this.columns.length];
} else if (needReadRecord()) {
// 看看其对应的列序号,下面的characters之后执行时,根据这个列序号来设置值存放的位置。
recordIndex = getColumnIndex(qName);
}
}
public void characters(char[] ch, int start, int length)
throws SAXException {
if (recordIndex > -1) {
// 读取值
String text = new String(ch, start, length);
XMLColumnNameType4Demo type = XMLParseDemoDataModel.this.columns[recordIndex];
Object value = null;
if (type.getType() == COLUMN_TYPE_STRING) {
value = text;
}
if (type.getType() == COLUMN_TYPE_INTEGER) {
value = new Integer(text);
} else if (type.getType() == COLUMN_TYPE_BOOLEAN) {
value = new Boolean(text);
}
values[recordIndex] = value;
}
}
public void endElement(String uri, String localName, String qName)
throws SAXException {
try {
if (isRecordWrapTag()) {
// 一条记录结束,就add进list中
XMLParseDemoDataModel.this.row_list.add(values);
values = null;
} else if (needReadRecord()) {
recordIndex = -1;
}
} finally {
levelList.remove(levelList.size() - 1);
}
}
// 正好匹配路径,确定是记录外部的Tag
private boolean isRecordWrapTag() {
if (levelList.size() == XMLParseDemoDataModel.this.xPath.length
&& compareXPath()) {
return true;
}
return false;
}
// 需要记录一条记录
private boolean needReadRecord() {
if (levelList.size() == (XMLParseDemoDataModel.this.xPath.length + 1)
&& compareXPath()) {
return true;
}
return false;
}
// 是否匹配设定的XPath路径
private boolean compareXPath() {
String[] xPath = XMLParseDemoDataModel.this.xPath;
for (int i = 0; i < xPath.length; i++) {
if (!ComparatorUtils.equals(xPath[i], levelList.get(i))) {
return false;
}
}
return true;
}
// 获取该字段的序号
private int getColumnIndex(String columnName) {
XMLColumnNameType4Demo[] nts = XMLParseDemoDataModel.this.columns;
for (int i = 0; i < nts.length; i++) {
if (ComparatorUtils.equals(nts[i].getName(), columnName)) {
return i;
}
}
return -1;
}
}
}

115
plugin-report-doc-demo/src/com/fr/data/XMLRead.java

@ -1,115 +0,0 @@
package com.fr.data;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
/**
* @author fanruan
*/
public class XMLRead extends AbstractTableData {
/**
* 列名数组保存程序数据集所有列名
*/
private String[] columnNames = {"id", "name", "MemoryFreeSize",
"MemoryTotalSize", "MemoryUsage"};
/**
* 保存表数据
*/
private ArrayList valueList = null;
@Override
public int getColumnCount() {
return 5;
}
@Override
public String getColumnName(int columnIndex) {
return columnNames[columnIndex];
}
@Override
public int getRowCount() {
init();
return valueList.size();
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
init();
return ((Object[]) valueList.get(rowIndex))[columnIndex];
}
private void init() {
// 确保只被执行一次
if (valueList != null) {
return;
}
valueList = new ArrayList();
String sql = "SELECT * FROM xmltest";
String[] name = {"MemoryFreeSize", "MemoryTotalSize", "MemoryUsage"};
Connection conn = this.getConnection();
try {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
// 用对象保存数据
Object[] objArray;
while (rs.next()) {
objArray = new Object[5];
String[] xmlData;
objArray[0] = rs.getObject(1);
objArray[1] = rs.getObject(2);
InputStream in;
String str = "中文stream";
in = new ByteArrayInputStream(str.getBytes("UTF-8"));
GetXmlData getXMLData = new GetXmlData();
// 对xml流进行解析,返回的为name对应的value值数组
xmlData = getXMLData.readerXMLSource(in, name);
// 将解析后的值存于最终结果ArrayList中
objArray[2] = xmlData[0];
objArray[3] = xmlData[1];
objArray[4] = xmlData[2];
valueList.add(objArray);
}
// 释放数据源
rs.close();
stmt.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private Connection getConnection() {
String driverName = "oracle.jdbc.driver.OracleDriver";
String url = "jdbc:oracle:thin:@env.finedevelop.com:55702:fr";
String username = "system";
String password = "123";
Connection con;
try {
Class.forName(driverName);
con = DriverManager.getConnection(url, username, password);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return con;
}
/**
* 释放一些资源因为可能会有重复调用所以需释放valueList将上次查询的结果释放掉
*
* @throws Exception e
*/
@Override
public void release() throws Exception {
super.release();
this.valueList = null;
}
}

40
plugin-report-doc-demo/src/com/fr/demo/NewDateDemo.java

@ -1,40 +0,0 @@
//<EFBFBD><EFBFBD>̬<EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
package com.fr.demo;
import com.fr.data.ArrayTableDataDemo;
import com.fr.general.ModuleContext;
import com.fr.io.TemplateWorkBookIO;
import com.fr.main.TemplateWorkBook;
import com.fr.report.module.EngineModule;
import com.fr.web.core.Reportlet;
import com.fr.web.request.ReportletRequest;
import java.util.Map;
public class NewDateDemo extends Reportlet {
public TemplateWorkBook createReport(ReportletRequest reportletrequest) {
TemplateWorkBook workbook = null;
ModuleContext.startModule(EngineModule.class.getName());
try {
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>workbook<EFBFBD><EFBFBD><EFBFBD>󣬽<EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>Ϊworkbook<EFBFBD><EFBFBD><EFBFBD>󲢷<EFBFBD><EFBFBD><EFBFBD>
workbook = TemplateWorkBookIO.readTemplateWorkBook("1.cpt");
ArrayTableDataDemo a = new ArrayTableDataDemo(); // <EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
workbook.putTableData("ds2", a); // <EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>µ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
} catch (Exception e) {
e.getStackTrace();
}
return workbook;
}
@Override
public void setParameterMap(Map arg0) {
// TODO Auto-generated method stub
}
@Override
public void setTplPath(String arg0) {
// TODO Auto-generated method stub
}
}

65
plugin-report-doc-demo/src/com/fr/demo/ReadFromDatabase.java

@ -1,65 +0,0 @@
package com.fr.demo;
import com.fr.base.FRContext;
import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook;
import com.fr.web.core.Reportlet;
import com.fr.web.request.ReportletRequest;
import com.fr.workspace.simple.SimpleWork;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Map;
public class ReadFromDatabase extends Reportlet {
public TemplateWorkBook createReport(ReportletRequest reportletRequest) {
// 定义报表运行环境,才能执行报表
String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
SimpleWork.checkIn(envpath);
WorkBook workbook = new WorkBook();
String name = reportletRequest.getParameter("cptname").toString();
try {
// 定义数据连接
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://112.124.109.239:3306/yourdatebase";
String user = "yourusername";
String pass = "yourpassword";
Class.forName(driver);
Connection conn = DriverManager.getConnection(url, user, pass);
// 从数据库中读模板
String sql = "select cpt from report where cptname = '" + name
+ "'";
Statement smt = conn.createStatement();
ResultSet rs = smt.executeQuery(sql);
while (rs.next()) {
Blob blob = rs.getBlob(1); // 取第一列的值,即cpt列
FRContext.getLogger().info(blob.toString());
InputStream ins = blob.getBinaryStream();
workbook.readStream(ins);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
return workbook;
}
@Override
public void setParameterMap(Map arg0) {
// TODO Auto-generated method stub
}
@Override
public void setTplPath(String arg0) {
// TODO Auto-generated method stub
}
}

50
plugin-report-doc-demo/src/com/fr/demo/SaveReportToDatabase.java

@ -1,50 +0,0 @@
package com.fr.demo;
import com.fr.workspace.simple.SimpleWork;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class SaveReportToDatabase {
public static void main(String[] args) {
SaveReport();
}
private static void SaveReport() {
try {
// 定义报表运行环境,才能执行报表
String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
SimpleWork.checkIn(envpath);
// 连接数据库
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://112.124.109.239:3306/yourdatabase";
String user = "yourusername";
String pass = "yourpassword";
Class.forName(driver);
Connection conn = DriverManager.getConnection(url, user, pass); //注意表名是否区分大小写
conn.setAutoCommit(false);
PreparedStatement presmt = conn
.prepareStatement("INSERT INTO report VALUES(?,?)");
// 读进需要保存入库的模板文件
File cptfile = new File(envpath
+ "\\reportlets\\GettingStarted.cpt");
int lens = (int) cptfile.length();
InputStream ins = new FileInputStream(cptfile);
// 将模板保存入库
presmt.setString(1, "GettingStarted.cpt"); // 第一个字段存放模板相对路径
presmt.setBinaryStream(2, ins, lens); // 第二个字段存放模板文件的二进制流
presmt.execute();
conn.commit();
presmt.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
}
}

42
plugin-report-doc-demo/src/com/fr/demo/SimpleReportletDemo.java

@ -1,42 +0,0 @@
//程序网络报表
package com.fr.demo;
import com.fr.io.TemplateWorkBookIO;
import com.fr.main.TemplateWorkBook;
import com.fr.web.core.Reportlet;
import com.fr.web.request.ReportletRequest;
import com.fr.workspace.simple.SimpleWork;
import java.util.Map;
public class SimpleReportletDemo extends Reportlet {
public TemplateWorkBook createReport(ReportletRequest reportletrequest) {
String envPath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
SimpleWork.checkIn(envPath);
// 新建一个WorkBook对象,用于保存最终返回的报表
TemplateWorkBook WorkBook = null;
try {
// 读取模板,将模板保存为workbook对象并返回
WorkBook = TemplateWorkBookIO.readTemplateWorkBook(
"\\doc\\Primary\\Parameter\\Parameter.cpt");
} catch (Exception e) {
e.getStackTrace();
} finally {
SimpleWork.checkOut();
}
return WorkBook;
}
@Override
public void setParameterMap(Map arg0) {
// TODO Auto-generated method stub
}
@Override
public void setTplPath(String arg0) {
// TODO Auto-generated method stub
}
}

86
plugin-report-doc-demo/src/com/fr/function/JFreeToChart.java

@ -1,86 +0,0 @@
// 引入JFreeChart图表
package com.fr.function;
import com.fr.script.AbstractFunction;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.DatasetRenderingOrder;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.renderer.category.LineAndShapeRenderer;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.DataUtilities;
import org.jfree.data.DefaultKeyedValues;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.general.DatasetUtilities;
import org.jfree.util.SortOrder;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.text.NumberFormat;
public class JFreeToChart extends AbstractFunction {
private String x, y;
public Object run(Object[] args) {
this.x = args[0].toString();
this.y = args[1].toString();
BufferedImage image = createImage(600, 400);
return image;
}
private BufferedImage createImage(int width, int height) {
CategoryDataset acategorydataset[] = createDatasets();
JFreeChart jfreechart = createChart(acategorydataset);
return jfreechart.createBufferedImage(width, height);
}
private CategoryDataset[] createDatasets() {
DefaultKeyedValues defaultkeyedvalues = new DefaultKeyedValues();
String[] xValue = this.x.split(",");
String[] yValue = this.y.split(",");
for (int i = 0; i < xValue.length; i++) {
defaultkeyedvalues.addValue(xValue[i], Double.valueOf(yValue[i]));
}
defaultkeyedvalues.sortByValues(SortOrder.DESCENDING);
org.jfree.data.KeyedValues keyedvalues = DataUtilities
.getCumulativePercentages(defaultkeyedvalues);
CategoryDataset categorydataset = DatasetUtilities
.createCategoryDataset("Languages", defaultkeyedvalues);
CategoryDataset categorydataset1 = DatasetUtilities
.createCategoryDataset("Cumulative", keyedvalues);
return (new CategoryDataset[]{categorydataset, categorydataset1});
}
private JFreeChart createChart(CategoryDataset acategorydataset[]) {
JFreeChart jfreechart = ChartFactory.createBarChart(
"Freshmeat Software Projects", "Language", "Projects",
acategorydataset[0], PlotOrientation.VERTICAL, true, true,
false);
jfreechart.addSubtitle(new TextTitle("By Programming Language"));
jfreechart.addSubtitle(new TextTitle("As at 5 March 2003"));
jfreechart.setBackgroundPaint(Color.white);
CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
categoryplot.setBackgroundPaint(Color.lightGray);
categoryplot.setRangeGridlinePaint(Color.white);
CategoryAxis categoryaxis = categoryplot.getDomainAxis();
categoryaxis.setLowerMargin(0.02D);
categoryaxis.setUpperMargin(0.02D);
categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
LineAndShapeRenderer lineandshaperenderer = new LineAndShapeRenderer();
NumberAxis numberaxis1 = new NumberAxis("Percent");
numberaxis1.setNumberFormatOverride(NumberFormat.getPercentInstance());
categoryplot.setRangeAxis(1, numberaxis1);
categoryplot.setDataset(1, acategorydataset[1]);
categoryplot.setRenderer(1, lineandshaperenderer);
categoryplot.mapDatasetToRangeAxis(1, 1);
categoryplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
return jfreechart;
}
}

19
plugin-report-doc-demo/src/com/fr/function/StringCat.java

@ -1,19 +0,0 @@
package com.fr.function;
import com.fr.script.AbstractFunction;
public class StringCat extends AbstractFunction {
public StringCat() {
}
public Object run(Object[] args) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < args.length; ++i) {
Object para = args[i];
result.append(para.toString());
}
return result.toString();
}
}

73
plugin-report-doc-demo/src/com/fr/function/StringImage.java

@ -1,73 +0,0 @@
//图片在下文字在上
package com.fr.function;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.script.AbstractFunction;
import com.fr.stable.CoreGraphHelper;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class StringImage extends AbstractFunction {
public Object run(Object[] args) {
Image result = null;
int p = 0;
Object[] ob = new Object[2];
for (int i = 0; (i < args.length && p <= 1); i++) {
if (args[i] == null) {
continue;
}
ob[p] = args[i];
p++;
}
try {
result = initStringImage(ob[0], ob[1]);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
public Image initStringImage(Object nameOb, Object imageOb)
throws IOException {
String name = (String) nameOb;
Image image = null;
if (imageOb instanceof Image)
image = (Image) imageOb;
else
;
Image stringImage = null;
BufferedImage splashBuffedImage = CoreGraphHelper.toBufferedImage(image);
stringImage = splashBuffedImage;
Graphics2D splashG2d = splashBuffedImage.createGraphics();
double centerX = 25;
double centerY = 25;
GraphHelper.drawString(splashG2d, name, centerX, centerY);
//
String FilePath = "Test.png";
File f = new File(FilePath);
ImageIO.write(splashBuffedImage, "png", f);
//
return splashBuffedImage;
}
public static void main(String arg[]) throws IOException {
StringImage tt = new StringImage();
Image image = BaseUtils.readImage("D:\\1.jpg");
String name = "12314124";
Image aa = tt.initStringImage(name, image);
JFrame jf = new JFrame();
JPanel jp = new JPanel();
}
}

25
plugin-report-doc-demo/src/com/fr/io/ExcelToCpt.java

@ -1,25 +0,0 @@
package com.fr.io;
import com.fr.general.ModuleContext;
import com.fr.io.importer.ExcelReportImporter;
import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook;
import com.fr.report.module.EngineModule;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
public class ExcelToCpt {
public static void main(String[] args) throws Exception {
File excelFile = new File("D:\\API.xls");
FileInputStream a = new FileInputStream(excelFile);
ModuleContext.startModule(EngineModule.class.getName());
TemplateWorkBook tpl = new ExcelReportImporter().generateWorkBookByStream(a);
OutputStream outputStream = new FileOutputStream(new File("D:\\abc.cpt"));
((WorkBook) tpl).export(outputStream);
outputStream.close();
ModuleContext.stopModules();
}
}

106
plugin-report-doc-demo/src/com/fr/io/ExportApi.java

@ -1,106 +0,0 @@
package com.fr.io;
import com.fr.base.Parameter;
import com.fr.config.activator.BaseDBActivator;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.data.impl.config.activator.RestrictionActivator;
import com.fr.general.ModuleContext;
import com.fr.io.exporter.CSVExporter;
import com.fr.io.exporter.EmbeddedTableDataExporter;
import com.fr.io.exporter.ExcelExporter;
import com.fr.io.exporter.ImageExporter;
import com.fr.io.exporter.PDFExporter;
import com.fr.io.exporter.SVGExporter;
import com.fr.io.exporter.TextExporter;
import com.fr.io.exporter.WordExporter;
import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter;
import com.fr.main.impl.WorkBook;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.report.ReportActivator;
import com.fr.report.module.ReportBaseActivator;
import com.fr.stable.WriteActor;
import com.fr.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
import java.io.File;
import java.io.FileOutputStream;
public class ExportApi {
public static void main(String[] args) {
// 定义报表运行环境,才能执行报表
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator());
String envpath = "D:\\FineReport_10.0\\webapps\\webroot\\WEB-INF";
SimpleWork.checkIn(envpath);
module.start();
ResultWorkBook rworkbook = null;
try {
// 未执行模板工作薄
WorkBook workbook = (WorkBook) TemplateWorkBookIO
.readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt");
// 获取报表参数并设置值,导出内置数据集时数据集会根据参数值查询出结果从而转为内置数据集
Parameter[] parameters = workbook.getParameters();
parameters[0].setValue("华东");
// 定义parametermap用于执行报表,将执行后的结果工作薄保存为rworkBook
java.util.Map parameterMap = new java.util.HashMap();
for (int i = 0; i < parameters.length; i++) {
parameterMap.put(parameters[i].getName(), parameters[i]
.getValue());
}
// 定义输出流
FileOutputStream outputStream;
// 将未执行模板工作薄导出为内置数据集模板
outputStream = new FileOutputStream(new File("D:\\EmbExport.cpt"));
EmbeddedTableDataExporter templateExporter = new EmbeddedTableDataExporter();
templateExporter.export(outputStream, workbook);
// 将模板工作薄导出模板文件,在导出前您可以编辑导入的模板工作薄,可参考报表调用章节
outputStream = new FileOutputStream(new File("D:\\TmpExport.cpt"));
((WorkBook) workbook).export(outputStream);
// 将结果工作薄导出为2003Excel文件
outputStream = new FileOutputStream(new File("D:\\ExcelExport.xls"));
ExcelExporter ExcelExport = new ExcelExporter();
ExcelExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// 将结果工作薄导出为Excel文件
outputStream = new FileOutputStream(new File("D:\\ExcelExport.xlsx"));
StreamExcel2007Exporter ExcelExport1 = new StreamExcel2007Exporter();
ExcelExport1.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// 将结果工作薄导出为Word文件
outputStream = new FileOutputStream(new File("D:\\WordExport.doc"));
WordExporter WordExport = new WordExporter();
WordExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// 将结果工作薄导出为Pdf文件
outputStream = new FileOutputStream(new File("D:\\PdfExport.pdf"));
PDFExporter PdfExport = new PDFExporter();
PdfExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// 将结果工作薄导出为Txt文件(txt文件本身不支持表格、图表等,被导出模板一般为明细表)
outputStream = new FileOutputStream(new File("D:\\TxtExport.txt"));
TextExporter TxtExport = new TextExporter();
TxtExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// 将结果工作薄导出为Csv文件
outputStream = new FileOutputStream(new File("D:\\CsvExport.csv"));
CSVExporter CsvExport = new CSVExporter();
CsvExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
//将结果工作薄导出为SVG文件
outputStream = new FileOutputStream(new File("D:\\SvgExport.svg"));
SVGExporter SvgExport = new SVGExporter();
SvgExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
//将结果工作薄导出为image文件
outputStream = new FileOutputStream(new File("D:\\PngExport.png"));
ImageExporter ImageExport = new ImageExporter();
ImageExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
outputStream.close();
ModuleContext.stopModules();
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
}
}

73
plugin-report-doc-demo/src/com/fr/openapi/remote/TemplateRead.java

@ -1,73 +0,0 @@
package com.fr.openapi.remote;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.data.impl.config.activator.RestrictionActivator;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.io.TemplateWorkBookIO;
import com.fr.log.FineLoggerFactory;
import com.fr.main.TemplateWorkBook;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.module.Activator;
import com.fr.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.report.ReportActivator;
import com.fr.report.module.ReportBaseActivator;
import com.fr.serialization.SerializationActivator;
import com.fr.stable.PageActor;
import com.fr.startup.WorkspaceRegister;
import com.fr.store.StateServerActivator;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.WorkspaceActivator;
import com.fr.workspace.server.ServerWorkspaceRegister;
import java.util.HashMap;
/**
* 远程环境读取模板
*/
public class TemplateRead {
public static void main(String[] args) {
try {
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new SerializationActivator(),
new Activator() {
@Override
public void start() {
WorkspaceConnectionInfo connectionInfo = new WorkspaceConnectionInfo("http://远程服务器地址:8080/webroot/decision", "admin", "ilovejava", "", "");
try {
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(RemoteDesignerWorkspaceInfo.create(connectionInfo)));
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void stop() {
}
},
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WorkspaceRegister(),
new ServerWorkspaceRegister()
);
module.start();
TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook("12345678.cpt");
ResultWorkBook result = workbook.execute(new HashMap<String, Object>(), new PageActor());
module.stop();//停止module
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}

76
plugin-report-doc-demo/src/com/fr/output/FTPUpload.java

@ -1,76 +0,0 @@
package com.fr.output;
import com.fr.data.dao.CompatiableIDFCMapper;
import com.fr.data.dao.ObjectTableMapper;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.schedule.output.AbstractOutputFileAction;
import com.fr.schedule.output.FTPTransmission;
import com.fr.schedule.output.OutputFileAction;
import com.fr.schedule.output.ftp.DefaultFTPTransmit;
import java.io.File;
public class FTPUpload extends AbstractOutputFileAction {
@Override
public ObjectTableMapper objectTableMapper2Register() {
return null;
}
@Override
public long getId() {
return 0;
}
@Override
public File[] getFilesToDealWith(File[] files) {
return files;
}
@Override
public void doFileAction(File[] files) {
FTPTransmission ftp = new FTPTransmission();
ftp.setServerAddress("env.finedevelop.com");
ftp.setPort(58321);
ftp.setSavePath("connie");
ftp.setUsername("fr");
ftp.setPassword("ilovejava");
try {
new DefaultFTPTransmit().transmit(files, ftp.getServerAddress(), ftp.getPort(), ftp.getUsername(), ftp.getPassword(), ftp.getSavePath());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public CompatiableIDFCMapper getExtraOutputFileActionForeignKey() {
return null;
}
@Override
public boolean isEmailNotification() {
// TODO Auto-generated method stub
return false;
}
@Override
public OutputFileAction analyzeJSON(JSONObject arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public JSONObject createJSONConfig() throws JSONException {
// TODO Auto-generated method stub
return null;
}
@Override
public String getJsonTag() {
// TODO Auto-generated method stub
return null;
}
}

100
plugin-report-doc-demo/src/com/fr/output/OutputExcel.java

@ -1,100 +0,0 @@
package com.fr.output;
import com.fr.data.dao.CompatiableIDFCMapper;
import com.fr.data.dao.ObjectTableMapper;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.schedule.output.AbstractOutputFileAction;
import com.fr.schedule.output.OutputFileAction;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class OutputExcel extends AbstractOutputFileAction {
@Override
public File[] getFilesToDealWith(File[] files) {
return files;
}
@Override
public void doFileAction(File[] files) {
// OutputStream out=new BufferedOutputStream(new FileOutputStream(new File(files.)));;
System.out.println(files[0].getName());
for (int i = 0; i < files.length; i++) {
String name = files[i].getName();
String path = "D:/" + name;
BufferedInputStream in = null;
OutputStream out = null;
try {
out = new BufferedOutputStream(new FileOutputStream(new File(path)));
in = new BufferedInputStream(new FileInputStream(files[i]));
byte[] ba = new byte[in.available()];
in.read(ba);
out.write(ba);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
@Override
public ObjectTableMapper objectTableMapper2Register() {
return null;
}
@Override
public CompatiableIDFCMapper getExtraOutputFileActionForeignKey() {
return null;
}
@Override
public long getId() {
return 0;
}
@Override
public boolean isEmailNotification() {
// TODO Auto-generated method stub
return false;
}
@Override
public OutputFileAction analyzeJSON(JSONObject arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public JSONObject createJSONConfig() throws JSONException {
// TODO Auto-generated method stub
return null;
}
@Override
public String getJsonTag() {
// TODO Auto-generated method stub
return null;
}
}

15
plugin-report-doc-demo/src/com/fr/plugin/core/MyLocaleFinder.java

@ -1,15 +0,0 @@
package com.fr.plugin.core;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.stable.fun.impl.AbstractLocaleFinder;
@EnableMetrics
public class MyLocaleFinder extends AbstractLocaleFinder {
@Override
@Focus(id = "com.fr.plugin.function", text = "插件全家桶", source = Original.PLUGIN)
public String find() {
return "com/fr/plugin/demo";
}
}

18
plugin-report-doc-demo/src/com/fr/plugin/core/secondary/ResourcePathTransformerImpl.java

@ -1,18 +0,0 @@
package com.fr.plugin.core.secondary;
import com.fr.stable.fun.impl.AbstractResourcePathTransformer;
/**
* 资源路径接口
*/
public class ResourcePathTransformerImpl extends AbstractResourcePathTransformer{
@Override
public boolean accept(String s) {
return true;
}
@Override
public String transform(String s) {
return s;
}
}

23
plugin-report-doc-demo/src/com/fr/plugin/core/secondary/SiteTransformerImpl.java

@ -1,23 +0,0 @@
package com.fr.plugin.core.secondary;
import com.fr.stable.fun.impl.AbstractSiteTransformer;
/**
* cloudcenter地址接口
*/
public class SiteTransformerImpl extends AbstractSiteTransformer{
@Override
public boolean match(String s) {
return true;
}
@Override
public String transform() {
return "";
}
@Override
public String transform(String s) {
return s;
}
}

16
plugin-report-doc-demo/src/main/java/com/fr/learn/Leaner.java

@ -1,16 +0,0 @@
package com.fr.learn;
import com.fr.start.Designer;
public class Leaner extends Designer {
static {
// 这段代码让插件能支持远程设计的时候的调试
String workDir = System.getProperty("user.dir");
System.setProperty("fine.plugin.home", workDir + "/webroot/WEB-INF/plugins");
}
public Leaner(String[] strings) {
super(strings);
}
}

8
plugin-report-doc-demo/src/main/java/com/fr/learn/Learner4Debug.java

@ -1,8 +0,0 @@
package com.fr.learn;
public class Learner4Debug {
public static void main(String... args) {
org.swingexplorer.Launcher.main(new String[]{"com.fr.start.Designer"});
}
}

45
src/com/fr/data/ArrayTableDataDemo.java

@ -1,45 +0,0 @@
package com.fr.data;
/**
* @author fanruan
*/
public class ArrayTableDataDemo extends AbstractTableData {
/**
* 定义程序数据集的列名与数据保存位置
*/
private String[] columnNames;
private Object[][] rowData;
/**
* 实现构建函数在构建函数中准备数据
*/
public ArrayTableDataDemo() {
String[] columnNames = {"Name", "Score"};
Object[][] datas = {{"Alex", 15},
{"Helly", 22}, {"Bobby", 99}};
this.columnNames = columnNames;
this.rowData = datas;
}
//实现ArrayTableData的其他四个方法,因为AbstractTableData已经实现了hasRow方法
@Override
public int getColumnCount() {
return columnNames.length;
}
@Override
public String getColumnName(int columnIndex) {
return columnNames[columnIndex];
}
@Override
public int getRowCount() {
return rowData.length;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return rowData[rowIndex][columnIndex];
}
}

133
src/com/fr/data/Commit3.java

@ -1,133 +0,0 @@
package com.fr.data;
import com.fr.cache.Attachment;
import com.fr.data.impl.SubmitJobValue;
import com.fr.general.FArray;
import com.fr.general.FRLogger;
import com.fr.script.Calculator;
import com.fr.stable.xml.FRFile;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* @author fanruan
*/
public class Commit3 implements SubmitJob {
private Object attach;
/**
* 定义文件路径
*/
private SubmitJobValue filePath;
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
public void doJob(Calculator ca) {
FRLogger.getLogger().info("begin to upload file...");
final Object attachO = attach;
if (attachO instanceof FArray && ((FArray) attachO).length() != 0) {
new Thread() {
@Override
public void run() {
int i;
FArray attachmentList = (FArray) attachO;
for (i = 0; i < attachmentList.length(); i++) {
if (!(attachmentList.elementAt(i) instanceof Attachment)) {
continue;
} else {
FRLogger.getLogger().info("filePath.value:" + filePath.getValue().toString());
FRLogger.getLogger().info("filePath.valueState:" + filePath.getValueState() +
"注:valueState 0,1,2,3 分别表示 默认值,插入行,值改变,删除行");
String FilePath = filePath.getValue().toString();
String FileName = ((Attachment) (attachmentList.elementAt(i))).getFilename();
String Path = FilePath + "\\" + FileName;
File fileDir = new File(FilePath);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
try {
//新建文件夹,并且写入内
mkfile(FilePath, FileName, new ByteArrayInputStream(
((Attachment) (attachmentList.elementAt(i))).getBytes()));
} catch (Exception e) {
Logger.getLogger("FR").log(Level.WARNING,
e.getMessage() + "/nmkfileerror", e);
}
}
}
}
}.start();
} else if (attach instanceof FRFile) {
String filepath = filePath.getValue().toString();
String filename = ((FRFile) attach).getFileName();
File fileDir = new File(filepath);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
try {
//新建文件夹,并且写入内
mkfile(filepath, filename, new ByteArrayInputStream(
((FRFile) attach).getBytes()));
} catch (Exception e) {
Logger.getLogger("FR").log(Level.WARNING,
e.getMessage() + "/nmkfileerror", e);
}
}
}
private static void mkfile(String path, String filename, InputStream source) throws IOException {
File fileout = new File(path, filename);
// 检查是否存在
if (fileout.exists()) {
// 删除文件
fileout.delete();
FRLogger.getLogger().info("old file deleted");
}
// 在当前目录下建立一个名为FileName的文件
if (fileout.createNewFile()) {
FRLogger.getLogger().info(path + filename + "created!!");
}
FileOutputStream outputStream = new FileOutputStream(fileout);
byte[] bytes = new byte[1024];
int read = source.read(bytes);
//把source写入新建的文件
while (read != -1) {
outputStream.write(bytes, 0, read);
outputStream.flush();
read = source.read(bytes);
}
outputStream.close();
}
@Override
public void readXML(XMLableReader reader) {
}
@Override
public void writeXML(XMLPrintWriter writer) {
}
@Override
public void doFinish(Calculator arg0) {
}
@Override
public String getJobType() {
return null;
}
}

51
src/com/fr/data/CustomTableData.java

@ -1,51 +0,0 @@
package com.fr.data;
/**
* @author fanruan
*/
public class CustomTableData extends AbstractTableData {
/**
* 获取数据集的列数
*
* @return 数据集的列
*/
@Override
public int getColumnCount() {
return 0;
}
/**
* 获取数据集指定列的列名
*
* @param columnIndex 指定列的索引
* @return 指定列的列名
*/
@Override
public String getColumnName(int columnIndex) {
return null;
}
/**
* 获取数据集的行数
*
* @return 数据集数据行数
*/
@Override
public int getRowCount() {
return 0;
}
/**
* 获取数据集指定位置上的值
*
* @param rowIndex 指定的行索引
* @param columnIndex 指定的列索引
* @return 指定位置的值
*/
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return null;
}
}

51
src/com/fr/data/DemoSubmitJob1.java

@ -1,51 +0,0 @@
package com.fr.data;
import com.fr.script.Calculator;
/**
* @author fanruan
*/
public class DemoSubmitJob1 extends DefinedSubmitJob {
/**
* 当模板自定义事件增加的属性 名称与下面变量有对应时则会自动赋值于此对应变量
*/
// JobValue对应单元格
private JobValue studentNo;
private JobValue name;
private JobValue grade;
// 非单元格,则对应具体类型值
private boolean isPass;
/**
* 每一条记录执行一次此方法
* 同一提交事件在一个处理事务内此对象是唯一的
*/
@Override
public void doJob(Calculator calculator) {
// JobValue的getValueState()方法获取此对应单元格的状态
if (studentNo.getValueState() == JobValue.VALUE_STATE_CHANGED) {
// 此单元格的值在报表初始化后被修改过
} else if (studentNo.getValueState() == JobValue.VALUE_STATE_INSERT) {
// 此单元格是在报表初始化后新增的(例如执行了插入行操作)
} else if (studentNo.getValueState() == JobValue.VALUE_STATE_DELETED) {
// 此单元格所在的记录被执行了删除操作
} else if (studentNo.getValueState() == JobValue.VALUE_STATE_DEFAULT) {
// 此单元格在报表初始化后没有变化
}
// 值获取,通过JobValue的getValue方法获得单元格的值
System.out.print(" 学号: " + studentNo.getValue());
System.out.print(" 姓名: " + name.getValue());
System.out.print(" 总分: " + grade.getValue());
System.out.print(" 是否达标: " + isPass);
System.out.println();
}
@Override
public String getJobType() {
return null;
}
}

64
src/com/fr/data/DemoSubmitJob2.java

@ -1,64 +0,0 @@
package com.fr.data;
import com.fr.script.Calculator;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
/**
* @author fanruan
*/
public class DemoSubmitJob2 extends DefinedSubmitJob {
/**
* 每一条记录执行一次此方法
* 同一提交事件在一个处理事务内此对象是唯一的
*/
@Override
public void doJob(Calculator calculator) {
// 同样可以直接在传入的calculator中获取定义的属性及其对应的值
Map map = (Map) calculator.getAttribute(PROPERTY_VALUE);
if (map == null) {
return;
}
Set set = map.entrySet();
Iterator it = set.iterator();
Entry entry;
// 遍历Map获取所有属性及其值
while (it.hasNext()) {
entry = (Entry) it.next();
System.out.print(" " + entry.getKey() + ": ");
// JobValue对应单元格
if (entry.getValue() instanceof JobValue) {
JobValue ce = (JobValue) entry.getValue();
// JobValue的getValueState()方法获取此对应单元格的状态
if (ce.getValueState() == JobValue.VALUE_STATE_CHANGED) {
// 此单元格的值在报表初始化后被修改过
System.out.println();
} else if (ce.getValueState() == JobValue.VALUE_STATE_INSERT) {
// 此单元格是在报表初始化后新增的(例如执行了插入行操作)
System.out.println();
} else if (ce.getValueState() == JobValue.VALUE_STATE_DELETED) {
// 此单元格所在的记录被执行了删除操作
System.out.println();
} else if (ce.getValueState() == JobValue.VALUE_STATE_DEFAULT) {
// 此单元格在报表初始化后没有变化
System.out.println();
}
// 通过JobValue的getValue方法获得单元格的值
System.out.print(ce.getValue());
} else {
// 非单元格,则对应具体类型值
System.out.print(entry.getValue().toString());
}
}
}
@Override
public String getJobType() {
return null;
}
}

59
src/com/fr/data/DemoTotalSubmitJob.java

@ -1,59 +0,0 @@
package com.fr.data;
import com.fr.script.Calculator;
/**
* @author fanruan
*/
public class DemoTotalSubmitJob extends TotalSubmitJob {
/**
* 同一提交事件在一个提交事务内只执行一次
*
* @param data 以二维表排列的所有提交数据
*/
@Override
protected void doTotalJob(Data data, Calculator calculator) {
// 获取列的数量,每一列对应一个添加的属性
data.getColumnCount();
for (int i = 0; i < data.getColumnCount(); i++) {
// 获取对应的属性名称
System.out.println(data.getColumnName(i));
}
// getRowCount 获取一共多少行数据
for (int i = 0; i < data.getRowCount(); i++) {
System.out.print("ROW " + i + " {");
for (int j = 0; j < data.getColumnCount(); j++) {
if (j > 0) {
System.out.print(", ");
}
// 获取对应位置的值
Object value = data.getValueAt(i, j);
if (value instanceof JobValue) {
JobValue ce = (JobValue) value;
// JobValue的getValueState()方法获取此对应单元格的状态
if (ce.getValueState() == JobValue.VALUE_STATE_CHANGED) {
// 此单元格的值在报表初始化后被修改过
System.out.println();
} else if (ce.getValueState() == JobValue.VALUE_STATE_INSERT) {
// 此单元格是在报表初始化后新增的(例如执行了插入行操作)
System.out.println();
} else if (ce.getValueState() == JobValue.VALUE_STATE_DELETED) {
// 此单元格所在的记录被执行了删除操作
System.out.println();
} else if (ce.getValueState() == JobValue.VALUE_STATE_DEFAULT) {
// 此单元格在报表初始化后没有变化
System.out.println();
}
// 通过JobValue的getValue方法获得单元格的值
value = ce.getValue();
}
System.out.print(data.getColumnName(j) + " : " + value);
}
System.out.print("}");
System.out.println();
}
}
}

81
src/com/fr/data/GetXmlData.java

@ -1,81 +0,0 @@
package com.fr.data;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLableReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
/**
* @author fanruan
*/
public class GetXmlData {
/**
* 定义返回值数组
*/
private String[] value = new String[3];
/**
* 定义查询的name值
*/
private String[] name = null;
protected String[] readerXMLSource(InputStream in, String[] name)
throws Exception {
this.name = name;
InputStreamReader reader = new InputStreamReader(in, "utf-8");
readXMLSource(reader);
return value;
}
protected void readXMLSource(Reader reader) throws Exception {
XMLableReader xmlReader = XMLableReader.createXMLableReader(reader);
if (xmlReader != null) {
xmlReader.readXMLObject(new Content());
}
}
private class Content implements XMLReadable {
@Override
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
if ("Field".equals(reader.getTagName())) {
Field field = new Field();
reader.readXMLObject(field);
// 获得name对应的value值
if (name[0].equals(field.name)) {
value[0] = field.value;
} else if (name[1].equals(field.name)) {
value[1] = field.value;
} else if (name[2].equals(field.name)) {
value[2] = field.value;
}
}
}
}
}
/**
* 定义每个field的结构
*/
private class Field implements XMLReadable {
private String name;
private String type;
private String value;
@Override
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
String tagName = reader.getTagName();
if ("name".equals(tagName)) {
this.name = reader.getElementValue();
} else if ("Type".equals(tagName)) {
this.type = reader.getElementValue();
} else if ("value".equals(tagName)) {
this.value = reader.getElementValue();
}
}
}
}
}

114
src/com/fr/data/MobileTableWsdlDataDemo.java

@ -1,114 +0,0 @@
package com.fr.data;
import com.fr.general.data.TableDataException;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* @author fanruan
*/
public class MobileTableWsdlDataDemo extends AbstractTableData {
private String[][] data;
public MobileTableWsdlDataDemo() {
this.data = this.getMobileTableWsdlData();
}
@Override
public int getColumnCount() throws TableDataException {
return data[0].length;
}
//获取列的名称为数组中第一行的值
@Override
public String getColumnName(int columnIndex) throws TableDataException {
return data[0][columnIndex];
}
//获取行数为数据的长度-1
@Override
public int getRowCount() throws TableDataException {
return data.length - 1;
}
//获取值
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return data[rowIndex + 1][columnIndex];
}
public static String[][] getResults(OMElement element) {
if (element == null) {
return null;
}
Iterator iterator = element.getChildElements();
Iterator innerItr;
List<String> list = new ArrayList<String>();
OMElement result;
while (iterator.hasNext()) {
result = (OMElement) iterator.next();
innerItr = result.getChildElements();
while (innerItr.hasNext()) {
OMElement elem = (OMElement) innerItr.next();
list.add(elem.getText());
}
}
String[] result1 = list.toArray(new String[list.size()]);
String[][] results = new String[result1.length][3];
String b1, b2, b3;
for (int i = 0; i < result1.length; i++) {
if (result1[i].length() != 0) {
b1 = result1[i].substring(0, result1[i].indexOf(" "));
b2 = result1[i].substring(result1[i].indexOf(" ") + 1).substring(0, result1[i].substring(result1[i].indexOf(" ") + 1).indexOf(" "));
b3 = result1[i].substring(result1[i].indexOf(" ") + 1).substring(result1[i].substring(result1[i].indexOf(" ") + 1).indexOf(" ") + 1);
results[i][0] = b1;
results[i][1] = b2;
results[i][2] = b3;
}
}
return results;
}
public String[][] getMobileTableWsdlData() {
try {
String url = "http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl";
EndpointReference targetEPR = new EndpointReference(url);
//创建一个OMFactory,下面的namespace、方法与参数均需由它创建
OMFactory fac = OMAbstractFactory.getOMFactory();
// 命名空间
OMNamespace omNs = fac.createOMNamespace("http://WebXml.com.cn", "a");
//下面创建的是参数对数
/*
*OMElement symbol = fac.createOMElement("mobileCode", omNs);
symbol.addChild(fac.createOMText(symbol, "18795842"));
*/
//下面创建一个method对象 ,方法
OMElement method = fac.createOMElement("getDatabaseInfo", omNs);
// method.addChild(symbol);
Options options = new Options();
options.setTo(targetEPR);
options.setAction("http://WebXml.com.cn/getDatabaseInfo");
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
OMElement result1 = sender.sendReceive(method);
return getResults(result1);
} catch (org.apache.axis2.AxisFault e) {
e.printStackTrace();
}
return new String[][]{{}};
}
}

147
src/com/fr/data/MobileWsdlTableDataDemo.java

@ -1,147 +0,0 @@
package com.fr.data;
import com.fr.base.AbstractTableData;
import com.fr.general.data.DataModel;
import com.fr.general.data.TableDataException;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class MobileWsdlTableDataDemo extends AbstractTableData {
private String[][] data;
public MobileWsdlTableDataDemo() {
this.data = this.getMobileWsdlTableData();
}
public int getColumnCount() throws TableDataException {
return data[0].length;
}
//<EFBFBD><EFBFBD>ȡ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>һ<EFBFBD>е<EFBFBD>ֵ
public String getColumnName(int columnIndex) throws TableDataException {
return data[0][columnIndex];
}
//<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD>ݵij<EFBFBD><EFBFBD><EFBFBD>-1
public int getRowCount() throws TableDataException {
return data.length - 1;
}
//<EFBFBD><EFBFBD>ȡֵ
public Object getValueAt(int rowIndex, int columnIndex) {
return data[rowIndex + 1][columnIndex];
}
public static String[][] getResults(OMElement element) {
if (element == null) {
return null;
}
Iterator iterator = element.getChildElements();
Iterator innerItr;
List<String> list = new ArrayList<String>();
OMElement result = null;
while (iterator.hasNext()) {
result = (OMElement) iterator.next();
innerItr = result.getChildElements();
while (innerItr.hasNext()) {
OMElement elem = (OMElement) innerItr.next();
list.add(elem.getText());
}
}
String[] result1 = list.toArray(new String[list.size()]);
String results[][] = new String[result1.length][3];
String b1, b2, b3;
for (int i = 0; i < result1.length; i++) {
if (result1[i].length() != 0) {
b1 = result1[i].substring(0, result1[i].indexOf(" "));
b2 = result1[i].substring(result1[i].indexOf(" ") + 1).substring(0, result1[i].substring(result1[i].indexOf(" ") + 1).indexOf(" "));
b3 = result1[i].substring(result1[i].indexOf(" ") + 1).substring(result1[i].substring(result1[i].indexOf(" ") + 1).indexOf(" ") + 1);
results[i][0] = b1;
results[i][1] = b2;
results[i][2] = b3;
}
}
return results;
}
public String[][] getMobileWsdlTableData() {
try {
String url = "http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl";
EndpointReference targetEPR = new EndpointReference(url);
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>OMFactory<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>namespace<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
OMFactory fac = OMAbstractFactory.getOMFactory();
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>
OMNamespace omNs = fac.createOMNamespace("http://WebXml.com.cn", "a");
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*
*OMElement symbol = fac.createOMElement("mobileCode", omNs);
symbol.addChild(fac.createOMText(symbol, "18795842"));
*/
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>method<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
OMElement method = fac.createOMElement("getDatabaseInfo", omNs);
// method.addChild(symbol);
Options options = new Options();
options.setTo(targetEPR);
options.setAction("http://WebXml.com.cn/getDatabaseInfo");
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
OMElement result1 = sender.sendReceive(method);
String[][] result = getResults(result1);
return result;
} catch (java.rmi.RemoteException e) {
e.printStackTrace();
}
return new String[][]{{}};
}
@Override
public DataModel createDataModel(Calculator arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public DataModel createDataModel(Calculator arg0, String arg1) {
// TODO Auto-generated method stub
return null;
}
@Override
public DataModel createDataModel(Calculator arg0, int arg1) {
// TODO Auto-generated method stub
return null;
}
@Override
public ParameterProvider[] getParameters(Calculator arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public void readXML(XMLableReader arg0) {
// TODO Auto-generated method stub
}
@Override
public void writeXML(XMLPrintWriter arg0) {
// TODO Auto-generated method stub
}
}

105
src/com/fr/data/MobileWsdlTableDataDemo1.java

@ -1,105 +0,0 @@
package com.fr.data;
import com.fr.general.data.TableDataException;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class MobileWsdlTableDataDemo1 extends AbstractTableData {
private String[][] data;
public MobileWsdlTableDataDemo1() {
this.data = this.getMobileWsdlTableData();
}
public int getColumnCount() throws TableDataException {
return data[0].length;
}
//获取列的名称为数组中第一行的值
public String getColumnName(int columnIndex) throws TableDataException {
return data[0][columnIndex];
}
//获取行数为数据的长度-1
public int getRowCount() throws TableDataException {
return data.length - 1;
}
//获取值
public Object getValueAt(int rowIndex, int columnIndex) {
return data[rowIndex + 1][columnIndex];
}
public static String[][] getResults(OMElement element) {
if (element == null) {
return null;
}
Iterator iterator = element.getChildElements();
Iterator innerItr;
List<String> list = new ArrayList<String>();
OMElement result = null;
while (iterator.hasNext()) {
result = (OMElement) iterator.next();
innerItr = result.getChildElements();
while (innerItr.hasNext()) {
OMElement elem = (OMElement) innerItr.next();
list.add(elem.getText());
}
}
String[] result1 = list.toArray(new String[list.size()]);
String results[][] = new String[result1.length][3];
String b1, b2, b3;
for (int i = 0; i < result1.length; i++) {
if (result1[i].length() != 0) {
b1 = result1[i].substring(0, result1[i].indexOf(" "));
b2 = result1[i].substring(result1[i].indexOf(" ") + 1).substring(0, result1[i].substring(result1[i].indexOf(" ") + 1).indexOf(" "));
b3 = result1[i].substring(result1[i].indexOf(" ") + 1).substring(result1[i].substring(result1[i].indexOf(" ") + 1).indexOf(" ") + 1);
results[i][0] = b1;
results[i][1] = b2;
results[i][2] = b3;
}
}
return results;
}
public String[][] getMobileWsdlTableData() {
try {
String url = "http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl";
EndpointReference targetEPR = new EndpointReference(url);
//创建一个OMFactory,下面的namespace、方法与参数均需由它创建
OMFactory fac = OMAbstractFactory.getOMFactory();
// 命名空间
OMNamespace omNs = fac.createOMNamespace("http://WebXml.com.cn", "a");
//下面创建的是参数对数
/*
*OMElement symbol = fac.createOMElement("mobileCode", omNs);
symbol.addChild(fac.createOMText(symbol, "18795842"));
*/
//下面创建一个method对象 ,方法
OMElement method = fac.createOMElement("getDatabaseInfo", omNs);
// method.addChild(symbol);
Options options = new Options();
options.setTo(targetEPR);
options.setAction("http://WebXml.com.cn/getDatabaseInfo");
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
OMElement result1 = sender.sendReceive(method);
String[][] result = getResults(result1);
return result;
} catch (org.apache.axis2.AxisFault e) {
e.printStackTrace();
}
return new String[][]{{}};
}
}

65
src/com/fr/data/MobileWsdlTableDataDemo2.java

@ -1,65 +0,0 @@
package com.fr.data;
import com.fr.general.data.TableDataException;
import mobile.MobileCodeWSStub;
public class MobileWsdlTableDataDemo2 extends AbstractTableData {
private String[][] data;
public MobileWsdlTableDataDemo2() {
// this.data = this.getData();
}
public int getColumnCount() throws TableDataException {
return data[0].length;
}
//获取列的名称为数组中第一行的值
public String getColumnName(int columnIndex) throws TableDataException {
return data[0][columnIndex];
}
//获取行数为数据的长度-1
public int getRowCount() throws TableDataException {
return data.length - 1;
}
//获取值
public Object getValueAt(int rowIndex, int columnIndex) {
return data[rowIndex + 1][columnIndex];
}
public static void main(String agrs[]) {
// public String[][] getData() {
try {
String url = "http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl";
MobileCodeWSStub stub = new MobileCodeWSStub(url);
// MobileCodeWSStub.GetMobileCodeInfo aa = new MobileCodeWSStub.GetMobileCodeInfo();
MobileCodeWSStub.GetDatabaseInfo bb = new MobileCodeWSStub.GetDatabaseInfo();
// aa.setMobileCode("18795842832");
// String rs=stub.getMobileCodeInfo(aa).getGetMobileCodeInfoResult();
String[] p = stub.getDatabaseInfo(bb).getGetDatabaseInfoResult().getString();
String result[][] = new String[p.length][3];
String b1, b2, b3;
for (int i = 0; i < p.length; i++) {
if (p[i].length() != 0) {
b1 = p[i].substring(0, p[i].indexOf(" "));
b2 = p[i].substring(p[i].indexOf(" ") + 1).substring(0, p[i].substring(p[i].indexOf(" ") + 1).indexOf(" "));
b3 = p[i].substring(p[i].indexOf(" ") + 1).substring(p[i].substring(p[i].indexOf(" ") + 1).indexOf(" ") + 1);
result[i][0] = b1;
result[i][1] = b2;
result[i][2] = b3;
// System.out.println(b1);
}
}
// return result;
} catch (org.apache.axis2.AxisFault e) {
e.printStackTrace();
} catch (java.rmi.RemoteException e) {
e.printStackTrace();
}
// return new String[][] { {} };
}
}

114
src/com/fr/data/MobileWsdlTableDataDemoPara.java

@ -1,114 +0,0 @@
package com.fr.data;
import com.fr.general.FRLogger;
import com.fr.general.data.TableDataException;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class MobileWsdlTableDataDemoPara extends AbstractTableData {
private String[][] data;
public MobileWsdlTableDataDemoPara() {
this.data = this.getMobileWsdlTableData();
}
public int getColumnCount() throws TableDataException {
return data[0].length;
}
//获取列的名称为数组中第一行的值
public String getColumnName(int columnIndex) throws TableDataException {
return data[0][columnIndex];
}
//获取行数为数据的长度-1
public int getRowCount() throws TableDataException {
return data.length - 1;
}
//获取值
public Object getValueAt(int rowIndex, int columnIndex) {
return data[rowIndex + 1][columnIndex];
}
public static String[][] getResults(OMElement element) {
if (element == null) {
return null;
}
Iterator iterator = element.getChildElements();
//Iterator innerItr;
List<String> list = new ArrayList<String>();
OMElement result = null;
while (iterator.hasNext()) {
result = (OMElement) iterator.next();
list.add(result.getText());
}
String[] result1 = (String[]) list.toArray(new String[list.size()]);
String results[][] = new String[result1.length][3];
String b1, b2, b3;
for (int i = 0; i < result1.length; i++) {
if (result1[i].length() != 0) {
b1 = result1[i].substring(0, result1[i].indexOf(" "));
b2 = result1[i].substring(result1[i].indexOf(" ") + 1).substring(0, result1[i].substring(result1[i].indexOf(" ") + 1).indexOf(" "));
b3 = result1[i].substring(result1[i].indexOf(" ") + 1).substring(result1[i].substring(result1[i].indexOf(" ") + 1).indexOf(" ") + 1);
results[i][0] = b1;
results[i][1] = b2;
results[i][2] = b3;
}
}
return results;
}
public String[][] getMobileWsdlTableData() {
try {
FRLogger.getLogger().error("进入了");
String url = "http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl";
EndpointReference targetEPR = new EndpointReference(url);
//创建一个OMFactory,下面的namespace、方法与参数均需由它创建
OMFactory fac = OMAbstractFactory.getOMFactory();
// 命名空间
OMNamespace omNs = fac.createOMNamespace("http://WebXml.com.cn/", "a");
//下面创建的是参数对数
OMElement symbol = fac.createOMElement("mobileCode", omNs);
symbol.addChild(fac.createOMText(symbol, "18651038607"));
OMElement symbol2 = fac.createOMElement("userID", omNs);
symbol2.addChild(fac.createOMText(symbol2, ""));
//下面创建一个method对象 ,方法
OMElement method = fac.createOMElement("getMobileCodeInfo", omNs);
method.addChild(symbol);
method.addChild(symbol2);
Options options = new Options();
options.setTo(targetEPR);
options.setAction("http://WebXml.com.cn/getMobileCodeInfo");
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
OMElement result1 = sender.sendReceive(method);
String[][] result = getResults(result1);
return result;
} catch (java.rmi.RemoteException e) {
e.printStackTrace();
}
return new String[][]{{}};
}
public static void main(String[] args) {
MobileWsdlTableDataDemoPara ss = new MobileWsdlTableDataDemoPara();
//ss.getData();
}
}

112
src/com/fr/data/ParamSAPDataTest.java

@ -1,112 +0,0 @@
package com.fr.data;
import com.fr.base.FRContext;
import com.fr.config.holder.impl.xml.XmlColConf;
import com.fr.function.ConnectSAPServer;
import com.fr.stable.ParameterProvider;
import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoException;
import com.sap.conn.jco.JCoFunction;
import com.sap.conn.jco.JCoTable;
import java.util.ArrayList;
import java.util.Collection;
public class ParamSAPDataTest extends AbstractTableData {
private String[] columnNames = null;
private int columnNum = 3;
private String[][] rowData;
private static JCoDestination jCoDestination;
public ParamSAPDataTest() {
ArrayList<String> arrayList = new ArrayList<String>();
arrayList.add("LIFNR");
arrayList.add("NAME1");
this.parameters = new XmlColConf<Collection<ParameterProvider>>(arrayList, ParameterProvider.class);
this.columnNames = new String[this.columnNum];
this.columnNames[0] = "供应商编码";
this.columnNames[1] = "供应商名称";
this.columnNames[2] = "供应商地址";
}
public int getColumnCount() {
return this.columnNum;
}
public String getColumnName(int columnIndex) {
return this.columnNames[columnIndex];
}
public int getRowCount() {
try {
init();
} catch (JCoException e) {
FRContext.getLogger().info("失败");
}
return this.rowData.length;
}
public Object getValueAt(int rowIndex, int columnIndex) {
try {
init();
} catch (JCoException e) {
FRContext.getLogger().info("失败");
}
if (columnIndex >= this.columnNum) {
return null;
}
return this.rowData[rowIndex][columnIndex];
}
public void init() throws JCoException {
if (this.rowData != null) {
return;
}
try {
jCoDestination = ConnectSAPServer.Connect();
} catch (Exception e) {
FRContext.getLogger().info("失败");
}
JCoFunction function = jCoDestination.getRepository().getFunction("Z_LFA3_QUERY");
if (function == null)
throw new RuntimeException(
"Function not found in SAP.");
function.getImportParameterList().setValue("LIFNR", "%" +
((ParameterProvider) (parameters.get().toArray()[0])).getValue().toString().toUpperCase().trim() + "%");
function.getImportParameterList().setValue("NAME1", "%" + ((ParameterProvider) (parameters.get().toArray()[1]))
.getValue().toString().toUpperCase().trim() + "%");
function.execute(jCoDestination);
JCoTable returnTable = function.getTableParameterList().getTable(
"ZLFA1S3");
rowData = new String[20][3];
if (returnTable.getNumRows() > 0) {
returnTable.firstRow();
for (int i = 0; i < 20; ) {
String[] objArray = new String[this.columnNum];
objArray[0] = returnTable.getString("LIFNR");
objArray[1] = returnTable.getString("NAME1");
objArray[2] = returnTable.getString("STRAS");
this.rowData[i] = objArray;
i++;
returnTable
.nextRow();
}
FRContext.getLogger().info(
"Query SQL of ParamSAPDataTest: \n" + this.rowData.length +
" rows selected");
}
}
public void release() throws Exception {
super.release();
this.rowData = null;
}
}

69
src/com/fr/data/WebServiceWsdlTableDataDemo2.java

@ -1,69 +0,0 @@
package com.fr.data;
import com.fr.general.data.TableDataException;
import mobile.MobileCodeWSStub;
public class WebServiceWsdlTableDataDemo2 extends AbstractTableData {
/**
*
*/
private static final long serialVersionUID = 1L;
private String[][] data;
public WebServiceWsdlTableDataDemo2() {
this.data = this.getWebServiceWsdlTableData();
}
public int getColumnCount() throws TableDataException {
return data[0].length;
}
//获取列的名称为数组中第一行的值
public String getColumnName(int columnIndex) throws TableDataException {
return data[0][columnIndex];
}
//获取行数为数据的长度-1
public int getRowCount() throws TableDataException {
return data.length - 1;
}
//获取值
public Object getValueAt(int rowIndex, int columnIndex) {
return data[rowIndex + 1][columnIndex];
}
public String[][] getWebServiceWsdlTableData() {
try {
String url = "http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl";
MobileCodeWSStub stub = new MobileCodeWSStub(url);
// MobileCodeWSStub.GetMobileCodeInfo aa = new MobileCodeWSStub.GetMobileCodeInfo();
MobileCodeWSStub.GetDatabaseInfo bb = new MobileCodeWSStub.GetDatabaseInfo();
// aa.setMobileCode("18795842832");
// String rs=stub.getMobileCodeInfo(aa).getGetMobileCodeInfoResult();
String[] p = stub.getDatabaseInfo(bb).getGetDatabaseInfoResult().getString();
String result[][] = new String[p.length][3];
String b1, b2, b3;
for (int i = 0; i < p.length; i++) {
if (p[i].length() != 0) {
b1 = p[i].substring(0, p[i].indexOf(" "));
b2 = p[i].substring(p[i].indexOf(" ") + 1).substring(0, p[i].substring(p[i].indexOf(" ") + 1).indexOf(" "));
b3 = p[i].substring(p[i].indexOf(" ") + 1).substring(p[i].substring(p[i].indexOf(" ") + 1).indexOf(" ") + 1);
result[i][0] = b1;
result[i][1] = b2;
result[i][2] = b3;
}
}
return result;
} catch (java.rmi.RemoteException e) {
e.printStackTrace();
}
return new String[][]{{}};
}
public static void main(String[] args) {
for (int i = 0; i < new WebServiceWsdlTableDataDemo2().getWebServiceWsdlTableData().length; i++) {
System.out.println(new WebServiceWsdlTableDataDemo2().getWebServiceWsdlTableData()[i]);
}
}
}

27
src/com/fr/data/XMLColumnNameType4Demo.java

@ -1,27 +0,0 @@
package com.fr.data;
public class XMLColumnNameType4Demo {
private int type = -1;
private String name = null;
public XMLColumnNameType4Demo(String name, int type) {
this.name = name;
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}

126
src/com/fr/data/impl/Commit1.java

@ -1,126 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.fr.data.impl;
import com.fr.base.Formula;
import com.fr.cache.Attachment;
import com.fr.data.SubmitJob;
import com.fr.general.FArray;
import com.fr.script.Calculator;
import com.fr.stable.UtilEvalError;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* @author fanruan
*/
public class Commit1 implements SubmitJob {
private Object attach;
private String filePath;
public Commit1() {
}
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
private Object getAttach(Calculator ca) {
if (this.attach != null && this.attach instanceof Formula) {
try {
return ca.eval(((Formula) this.attach).getContent());
} catch (UtilEvalError var3) {
var3.printStackTrace();
return "";
}
} else {
return ca.resolveVariable("attach");
}
}
@Override
public void doJob(Calculator ca) {
final Object attachO = this.getAttach(ca);
if (attachO instanceof FArray && ((FArray) attachO).length() != 0) {
(new Thread() {
@Override
public void run() {
FArray attachmentlist = (FArray) attachO;
for (int i = 0; i < attachmentlist.length(); ++i) {
Statement sm = null;
String command = null;
String result = null;
if (attachmentlist.elementAt(i) instanceof Attachment) {
String FilePath = Commit1.this.filePath;
String FileName = ((Attachment) attachmentlist.elementAt(i)).getFilename();
(new StringBuilder(String.valueOf(FilePath))).append("\\").append(FileName).toString();
File fileDir = new File(FilePath);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
try {
Commit1.mkfile(FilePath, FileName, new ByteArrayInputStream(((Attachment) attachmentlist.elementAt(i)).getBytes()));
} catch (Exception var11) {
Logger.getLogger("FR").log(Level.WARNING, var11.getMessage() + "/nmkfileerror", var11);
}
}
}
}
}).start();
}
}
@Override
public void doFinish(Calculator calculator) {
}
private static void mkfile(String path, String FileName, InputStream source) throws FileNotFoundException, IOException {
File fileout = new File(path, FileName);
if (fileout.exists()) {
fileout.delete();
}
fileout.createNewFile();
FileOutputStream outputStream = new FileOutputStream(fileout);
byte[] bytes = new byte[1024];
for (int read = source.read(bytes); read != -1; read = source.read(bytes)) {
outputStream.write(bytes, 0, read);
outputStream.flush();
}
outputStream.close();
}
@Override
public void readXML(XMLableReader reader) {
}
@Override
public void writeXML(XMLPrintWriter writer) {
}
@Override
public String getJobType() {
return null;
}
}

131
src/com/fr/data/impl/Commit3.java

@ -1,131 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.fr.data.impl;
import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.cache.Attachment;
import com.fr.data.JobValue;
import com.fr.data.SubmitJob;
import com.fr.general.FArray;
import com.fr.script.Calculator;
import com.fr.stable.UtilEvalError;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* @author fanruan
*/
public class Commit3 implements SubmitJob {
private Object attach;
private JobValue filePath;
public Commit3() {
}
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
public void doJob(Calculator ca) throws Exception {
FRContext.getLogger().info("begin to upload file...");
final Object attachO = this.getAttach(ca);
if (attachO instanceof FArray && ((FArray) attachO).length() != 0) {
(new Thread() {
@Override
public void run() {
FArray attachmentlist = (FArray) attachO;
for (int i = 0; i < attachmentlist.length(); ++i) {
if (attachmentlist.elementAt(i) instanceof Attachment) {
FRContext.getLogger().info("filePath.value:" + Commit3.this.filePath.getValue().toString());
FRContext.getLogger().info("filePath.valueState:" + Commit3.this.filePath.getValueState() + "注:valueState 0,1,2,3 分别表示 默认值,插入行,值改变,删除行");
String FilePath = Commit3.this.filePath.getValue().toString();
String FileName = ((Attachment) attachmentlist.elementAt(i)).getFilename();
(new StringBuilder(String.valueOf(FilePath))).append("\\").append(FileName).toString();
File fileDir = new File(FilePath);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
try {
Commit3.mkfile(FilePath, FileName, new ByteArrayInputStream(((Attachment) attachmentlist.elementAt(i)).getBytes()));
} catch (Exception var8) {
Logger.getLogger("FR").log(Level.WARNING, var8.getMessage() + "/nmkfileerror", var8);
}
}
}
}
}).start();
}
}
@Override
public void doFinish(Calculator calculator) throws Exception {
}
private Object getAttach(Calculator ca) {
if (this.attach != null && this.attach instanceof Formula) {
try {
return ca.eval(((Formula) this.attach).getContent());
} catch (UtilEvalError var3) {
var3.printStackTrace();
return "";
}
} else {
return ca.resolveVariable("attach");
}
}
private static void mkfile(String path, String FileName, InputStream source) throws FileNotFoundException, IOException {
File fileout = new File(path, FileName);
if (fileout.exists()) {
fileout.delete();
FRContext.getLogger().info("old file deleted");
}
if (fileout.createNewFile()) {
FRContext.getLogger().info(path + FileName + "created!!");
}
FileOutputStream outputStream = new FileOutputStream(fileout);
byte[] bytes = new byte[1024];
for (int read = source.read(bytes); read != -1; read = source.read(bytes)) {
outputStream.write(bytes, 0, read);
outputStream.flush();
}
outputStream.close();
}
@Override
public void readXML(XMLableReader reader) {
}
@Override
public void writeXML(XMLPrintWriter writer) {
}
@Override
public String getJobType() {
return null;
}
}

79
src/com/fr/demo/ChangeRowAndCol.java

@ -1,79 +0,0 @@
//遍历单元格
package com.fr.demo;
import com.fr.io.TemplateWorkBookIO;
import com.fr.main.TemplateWorkBook;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.worksheet.WorkSheet;
import com.fr.web.core.Reportlet;
import com.fr.web.request.ReportletRequest;
import com.fr.workspace.simple.SimpleWork;
import java.util.Map;
public class ChangeRowAndCol extends Reportlet {
public TemplateWorkBook createReport(ReportletRequest reportletrequest) {
// 定义最终需要返回的WorkBook对象
TemplateWorkBook workbook = null;
String envPath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
SimpleWork.checkIn(envPath);
WorkSheet newworksheet = new WorkSheet();
String change = "0";
try {
// 读取模板保存为WorkBook对象
workbook = TemplateWorkBookIO.readTemplateWorkBook(
"\\doc\\Primary\\GroupReport\\Group.cpt");
// 读取请求中的参数判断是否需要切换行列显示,0表示不切换,1表示切换
if (reportletrequest.getParameter("change") != null) {
change = reportletrequest.getParameter("change").toString();
}
if (change.equals("1")) {
// 获得单元格需要首先获得单元格所在的报表
TemplateElementCase report = (TemplateElementCase) workbook
.getTemplateReport(0);
// 遍历单元格
int col = 0, row = 0;
byte direction = 0;
java.util.Iterator it = report.cellIterator();
while (it.hasNext()) {
TemplateCellElement cell = (TemplateCellElement) it.next();
// 获取单元格的行号与列号并互换
col = cell.getColumn();
row = cell.getRow();
cell.setColumn(row);
cell.setRow(col);
// 获取原单元格的扩展方向,0表示纵向扩展,1表示横向扩展
direction = cell.getCellExpandAttr().getDirection();
if (direction == 0) {
cell.getCellExpandAttr().setDirection((byte) 1);
} else if (direction == 1) {
cell.getCellExpandAttr().setDirection((byte) 0);
}
// 将改变后的单元格添加进新的WorkSheet中
newworksheet.addCellElement(cell);
}
// 替换原sheet
workbook.setReport(0, newworksheet);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
return workbook;
}
@Override
public void setParameterMap(Map arg0) {
// TODO Auto-generated method stub
}
@Override
public void setTplPath(String arg0) {
// TODO Auto-generated method stub
}
}

50
src/com/fr/demo/CreateReportletDemo.java

@ -1,50 +0,0 @@
//创建程序报表
package com.fr.demo;
import com.fr.base.Style;
import com.fr.general.FRFont;
import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.unit.OLDPIX;
import com.fr.web.core.Reportlet;
import com.fr.web.request.ReportletRequest;
import java.awt.Color;
import java.util.Map;
public class CreateReportletDemo extends Reportlet {
public TemplateWorkBook createReport(ReportletRequest arg0) {
//创建一个WorkBook工作薄,在工作薄中插入一个WorkSheet
WorkBook workbook = new WorkBook();
WorkSheet sheet1 = new WorkSheet();
TemplateCellElement CellA1 = new DefaultTemplateCellElement(0, 0,
"FineReport");
Style style = Style.getInstance();
FRFont frfont = FRFont.getInstance("Arial", 1, 20.0F, Color.red);
style = style.deriveFRFont(frfont);
CellA1.setStyle(style);
sheet1.addCellElement(CellA1);
sheet1.setColumnWidth(0, new OLDPIX(150.0F));
sheet1.setRowHeight(1, new OLDPIX(35.0F));
workbook.addReport(sheet1);
return workbook;
}
@Override
public void setParameterMap(Map arg0) {
// TODO Auto-generated method stub
}
@Override
public void setTplPath(String arg0) {
// TODO Auto-generated method stub
}
}

50
src/com/fr/demo/SaveReportToDatabase.java

@ -1,50 +0,0 @@
package com.fr.demo;
import com.fr.workspace.simple.SimpleWork;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class SaveReportToDatabase {
public static void main(String[] args) {
SaveReport();
}
private static void SaveReport() {
try {
// 定义报表运行环境,才能执行报表
String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
SimpleWork.checkIn(envpath);
// 连接数据库
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://112.124.109.239:3306/yourdatabase";
String user = "yourusername";
String pass = "yourpassword";
Class.forName(driver);
Connection conn = DriverManager.getConnection(url, user, pass); //注意表名是否区分大小写
conn.setAutoCommit(false);
PreparedStatement presmt = conn
.prepareStatement("INSERT INTO report VALUES(?,?)");
// 读进需要保存入库的模板文件
File cptfile = new File(envpath
+ "\\reportlets\\GettingStarted.cpt");
int lens = (int) cptfile.length();
InputStream ins = new FileInputStream(cptfile);
// 将模板保存入库
presmt.setString(1, "GettingStarted.cpt"); // 第一个字段存放模板相对路径
presmt.setBinaryStream(2, ins, lens); // 第二个字段存放模板文件的二进制流
presmt.execute();
conn.commit();
presmt.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
}
}

71
src/com/fr/demo/SetCellElementStyle.java

@ -1,71 +0,0 @@
//单元格格式设置
package com.fr.demo;
import com.fr.base.Style;
import com.fr.base.background.ColorBackground;
import com.fr.general.FRFont;
import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.Constants;
import com.fr.stable.unit.OLDPIX;
import com.fr.web.core.Reportlet;
import com.fr.web.request.ReportletRequest;
import java.awt.Color;
import java.awt.Font;
import java.util.Map;
public class SetCellElementStyle extends Reportlet {
public TemplateWorkBook createReport(ReportletRequest arg0) {
// 新建报表
WorkBook workbook = new WorkBook();
WorkSheet worksheet = new WorkSheet();
// 新建一个单元格,位置为(1,1),列占2单元格,行占2单元格,文本值为 "FineReport"
TemplateCellElement cellElement = new DefaultTemplateCellElement(1, 1,
2, 2, "FineReport");
// 设置列宽为300px,设置行高为30px
worksheet.setColumnWidth(1, new OLDPIX(300));
worksheet.setRowHeight(1, new OLDPIX(30));
// 得到CellElement的样式,如果没有新建默认样式
Style style = cellElement.getStyle();
if (style == null) {
style = Style.getInstance();
}
// 设置字体和前景的颜色
FRFont frFont = FRFont.getInstance("Dialog", Font.BOLD, 16);
frFont = frFont.applyForeground(new Color(21, 76, 160));
style = style.deriveFRFont(frFont);
// 设置背景
ColorBackground background = ColorBackground.getInstance(new Color(255,
255, 177));
style = style.deriveBackground(background);
// 设置水平居中
style = style.deriveHorizontalAlignment(Constants.CENTER);
// 设置边框
style = style.deriveBorder(Constants.LINE_DASH, Color.red,
Constants.LINE_DOT, Color.gray, Constants.LINE_DASH_DOT,
Color.BLUE, Constants.LINE_DOUBLE, Color.CYAN);
// 改变单元格的样式
cellElement.setStyle(style);
// 将单元格添加到报表中
worksheet.addCellElement(cellElement);
workbook.addReport(worksheet);
return workbook;
}
@Override
public void setParameterMap(Map arg0) {
// TODO Auto-generated method stub
}
@Override
public void setTplPath(String arg0) {
// TODO Auto-generated method stub
}
}

55
src/com/fr/demo/TotalVerifyJobDemo.java

@ -1,55 +0,0 @@
package com.fr.demo;
import com.fr.base.Utils;
import com.fr.data.JobValue;
import com.fr.data.TotalVerifyJob;
import com.fr.data.Verifier;
import com.fr.script.Calculator;
public class TotalVerifyJobDemo extends TotalVerifyJob {
/*
* type : 必须要定义此私有变量变量名可改表示校验状态
* 0 表示校验成功默认校验状态位为0
* 1 表示校验失败
*/
private int type = 0;
@Override
protected void doTotalJob(Data data, Calculator calculator)
throws Exception { // @param data 以二维表排列的所有提交数据
int sale, min;
JobValue salenum, minnum;
int row = data.getRowCount(); // 获取一共多少行数据
for (int i = 0; i < row; i++) { // 遍历每行,进行校验
salenum = (JobValue) data.getValueAt(i, 0);
sale = Integer.parseInt(Utils.objectToString(salenum.getValue()));
minnum = (JobValue) data.getValueAt(i, 1);
min = Integer.parseInt(Utils.objectToString(minnum.getValue()));
if (sale < min) { //校验判断
type = 1;
}
}
}
public String getMessage() {
// 根据校验状态是成功还是失败,设置对应的返回信息
if (type == 0) {
return "恭喜你,校验成功";
} else {
return "销量值不能小于最小基数";
}
}
public Verifier.Status getType() {
// 返回校验状态
return Verifier.Status.parse(type);
}
public String getJobType() {
return "totalVerifyJob";
}
}

53
src/com/fr/demo/URLParameterDemo.java

@ -1,53 +0,0 @@
// 程序网络报表中获取request中的值
package com.fr.demo;
import com.fr.base.Parameter;
import com.fr.general.ModuleContext;
import com.fr.io.TemplateWorkBookIO;
import com.fr.main.TemplateWorkBook;
import com.fr.report.module.EngineModule;
import com.fr.web.core.Reportlet;
import com.fr.web.request.ReportletRequest;
import com.fr.workspace.simple.SimpleWork;
import java.util.Map;
public class URLParameterDemo extends Reportlet {
public TemplateWorkBook createReport(ReportletRequest reportletRequest) {
String envPath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
SimpleWork.checkIn(envPath);
ModuleContext.startModule(EngineModule.class.getName());
// 获取外部传来的参数
TemplateWorkBook wbTpl = null;
String countryValue = reportletRequest.getParameter("地区").toString();
try {
wbTpl = TemplateWorkBookIO.readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt");
// 提取报表参数组,由于原模板只有country一个参数,因此直接取index为0的参数,并将外部传入的值赋给该参数
Parameter[] ps = wbTpl.getParameters();
ps[0].setValue(countryValue);
// 原模板定义有参数界面,参数已经从外部获得,去掉参数页面
// 若您想保留参数界面,则将模板设置为不延迟报表展示,再传入参数后直接根据参数值显示结果,否则还需要再次点击查询按钮
wbTpl.getReportParameterAttr().setParameterUI(null);
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
return wbTpl;
}
@Override
public void setParameterMap(Map arg0) {
// TODO Auto-generated method stub
}
@Override
public void setTplPath(String arg0) {
// TODO Auto-generated method stub
}
}

68
src/com/fr/demo/VerifyJobDemo.java

@ -1,68 +0,0 @@
package com.fr.demo;
import com.fr.base.Utils;
import com.fr.data.DefinedVerifyJob;
import com.fr.data.JobValue;
import com.fr.data.Verifier;
import com.fr.script.Calculator;
public class VerifyJobDemo extends DefinedVerifyJob {
/*
* 必须要定义此私有变量,变量名可改表示校验状态
* 0 表示校验成功默认校验状态位为0
* 1 表示校验失败
*/
private int type = 0;
/**
* 当模板自定义事件增加的属性 名称与下面变量有对应时则会自动赋值于此对应变量
*/
private JobValue salenum; // JobValue对应单元格
private int minnum; // 非单元格,则对应具体类型值
public void doJob(Calculator calculator) throws Exception {
/*
* 如这边提供一个简单的判断来模拟执行过程
* 校验规则为销量需要大于等于最小基数salenum >= minnum
* 校验不通过,提示销量值不能小于最小基数
*/
if (salenum != null) {
int sale = 0;
if (salenum.getValue() instanceof Integer) { //将单元格值转为整型以便用于比较
sale = (Integer) salenum.getValue();
} else {
sale = Integer.parseInt(Utils.objectToString(salenum.getValue()));
}
if (sale < minnum) { //校验判断
type = 1;
}
} else {
type = 1;
}
}
public String getMessage() {
// 根据校验状态是成功还是失败,设置对应的返回信息
if (type == 0) {
return "恭喜你,校验成功";
} else {
return "销量值不能小于最小基数";
}
}
public Verifier.Status getType() {
// 返回校验状态
return Verifier.Status.parse(type);
}
public void doFinish(Calculator arg0) throws Exception {
// TODO Auto-generated method stub
}
}

91
src/com/fr/function/BinaryImage.java

@ -1,91 +0,0 @@
package com.fr.function;
import com.fr.data.core.db.BinaryObject;
import com.fr.script.AbstractFunction;
import com.sun.jna.Library;
import com.sun.jna.Native;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class BinaryImage extends AbstractFunction {
//加载dll,"E:\\bmp\\WltRS"是dll的文件完整路径,但不带后缀名,生成WltRS.class
static WltRS wltrs = (WltRS) Native.loadLibrary("E:\\bmp\\WltRS", WltRS.class);
static int index = 0;
public Object run(Object[] args) {
int current = index;
//args[0] 是 BinaryObject对象,取为bo
BinaryObject bo = (BinaryObject) args[0];
//将bo转换为.wlt文件,并保存在位置E:\bmp\;本地方法GetBmp的第一个参数是wlt文件的路径
getFile(bo.getBytes(), "E:\\bmp\\", current + ".wlt");
//读取.wlt为文件
File file = new File("E:\\bmp\\" + current + ".wlt");
//调用本地方法,在相同路径下生产.bmp
wltrs.GetBmp("E:\\bmp\\" + current + ".wlt", 1);
//读取并返回图片
File imagefile = new File("E:\\bmp\\" + current + ".bmp");
BufferedImage buffer = null;
try {
buffer = ImageIO.read(imagefile);
} catch (IOException e) {
e.printStackTrace();
}
index = (++index) % 300;
return buffer;
}
// byte[]转换为file的方法
public static void getFile(byte[] bfile, String filePath, String fileName) {
BufferedOutputStream bos = null;
FileOutputStream fos = null;
File file = null;
try {
File dir = new File(filePath);
if (!dir.exists() && dir.isDirectory()) {//判断文件目录是否存在
dir.mkdirs();
}
file = new File(filePath + "\\" + fileName);
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos);
bos.write(bfile);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (bos != null) {
try {
bos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
}
//用jna调用本地方法的必须步骤,具体含义不明
interface WltRS extends Library {
//定义要调用的本地方法
void GetBmp(String str, int i);
}

15
src/com/fr/function/CellSum.java

@ -1,15 +0,0 @@
// 自定义函数中获取公式所在单元格
package com.fr.function;
import com.fr.base.Utils;
import com.fr.script.AbstractFunction;
public class CellSum extends AbstractFunction {
public Object run(Object[] args) {
String sum = Utils.objectToNumber(new SUM().run(args), false)
.toString(); // 直接调用FR内部的SUM方法
String result = "所在单元格为:" + this.getCalculator().getCurrentColumnRow()
+ ";总和为:" + sum; // 获取当前单元格拼出最终结果
return result;
}
}

58
src/com/fr/function/ConnectSAPServer.java

@ -1,58 +0,0 @@
package com.fr.function;
import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.JCoException;
import com.sap.conn.jco.ext.DestinationDataProvider;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Properties;
public class ConnectSAPServer {
static String ABAP_AS_POOLED = "ABAP_AS_WITH_POOL";
static {
Properties connectProperties = new Properties();
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST,
"SAP服务器IP地址");
connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "系统编号");
connectProperties
.setProperty(DestinationDataProvider.JCO_CLIENT, "客户端编号(SAP中的,和客户端没关系)");
connectProperties.setProperty(DestinationDataProvider.JCO_USER,
"用户名");
connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD,
"密码");
connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "ZH");
connectProperties.setProperty(
DestinationDataProvider.JCO_POOL_CAPACITY, "10");
connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT,
"10");
createDataFile(ABAP_AS_POOLED, "jcoDestination", connectProperties);
}
static void createDataFile(String name, String suffix, Properties properties) {
File cfg = new File(name + "." + suffix);
if (!cfg.exists()) {
try {
FileOutputStream fos = new FileOutputStream(cfg, false);
properties.store(fos, "SAP连接配置文件");
fos.close();
} catch (Exception e) {
throw new RuntimeException(
"Unable to create the destination file "
+ cfg.getName(), e);
}
}
}
public static JCoDestination Connect() {
JCoDestination destination = null;
try {
destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
} catch (JCoException e) {
e.getCause();
}
return destination;
}
}

67
src/com/fr/function/FlagHtmlColor.java

@ -1,67 +0,0 @@
package com.fr.function;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
public class FlagHtmlColor extends AbstractFunction {
public Object run(Object[] args) {
String txt="";
String color="";
String flag="";
if(null==args||args.length==0){
return Primitive.ERROR_NAME;
}else if(args.length==1){
txt=args[0].toString();
color="red";
flag="N";
}else if(args.length==2){
txt=args[0].toString();
color=args[1].toString();
flag="N";
}else{
txt=args[0].toString();
color=args[1].toString();
flag=args[2].toString();
}
String result=getHtmlStr(txt, color, flag);
return result;
}
public String getHtmlStr(String txt,String color,String flag){
String starthtml="<font color='"+color+"'>";
String endhtml="</font>";
StringBuffer sb=new StringBuffer();
int len=txt.length();
if("N".equalsIgnoreCase(flag)){//数字
for(int i=0;i<len;i++){
char c=txt.charAt(i);
if(c>='0'&&c<='9'){
String str=starthtml+c+endhtml;
sb.append(str);
}else{
sb.append(c);
}
}
}else if("C".equalsIgnoreCase(flag)){//字母
for(int i=0;i<len;i++){
char c=txt.charAt(i);
if((c>='a'&&c<='z')||(c>='A'&&c<='Z')){
String str=starthtml+c+endhtml;
sb.append(str);
}else{
sb.append(c);
}
}
} else if("Z".equalsIgnoreCase(flag)){//中文
for(int i=0;i<len;i++){
char c=txt.charAt(i);
if(c >= 0x4E00 && c <= 0x9FA5){
String str=starthtml+c+endhtml;
sb.append(str);
}else{
sb.append(c);
}
}
}else{
return txt;
}
return sb.toString();
}
}

23
src/com/fr/function/GETIP.java

@ -1,23 +0,0 @@
package com.fr.function;
import com.fr.script.AbstractFunction;
import java.net.InetAddress;
public class GETIP extends AbstractFunction {
@Override
public Object run(Object[] objects) {
try {
InetAddress ia = InetAddress.getLocalHost();
return ia.getHostAddress();
} catch (Exception e) {
return e.getMessage();
}
}
public static InetAddress getInetAddress() {
return null;
}
}

15
src/com/fr/function/Lunar.java

@ -1,15 +0,0 @@
//自定义函数把阳历转换成阴历
package com.fr.function;
import com.fr.script.AbstractFunction;
public class Lunar extends AbstractFunction {
public Object run(Object[] args) {
String result = "";
int y = Integer.parseInt(args[0].toString());
int m = Integer.parseInt(args[1].toString());
int d = Integer.parseInt(args[2].toString());
result = SolarToLunar.today(y, m, d);
return result;
}
}

40
src/com/fr/function/ParamSAPDataTest.java

@ -1,40 +0,0 @@
package com.fr.function;
import com.fr.data.AbstractTableData;
import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoException;
public class ParamSAPDataTest extends AbstractTableData {
private String[] columnNames;
private int columnNum;
private String[][] rowData;
private static JCoDestination jCoDestination;
public ParamSAPDataTest() {
throw new Error("Unresolved compilation problems: \n\tThe declared package \"com.fr.data\" does not match the expected package \"com.fr.function\"\n\tThe import com.sap cannot be resolved\n\tThe import com.sap cannot be resolved\n\tThe import com.sap cannot be resolved\n\tThe import com.sap cannot be resolved\n\tAbstractTableData cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tparameters cannot be resolved or is not a field\n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n\tJCoException cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tThe method Connect() from the type ConnectSAPServer refers to the missing type JCoDestination\n\tJCoFunction cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tparameters cannot be resolved or is not a field\n\tparameters cannot be resolved or is not a field\n\tJCoDestination cannot be resolved to a type\n\tJCoTable cannot be resolved to a type\n\tAbstractTableData cannot be resolved to a type\n");
}
public int getColumnCount() {
throw new Error("Unresolved compilation problem: \n");
}
public String getColumnName(int columnIndex) {
throw new Error("Unresolved compilation problem: \n");
}
public int getRowCount() {
throw new Error("Unresolved compilation problems: \n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n");
}
public Object getValueAt(int rowIndex, int columnIndex) {
throw new Error("Unresolved compilation problems: \n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n");
}
public void init() throws JCoException {
throw new Error("Unresolved compilation problems: \n\tJCoException cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tThe method Connect() from the type ConnectSAPServer refers to the missing type JCoDestination\n\tJCoFunction cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tparameters cannot be resolved or is not a field\n\tparameters cannot be resolved or is not a field\n\tJCoDestination cannot be resolved to a type\n\tJCoTable cannot be resolved to a type\n");
}
public void release() throws Exception {
throw new Error("Unresolved compilation problem: \n\tAbstractTableData cannot be resolved to a type\n");
}
}

105
src/com/fr/function/ReportCheck.java

@ -1,105 +0,0 @@
// 自定义函数实现表间校验
package com.fr.function;
import com.fr.base.ResultFormula;
import com.fr.io.TemplateWorkBookIO;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.main.impl.WorkBook;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.report.cell.CellElement;
import com.fr.report.report.ResultReport;
import com.fr.script.AbstractFunction;
import com.fr.stable.WriteActor;
import com.fr.write.cal.WB;
import java.util.HashMap;
public class ReportCheck extends AbstractFunction {
private static HashMap wMap = new HashMap();
public Object run(Object[] args) {
// 获取公式中的参数
String cptname = args[0].toString(); // 获取报表名称
int colnumber = Integer.parseInt(args[2].toString()); // 所取单元格所在列
int rownumber = Integer.parseInt(args[3].toString()); // 所取单元格所在行
// 定义返回的值
Object returnValue = null;
// 定义报表运行环境,才能运行读取的报表
try {
ResultWorkBook rworkbook = null;
// 读取模板
WorkBook workbook = (WorkBook) TemplateWorkBookIO
.readTemplateWorkBook(cptname);
// 获取需要传递给报表的参数名与参数值,格式如[{"name":para1name,"value":para1value},{"name":para2name,"value":para2value},......]
JSONArray parasArray = new JSONArray(args[1].toString());
// 需要判断是否是5秒内执行过的
// 取出保存的resultworkbook;
Object tempWObj = wMap.get(cptname + parasArray.toString());
if (tempWObj != null) {
// 取出hashmap里面保存的TpObj;
TpObj curTpObj = (TpObj) tempWObj;
if ((System.currentTimeMillis() - curTpObj.getExeTime()) < 8000) {
rworkbook = curTpObj.getRworkbook();
} else {
wMap.remove(cptname + parasArray.toString());
}
}
// 如果没有设置,需要生成
if (rworkbook == null) {
JSONObject jo = new JSONObject();
// 定义报表执行时使用的paraMap,保存参数名与值
java.util.Map parameterMap = new java.util.HashMap();
if (parasArray.length() > 0) {
for (int i = 0; i < parasArray.length(); i++) {
jo = parasArray.getJSONObject(i);
parameterMap.put(jo.get("name"), jo.get("value"));
}
}
// 执行报表
rworkbook = workbook.execute(parameterMap, new WriteActor());
// 保存下来
wMap.put(cptname + parasArray.toString(), new TpObj(rworkbook,
System.currentTimeMillis()));
}
// 获取报表结果中对应Cell的值
ResultReport report = rworkbook.getResultReport(0);
CellElement cellElement = ((WB) report).getCellElement(colnumber, rownumber);
returnValue = cellElement.getValue().toString();
if (cellElement.getValue() instanceof ResultFormula) {
returnValue = ((ResultFormula) cellElement.getValue()).getResult().toString();
}
} catch (Exception e) {
e.printStackTrace();
}
return returnValue;
}
class TpObj {
private ResultWorkBook rworkbook = null;
private long exeTime = System.currentTimeMillis();
public TpObj(ResultWorkBook rworkbook, long exeTime) {
this.setRworkbook(rworkbook);
this.setExeTime(exeTime);
}
public ResultWorkBook getRworkbook() {
return rworkbook;
}
public void setRworkbook(ResultWorkBook rworkbook) {
this.rworkbook = rworkbook;
}
public long getExeTime() {
return exeTime;
}
public void setExeTime(long exeTime) {
this.exeTime = exeTime;
}
}
}

381
src/com/fr/function/SolarToLunar.java

@ -1,381 +0,0 @@
//自定义函数把阳历转换成阴历
package com.fr.function;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
public class SolarToLunar {
final private static long[] lunarInfo = new long[]{0x04bd8, 0x04ae0,
0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0,
0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540,
0x0d6a0, 0x0ada2, 0x095b0, 0x14977, 0x04970, 0x0a4b0, 0x0b4b5,
0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970,
0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3,
0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0,
0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0,
0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8,
0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570,
0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5,
0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0,
0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50,
0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5, 0x04970, 0x064b0,
0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0,
0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7,
0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50,
0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954,
0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260,
0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0,
0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, 0x0b5a0, 0x056d0,
0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20,
0x0ada0};
final private static int[] year20 = new int[]{1, 4, 1, 2, 1, 2, 1, 1, 2,
1, 2, 1};
final private static int[] year19 = new int[]{0, 3, 0, 1, 0, 1, 0, 0, 1,
0, 1, 0};
final private static int[] year2000 = new int[]{0, 3, 1, 2, 1, 2, 1, 1,
2, 1, 2, 1};
public final static String[] nStr1 = new String[]{"", "正", "二", "三", "四",
"五", "六", "七", "八", "九", "十", "十一", "十二"};
private final static String[] Gan = new String[]{"甲", "乙", "丙", "丁", "戊",
"己", "庚", "辛", "壬", "癸"};
private final static String[] Zhi = new String[]{"子", "丑", "寅", "卯", "辰",
"巳", "午", "未", "申", "酉", "戌", "亥"};
private final static String[] Animals = new String[]{"鼠", "牛", "虎", "兔",
"龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"};
private final static String[] solarTerm = new String[]{"小寒", "大寒", "立春",
"雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑",
"立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至"};
private final static String[] sFtv = new String[]{"0101*元旦", "0214 情人节",
"0308 妇女节", "0312 植树节", "0315 消费者权益日", "0401 愚人节", "0501 劳动节",
"0504 青年节", "0512 护士节", "0601 儿童节", "0701 建党节", "0801 建军节",
"0808 父亲节", "0909 毛泽东逝世纪念", "0910 教师节", "0928 孔子诞辰", "1001*国庆节",
"1006 老人节", "1024 联合国日", "1112 孙中山诞辰", "1220 澳门回归", "1225 圣诞节",
"1226 毛泽东诞辰"};
private final static String[] lFtv = new String[]{"0101*农历春节",
"0115 元宵节", "0505 端午节", "0707 七夕情人节", "0815 中秋节", "0909 重阳节",
"1208 腊八节", "1224 小年", "0100*除夕"};
/**
* 传回农历 y年的总天数
*
* @param y
* @return
*/
final private static int lYearDays(int y) {
int i, sum = 348;
for (i = 0x8000; i > 0x8; i >>= 1) {
if ((lunarInfo[y - 1900] & i) != 0)
sum += 1;
}
return (sum + leapDays(y));
}
/**
* 传回农历 y年闰月的天数
*
* @param y
* @return
*/
final private static int leapDays(int y) {
if (leapMonth(y) != 0) {
if ((lunarInfo[y - 1900] & 0x10000) != 0)
return 30;
else
return 29;
} else
return 0;
}
/**
* 传回农历 y年闰哪个月 1-12 , 没闰传回 0
*
* @param y
* @return
*/
final private static int leapMonth(int y) {
return (int) (lunarInfo[y - 1900] & 0xf);
}
/**
* 传回农历 y年m月的总天数
*
* @param y
* @param m
* @return
*/
final private static int monthDays(int y, int m) {
if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0)
return 29;
else
return 30;
}
/**
* 传回农历 y年的生肖
*
* @param y
* @return
*/
final public static String AnimalsYear(int y) {
return Animals[(y - 4) % 12];
}
/**
* 传入 月日的offset 传回干支,0=甲子
*
* @param num
* @return
*/
final private static String cyclicalm(int num) {
return (Gan[num % 10] + Zhi[num % 12]);
}
/**
* 传入 offset 传回干支, 0=甲子
*
* @param y
* @return
*/
final public static String cyclical(int y) {
int num = y - 1900 + 36;
return (cyclicalm(num));
}
/**
* 传出农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6
*
* @param y
* @param m
* @return
*/
final private long[] Lunar(int y, int m) {
long[] nongDate = new long[7];
int i = 0, temp = 0, leap = 0;
Date baseDate = new GregorianCalendar(1900 + 1900, 1, 31).getTime();
Date objDate = new GregorianCalendar(y + 1900, m, 1).getTime();
long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L;
if (y < 2000)
offset += year19[m - 1];
if (y > 2000)
offset += year20[m - 1];
if (y == 2000)
offset += year2000[m - 1];
nongDate[5] = offset + 40;
nongDate[4] = 14;
for (i = 1900; i < 2050 && offset > 0; i++) {
temp = lYearDays(i);
offset -= temp;
nongDate[4] += 12;
}
if (offset < 0) {
offset += temp;
i--;
nongDate[4] -= 12;
}
nongDate[0] = i;
nongDate[3] = i - 1864;
leap = leapMonth(i); // 闰哪个月
nongDate[6] = 0;
for (i = 1; i < 13 && offset > 0; i++) {
// 闰月
if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) {
--i;
nongDate[6] = 1;
temp = leapDays((int) nongDate[0]);
} else {
temp = monthDays((int) nongDate[0], i);
}
// 解除闰月
if (nongDate[6] == 1 && i == (leap + 1))
nongDate[6] = 0;
offset -= temp;
if (nongDate[6] == 0)
nongDate[4]++;
}
if (offset == 0 && leap > 0 && i == leap + 1) {
if (nongDate[6] == 1) {
nongDate[6] = 0;
} else {
nongDate[6] = 1;
--i;
--nongDate[4];
}
}
if (offset < 0) {
offset += temp;
--i;
--nongDate[4];
}
nongDate[1] = i;
nongDate[2] = offset + 1;
return nongDate;
}
/**
* 传出y年m月d日对应的农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6
*
* @param y
* @param m
* @param d
* @return
*/
final public static long[] calElement(int y, int m, int d) {
long[] nongDate = new long[7];
int i = 0, temp = 0, leap = 0;
Date baseDate = new GregorianCalendar(0 + 1900, 0, 31).getTime();
Date objDate = new GregorianCalendar(y, m - 1, d).getTime();
long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L;
nongDate[5] = offset + 40;
nongDate[4] = 14;
for (i = 1900; i < 2050 && offset > 0; i++) {
temp = lYearDays(i);
offset -= temp;
nongDate[4] += 12;
}
if (offset < 0) {
offset += temp;
i--;
nongDate[4] -= 12;
}
nongDate[0] = i;
nongDate[3] = i - 1864;
leap = leapMonth(i); // 闰哪个月
nongDate[6] = 0;
for (i = 1; i < 13 && offset > 0; i++) {
// 闰月
if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) {
--i;
nongDate[6] = 1;
temp = leapDays((int) nongDate[0]);
} else {
temp = monthDays((int) nongDate[0], i);
}
// 解除闰月
if (nongDate[6] == 1 && i == (leap + 1))
nongDate[6] = 0;
offset -= temp;
if (nongDate[6] == 0)
nongDate[4]++;
}
if (offset == 0 && leap > 0 && i == leap + 1) {
if (nongDate[6] == 1) {
nongDate[6] = 0;
} else {
nongDate[6] = 1;
--i;
--nongDate[4];
}
}
if (offset < 0) {
offset += temp;
--i;
--nongDate[4];
}
nongDate[1] = i;
nongDate[2] = offset + 1;
return nongDate;
}
public final static String getChinaDate(int day) {
String a = "";
if (day == 10)
return "初十";
if (day == 20)
return "二十";
if (day == 30)
return "三十";
int two = (int) ((day) / 10);
if (two == 0)
a = "初";
if (two == 1)
a = "十";
if (two == 2)
a = "廿";
if (two == 3)
a = "三";
int one = (int) (day % 10);
switch (one) {
case 1:
a += "一";
break;
case 2:
a += "二";
break;
case 3:
a += "三";
break;
case 4:
a += "四";
break;
case 5:
a += "五";
break;
case 6:
a += "六";
break;
case 7:
a += "七";
break;
case 8:
a += "八";
break;
case 9:
a += "九";
break;
}
return a;
}
public static String today(int y, int m, int d) {
int year = y;
int month = m;
int date = d;
long[] l = calElement(year, month, date);
StringBuffer sToday = new StringBuffer();
try {
sToday.append(" 农历");
sToday.append(cyclical(year));
sToday.append('(');
sToday.append(AnimalsYear(year));
sToday.append(")年");
sToday.append(nStr1[(int) l[1]]);
sToday.append("月");
sToday.append(getChinaDate((int) (l[2])));
return sToday.toString();
} finally {
sToday = null;
}
}
private static SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy年M月d日 EEEEE");
/**
* 农历日历工具使用演示
*
* @param args
*/
public static void main(String[] args) {
System.out.println(today(1988, 10, 27));
}
}

19
src/com/fr/function/StringCat.java

@ -1,19 +0,0 @@
package com.fr.function;
import com.fr.script.AbstractFunction;
public class StringCat extends AbstractFunction {
public StringCat() {
}
public Object run(Object[] args) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < args.length; ++i) {
Object para = args[i];
result.append(para.toString());
}
return result.toString();
}
}

73
src/com/fr/function/StringImage.java

@ -1,73 +0,0 @@
//图片在下文字在上
package com.fr.function;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.script.AbstractFunction;
import com.fr.stable.CoreGraphHelper;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class StringImage extends AbstractFunction {
public Object run(Object[] args) {
Image result = null;
int p = 0;
Object[] ob = new Object[2];
for (int i = 0; (i < args.length && p <= 1); i++) {
if (args[i] == null) {
continue;
}
ob[p] = args[i];
p++;
}
try {
result = initStringImage(ob[0], ob[1]);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
public Image initStringImage(Object nameOb, Object imageOb)
throws IOException {
String name = (String) nameOb;
Image image = null;
if (imageOb instanceof Image)
image = (Image) imageOb;
else
;
Image stringImage = null;
BufferedImage splashBuffedImage = CoreGraphHelper.toBufferedImage(image);
stringImage = splashBuffedImage;
Graphics2D splashG2d = splashBuffedImage.createGraphics();
double centerX = 25;
double centerY = 25;
GraphHelper.drawString(splashG2d, name, centerX, centerY);
//
String FilePath = "Test.png";
File f = new File(FilePath);
ImageIO.write(splashBuffedImage, "png", f);
//
return splashBuffedImage;
}
public static void main(String arg[]) throws IOException {
StringImage tt = new StringImage();
Image image = BaseUtils.readImage("D:\\1.jpg");
String name = "12314124";
Image aa = tt.initStringImage(name, image);
JFrame jf = new JFrame();
JPanel jp = new JPanel();
}
}

45
src/com/fr/function/SubSection.java

@ -1,45 +0,0 @@
//SubSection函数-Oracle查询参数个数限制
package com.fr.function;
import com.fr.general.FArray;
import com.fr.script.AbstractFunction;
public class SubSection extends AbstractFunction {
public Object run(Object[] args) {
// 获取第一个对象,即取得传入的参数
Object para = args[0];
String parastr = para.toString();
// 由于是复选参数,因此要去掉前后的"("和")"
if (parastr.startsWith("(") && parastr.endsWith(")")) {
parastr = parastr.substring(1, parastr.length() - 1);
}
// 将字符串转为","分割的数组
String test[] = parastr.split(",");
int len = test.length;
int loopnum = len / 500;
if (len % 500 != 0) {
loopnum += 1;
}
;
// 返回的值是数组,需要定义成我们内部的类型FArray
FArray result = new FArray();
String str = "";
int k = 1;
for (int i = 0; i < loopnum; i++) {
for (int j = 500 * i; j < 500 * (i + 1) && j < len; j++) {
if (k != 500 && j != (len - 1)) {
str += test[j] + ",";
} else {
str += test[j];
}
k++;
}
// 每500个形成一组并在每组外部加上"("和")"
str = "(" + str + ")";
result.add(str);
str = "";
k = 1;
}
return result;
}
}

25
src/com/fr/function/Ubm.java

@ -1,25 +0,0 @@
// 自定义函数Unicode编码转化为中文
package com.fr.function;
import com.fr.script.AbstractFunction;
public class Ubm extends AbstractFunction {
public Object run(Object[] args) {
String str = args[0].toString();
String st = "";
StringBuffer buffer = new StringBuffer();
while (str.length() > 0) {
if (str.startsWith("%u")) {
st = str.substring(2, 6);
char ch = (char) Integer.parseInt(String.valueOf(st), 16);
buffer.append(new Character(ch).toString());
str = str.substring(6);
} else {
st = str.substring(0, str.indexOf("%u"));
buffer.append(st);
str = str.substring(st.length());
}
}
return buffer.toString();
}
}

35
src/com/fr/function/Upc.java

@ -1,35 +0,0 @@
// 自定义函数生成UPC条形码
package com.fr.function;
import com.fr.script.AbstractFunction;
import org.krysalis.barcode4j.impl.upcean.UPCABean;
import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider;
import org.krysalis.barcode4j.tools.UnitConv;
import java.awt.image.BufferedImage;
public class Upc extends AbstractFunction {
public Object run(Object[] args) {
if (args == null || args.length < 1) {
return "参数不对,必须有一个参数";
}
try {
// 创建一个UPC编码生成器
UPCABean bean = new UPCABean();
// 设置条形码高度,BufferedImage.TYPE_BYTE_BINARY代表常量值12,可直接使用常量值
final int dpi = Integer.parseInt(args[1].toString());
bean.setModuleWidth(UnitConv.in2mm(1.0f / dpi));
bean.doQuietZone(false);
BitmapCanvasProvider canvas = new BitmapCanvasProvider(dpi,
BufferedImage.TYPE_BYTE_BINARY, false, 0);
// 创建条形码
bean.generateBarcode(canvas, String.valueOf(args[0]));
canvas.finish();
// 返回图片显示
return canvas.getBufferedImage();
} catch (Exception e) {
e.printStackTrace();
}
return args[0];
}
}

105
src/com/fr/function/Widget2Image.java

@ -1,105 +0,0 @@
// 导出打印单选按钮及复选框
package com.fr.function;
import com.fr.base.AbstractPainter;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.Style;
import com.fr.general.FArray;
import com.fr.general.FRFont;
import com.fr.script.AbstractFunction;
import com.fr.stable.Primitive;
import com.fr.stable.StringUtils;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
public class Widget2Image extends AbstractFunction {
public Object run(Object[] args) {
if (args.length < 3)
return Primitive.NULL;
// 第一个参数:控件类型,不区分大小写
String type = args[0].toString().toLowerCase();
if (!("checkbox".equals(type) || "radiobutton".equals(type)))
return Primitive.ERROR_VALUE;
// 第二个参数:控件按钮个数
int num = Integer.parseInt(args[1].toString());
// 第三个参数:按钮组的值,哪些被选中
String selection = args[2].toString();
// 第四个参数:可选参数,按钮组对应的显示值数组
FArray textArray = new FArray();
if (args.length == 4 && args[3] instanceof FArray) {
textArray = (FArray) args[3];
}
return new WidgetPaint(type, num, selection, textArray);
}
public static class WidgetPaint extends AbstractPainter {
public static String CHECK_ON = "/com/fr/web/images/checkon.gif";
public static String CHECK_OFF = "/com/fr/web/images/checkoff.gif";
public static String RADIO_ON = "/com/fr/web/images/radioon.gif";
public static String RADIO_OFF = "/com/fr/web/images/radiooff.gif";
public static FRFont DEFUALT_FONT = FRFont.getInstance();
public static FontMetrics FontMetrics = GraphHelper
.getFontMetrics(DEFUALT_FONT);
private String type;
private int num;
private String selection;
private FArray textArray;
{
DEFUALT_FONT = DEFUALT_FONT.applyForeground(Color.BLACK);
}
public WidgetPaint(String type, int num, String selection,
FArray textArray) {
this.type = type;
this.num = num;
this.selection = selection;
this.textArray = textArray;
}
private String resolveText(int i) {
if (i < this.textArray.length()) {
return this.textArray.elementAt(i).toString();
}
return StringUtils.EMPTY;
}
public void paint(Graphics g, int width, int height, int resolution,
Style style) {
String OFF = CHECK_OFF;
String ON = CHECK_ON;
if ("radiobutton".equals(type)) {
OFF = RADIO_OFF;
ON = RADIO_ON;
}
Image[] checkOFFON = {BaseUtils.readImage(OFF),
BaseUtils.readImage(ON)};
int[] imgWidths = {checkOFFON[0].getWidth(null),
checkOFFON[1].getWidth(null)};
int[] imgHeights = {checkOFFON[0].getHeight(null),
checkOFFON[1].getHeight(null)};
Graphics2D g2d = (Graphics2D) g;
g2d.setFont(FRFont.getInstance());
g2d.setPaint(Color.BLACK);
int x = 2;
int y = (height - imgHeights[0]) / 2;
String select = selection;
for (int i = 0; i < num; i++) {
int bit = Integer.parseInt(select.substring(i, i + 1));
g2d.drawImage(checkOFFON[bit], x, y, imgWidths[bit],
imgHeights[bit], null);
x += imgWidths[bit] + 2;
String text = resolveText(i);
g2d.setBackground(Color.BLACK);
g2d.drawString(text, (float) x, (float) (y + FontMetrics
.getAscent()));
x += FontMetrics.stringWidth(text) + 2;
}
}
}
}

25
src/com/fr/io/ExcelToCpt.java

@ -1,25 +0,0 @@
package com.fr.io;
import com.fr.general.ModuleContext;
import com.fr.io.importer.ExcelReportImporter;
import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook;
import com.fr.report.module.EngineModule;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
public class ExcelToCpt {
public static void main(String[] args) throws Exception {
File excelFile = new File("D:\\API.xls");
FileInputStream a = new FileInputStream(excelFile);
ModuleContext.startModule(EngineModule.class.getName());
TemplateWorkBook tpl = new ExcelReportImporter().generateWorkBookByStream(a);
OutputStream outputStream = new FileOutputStream(new File("D:\\abc.cpt"));
((WorkBook) tpl).export(outputStream);
outputStream.close();
ModuleContext.stopModules();
}
}

46
src/com/fr/io/ExcelToCptpage.java

@ -1,46 +0,0 @@
package com.fr.io;
import com.fr.io.importer.ExcelReportImporter;
import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.cellattr.CellPageAttr;
import com.fr.report.elementcase.AbstractElementCase;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Iterator;
public class ExcelToCptpage {
public static void main(String[] args) throws Exception {
File excelFile = new File("D:\\API.xls"); // 获取EXCEL文件
FileInputStream a = new FileInputStream(excelFile);
TemplateWorkBook tpl = new ExcelReportImporter().generateWorkBookByStream(a);
Iterator it = tpl.getReport(0).iteratorOfElementCase();
while (it.hasNext()) {
AbstractElementCase ec = (AbstractElementCase) it.next();
Iterator cellIt = ec.cellIterator();
while (cellIt.hasNext()) {
CellElement obj = (CellElement) cellIt.next();
if (matchCell(obj, Integer.parseInt("1"), Integer.parseInt("0"))) {
CellPageAttr cpa = new CellPageAttr();
cpa.setPageAfterRow(true);
obj.setCellPageAttr(cpa);
}
}
}
OutputStream outputStream = new FileOutputStream(new File("D:\\abc.cpt")); // 转换成cpt模板
((WorkBook) tpl).export(outputStream);
}
private static boolean matchCell(CellElement cell, int row, int col) {
if (cell.getRow() == row && cell.getColumn() == col)
return true;
return false;
}
}

66
src/com/fr/io/ExcuteDemo.java

@ -1,66 +0,0 @@
package com.fr.io;
import com.fr.config.activator.BaseDBActivator;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.data.impl.config.activator.RestrictionActivator;
import com.fr.io.exporter.ExcelExporter;
import com.fr.main.TemplateWorkBook;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.report.ReportActivator;
import com.fr.report.module.ReportBaseActivator;
import com.fr.serialization.SerializationActivator;
import com.fr.stable.WriteActor;
import com.fr.startup.WorkspaceRegister;
import com.fr.store.StateServerActivator;
import com.fr.workspace.engine.WorkspaceActivator;
import com.fr.workspace.server.ServerWorkspaceRegister;
import com.fr.workspace.simple.SimpleWork;
import java.io.File;
import java.io.FileOutputStream;
public class ExcuteDemo {
public static void main(String[] args) {
try {
// 首先需要定义执行所在的环境,这样才能正确读取数据库信息
// 定义报表运行环境,用于执行报表
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WorkspaceRegister(),
new ServerWorkspaceRegister(),
new SerializationActivator());
String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径
SimpleWork.checkIn(envpath);
module.start();
// 读取模板
TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt");
/*
* 生成参数map注入参数与对应的值用于执行报表 该模板中只有一个参数地区给其赋值华北
* 若参数在发送请求时传过来可以通过req.getParameter(name)获得
* 获得的参数put进map中paraMap.put(paraname,paravalue)
*/
java.util.Map paraMap = new java.util.HashMap();
paraMap.put("地区", "华北");
// 使用paraMap执行生成结果
ResultWorkBook result = workbook.execute(paraMap, new WriteActor());
// 使用结果如导出至excel
FileOutputStream outputStream = new FileOutputStream(new File(
"D:\\Parameter.xls"));
ExcelExporter excelExporter = new ExcelExporter();
excelExporter.export(outputStream, result);
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
}
}

91
src/com/fr/io/ExportBatch.java

@ -1,91 +0,0 @@
package com.fr.io;
import com.fr.config.activator.BaseDBActivator;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.data.impl.config.activator.RestrictionActivator;
import com.fr.general.ModuleContext;
import com.fr.io.exporter.ExcelExporter;
import com.fr.main.TemplateWorkBook;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.report.ReportActivator;
import com.fr.report.module.ReportBaseActivator;
import com.fr.serialization.SerializationActivator;
import com.fr.stable.StableUtils;
import com.fr.stable.WriteActor;
import com.fr.startup.WorkspaceRegister;
import com.fr.store.StateServerActivator;
import com.fr.workspace.engine.WorkspaceActivator;
import com.fr.workspace.server.ServerWorkspaceRegister;
import com.fr.workspace.simple.SimpleWork;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Arrays;
public class ExportBatch {
public static void main(String[] args) {
try {
// 定义报表运行环境,用于执行报表
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WorkspaceRegister(),
new ServerWorkspaceRegister(),
new SerializationActivator());
String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径
SimpleWork.checkIn(envpath);
module.start();
// 读取环境下的模板文件
TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook(
"doc\\Primary\\DetailReport\\Details.cpt");
// 读取用于保存的参数值的txt文件
File parafile = new File(envpath + "\\para.txt");
FileInputStream fileinputstream;
fileinputstream = new FileInputStream(parafile);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileinputstream));
// 定义保存参数的map,用于执行报表
java.util.Map paramap = new java.util.HashMap();
/*
* 遍历参数值所在txt文件txt文件中参数保存形式为 para1,para2 江苏,陈羽 江苏,安娜 首先取出第一行保存参数名称
* 遍历每个参数组合如para1=江苏para2=陈羽根据参数执行模板并将结果导出excel excel文件名为名称+导出编号
*/
// 读第一行,保存参数名称
String lineText = bufferedReader.readLine();
lineText = lineText.trim();
String[] paraname = StableUtils.splitString(lineText, ",");
System.out.println(Arrays.toString(paraname));
// 遍历每个参数组合,执行模板,导出结果
int number = 0;
while ((lineText = bufferedReader.readLine()) != null) {
lineText = lineText.trim();
String[] paravalue = StableUtils.splitString(lineText, ",");
for (int j = 0; j < paravalue.length; j++) {
paramap.put(paraname[j], paravalue[j]);
}
ResultWorkBook result = workbook.execute(paramap,new WriteActor());
OutputStream outputstream = new FileOutputStream(new File("E:\\ExportEg" + number + ".xls"));
ExcelExporter excelexporter = new ExcelExporter();
excelexporter.export(outputstream, result);
// 最后要清空一下参数map,用于下次计算
paramap.clear();
number++;
outputstream.close();
}
ModuleContext.stopModules();
} catch (Exception e) {
e.printStackTrace();
}
}
}

88
src/com/fr/io/ExportExcel.java

@ -1,88 +0,0 @@
package com.fr.io;
import com.fr.base.Parameter;
import com.fr.general.ModuleContext;
import com.fr.io.exporter.ExcelExporter;
import com.fr.io.exporter.LargeDataPageExcelExporter;
import com.fr.io.exporter.PageExcel2007Exporter;
import com.fr.io.exporter.PageExcelExporter;
import com.fr.io.exporter.PageToSheetExcel2007Exporter;
import com.fr.io.exporter.PageToSheetExcelExporter;
import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter;
import com.fr.main.impl.WorkBook;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.report.core.ReportUtils;
import com.fr.report.module.EngineModule;
import com.fr.stable.WriteActor;
import com.fr.workspace.simple.SimpleWork;
import java.io.File;
import java.io.FileOutputStream;
public class ExportExcel {
public static void main(String[] args) {
// 定义报表运行环境,才能执行报表
String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
SimpleWork.checkIn(envpath);
ModuleContext.startModule(EngineModule.class.getName());
ResultWorkBook rworkbook = null;
try {
// 未执行模板工作薄
WorkBook workbook = (WorkBook) TemplateWorkBookIO
.readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt");
// 获取报表参数并设置值,导出内置数据集时数据集会根据参数值查询出结果从而转为内置数据集
Parameter[] parameters = workbook.getParameters();
parameters[0].setValue("华东");
// 定义parametermap用于执行报表,将执行后的结果工作薄保存为rworkBook
java.util.Map parameterMap = new java.util.HashMap();
for (int i = 0; i < parameters.length; i++) {
parameterMap.put(parameters[i].getName(), parameters[i]
.getValue());
}
// 定义输出流
FileOutputStream outputStream;
//原样导出excel2003
outputStream = new FileOutputStream(new File("E:\\ExcelExport.xls"));
ExcelExporter excel = new ExcelExporter();
excel.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
//原样导出excel2007
outputStream = new FileOutputStream(new File("E:\\ExcelExport.xlsx"));
StreamExcel2007Exporter excel1 = new StreamExcel2007Exporter();
excel.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
//分页导出excel2003
outputStream = new FileOutputStream(new File("E:\\PageExcelExport.xls"));
PageExcelExporter page = new PageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap, new WriteActor())));
page.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
//分页导出excel2007
outputStream = new FileOutputStream(new File("E:\\PageExcelExport.xlsx"));
PageExcel2007Exporter page1 = new PageExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook));
page1.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
//分页分sheet导出excel2003
outputStream = new FileOutputStream(new File("E:\\PageSheetExcelExport.xls"));
PageToSheetExcelExporter sheet = new PageToSheetExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap, new WriteActor())));
sheet.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
//分页分sheet导出excel2007
outputStream = new FileOutputStream(new File("E:\\PageSheetExcelExport.xlsx"));
PageToSheetExcel2007Exporter sheet1 = new PageToSheetExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook));
sheet1.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
//大数据量导出
outputStream = new FileOutputStream(new File("E:\\LargeExcelExport.zip"));
LargeDataPageExcelExporter large = new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap, new WriteActor())), true);
//导出2007版outputStream = new FileOutputStream(new File("E:\\LargeExcelExport.xlsx")); excel LargeDataPageExcel2007Exporter large = new LargeDataPageExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook), true);
large.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
outputStream.close();
ModuleContext.stopModules();
} catch (Exception e) {
e.printStackTrace();
}
}
}

58
src/com/fr/io/ExportReports.java

@ -1,58 +0,0 @@
package com.fr.io;
import com.fr.base.Parameter;
import com.fr.general.ModuleContext;
import com.fr.io.exporter.PageExcelExporter;
import com.fr.main.TemplateWorkBook;
import com.fr.main.workbook.PageWorkBook;
import com.fr.report.core.ReportUtils;
import com.fr.report.module.EngineModule;
import com.fr.report.report.PageReport;
import com.fr.stable.PageActor;
import com.fr.workspace.simple.SimpleWork;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
public class ExportReports {
public static void main(String[] args) {
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>
String envpath = "D:\\FineReport\\develop\\code\\build\\package\\WebReport\\WEB-INF";
SimpleWork.checkIn(envpath);
ModuleContext.startModule(EngineModule.class.getName());
// <EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һЩ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
try {
// δִ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook(
"Gettingstarted.cpt");
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪChina<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>rworkbook
Parameter[] parameters = workbook.getParameters();
java.util.Map parameterMap = new java.util.HashMap();
for (int i = 0; i < parameters.length; i++) {
parameterMap.put(parameters[i].getName(), "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
PageWorkBook rworkbook = (PageWorkBook) workbook.execute(parameterMap, new PageActor());
rworkbook.setReportName(0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
// <EFBFBD><EFBFBD><EFBFBD>parametermap<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ResultReport
parameterMap.clear();
for (int i = 0; i < parameters.length; i++) {
parameterMap.put(parameters[i].getName(), "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
PageWorkBook rworkbook2 = (PageWorkBook) workbook.execute(parameterMap, new PageActor());
PageReport rreport2 = rworkbook2.getPageReport(0);
rworkbook.addReport("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", rreport2);
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪExcel<EFBFBD>ļ<EFBFBD>
OutputStream outputStream = new FileOutputStream(new File("D:\\ExcelExport1.xls"));
PageExcelExporter excelExport = new PageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook));
excelExport.export(outputStream, rworkbook);
outputStream.close();
ModuleContext.stopModules();
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
}
}

36
src/com/fr/io/JavaPrint.java

@ -1,36 +0,0 @@
package com.fr.io;
import com.fr.base.Parameter;
import com.fr.main.TemplateWorkBook;
import com.fr.print.PrintUtils;
import com.fr.workspace.simple.SimpleWork;
import java.util.HashMap;
public class JavaPrint {
public static void main(String[] args) {
// 定义报表运行环境,才能执行报表
String envPath = "D:\\FineReport\\develop\\code\\build\\package\\WebReport\\WEB-INF";
SimpleWork.checkIn(envPath);
try {
TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook("GettingStarted.cpt");
// 参数传值
Parameter[] parameters = workbook.getParameters();
HashMap<String, String> paraMap = new HashMap<String, String>();
paraMap.put(parameters[0].getName(), "华北");
// java中调用报表打印方法
boolean a = PrintUtils.printWorkBook("GettingStarted.cpt", paraMap, true);
if (a == false) {
System.out.println("失败啦!返回" + a);
} else {
System.out.println("成功!返回" + a);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
}
}

78
src/com/fr/io/SetParameterWindow.java

@ -1,78 +0,0 @@
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>API
package com.fr.io;
import com.fr.base.background.ColorBackground;
import com.fr.config.activator.BaseDBActivator;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.data.impl.config.activator.RestrictionActivator;
import com.fr.general.Background;
import com.fr.io.exporter.EmbeddedTableDataExporter;
import com.fr.main.impl.WorkBook;
import com.fr.main.parameter.ReportParameterAttr;
import com.fr.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.report.ReportActivator;
import com.fr.report.module.ReportBaseActivator;
import com.fr.serialization.SerializationActivator;
import com.fr.startup.WorkspaceRegister;
import com.fr.store.StateServerActivator;
import com.fr.workspace.engine.WorkspaceActivator;
import com.fr.workspace.server.ServerWorkspaceRegister;
import com.fr.workspace.simple.SimpleWork;
import java.awt.Color;
import java.io.File;
import java.io.FileOutputStream;
public class SetParameterWindow {
public static void main(String[] args) {
try {
// 定义报表运行环境,用于执行报表
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WorkspaceRegister(),
new ServerWorkspaceRegister(),
new SerializationActivator());
String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径
SimpleWork.checkIn(envpath);
module.start();
WorkBook workbook = (WorkBook) TemplateWorkBookIO
.readTemplateWorkBook(
"\\doc\\Primary\\Parameter\\Parameter.cpt");
// <EFBFBD><EFBFBD>ȡWorkBook<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ReportParameterAttr
ReportParameterAttr paraAttr = workbook.getReportParameterAttr();
/* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>
* 0 : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* 1 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* 2 <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
paraAttr.setAlign(1);
/*
* <EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* ColorBackground <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* GradientBackground <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* ImageBackground <EFBFBD><EFBFBD>ͼƬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* PatternBackground <EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* TextureBackground <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
Background background = ColorBackground.getInstance(new Color(0, 255, 255));
paraAttr.setBackground(background);
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><EFBFBD>
workbook.setReportParameterAttr(paraAttr);
FileOutputStream outputStream = new FileOutputStream(new File(
"D:\\newParameter.cpt"));
EmbeddedTableDataExporter templateExporter = new EmbeddedTableDataExporter();
templateExporter.export(outputStream, workbook);
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
}
}

71
src/com/fr/io/SimpleDemo.java

@ -1,71 +0,0 @@
//<EFBFBD><EFBFBD>ȡ<EFBFBD>޸ı<EFBFBD><EFBFBD><EFBFBD>
package com.fr.io;
import com.fr.base.Style;
import com.fr.config.activator.BaseDBActivator;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.data.impl.config.activator.RestrictionActivator;
import com.fr.general.FRFont;
import com.fr.main.impl.WorkBook;
import com.fr.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.report.ReportActivator;
import com.fr.report.cell.CellElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.module.ReportBaseActivator;
import com.fr.serialization.SerializationActivator;
import com.fr.startup.WorkspaceRegister;
import com.fr.store.StateServerActivator;
import com.fr.workspace.engine.WorkspaceActivator;
import com.fr.workspace.server.ServerWorkspaceRegister;
import com.fr.workspace.simple.SimpleWork;
import java.awt.Color;
import java.io.File;
import java.io.FileOutputStream;
public class SimpleDemo {
public static void main(String[] args) {
// 定义报表运行环境,用于执行报表
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WorkspaceRegister(),
new ServerWorkspaceRegister(),
new SerializationActivator());
String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径
SimpleWork.checkIn(envpath);
module.start();
try {
// <EFBFBD><EFBFBD>ȡģ<EFBFBD><EFBFBD>
WorkBook workbook = (WorkBook) TemplateWorkBookIO
.readTemplateWorkBook(
"\\doc\\Primary\\Parameter\\Parameter.cpt");
// <EFBFBD><EFBFBD><EFBFBD>WorkBook<EFBFBD>е<EFBFBD>WorkSheet<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>A1<EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>ɫΪ<EFBFBD><EFBFBD>ɫ
TemplateElementCase report = (TemplateElementCase) workbook
.getReport(0);
// getCellElement(int column, int
// row),column<EFBFBD><EFBFBD>row<EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A1<EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD>0<EFBFBD>е<EFBFBD>0<EFBFBD><EFBFBD>
CellElement cellA1 = report.getCellElement(0, 0);
FRFont frFont = FRFont.getInstance();
frFont = frFont.applyForeground(Color.red);
Style style = Style.getInstance();
style = style.deriveFRFont(frFont);
cellA1.setStyle(style);
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>
FileOutputStream outputStream = new FileOutputStream(new File(
"D:\\newParameter1.cpt"));
((WorkBook) workbook).export(outputStream);
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
}
}

12
src/com/fr/log/LogApi.java

@ -1,12 +0,0 @@
package com.fr.log;
/**
* 后台输出log信息-http://help.finereport.com/doc-view-746.html
*/
public class LogApi {
public static void main(String[] args) {
FineLoggerFactory.getLogger().info( "This is level info"); //需要服务器log级别为info时才会显示
FineLoggerFactory.getLogger().warn("This is level warning"); //需要服务器log级别为info、warning时才会显示
FineLoggerFactory.getLogger().error("This is level error"); //需要服务器log级别为info、warning、error时才会显示,10.0取消了server级别日志记录
}
}

76
src/com/fr/output/FTPUpload.java

@ -1,76 +0,0 @@
package com.fr.output;
import com.fr.data.dao.CompatiableIDFCMapper;
import com.fr.data.dao.ObjectTableMapper;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.schedule.output.AbstractOutputFileAction;
import com.fr.schedule.output.FTPTransmission;
import com.fr.schedule.output.OutputFileAction;
import com.fr.schedule.output.ftp.DefaultFTPTransmit;
import java.io.File;
public class FTPUpload extends AbstractOutputFileAction {
@Override
public ObjectTableMapper objectTableMapper2Register() {
return null;
}
@Override
public long getId() {
return 0;
}
@Override
public File[] getFilesToDealWith(File[] files) {
return files;
}
@Override
public void doFileAction(File[] files) {
FTPTransmission ftp = new FTPTransmission();
ftp.setServerAddress("env.finedevelop.com");
ftp.setPort(58321);
ftp.setSavePath("connie");
ftp.setUsername("fr");
ftp.setPassword("ilovejava");
try {
new DefaultFTPTransmit().transmit(files, ftp.getServerAddress(), ftp.getPort(), ftp.getUsername(), ftp.getPassword(), ftp.getSavePath());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public CompatiableIDFCMapper getExtraOutputFileActionForeignKey() {
return null;
}
@Override
public boolean isEmailNotification() {
// TODO Auto-generated method stub
return false;
}
@Override
public OutputFileAction analyzeJSON(JSONObject arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public JSONObject createJSONConfig() throws JSONException {
// TODO Auto-generated method stub
return null;
}
@Override
public String getJsonTag() {
// TODO Auto-generated method stub
return null;
}
}

100
src/com/fr/output/OutputExcel.java

@ -1,100 +0,0 @@
package com.fr.output;
import com.fr.data.dao.CompatiableIDFCMapper;
import com.fr.data.dao.ObjectTableMapper;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.schedule.output.AbstractOutputFileAction;
import com.fr.schedule.output.OutputFileAction;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class OutputExcel extends AbstractOutputFileAction {
@Override
public File[] getFilesToDealWith(File[] files) {
return files;
}
@Override
public void doFileAction(File[] files) {
// OutputStream out=new BufferedOutputStream(new FileOutputStream(new File(files.)));;
System.out.println(files[0].getName());
for (int i = 0; i < files.length; i++) {
String name = files[i].getName();
String path = "D:/" + name;
BufferedInputStream in = null;
OutputStream out = null;
try {
out = new BufferedOutputStream(new FileOutputStream(new File(path)));
in = new BufferedInputStream(new FileInputStream(files[i]));
byte[] ba = new byte[in.available()];
in.read(ba);
out.write(ba);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
@Override
public ObjectTableMapper objectTableMapper2Register() {
return null;
}
@Override
public CompatiableIDFCMapper getExtraOutputFileActionForeignKey() {
return null;
}
@Override
public long getId() {
return 0;
}
@Override
public boolean isEmailNotification() {
// TODO Auto-generated method stub
return false;
}
@Override
public OutputFileAction analyzeJSON(JSONObject arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public JSONObject createJSONConfig() throws JSONException {
// TODO Auto-generated method stub
return null;
}
@Override
public String getJsonTag() {
// TODO Auto-generated method stub
return null;
}
}

26
src/com/fr/plugin/chart/IndependentChartProviderImpl.java

@ -1,26 +0,0 @@
package com.fr.plugin.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.fun.impl.AbstractIndependentChartProvider;
public class IndependentChartProviderImpl extends AbstractIndependentChartProvider {
@Override
public void init() {
}
@Override
public void destroy() {
}
@Override
public String getChartName() {
return "";
}
@Override
public Chart[] getChartTypes() {
return null;
}
}

22
src/com/fr/plugin/chart/IndependentChartUIProviderImpl.java

@ -1,22 +0,0 @@
package com.fr.plugin.chart;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.extended.chart.AbstractExtendedChartTableDataPane;
import com.fr.extended.chart.AbstractExtendedChartUIProvider;
public class IndependentChartUIProviderImpl extends AbstractExtendedChartUIProvider {
@Override
protected AbstractExtendedChartTableDataPane getTableDataSourcePane() {
return null;
}
@Override
protected AbstractReportDataContentPane getReportDataSourcePane() {
return null;
}
@Override
public String getIconPath() {
return "";
}
}

23
src/com/fr/plugin/core/ActionCMDImpl.java

@ -1,23 +0,0 @@
package com.fr.plugin.core;
import com.fr.web.core.ActionCMD;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ActionCMDImpl implements ActionCMD {
@Override
public String getCMD() {
return "";
}
@Override
public void actionCMD(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s) throws Exception {
}
@Override
public void actionCMD(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
}
}

18
src/com/fr/plugin/core/AttachmentDownloaderImpl.java

@ -1,18 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.fun.impl.AbstractAttachmentDownloader;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class AttachmentDownloaderImpl extends AbstractAttachmentDownloader {
@Override
public void download(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s, String[] strings) throws Exception {
}
@Override
public String createDownloadScript(String s) {
return "";
}
}

18
src/com/fr/plugin/core/CellValueProcessorImpl.java

@ -1,18 +0,0 @@
package com.fr.plugin.core;
import com.fr.base.Style;
import com.fr.report.cell.cellattr.CellGUIAttr;
import com.fr.report.fun.impl.AbstractCellValueProvider;
import com.fr.stable.script.CalculatorProvider;
public class CellValueProcessorImpl extends AbstractCellValueProvider {
@Override
public Object process(Object o, CalculatorProvider calculatorProvider) {
return null;
}
@Override
public Object processBeforeToTag(Object o, CellGUIAttr cellGUIAttr, Style style, int i, int i1) {
return null;
}
}

10
src/com/fr/plugin/core/CssFileHandlerImpl.java

@ -1,10 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.fun.impl.AbstractCssFileHandler;
public class CssFileHandlerImpl extends AbstractCssFileHandler {
@Override
public String[] pathsForFiles() {
return null;
}
}

7
src/com/fr/plugin/core/DebugLogProviderImpl.java

@ -1,7 +0,0 @@
package com.fr.plugin.core;
public class DebugLogProviderImpl {
public static void main(String[] args) {
}
}

18
src/com/fr/plugin/core/DialectCreatorImpl.java

@ -1,18 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.UrlDriver;
import com.fr.stable.fun.impl.AbstractDialectCreator;
import java.sql.Connection;
public class DialectCreatorImpl extends AbstractDialectCreator {
@Override
public Class<?> generate(UrlDriver urlDriver) {
return null;
}
@Override
public Class<?> generate(Connection connection) {
return null;
}
}

13
src/com/fr/plugin/core/EmailProcessorImpl.java

@ -1,13 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.fun.impl.AbstractEmailProcessor;
import java.util.HashMap;
import java.util.Map;
public class EmailProcessorImpl extends AbstractEmailProcessor {
@Override
public Map<String, Object> loadMailProperties(String s, String s1, String s2, String s3, String s4) {
return new HashMap<String, Object>();
}
}

11
src/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java

@ -1,11 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.fun.impl.AbstractExcelExportCellValueProvider;
import com.fr.stable.script.CalculatorProvider;
public class ExcelExportCellValueProviderImpl extends AbstractExcelExportCellValueProvider {
@Override
public Object getCellValue(Object o, Object o1, CalculatorProvider calculatorProvider) {
return null;
}
}

6
src/com/fr/plugin/core/ExcelExportProcessorImpl.java

@ -1,6 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.fun.impl.AbstractExcelExportProcessor;
public class ExcelExportProcessorImpl extends AbstractExcelExportProcessor {
}

10
src/com/fr/plugin/core/FunctionDefineProviderImpl.java

@ -1,10 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.fun.FunctionDefineProvider;
public class FunctionDefineProviderImpl implements FunctionDefineProvider {
@Override
public int currentAPILevel() {
return 0;
}
}

13
src/com/fr/plugin/core/GraphDrawProcessorImpl.java

@ -1,13 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.fun.impl.AbstractGraphDrawProcessor;
import java.awt.Graphics;
import java.awt.Image;
public class GraphDrawProcessorImpl extends AbstractGraphDrawProcessor {
@Override
public void paintImage(Graphics graphics, int i, int i1, Image image, int i2, int i3, int i4, int i5, int i6) {
}
}

10
src/com/fr/plugin/core/HttpAuthProcessorImpl.java

@ -1,10 +0,0 @@
package com.fr.plugin.core;
/**
* 10.0已经废弃
*/
public class HttpAuthProcessorImpl {
public static void main(String[] args) {
//HttpAuthProcessor pro = new HttpAuthProcessor();
}
}

10
src/com/fr/plugin/core/JavaScriptFileHandlerImpl.java

@ -1,10 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.fun.impl.AbstractJavaScriptFileHandler;
public class JavaScriptFileHandlerImpl extends AbstractJavaScriptFileHandler {
@Override
public String[] pathsForFiles() {
return null;
}
}

25
src/com/fr/plugin/core/LogDBRecordProcessorImpl.java

@ -1,25 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.fun.impl.AbstractLogDBRecordProcessor;
public class LogDBRecordProcessorImpl extends AbstractLogDBRecordProcessor {
@Override
public String driver() {
return "";
}
@Override
public String url() {
return "";
}
@Override
public String username() {
return "";
}
@Override
public String password() {
return "";
}
}

6
src/com/fr/plugin/core/LogProviderImpl.java

@ -1,6 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.fun.impl.AbstractLogProvider;
public class LogProviderImpl extends AbstractLogProvider {
}

12
src/com/fr/plugin/core/PrintCellValueProviderImpl.java

@ -1,12 +0,0 @@
package com.fr.plugin.core;
import com.fr.report.cell.cellattr.CellGUIAttr;
import com.fr.report.cell.cellattr.PageExportCellElement;
import com.fr.report.fun.impl.AbstractPrintCellValueProvider;
public class PrintCellValueProviderImpl extends AbstractPrintCellValueProvider {
@Override
public Object getCellValue(PageExportCellElement pageExportCellElement, CellGUIAttr cellGUIAttr, Object o, int i, int i1) {
return null;
}
}

33
src/com/fr/plugin/core/RequestParameterCollectorImpl.java

@ -1,33 +0,0 @@
package com.fr.plugin.core;
import com.fr.stable.fun.impl.AbstractRequestParameterCollector;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
public class RequestParameterCollectorImpl extends AbstractRequestParameterCollector {
@Override
public Map<String, Object> getParametersFromSession(HttpServletRequest httpServletRequest) {
return null;
}
@Override
public Map<String, Object> getParametersFromAttribute(HttpServletRequest httpServletRequest) {
return null;
}
@Override
public Map<String, Object> getParametersFromReqInputStream(HttpServletRequest httpServletRequest) {
return null;
}
@Override
public Map<String, Object> getParametersFromParameter(HttpServletRequest httpServletRequest) {
return null;
}
@Override
public Map<String, Object> getParametersFromJSON(HttpServletRequest httpServletRequest, Map<String, Object> map) {
return null;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save