From ebabb7f7833e00537c0558e72a6457c99b4099ce Mon Sep 17 00:00:00 2001 From: zack Date: Mon, 4 Mar 2019 15:54:41 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-15174=20=E4=B8=BA=E4=BA=86=E8=A7=A3?= =?UTF-8?q?=E5=86=B3UNDEF-1709=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=B8=AE=E5=8A=A9=E6=96=87=E6=A1=A3=E6=89=80?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=8C=E6=AF=8F?= =?UTF-8?q?=E5=A4=A9=E9=83=BD=E8=A6=81=E8=83=BD=E4=BF=9D=E8=AF=81=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E9=80=9A=E8=BF=87,=20=E5=85=AC=E5=BC=80api=E5=92=8C?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=8E=A5=E5=8F=A3=E6=8C=AA=E5=88=B0=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin-report-doc-demo/lib/report/.gitkeep | 0 plugin-report-doc-demo/plugin.xml | 23 + plugin-report-doc-demo/readme.md | 26 + .../src/com/fr/StartFRDesigner.java | 12 + .../src/com/fr/data/ArrayTableDataDemo.java | 45 + .../src/com/fr/data/Commit3.java | 133 + .../src/com/fr/data/CustomTableData.java | 51 + .../src/com/fr/data/DataModelDemo.java | 84 + .../src/com/fr/data/DemoSubmitJob1.java | 51 + .../src/com/fr/data/DemoSubmitJob2.java | 64 + .../src/com/fr/data/DemoTotalSubmitJob.java | 59 + .../src/com/fr/data/GetXmlData.java | 81 + .../src/com/fr/data/GetXmlDate.java | 70 + .../com/fr/data/MobileTableWsdlDataDemo.java | 114 + .../com/fr/data/MobileWsdlTableDataDemo.java | 147 + .../com/fr/data/MobileWsdlTableDataDemo1.java | 105 + .../com/fr/data/MobileWsdlTableDataDemo2.java | 65 + .../fr/data/MobileWsdlTableDataDemoPara.java | 114 + .../src/com/fr/data/ParamSAPDataTest.java | 112 + .../src/com/fr/data/ParamTableDataDemo.java | 158 + .../src/com/fr/data/WebServiceTableData.java | 58 + .../fr/data/WebServiceWsdlTableDataDemo2.java | 69 + .../com/fr/data/XMLColumnNameType4Demo.java | 27 + .../src/com/fr/data/XMLDemoTableData.java | 202 + .../com/fr/data/XMLParseDemoDataModel.java | 226 + .../src/com/fr/data/XMLRead.java | 115 + .../src/com/fr/data/impl/Commit1.java | 126 + .../src/com/fr/data/impl/Commit3.java | 131 + .../src/com/fr/demo/ChangeRowAndCol.java | 79 + .../src/com/fr/demo/CreateReportletDemo.java | 50 + .../src/com/fr/demo/NewDateDemo.java | 40 + .../src/com/fr/demo/ReadFromDatabase.java | 65 + .../src/com/fr/demo/SaveReportToDatabase.java | 50 + .../src/com/fr/demo/SetCellElementStyle.java | 71 + .../src/com/fr/demo/SimpleReportletDemo.java | 42 + .../src/com/fr/demo/TotalVerifyJobDemo.java | 55 + .../src/com/fr/demo/URLParameterDemo.java | 53 + .../src/com/fr/demo/VerifyJobDemo.java | 68 + .../src/com/fr/function/BinaryImage.java | 91 + .../src/com/fr/function/CellSum.java | 15 + .../src/com/fr/function/ConnectSAPServer.java | 58 + .../src/com/fr/function/FlagHtmlColor.java | 67 + .../src/com/fr/function/GETIP.java | 23 + .../src/com/fr/function/JFreeToChart.java | 86 + .../src/com/fr/function/Lunar.java | 15 + .../src/com/fr/function/ParamSAPDataTest.java | 40 + .../src/com/fr/function/ReportCheck.java | 105 + .../src/com/fr/function/SolarToLunar.java | 381 ++ .../src/com/fr/function/StringCat.java | 19 + .../src/com/fr/function/StringImage.java | 73 + .../src/com/fr/function/SubSection.java | 45 + .../src/com/fr/function/Ubm.java | 25 + .../src/com/fr/function/Upc.java | 35 + .../src/com/fr/function/Widget2Image.java | 105 + .../src/com/fr/io/ExcelToCpt.java | 25 + .../src/com/fr/io/ExcelToCptpage.java | 46 + .../src/com/fr/io/ExcuteDemo.java | 66 + .../src/com/fr/io/ExportApi.java | 116 + .../src/com/fr/io/ExportBatch.java | 91 + .../src/com/fr/io/ExportExcel.java | 88 + .../src/com/fr/io/ExportReports.java | 58 + .../src/com/fr/io/JavaPrint.java | 36 + .../src/com/fr/io/SetParameterWindow.java | 78 + .../src/com/fr/io/SimpleDemo.java | 71 + .../src/com/fr/log/LogApi.java | 12 + .../src/com/fr/output/FTPUpload.java | 76 + .../src/com/fr/output/OutputExcel.java | 100 + .../src/com/fr/output/session.java | 48 + .../chart/IndependentChartProviderImpl.java | 26 + .../chart/IndependentChartUIProviderImpl.java | 22 + .../src/com/fr/plugin/core/ActionCMDImpl.java | 23 + .../plugin/core/AttachmentDownloaderImpl.java | 18 + .../plugin/core/CellValueProcessorImpl.java | 18 + .../fr/plugin/core/CssFileHandlerImpl.java | 10 + .../fr/plugin/core/DebugLogProviderImpl.java | 7 + .../fr/plugin/core/DialectCreatorImpl.java | 18 + .../fr/plugin/core/EmailProcessorImpl.java | 13 + .../ExcelExportCellValueProviderImpl.java | 11 + .../plugin/core/ExcelExportProcessorImpl.java | 6 + .../core/FunctionDefineProviderImpl.java | 10 + .../plugin/core/GraphDrawProcessorImpl.java | 13 + .../fr/plugin/core/HttpAuthProcessorImpl.java | 10 + .../core/JavaScriptFileHandlerImpl.java | 10 + .../plugin/core/LogDBRecordProcessorImpl.java | 25 + .../com/fr/plugin/core/LogProviderImpl.java | 6 + .../core/PrintCellValueProviderImpl.java | 12 + .../core/RequestParameterCollectorImpl.java | 33 + .../core/RequestParameterHandlerImpl.java | 32 + .../src/com/fr/plugin/core/ServiceImpl.java | 18 + .../plugin/core/SpecialCharProcessorImpl.java | 10 + .../fr/plugin/core/TableDataProviderImpl.java | 6 + .../fr/plugin/core/WidgetSwitcherImpl.java | 10 + .../core/XMLFileManagerProviderImpl.java | 7 + .../design/CellAttributeProviderImpl.java | 11 + .../design/CellWidgetOptionProviderImpl.java | 27 + .../plugin/design/ConnectionProviderImpl.java | 28 + .../design/FormWidgetOptionProviderImpl.java | 26 + .../design/GlobalListenerProviderImpl.java | 12 + .../plugin/design/HighlightProviderImpl.java | 17 + .../design/IndentationUnitProcessorImpl.java | 6 + .../design/JavaScriptActionProviderImpl.java | 12 + .../ParameterWidgetOptionProviderImpl.java | 27 + .../fr/plugin/design/PreviewProviderImpl.java | 25 + .../com/fr/plugin/design/ShortCutImpl.java | 28 + .../fr/plugin/design/SubmitProviderImpl.java | 21 + .../design/TableDataDefineProviderImpl.java | 37 + .../design/TitlePlaceProcessorImpl.java | 13 + .../plugin/design/UIFormulaProcessorImpl.java | 16 + .../design/WidgetDesignHandlerImpl.java | 11 + .../fr/plugin/report/ActorProviderImpl.java | 11 + .../report/CellTooltipProcessorImpl.java | 12 + .../report/ExcelExportAppProviderImpl.java | 10 + .../plugin/report/ExcelImportProcessor.java | 14 + .../report/ExportEncodeProviderImpl.java | 6 + .../report/ExportExtensionProcessorImpl.java | 21 + .../report/ExportOperateProviderImpl.java | 16 + .../report/FromExportProcessorImpl.java | 13 + .../report/PageCalObjectProcessorImpl.java | 18 + .../ReportPretreatmentProcessorImpl.java | 13 + .../src/com/fr/privilege/RSAUtil.java | 205 + .../fr/privilege/TestPasswordValidator.java | 21 + .../privilege/TestPasswordValidatorRSA.java | 33 + .../privilege/TestPasswordValidatorUser.java | 46 + .../src/com/fr/test/gauthority.java | 77 + .../src/main/java/com/fr/learn/Leaner.java | 16 + .../main/java/com/fr/learn/Learner4Debug.java | 8 + .../mobile/MobileCodeWSCallbackHandler.java | 71 + .../src/mobile/MobileCodeWSStub.java | 3780 +++++++++++++++++ 128 files changed, 10217 insertions(+) create mode 100644 plugin-report-doc-demo/lib/report/.gitkeep create mode 100644 plugin-report-doc-demo/plugin.xml create mode 100644 plugin-report-doc-demo/readme.md create mode 100644 plugin-report-doc-demo/src/com/fr/StartFRDesigner.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/ArrayTableDataDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/Commit3.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/CustomTableData.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/DataModelDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob1.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob2.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/DemoTotalSubmitJob.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/GetXmlData.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/GetXmlDate.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/MobileTableWsdlDataDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo1.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo2.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemoPara.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/ParamSAPDataTest.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/ParamTableDataDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/WebServiceTableData.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/WebServiceWsdlTableDataDemo2.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/XMLColumnNameType4Demo.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/XMLDemoTableData.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/XMLParseDemoDataModel.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/XMLRead.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/impl/Commit1.java create mode 100644 plugin-report-doc-demo/src/com/fr/data/impl/Commit3.java create mode 100644 plugin-report-doc-demo/src/com/fr/demo/ChangeRowAndCol.java create mode 100644 plugin-report-doc-demo/src/com/fr/demo/CreateReportletDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/demo/NewDateDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/demo/ReadFromDatabase.java create mode 100644 plugin-report-doc-demo/src/com/fr/demo/SaveReportToDatabase.java create mode 100644 plugin-report-doc-demo/src/com/fr/demo/SetCellElementStyle.java create mode 100644 plugin-report-doc-demo/src/com/fr/demo/SimpleReportletDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/demo/TotalVerifyJobDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/demo/URLParameterDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/demo/VerifyJobDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/BinaryImage.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/CellSum.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/ConnectSAPServer.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/FlagHtmlColor.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/GETIP.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/JFreeToChart.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/Lunar.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/ParamSAPDataTest.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/ReportCheck.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/SolarToLunar.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/StringCat.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/StringImage.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/SubSection.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/Ubm.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/Upc.java create mode 100644 plugin-report-doc-demo/src/com/fr/function/Widget2Image.java create mode 100644 plugin-report-doc-demo/src/com/fr/io/ExcelToCpt.java create mode 100644 plugin-report-doc-demo/src/com/fr/io/ExcelToCptpage.java create mode 100644 plugin-report-doc-demo/src/com/fr/io/ExcuteDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/io/ExportApi.java create mode 100644 plugin-report-doc-demo/src/com/fr/io/ExportBatch.java create mode 100644 plugin-report-doc-demo/src/com/fr/io/ExportExcel.java create mode 100644 plugin-report-doc-demo/src/com/fr/io/ExportReports.java create mode 100644 plugin-report-doc-demo/src/com/fr/io/JavaPrint.java create mode 100644 plugin-report-doc-demo/src/com/fr/io/SetParameterWindow.java create mode 100644 plugin-report-doc-demo/src/com/fr/io/SimpleDemo.java create mode 100644 plugin-report-doc-demo/src/com/fr/log/LogApi.java create mode 100644 plugin-report-doc-demo/src/com/fr/output/FTPUpload.java create mode 100644 plugin-report-doc-demo/src/com/fr/output/OutputExcel.java create mode 100644 plugin-report-doc-demo/src/com/fr/output/session.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartUIProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/ActionCMDImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/AttachmentDownloaderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/CellValueProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/CssFileHandlerImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/DebugLogProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/DialectCreatorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/EmailProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/FunctionDefineProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/GraphDrawProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/HttpAuthProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/JavaScriptFileHandlerImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/LogDBRecordProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/LogProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/PrintCellValueProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterCollectorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterHandlerImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/ServiceImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/SpecialCharProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/TableDataProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/WidgetSwitcherImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/core/XMLFileManagerProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/CellAttributeProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/CellWidgetOptionProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/ConnectionProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/FormWidgetOptionProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/GlobalListenerProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/HighlightProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/IndentationUnitProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/JavaScriptActionProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/ParameterWidgetOptionProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/PreviewProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/ShortCutImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/SubmitProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/TableDataDefineProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/TitlePlaceProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/UIFormulaProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/design/WidgetDesignHandlerImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/report/ActorProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/report/CellTooltipProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/report/ExcelExportAppProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/report/ExcelImportProcessor.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/report/ExportEncodeProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/report/ExportExtensionProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/report/ExportOperateProviderImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/report/FromExportProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/report/PageCalObjectProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/plugin/report/ReportPretreatmentProcessorImpl.java create mode 100644 plugin-report-doc-demo/src/com/fr/privilege/RSAUtil.java create mode 100644 plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidator.java create mode 100644 plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorRSA.java create mode 100644 plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorUser.java create mode 100644 plugin-report-doc-demo/src/com/fr/test/gauthority.java create mode 100644 plugin-report-doc-demo/src/main/java/com/fr/learn/Leaner.java create mode 100644 plugin-report-doc-demo/src/main/java/com/fr/learn/Learner4Debug.java create mode 100644 plugin-report-doc-demo/src/mobile/MobileCodeWSCallbackHandler.java create mode 100644 plugin-report-doc-demo/src/mobile/MobileCodeWSStub.java diff --git a/plugin-report-doc-demo/lib/report/.gitkeep b/plugin-report-doc-demo/lib/report/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/plugin-report-doc-demo/plugin.xml b/plugin-report-doc-demo/plugin.xml new file mode 100644 index 0000000..879bd29 --- /dev/null +++ b/plugin-report-doc-demo/plugin.xml @@ -0,0 +1,23 @@ + + + com.fr.plugin.doc.demo.v10 + + yes + no + 1.1.1 + 10.0~ + 2018-08-02 + finereport + + + [2018-08-02] 插件适配10 + ]]> + + + + + + + + \ No newline at end of file diff --git a/plugin-report-doc-demo/readme.md b/plugin-report-doc-demo/readme.md new file mode 100644 index 0000000..fd6605a --- /dev/null +++ b/plugin-report-doc-demo/readme.md @@ -0,0 +1,26 @@ +# 工程配置指南 + +## 安装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的正式版本| \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/StartFRDesigner.java b/plugin-report-doc-demo/src/com/fr/StartFRDesigner.java new file mode 100644 index 0000000..e1abc07 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/StartFRDesigner.java @@ -0,0 +1,12 @@ +package com.fr; + +import com.fr.start.Designer; + +public class StartFRDesigner { + public StartFRDesigner() { + } + + public static void main(String[] args) { + Designer.main(args); + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/ArrayTableDataDemo.java b/plugin-report-doc-demo/src/com/fr/data/ArrayTableDataDemo.java new file mode 100644 index 0000000..cc6a50e --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/ArrayTableDataDemo.java @@ -0,0 +1,45 @@ +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]; + } +} diff --git a/plugin-report-doc-demo/src/com/fr/data/Commit3.java b/plugin-report-doc-demo/src/com/fr/data/Commit3.java new file mode 100644 index 0000000..551d137 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/Commit3.java @@ -0,0 +1,133 @@ +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; + } +} diff --git a/plugin-report-doc-demo/src/com/fr/data/CustomTableData.java b/plugin-report-doc-demo/src/com/fr/data/CustomTableData.java new file mode 100644 index 0000000..2e65af1 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/CustomTableData.java @@ -0,0 +1,51 @@ +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; + } +} diff --git a/plugin-report-doc-demo/src/com/fr/data/DataModelDemo.java b/plugin-report-doc-demo/src/com/fr/data/DataModelDemo.java new file mode 100644 index 0000000..2de39d6 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/DataModelDemo.java @@ -0,0 +1,84 @@ +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(); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob1.java b/plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob1.java new file mode 100644 index 0000000..c543350 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob1.java @@ -0,0 +1,51 @@ +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; + } +} diff --git a/plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob2.java b/plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob2.java new file mode 100644 index 0000000..64b341f --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob2.java @@ -0,0 +1,64 @@ +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; + } +} diff --git a/plugin-report-doc-demo/src/com/fr/data/DemoTotalSubmitJob.java b/plugin-report-doc-demo/src/com/fr/data/DemoTotalSubmitJob.java new file mode 100644 index 0000000..aaa9b92 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/DemoTotalSubmitJob.java @@ -0,0 +1,59 @@ +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(); + } + } +} diff --git a/plugin-report-doc-demo/src/com/fr/data/GetXmlData.java b/plugin-report-doc-demo/src/com/fr/data/GetXmlData.java new file mode 100644 index 0000000..9a6f887 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/GetXmlData.java @@ -0,0 +1,81 @@ +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(); + } + } + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/GetXmlDate.java b/plugin-report-doc-demo/src/com/fr/data/GetXmlDate.java new file mode 100644 index 0000000..ed6b2ff --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/GetXmlDate.java @@ -0,0 +1,70 @@ +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(); + } + } + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/MobileTableWsdlDataDemo.java b/plugin-report-doc-demo/src/com/fr/data/MobileTableWsdlDataDemo.java new file mode 100644 index 0000000..bd0535a --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/MobileTableWsdlDataDemo.java @@ -0,0 +1,114 @@ +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 list = new ArrayList(); + 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[][]{{}}; + } + +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo.java b/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo.java new file mode 100644 index 0000000..44eca53 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo.java @@ -0,0 +1,147 @@ +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; + } + + //��ȡ�е�����Ϊ�����е�һ�е�ֵ + public String getColumnName(int columnIndex) throws TableDataException { + return data[0][columnIndex]; + } + + //��ȡ����Ϊ���ݵij���-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 list = new ArrayList(); + 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"); + //���洴�����Dz������� + /* + *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 (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 + + } + +} diff --git a/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo1.java b/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo1.java new file mode 100644 index 0000000..c46fc03 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo1.java @@ -0,0 +1,105 @@ +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 list = new ArrayList(); + 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[][]{{}}; + } + +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo2.java b/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo2.java new file mode 100644 index 0000000..76509d9 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo2.java @@ -0,0 +1,65 @@ +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[][] { {} }; + } + +} + diff --git a/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemoPara.java b/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemoPara.java new file mode 100644 index 0000000..fb12108 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemoPara.java @@ -0,0 +1,114 @@ +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 list = new ArrayList(); + 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(); + } + +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/ParamSAPDataTest.java b/plugin-report-doc-demo/src/com/fr/data/ParamSAPDataTest.java new file mode 100644 index 0000000..9b06dba --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/ParamSAPDataTest.java @@ -0,0 +1,112 @@ +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 arrayList = new ArrayList(); + arrayList.add("LIFNR"); + arrayList.add("NAME1"); + + + this.parameters = new XmlColConf>(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; + } +} diff --git a/plugin-report-doc-demo/src/com/fr/data/ParamTableDataDemo.java b/plugin-report-doc-demo/src/com/fr/data/ParamTableDataDemo.java new file mode 100644 index 0000000..8024cfa --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/ParamTableDataDemo.java @@ -0,0 +1,158 @@ +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#0,column#1,。。。。。。column#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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/WebServiceTableData.java b/plugin-report-doc-demo/src/com/fr/data/WebServiceTableData.java new file mode 100644 index 0000000..127f658 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/WebServiceTableData.java @@ -0,0 +1,58 @@ +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[][]{}; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/WebServiceWsdlTableDataDemo2.java b/plugin-report-doc-demo/src/com/fr/data/WebServiceWsdlTableDataDemo2.java new file mode 100644 index 0000000..a4f16e8 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/WebServiceWsdlTableDataDemo2.java @@ -0,0 +1,69 @@ +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]); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/XMLColumnNameType4Demo.java b/plugin-report-doc-demo/src/com/fr/data/XMLColumnNameType4Demo.java new file mode 100644 index 0000000..7e42fbf --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/XMLColumnNameType4Demo.java @@ -0,0 +1,27 @@ +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/XMLDemoTableData.java b/plugin-report-doc-demo/src/com/fr/data/XMLDemoTableData.java new file mode 100644 index 0000000..5477b97 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/XMLDemoTableData.java @@ -0,0 +1,202 @@ +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 + *

+ * 这是一个按参数来解析不同地址XML文件的demo + *

+ * AbstractParameterTableData 包装了有参数数据集的基本实现 + */ +public class XMLDemoTableData extends AbstractParameterTableData { + + // 构造函数 + public XMLDemoTableData() { + // 定义需要的参数,这里定义一个参数,参数名为filename,给其一个默认值"Northwind.xml" + this.parameters = new XmlColConf>(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文件的格式是: + * + * + * ALFKI + * Alfreds Futterkiste + * Maria Anders + * Sales Representative + *

Obere Str. 57
+ * Berlin + * 12209 + * Germany + * 030-0074321 + * 030-0076545 + * + * + * + * 上面定义的意义就是 + * /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(); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/XMLParseDemoDataModel.java b/plugin-report-doc-demo/src/com/fr/data/XMLParseDemoDataModel.java new file mode 100644 index 0000000..70619f6 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/XMLParseDemoDataModel.java @@ -0,0 +1,226 @@ +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 + *

+ * DataModel是获取数据的接口 + *

+ * 这里通过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; + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/XMLRead.java b/plugin-report-doc-demo/src/com/fr/data/XMLRead.java new file mode 100644 index 0000000..ef3bc4d --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/XMLRead.java @@ -0,0 +1,115 @@ +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/impl/Commit1.java b/plugin-report-doc-demo/src/com/fr/data/impl/Commit1.java new file mode 100644 index 0000000..49bdac1 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/impl/Commit1.java @@ -0,0 +1,126 @@ +// +// 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; + } +} diff --git a/plugin-report-doc-demo/src/com/fr/data/impl/Commit3.java b/plugin-report-doc-demo/src/com/fr/data/impl/Commit3.java new file mode 100644 index 0000000..4697f6f --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/data/impl/Commit3.java @@ -0,0 +1,131 @@ +// +// 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; + } +} diff --git a/plugin-report-doc-demo/src/com/fr/demo/ChangeRowAndCol.java b/plugin-report-doc-demo/src/com/fr/demo/ChangeRowAndCol.java new file mode 100644 index 0000000..61afa9b --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/demo/ChangeRowAndCol.java @@ -0,0 +1,79 @@ +//遍历单元格 +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 + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/demo/CreateReportletDemo.java b/plugin-report-doc-demo/src/com/fr/demo/CreateReportletDemo.java new file mode 100644 index 0000000..54f08e4 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/demo/CreateReportletDemo.java @@ -0,0 +1,50 @@ +//创建程序报表 +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 + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/demo/NewDateDemo.java b/plugin-report-doc-demo/src/com/fr/demo/NewDateDemo.java new file mode 100644 index 0000000..b38d639 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/demo/NewDateDemo.java @@ -0,0 +1,40 @@ +//��̬�޸����� +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 { + // ����workbook���󣬽�ģ�屣��Ϊworkbook���󲢷��� + workbook = TemplateWorkBookIO.readTemplateWorkBook("1.cpt"); + ArrayTableDataDemo a = new ArrayTableDataDemo(); // ���ö���ij������ݼ����� + workbook.putTableData("ds2", a); // ��ģ�帳�µ����ݼ� + } 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 + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/demo/ReadFromDatabase.java b/plugin-report-doc-demo/src/com/fr/demo/ReadFromDatabase.java new file mode 100644 index 0000000..be146dc --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/demo/ReadFromDatabase.java @@ -0,0 +1,65 @@ +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 + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/demo/SaveReportToDatabase.java b/plugin-report-doc-demo/src/com/fr/demo/SaveReportToDatabase.java new file mode 100644 index 0000000..0f04f30 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/demo/SaveReportToDatabase.java @@ -0,0 +1,50 @@ +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(); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/demo/SetCellElementStyle.java b/plugin-report-doc-demo/src/com/fr/demo/SetCellElementStyle.java new file mode 100644 index 0000000..3b19637 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/demo/SetCellElementStyle.java @@ -0,0 +1,71 @@ +//单元格格式设置 +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 + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/demo/SimpleReportletDemo.java b/plugin-report-doc-demo/src/com/fr/demo/SimpleReportletDemo.java new file mode 100644 index 0000000..b051b1a --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/demo/SimpleReportletDemo.java @@ -0,0 +1,42 @@ +//程序网络报表 +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 + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/demo/TotalVerifyJobDemo.java b/plugin-report-doc-demo/src/com/fr/demo/TotalVerifyJobDemo.java new file mode 100644 index 0000000..7a0247c --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/demo/TotalVerifyJobDemo.java @@ -0,0 +1,55 @@ +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"; + } +} diff --git a/plugin-report-doc-demo/src/com/fr/demo/URLParameterDemo.java b/plugin-report-doc-demo/src/com/fr/demo/URLParameterDemo.java new file mode 100644 index 0000000..c4dac4f --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/demo/URLParameterDemo.java @@ -0,0 +1,53 @@ +// 程序网络报表中获取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 + + } + +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/demo/VerifyJobDemo.java b/plugin-report-doc-demo/src/com/fr/demo/VerifyJobDemo.java new file mode 100644 index 0000000..77b0e40 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/demo/VerifyJobDemo.java @@ -0,0 +1,68 @@ +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 + + } + +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/BinaryImage.java b/plugin-report-doc-demo/src/com/fr/function/BinaryImage.java new file mode 100644 index 0000000..65ac6eb --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/BinaryImage.java @@ -0,0 +1,91 @@ +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); +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/CellSum.java b/plugin-report-doc-demo/src/com/fr/function/CellSum.java new file mode 100644 index 0000000..008009b --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/CellSum.java @@ -0,0 +1,15 @@ +// 自定义函数中获取公式所在单元格 +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/ConnectSAPServer.java b/plugin-report-doc-demo/src/com/fr/function/ConnectSAPServer.java new file mode 100644 index 0000000..e97c7b7 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/ConnectSAPServer.java @@ -0,0 +1,58 @@ +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/FlagHtmlColor.java b/plugin-report-doc-demo/src/com/fr/function/FlagHtmlColor.java new file mode 100644 index 0000000..76da40b --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/FlagHtmlColor.java @@ -0,0 +1,67 @@ +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=""; + String endhtml=""; + StringBuffer sb=new StringBuffer(); + int len=txt.length(); + if("N".equalsIgnoreCase(flag)){//数字 + for(int i=0;i='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='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= 0x4E00 && c <= 0x9FA5){ + String str=starthtml+c+endhtml; + sb.append(str); + }else{ + sb.append(c); + } + } + }else{ + return txt; + } + return sb.toString(); + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/GETIP.java b/plugin-report-doc-demo/src/com/fr/function/GETIP.java new file mode 100644 index 0000000..f247c53 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/GETIP.java @@ -0,0 +1,23 @@ +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/JFreeToChart.java b/plugin-report-doc-demo/src/com/fr/function/JFreeToChart.java new file mode 100644 index 0000000..6ee0a16 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/JFreeToChart.java @@ -0,0 +1,86 @@ +// 引入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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/Lunar.java b/plugin-report-doc-demo/src/com/fr/function/Lunar.java new file mode 100644 index 0000000..8f003c2 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/Lunar.java @@ -0,0 +1,15 @@ +//自定义函数把阳历转换成阴历 +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/ParamSAPDataTest.java b/plugin-report-doc-demo/src/com/fr/function/ParamSAPDataTest.java new file mode 100644 index 0000000..e98088d --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/ParamSAPDataTest.java @@ -0,0 +1,40 @@ +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"); + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/ReportCheck.java b/plugin-report-doc-demo/src/com/fr/function/ReportCheck.java new file mode 100644 index 0000000..5ea8448 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/ReportCheck.java @@ -0,0 +1,105 @@ +// 自定义函数实现表间校验 +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; + } + } + +} diff --git a/plugin-report-doc-demo/src/com/fr/function/SolarToLunar.java b/plugin-report-doc-demo/src/com/fr/function/SolarToLunar.java new file mode 100644 index 0000000..c70a634 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/SolarToLunar.java @@ -0,0 +1,381 @@ +//自定义函数把阳历转换成阴历 +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)); + } +} diff --git a/plugin-report-doc-demo/src/com/fr/function/StringCat.java b/plugin-report-doc-demo/src/com/fr/function/StringCat.java new file mode 100644 index 0000000..8db60a7 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/StringCat.java @@ -0,0 +1,19 @@ +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(); + } +} diff --git a/plugin-report-doc-demo/src/com/fr/function/StringImage.java b/plugin-report-doc-demo/src/com/fr/function/StringImage.java new file mode 100644 index 0000000..5b01967 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/StringImage.java @@ -0,0 +1,73 @@ +//图片在下文字在上 +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(); + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/SubSection.java b/plugin-report-doc-demo/src/com/fr/function/SubSection.java new file mode 100644 index 0000000..a502c9c --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/SubSection.java @@ -0,0 +1,45 @@ +//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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/Ubm.java b/plugin-report-doc-demo/src/com/fr/function/Ubm.java new file mode 100644 index 0000000..3501fb7 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/Ubm.java @@ -0,0 +1,25 @@ +// 自定义函数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(); + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/Upc.java b/plugin-report-doc-demo/src/com/fr/function/Upc.java new file mode 100644 index 0000000..b922952 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/Upc.java @@ -0,0 +1,35 @@ +// 自定义函数生成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]; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/Widget2Image.java b/plugin-report-doc-demo/src/com/fr/function/Widget2Image.java new file mode 100644 index 0000000..b809ce6 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/function/Widget2Image.java @@ -0,0 +1,105 @@ +// 导出打印单选按钮及复选框 +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; + } + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/io/ExcelToCpt.java b/plugin-report-doc-demo/src/com/fr/io/ExcelToCpt.java new file mode 100644 index 0000000..c8af6e1 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/io/ExcelToCpt.java @@ -0,0 +1,25 @@ +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(); + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/io/ExcelToCptpage.java b/plugin-report-doc-demo/src/com/fr/io/ExcelToCptpage.java new file mode 100644 index 0000000..eb3a391 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/io/ExcelToCptpage.java @@ -0,0 +1,46 @@ +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/io/ExcuteDemo.java b/plugin-report-doc-demo/src/com/fr/io/ExcuteDemo.java new file mode 100644 index 0000000..d77fa1c --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/io/ExcuteDemo.java @@ -0,0 +1,66 @@ +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(); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/io/ExportApi.java b/plugin-report-doc-demo/src/com/fr/io/ExportApi.java new file mode 100644 index 0000000..8786733 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/io/ExportApi.java @@ -0,0 +1,116 @@ +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.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 ExportApi { + 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(); + 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(); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/io/ExportBatch.java b/plugin-report-doc-demo/src/com/fr/io/ExportBatch.java new file mode 100644 index 0000000..efe2a29 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/io/ExportBatch.java @@ -0,0 +1,91 @@ +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(); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/io/ExportExcel.java b/plugin-report-doc-demo/src/com/fr/io/ExportExcel.java new file mode 100644 index 0000000..a7a1d83 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/io/ExportExcel.java @@ -0,0 +1,88 @@ +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(); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/io/ExportReports.java b/plugin-report-doc-demo/src/com/fr/io/ExportReports.java new file mode 100644 index 0000000..96a20cc --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/io/ExportReports.java @@ -0,0 +1,58 @@ +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) { + // ���屨�����л���,����ִ�б��� + String envpath = "D:\\FineReport\\develop\\code\\build\\package\\WebReport\\WEB-INF"; + SimpleWork.checkIn(envpath); + ModuleContext.startModule(EngineModule.class.getName()); + // ���г����һЩ��Ҫ��ʼ�� + try { + // δִ��ģ�幤���� + TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook( + "Gettingstarted.cpt"); + // ����ֵΪChina�������������������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(), "����"); + } + PageWorkBook rworkbook = (PageWorkBook) workbook.execute(parameterMap, new PageActor()); + rworkbook.setReportName(0, "����"); + // ���parametermap��������ֵ��Ϊ����,�������ResultReport + parameterMap.clear(); + for (int i = 0; i < parameters.length; i++) { + parameterMap.put(parameters[i].getName(), "����"); + } + PageWorkBook rworkbook2 = (PageWorkBook) workbook.execute(parameterMap, new PageActor()); + PageReport rreport2 = rworkbook2.getPageReport(0); + rworkbook.addReport("����", rreport2); + // ���������������ΪExcel�ļ� + 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(); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/io/JavaPrint.java b/plugin-report-doc-demo/src/com/fr/io/JavaPrint.java new file mode 100644 index 0000000..7a7cad8 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/io/JavaPrint.java @@ -0,0 +1,36 @@ +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 paraMap = new HashMap(); + 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(); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/io/SetParameterWindow.java b/plugin-report-doc-demo/src/com/fr/io/SetParameterWindow.java new file mode 100644 index 0000000..aec2d19 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/io/SetParameterWindow.java @@ -0,0 +1,78 @@ +// �����������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"); + // ��ȡWorkBook�������IJ�������ReportParameterAttr + ReportParameterAttr paraAttr = workbook.getReportParameterAttr(); + /* ��������IJ��� + * 0 : ���� + * 1 ������ + * 2 �� ���� + */ + paraAttr.setAlign(1); + /* + * ���ò������汳�� + * ColorBackground ����ɫ���� + * GradientBackground ������ɫ���� + * ImageBackground ��ͼƬ���� + * PatternBackground ��ͼ������ + * TextureBackground �������� + */ + Background background = ColorBackground.getInstance(new Color(0, 255, 255)); + paraAttr.setBackground(background); + // �������ò�������,�������ս�� + 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(); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/io/SimpleDemo.java b/plugin-report-doc-demo/src/com/fr/io/SimpleDemo.java new file mode 100644 index 0000000..8a0357f --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/io/SimpleDemo.java @@ -0,0 +1,71 @@ +//��ȡ�޸ı��� +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 { + // ��ȡģ�� + WorkBook workbook = (WorkBook) TemplateWorkBookIO + .readTemplateWorkBook( + "\\doc\\Primary\\Parameter\\Parameter.cpt"); + + // ���WorkBook�е�WorkSheet�������޸�A1��Ԫ���ǰ��ɫΪ��ɫ + TemplateElementCase report = (TemplateElementCase) workbook + .getReport(0); + // getCellElement(int column, int + // row),column��row����0��ʼ�����A1��Ԫ����ǵ�0�е�0�� + 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); + // ����ģ�� + FileOutputStream outputStream = new FileOutputStream(new File( + "D:\\newParameter1.cpt")); + ((WorkBook) workbook).export(outputStream); + } catch (Exception e) { + e.printStackTrace(); + } finally { + SimpleWork.checkOut(); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/log/LogApi.java b/plugin-report-doc-demo/src/com/fr/log/LogApi.java new file mode 100644 index 0000000..dd50e08 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/log/LogApi.java @@ -0,0 +1,12 @@ +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级别日志记录 + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/output/FTPUpload.java b/plugin-report-doc-demo/src/com/fr/output/FTPUpload.java new file mode 100644 index 0000000..0c08b92 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/output/FTPUpload.java @@ -0,0 +1,76 @@ +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; + } + +} diff --git a/plugin-report-doc-demo/src/com/fr/output/OutputExcel.java b/plugin-report-doc-demo/src/com/fr/output/OutputExcel.java new file mode 100644 index 0000000..1471580 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/output/OutputExcel.java @@ -0,0 +1,100 @@ +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; + } + +} diff --git a/plugin-report-doc-demo/src/com/fr/output/session.java b/plugin-report-doc-demo/src/com/fr/output/session.java new file mode 100644 index 0000000..1745f9c --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/output/session.java @@ -0,0 +1,48 @@ +package com.fr.output; + +import com.fr.stable.CodeUtils; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; +import java.io.PrintWriter; + +public class session extends HttpServlet { + public void doGet(HttpServletRequest request, + HttpServletResponse response) + throws IOException, ServletException { + response.setContentType("text/html; charset=gb2312"); + + PrintWriter out = response.getWriter(); + out.println(""); + out.println(""); + String urlid = request.getParameter("id"); //获取url通过ajax传递的值 + HttpSession session = request.getSession(true); + if (urlid == "" || urlid == null) { + out.print("

"); + out.println("set session:"); + out.println(""); + out.println("
"); + if (request.getParameter("sessionvalue") != null && request.getParameter("sessionvalue") != "") { + session.setAttribute("sessionname", request.getParameter("sessionvalue")); + } + } else { + urlid = CodeUtils.decodeText(urlid); + session.setAttribute("sessionname", urlid); //将值赋值给sessionname这个session中 + out.println(""); + } + out.println(""); + out.println(""); + } + + public void doPost(HttpServletRequest request, + HttpServletResponse response) + throws IOException, ServletException { + doGet(request, response); + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartProviderImpl.java new file mode 100644 index 0000000..bd1b741 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartProviderImpl.java @@ -0,0 +1,26 @@ +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartUIProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartUIProviderImpl.java new file mode 100644 index 0000000..9445e2d --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartUIProviderImpl.java @@ -0,0 +1,22 @@ +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 ""; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/ActionCMDImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/ActionCMDImpl.java new file mode 100644 index 0000000..436ef9c --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/ActionCMDImpl.java @@ -0,0 +1,23 @@ +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 { + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/AttachmentDownloaderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/AttachmentDownloaderImpl.java new file mode 100644 index 0000000..1909f32 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/AttachmentDownloaderImpl.java @@ -0,0 +1,18 @@ +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 ""; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/CellValueProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/CellValueProcessorImpl.java new file mode 100644 index 0000000..a140b57 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/CellValueProcessorImpl.java @@ -0,0 +1,18 @@ +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/CssFileHandlerImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/CssFileHandlerImpl.java new file mode 100644 index 0000000..d164ce2 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/CssFileHandlerImpl.java @@ -0,0 +1,10 @@ +package com.fr.plugin.core; + +import com.fr.stable.fun.impl.AbstractCssFileHandler; + +public class CssFileHandlerImpl extends AbstractCssFileHandler { + @Override + public String[] pathsForFiles() { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/DebugLogProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/DebugLogProviderImpl.java new file mode 100644 index 0000000..08fe2dc --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/DebugLogProviderImpl.java @@ -0,0 +1,7 @@ +package com.fr.plugin.core; + +public class DebugLogProviderImpl { + public static void main(String[] args) { + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/DialectCreatorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/DialectCreatorImpl.java new file mode 100644 index 0000000..167513c --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/DialectCreatorImpl.java @@ -0,0 +1,18 @@ +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/EmailProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/EmailProcessorImpl.java new file mode 100644 index 0000000..1c6af76 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/EmailProcessorImpl.java @@ -0,0 +1,13 @@ +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 loadMailProperties(String s, String s1, String s2, String s3, String s4) { + return new HashMap(); + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java new file mode 100644 index 0000000..f75368f --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java @@ -0,0 +1,11 @@ +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportProcessorImpl.java new file mode 100644 index 0000000..1fb65a6 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportProcessorImpl.java @@ -0,0 +1,6 @@ +package com.fr.plugin.core; + +import com.fr.stable.fun.impl.AbstractExcelExportProcessor; + +public class ExcelExportProcessorImpl extends AbstractExcelExportProcessor { +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/FunctionDefineProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/FunctionDefineProviderImpl.java new file mode 100644 index 0000000..7983e36 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/FunctionDefineProviderImpl.java @@ -0,0 +1,10 @@ +package com.fr.plugin.core; + +import com.fr.stable.fun.FunctionDefineProvider; + +public class FunctionDefineProviderImpl implements FunctionDefineProvider { + @Override + public int currentAPILevel() { + return 0; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/GraphDrawProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/GraphDrawProcessorImpl.java new file mode 100644 index 0000000..7149894 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/GraphDrawProcessorImpl.java @@ -0,0 +1,13 @@ +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) { + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/HttpAuthProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/HttpAuthProcessorImpl.java new file mode 100644 index 0000000..e7bfffb --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/HttpAuthProcessorImpl.java @@ -0,0 +1,10 @@ +package com.fr.plugin.core; + +/** + * 10.0已经废弃 + */ +public class HttpAuthProcessorImpl { + public static void main(String[] args) { + //HttpAuthProcessor pro = new HttpAuthProcessor(); + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/JavaScriptFileHandlerImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/JavaScriptFileHandlerImpl.java new file mode 100644 index 0000000..95ee326 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/JavaScriptFileHandlerImpl.java @@ -0,0 +1,10 @@ +package com.fr.plugin.core; + +import com.fr.stable.fun.impl.AbstractJavaScriptFileHandler; + +public class JavaScriptFileHandlerImpl extends AbstractJavaScriptFileHandler { + @Override + public String[] pathsForFiles() { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/LogDBRecordProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/LogDBRecordProcessorImpl.java new file mode 100644 index 0000000..40e22f2 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/LogDBRecordProcessorImpl.java @@ -0,0 +1,25 @@ +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 ""; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/LogProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/LogProviderImpl.java new file mode 100644 index 0000000..95b2aa9 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/LogProviderImpl.java @@ -0,0 +1,6 @@ +package com.fr.plugin.core; + +import com.fr.stable.fun.impl.AbstractLogProvider; + +public class LogProviderImpl extends AbstractLogProvider { +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/PrintCellValueProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/PrintCellValueProviderImpl.java new file mode 100644 index 0000000..c93ed4b --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/PrintCellValueProviderImpl.java @@ -0,0 +1,12 @@ +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; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterCollectorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterCollectorImpl.java new file mode 100644 index 0000000..46de013 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterCollectorImpl.java @@ -0,0 +1,33 @@ +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 getParametersFromSession(HttpServletRequest httpServletRequest) { + return null; + } + + @Override + public Map getParametersFromAttribute(HttpServletRequest httpServletRequest) { + return null; + } + + @Override + public Map getParametersFromReqInputStream(HttpServletRequest httpServletRequest) { + return null; + } + + @Override + public Map getParametersFromParameter(HttpServletRequest httpServletRequest) { + return null; + } + + @Override + public Map getParametersFromJSON(HttpServletRequest httpServletRequest, Map map) { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterHandlerImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterHandlerImpl.java new file mode 100644 index 0000000..340bb25 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterHandlerImpl.java @@ -0,0 +1,32 @@ +package com.fr.plugin.core; + +import com.fr.stable.fun.impl.AbstractRequestParameterHandler; + +import javax.servlet.http.HttpServletRequest; + +public class RequestParameterHandlerImpl extends AbstractRequestParameterHandler { + @Override + public Object getParameterFromRequest(HttpServletRequest httpServletRequest, String s) { + return null; + } + + @Override + public Object getParameterFromRequestInputStream(HttpServletRequest httpServletRequest, String s) { + return null; + } + + @Override + public Object getParameterFromAttribute(HttpServletRequest httpServletRequest, String s) { + return null; + } + + @Override + public Object getParameterFromJSONParameters(HttpServletRequest httpServletRequest, String s) { + return null; + } + + @Override + public Object getParameterFromSession(HttpServletRequest httpServletRequest, String s) { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/ServiceImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/ServiceImpl.java new file mode 100644 index 0000000..fb31d2b --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/ServiceImpl.java @@ -0,0 +1,18 @@ +package com.fr.plugin.core; + +import com.fr.stable.fun.Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ServiceImpl implements Service { + @Override + public String actionOP() { + return ""; + } + + @Override + public void process(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s, String s1) throws Exception { + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/SpecialCharProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/SpecialCharProcessorImpl.java new file mode 100644 index 0000000..c52d360 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/SpecialCharProcessorImpl.java @@ -0,0 +1,10 @@ +package com.fr.plugin.core; + +import com.fr.stable.fun.impl.AbstractSpecialCharProcessor; + +public class SpecialCharProcessorImpl extends AbstractSpecialCharProcessor { + @Override + public String processChar(String s) { + return ""; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/TableDataProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/TableDataProviderImpl.java new file mode 100644 index 0000000..0e6b92f --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/TableDataProviderImpl.java @@ -0,0 +1,6 @@ +package com.fr.plugin.core; + +import com.fr.stable.fun.impl.AbstractTableDataProvider; + +public class TableDataProviderImpl extends AbstractTableDataProvider { +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/WidgetSwitcherImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/WidgetSwitcherImpl.java new file mode 100644 index 0000000..f5495c0 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/WidgetSwitcherImpl.java @@ -0,0 +1,10 @@ +package com.fr.plugin.core; + +import com.fr.stable.fun.impl.AbstractWidgetSwitcher; + +public class WidgetSwitcherImpl extends AbstractWidgetSwitcher { + @Override + public String toNewMarkType(String s) { + return ""; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/XMLFileManagerProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/XMLFileManagerProviderImpl.java new file mode 100644 index 0000000..16f7155 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/core/XMLFileManagerProviderImpl.java @@ -0,0 +1,7 @@ +package com.fr.plugin.core; + +public class XMLFileManagerProviderImpl { + public static void main(String[] args) { +// XMLFileManagerProvider provider = new XMLFileManagerProvider(); + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/CellAttributeProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/CellAttributeProviderImpl.java new file mode 100644 index 0000000..d0cb46d --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/CellAttributeProviderImpl.java @@ -0,0 +1,11 @@ +package com.fr.plugin.design; + +import com.fr.design.fun.impl.AbstractCellAttributeProvider; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; + +public class CellAttributeProviderImpl extends AbstractCellAttributeProvider { + @Override + public AbstractAttrNoScrollPane createCellAttributePane() { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/CellWidgetOptionProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/CellWidgetOptionProviderImpl.java new file mode 100644 index 0000000..e236aff --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/CellWidgetOptionProviderImpl.java @@ -0,0 +1,27 @@ +package com.fr.plugin.design; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.impl.AbstractCellWidgetOptionProvider; +import com.fr.form.ui.Widget; + +public class CellWidgetOptionProviderImpl extends AbstractCellWidgetOptionProvider { + @Override + public Class classForWidget() { + return null; + } + + @Override + public Class> appearanceForWidget() { + return null; + } + + @Override + public String iconPathForWidget() { + return ""; + } + + @Override + public String nameForWidget() { + return ""; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/ConnectionProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/ConnectionProviderImpl.java new file mode 100644 index 0000000..46a6015 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/ConnectionProviderImpl.java @@ -0,0 +1,28 @@ +package com.fr.plugin.design; + +import com.fr.data.impl.Connection; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.impl.AbstractConnectionProvider; + +public class ConnectionProviderImpl extends AbstractConnectionProvider { + @Override + public String nameForConnection() { + return ""; + } + + @Override + public String iconPathForConnection() { + return ""; + } + + @Override + public Class classForConnection() { + return null; + + } + + @Override + public Class> appearanceForConnection() { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/FormWidgetOptionProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/FormWidgetOptionProviderImpl.java new file mode 100644 index 0000000..0fccb52 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/FormWidgetOptionProviderImpl.java @@ -0,0 +1,26 @@ +package com.fr.plugin.design; + +import com.fr.design.fun.impl.AbstractFormWidgetOptionProvider; +import com.fr.form.ui.Widget; + +public class FormWidgetOptionProviderImpl extends AbstractFormWidgetOptionProvider { + @Override + public Class classForWidget() { + return null; + } + + @Override + public Class appearanceForWidget() { + return null; + } + + @Override + public String iconPathForWidget() { + return ""; + } + + @Override + public String nameForWidget() { + return ""; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/GlobalListenerProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/GlobalListenerProviderImpl.java new file mode 100644 index 0000000..169cf08 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/GlobalListenerProviderImpl.java @@ -0,0 +1,12 @@ +package com.fr.plugin.design; + +import com.fr.design.fun.impl.AbstractGlobalListenerProvider; + +import java.awt.event.AWTEventListener; + +public class GlobalListenerProviderImpl extends AbstractGlobalListenerProvider { + @Override + public AWTEventListener listener() { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/HighlightProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/HighlightProviderImpl.java new file mode 100644 index 0000000..ff5ab5c --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/HighlightProviderImpl.java @@ -0,0 +1,17 @@ +package com.fr.plugin.design; + +import com.fr.design.condition.ConditionAttrSingleConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.fun.impl.AbstractHighlightProvider; + +public class HighlightProviderImpl extends AbstractHighlightProvider { + @Override + public Class classForHighlightAction() { + return null; + } + + @Override + public ConditionAttrSingleConditionPane appearanceForCondition(ConditionAttributesPane conditionAttributesPane) { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/IndentationUnitProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/IndentationUnitProcessorImpl.java new file mode 100644 index 0000000..36aa2e4 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/IndentationUnitProcessorImpl.java @@ -0,0 +1,6 @@ +package com.fr.plugin.design; + +import com.fr.design.fun.impl.AbstractIndentationUnitProcessor; + +public class IndentationUnitProcessorImpl extends AbstractIndentationUnitProcessor { +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/JavaScriptActionProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/JavaScriptActionProviderImpl.java new file mode 100644 index 0000000..abda85c --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/JavaScriptActionProviderImpl.java @@ -0,0 +1,12 @@ +package com.fr.plugin.design; + +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.fun.impl.AbstractJavaScriptActionProvider; +import com.fr.js.JavaScript; + +public class JavaScriptActionProviderImpl extends AbstractJavaScriptActionProvider { + @Override + public FurtherBasicBeanPane getJavaScriptActionPane() { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/ParameterWidgetOptionProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/ParameterWidgetOptionProviderImpl.java new file mode 100644 index 0000000..1bbaa88 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/ParameterWidgetOptionProviderImpl.java @@ -0,0 +1,27 @@ +package com.fr.plugin.design; + +import com.fr.design.fun.impl.AbstractParameterWidgetOptionProvider; +import com.fr.form.ui.Widget; + +public class ParameterWidgetOptionProviderImpl extends AbstractParameterWidgetOptionProvider { + @Override + public Class classForWidget() { + return null; + } + + @Override + public Class appearanceForWidget() { + return null; + } + + @Override + public String iconPathForWidget() { + return null; + + } + + @Override + public String nameForWidget() { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/PreviewProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/PreviewProviderImpl.java new file mode 100644 index 0000000..d182b6c --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/PreviewProviderImpl.java @@ -0,0 +1,25 @@ +package com.fr.plugin.design; + +import com.fr.design.fun.impl.AbstractPreviewProvider; + +public class PreviewProviderImpl extends AbstractPreviewProvider { + @Override + public String nameForPopupItem() { + return ""; + } + + @Override + public String iconPathForPopupItem() { + return ""; + } + + @Override + public String iconPathForLarge() { + return ""; + } + + @Override + public int previewTypeCode() { + return 0; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/ShortCutImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/ShortCutImpl.java new file mode 100644 index 0000000..c10dfe9 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/ShortCutImpl.java @@ -0,0 +1,28 @@ +package com.fr.plugin.design; + +import com.fr.design.menu.ShortCut; + +import javax.swing.JPopupMenu; +import javax.swing.JToolBar; + +public class ShortCutImpl extends ShortCut { + @Override + public void intoJPopupMenu(JPopupMenu jPopupMenu) { + + } + + @Override + public void intoJToolBar(JToolBar jToolBar) { + + } + + @Override + public void setEnabled(boolean b) { + + } + + @Override + public boolean isEnabled() { + return true; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/SubmitProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/SubmitProviderImpl.java new file mode 100644 index 0000000..e0ae021 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/SubmitProviderImpl.java @@ -0,0 +1,21 @@ +package com.fr.plugin.design; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.impl.AbstractSubmitProvider; + +public class SubmitProviderImpl extends AbstractSubmitProvider { + @Override + public BasicBeanPane appearanceForSubmit() { + return null; + } + + @Override + public String dataForSubmit() { + return ""; + } + + @Override + public String keyForSubmit() { + return ""; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/TableDataDefineProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/TableDataDefineProviderImpl.java new file mode 100644 index 0000000..ba8b9e0 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/TableDataDefineProviderImpl.java @@ -0,0 +1,37 @@ +package com.fr.plugin.design; + +import com.fr.base.TableData; +import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; +import com.fr.design.fun.impl.AbstractTableDataDefineProvider; + +public class TableDataDefineProviderImpl extends AbstractTableDataDefineProvider { + @Override + public Class classForTableData() { + return null; + } + + @Override + public Class classForInitTableData() { + return null; + } + + @Override + public Class appearanceForTableData() { + return null; + } + + @Override + public String nameForTableData() { + return ""; + } + + @Override + public String prefixForTableData() { + return ""; + } + + @Override + public String iconPathForTableData() { + return ""; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/TitlePlaceProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/TitlePlaceProcessorImpl.java new file mode 100644 index 0000000..b8f959e --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/TitlePlaceProcessorImpl.java @@ -0,0 +1,13 @@ +package com.fr.plugin.design; + +import com.fr.design.fun.impl.AbstractTitleProcessor; + +import java.awt.Component; +import java.awt.Container; + +public class TitlePlaceProcessorImpl extends AbstractTitleProcessor { + @Override + public void hold(Container container, Component component, Component component1) { + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/UIFormulaProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/UIFormulaProcessorImpl.java new file mode 100644 index 0000000..0c04c5d --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/UIFormulaProcessorImpl.java @@ -0,0 +1,16 @@ +package com.fr.plugin.design; + +import com.fr.design.formula.UIFormula; +import com.fr.design.fun.impl.AbstractUIFormulaProcessor; + +public class UIFormulaProcessorImpl extends AbstractUIFormulaProcessor { + @Override + public UIFormula appearanceFormula() { + return null; + } + + @Override + public UIFormula appearanceWhenReserveFormula() { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/WidgetDesignHandlerImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/design/WidgetDesignHandlerImpl.java new file mode 100644 index 0000000..10d0c8f --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/design/WidgetDesignHandlerImpl.java @@ -0,0 +1,11 @@ +package com.fr.plugin.design; + +import com.fr.design.fun.impl.AbstractWidgetDesignHandler; +import com.fr.form.ui.Widget; + +public class WidgetDesignHandlerImpl extends AbstractWidgetDesignHandler { + @Override + public void transferWidgetProperties(Widget widget, Widget widget1) { + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ActorProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/report/ActorProviderImpl.java new file mode 100644 index 0000000..09fb693 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/report/ActorProviderImpl.java @@ -0,0 +1,11 @@ +package com.fr.plugin.report; + +import com.fr.report.fun.impl.AbstractActorProvider; +import com.fr.report.stable.fun.Actor; + +public class ActorProviderImpl extends AbstractActorProvider { + @Override + public Actor[] createActor() { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/CellTooltipProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/report/CellTooltipProcessorImpl.java new file mode 100644 index 0000000..9840b74 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/report/CellTooltipProcessorImpl.java @@ -0,0 +1,12 @@ +package com.fr.plugin.report; + +import com.fr.report.fun.impl.AbstractCellTagTransformer; +import com.fr.script.Calculator; +import com.fr.stable.html.Tag; + +public class CellTooltipProcessorImpl extends AbstractCellTagTransformer { + @Override + public Tag process(Calculator calculator, Tag tag, String s, Object o) { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ExcelExportAppProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/report/ExcelExportAppProviderImpl.java new file mode 100644 index 0000000..24e7e04 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/report/ExcelExportAppProviderImpl.java @@ -0,0 +1,10 @@ +package com.fr.plugin.report; + +import com.fr.report.fun.impl.AbstractExcelExportAppProvider; + +public class ExcelExportAppProviderImpl extends AbstractExcelExportAppProvider { + @Override + public String exportType() { + return ""; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ExcelImportProcessor.java b/plugin-report-doc-demo/src/com/fr/plugin/report/ExcelImportProcessor.java new file mode 100644 index 0000000..75932d1 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/report/ExcelImportProcessor.java @@ -0,0 +1,14 @@ +package com.fr.plugin.report; + +import com.fr.main.TemplateWorkBook; +import com.fr.report.fun.impl.AbstractExcelImportProcessor; + +import java.io.InputStream; +import java.util.Map; + +public class ExcelImportProcessor extends AbstractExcelImportProcessor { + @Override + public TemplateWorkBook generateWorkBookByStream(InputStream inputStream, String s, Map map) throws Exception { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ExportEncodeProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/report/ExportEncodeProviderImpl.java new file mode 100644 index 0000000..700d368 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/report/ExportEncodeProviderImpl.java @@ -0,0 +1,6 @@ +package com.fr.plugin.report; + +import com.fr.report.fun.impl.AbstractExportEncodeProvider; + +public class ExportEncodeProviderImpl extends AbstractExportEncodeProvider { +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ExportExtensionProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/report/ExportExtensionProcessorImpl.java new file mode 100644 index 0000000..b874a58 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/report/ExportExtensionProcessorImpl.java @@ -0,0 +1,21 @@ +package com.fr.plugin.report; + +import com.fr.io.collection.ExportCollection; +import com.fr.report.fun.impl.AbstractExportExtension; +import com.fr.web.core.ReportSessionIDInfor; +import com.fr.web.core.TemplateSessionIDInfo; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ExportExtensionProcessorImpl extends AbstractExportExtension { + @Override + public String fileName(HttpServletRequest httpServletRequest, TemplateSessionIDInfo templateSessionIDInfo) throws Exception { + return ""; + } + + @Override + public ExportCollection createCollection(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, ReportSessionIDInfor reportSessionIDInfor, String s, String s1, boolean b) throws Exception { + return null; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ExportOperateProviderImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/report/ExportOperateProviderImpl.java new file mode 100644 index 0000000..84c2b71 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/report/ExportOperateProviderImpl.java @@ -0,0 +1,16 @@ +package com.fr.plugin.report; + +import com.fr.report.fun.impl.AbstractExportOperateProvider; +import com.fr.web.core.reserve.Operate; + +public class ExportOperateProviderImpl extends AbstractExportOperateProvider { + @Override + public Operate operate() { + return null; + } + + @Override + public String markType() { + return ""; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/FromExportProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/report/FromExportProcessorImpl.java new file mode 100644 index 0000000..0818d01 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/report/FromExportProcessorImpl.java @@ -0,0 +1,13 @@ +package com.fr.plugin.report; + +import com.fr.form.stable.fun.AbstractFormExportProcessor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class FromExportProcessorImpl extends AbstractFormExportProcessor { + @Override + public void dealWithExport(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s) { + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/PageCalObjectProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/report/PageCalObjectProcessorImpl.java new file mode 100644 index 0000000..50c7866 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/report/PageCalObjectProcessorImpl.java @@ -0,0 +1,18 @@ +package com.fr.plugin.report; + +import com.fr.report.cell.CellElement; +import com.fr.report.cell.cellattr.highlight.HighlightGroup; +import com.fr.report.fun.impl.AbstractPageCalObjectProcessor; +import com.fr.script.Calculator; + +public class PageCalObjectProcessorImpl extends AbstractPageCalObjectProcessor { + @Override + public void collectPageCalHighlight(CellElement cellElement, Calculator calculator, HighlightGroup highlightGroup) { + + } + + @Override + public void resolvePageCalHighlight(Calculator calculator, CellElement cellElement) { + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ReportPretreatmentProcessorImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/report/ReportPretreatmentProcessorImpl.java new file mode 100644 index 0000000..16c2bb3 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/plugin/report/ReportPretreatmentProcessorImpl.java @@ -0,0 +1,13 @@ +package com.fr.plugin.report; + +import com.fr.report.fun.impl.AbstractReportPretreatmentProcessor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ReportPretreatmentProcessorImpl extends AbstractReportPretreatmentProcessor { + @Override + public void process(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s) { + + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/privilege/RSAUtil.java b/plugin-report-doc-demo/src/com/fr/privilege/RSAUtil.java new file mode 100644 index 0000000..d9d98e8 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/privilege/RSAUtil.java @@ -0,0 +1,205 @@ +package com.fr.privilege; + +import javax.crypto.Cipher; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.math.BigInteger; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.SecureRandom; +import java.security.interfaces.RSAPrivateKey; +import java.security.interfaces.RSAPublicKey; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.RSAPrivateKeySpec; +import java.security.spec.RSAPublicKeySpec; + +/** + * RSA 工具类。提供加密,解密,生成密钥对等方法。 + * 需要到http://www.bouncycastle.org下载bcprov-jdk14-123.jar。 + */ +public class RSAUtil { + /** + * * 生成密钥对 * + * + * @return KeyPair * + * @throws EncryptException + */ + public static KeyPair generateKeyPair() throws Exception { + try { + KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA", + new org.bouncycastle.jce.provider.BouncyCastleProvider()); + final int KEY_SIZE = 1024;// 没什么好说的了,这个值关系到块加密的大小,可以更改,但是不要太大,否则效率会低 + keyPairGen.initialize(KEY_SIZE, new SecureRandom()); + KeyPair keyPair = keyPairGen.generateKeyPair(); + saveKeyPair(keyPair); + return keyPair; + } catch (Exception e) { + throw new Exception(e.getMessage()); + } + } + + public static KeyPair getKeyPair() throws Exception { + FileInputStream fis = new FileInputStream("C:/RSAKey.txt"); + ObjectInputStream oos = new ObjectInputStream(fis); + KeyPair kp = (KeyPair) oos.readObject(); + oos.close(); + fis.close(); + return kp; + } + + public static void saveKeyPair(KeyPair kp) throws Exception { + + FileOutputStream fos = new FileOutputStream("C:/RSAKey.txt"); + ObjectOutputStream oos = new ObjectOutputStream(fos); + // 生成密钥 + oos.writeObject(kp); + oos.close(); + fos.close(); + } + + /** + * * 生成公钥 * + * + * @param modulus * + * @param publicExponent * + * @return RSAPublicKey * + * @throws Exception + */ + public static RSAPublicKey generateRSAPublicKey(byte[] modulus, + byte[] publicExponent) throws Exception { + KeyFactory keyFac = null; + try { + keyFac = KeyFactory.getInstance("RSA", + new org.bouncycastle.jce.provider.BouncyCastleProvider()); + } catch (NoSuchAlgorithmException ex) { + throw new Exception(ex.getMessage()); + } + + RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(new BigInteger( + modulus), new BigInteger(publicExponent)); + try { + return (RSAPublicKey) keyFac.generatePublic(pubKeySpec); + } catch (InvalidKeySpecException ex) { + throw new Exception(ex.getMessage()); + } + } + + /** + * * 生成私钥 * + * + * @param modulus * + * @param privateExponent * + * @return RSAPrivateKey * + * @throws Exception + */ + public static RSAPrivateKey generateRSAPrivateKey(byte[] modulus, + byte[] privateExponent) throws Exception { + KeyFactory keyFac = null; + try { + keyFac = KeyFactory.getInstance("RSA", + new org.bouncycastle.jce.provider.BouncyCastleProvider()); + } catch (NoSuchAlgorithmException ex) { + throw new Exception(ex.getMessage()); + } + + RSAPrivateKeySpec priKeySpec = new RSAPrivateKeySpec(new BigInteger( + modulus), new BigInteger(privateExponent)); + try { + return (RSAPrivateKey) keyFac.generatePrivate(priKeySpec); + } catch (InvalidKeySpecException ex) { + throw new Exception(ex.getMessage()); + } + } + + /** + * * 加密 * + * + * @param key 加密的密钥 * + * @param data 待加密的明文数据 * + * @return 加密后的数据 * + * @throws Exception + */ + public static byte[] encrypt(PublicKey pk, byte[] data) throws Exception { + try { + Cipher cipher = Cipher.getInstance("RSA", + new org.bouncycastle.jce.provider.BouncyCastleProvider()); + cipher.init(Cipher.ENCRYPT_MODE, pk); + int blockSize = cipher.getBlockSize();// 获得加密块大小,如:加密前数据为128个byte,而key_size=1024 + // 加密块大小为127 + // byte,加密后为128个byte;因此共有2个加密块,第一个127 + // byte第二个为1个byte + int outputSize = cipher.getOutputSize(data.length);// 获得加密块加密后块大小 + int leavedSize = data.length % blockSize; + int blocksSize = leavedSize != 0 ? data.length / blockSize + 1 + : data.length / blockSize; + byte[] raw = new byte[outputSize * blocksSize]; + int i = 0; + while (data.length - i * blockSize > 0) { + if (data.length - i * blockSize > blockSize) + cipher.doFinal(data, i * blockSize, blockSize, raw, i + * outputSize); + else + cipher.doFinal(data, i * blockSize, data.length - i + * blockSize, raw, i * outputSize); + // 这里面doUpdate方法不可用,查看源代码后发现每次doUpdate后并没有什么实际动作除了把byte[]放到 + // ByteArrayOutputStream中,而最后doFinal的时候才将所有的byte[]进行加密,可是到了此时加密块大小很可能已经超出了 + // OutputSize所以只好用dofinal方法。 + + i++; + } + return raw; + } catch (Exception e) { + throw new Exception(e.getMessage()); + } + } + + /** + * * 解密 * + * + * @param key 解密的密钥 * + * @param raw 已经加密的数据 * + * @return 解密后的明文 * + * @throws Exception + */ + public static byte[] decrypt(PrivateKey pk, byte[] raw) throws Exception { + try { + Cipher cipher = Cipher.getInstance("RSA", + new org.bouncycastle.jce.provider.BouncyCastleProvider()); + cipher.init(cipher.DECRYPT_MODE, pk); + int blockSize = cipher.getBlockSize(); + ByteArrayOutputStream bout = new ByteArrayOutputStream(64); + int j = 0; + + while (raw.length - j * blockSize > 0) { + bout.write(cipher.doFinal(raw, j * blockSize, blockSize)); + j++; + } + return bout.toByteArray(); + } catch (Exception e) { + throw new Exception(e.getMessage()); + } + } + + /** + * * * + * + * @param args * + * @throws Exception + */ + public static void main(String[] args) throws Exception { + RSAPublicKey rsap = (RSAPublicKey) RSAUtil.generateKeyPair() + .getPublic(); + String test = "hello world"; + byte[] en_test = encrypt(getKeyPair().getPublic(), test.getBytes()); + System.out.println("123:" + new String(en_test)); + byte[] de_test = decrypt(getKeyPair().getPrivate(), en_test); + System.out.println(new String(de_test)); + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidator.java b/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidator.java new file mode 100644 index 0000000..973278a --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidator.java @@ -0,0 +1,21 @@ +package com.fr.privilege; + +import com.fr.privilege.providers.dao.AbstractPasswordEncode; + +public class TestPasswordValidator extends AbstractPasswordEncode { + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + public String encodePassword(String clientPassword) { + return (clientPassword + "FR");//即获取用户输入的密码然后在后面加上FR,再与数据库密码匹配。 + } + +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorRSA.java b/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorRSA.java new file mode 100644 index 0000000..0e4c229 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorRSA.java @@ -0,0 +1,33 @@ +package com.fr.privilege; + +import com.fr.privilege.providers.dao.AbstractPasswordValidator; + +public class TestPasswordValidatorRSA extends AbstractPasswordValidator { + //@Override + public String encodePassword(String clinetPassword) { + try { + //对密码进行翻转如输入ab翻转后为ba + StringBuffer sb = new StringBuffer(); + sb.append(new String(clinetPassword)); + String bb = sb.reverse().toString(); + //进行加密 + byte[] en_test = RSAUtil.encrypt(RSAUtil.getKeyPair().getPublic(), bb.getBytes()); + //进行解密,如果数据库里面保存的是加密码,则此处不需要进行解密 + byte[] de_test = RSAUtil.decrypt(RSAUtil.getKeyPair().getPrivate(), en_test); + //返回加密密码 + clinetPassword = new String(de_test); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return clinetPassword; //即获取加密密码再与数据库密码匹配。 + } + + @Override + public boolean validatePassword(String arg0, String arg1) { + // TODO Auto-generated method stub + return false; + } + + +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorUser.java b/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorUser.java new file mode 100644 index 0000000..8642817 --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorUser.java @@ -0,0 +1,46 @@ +package com.fr.privilege; + +import com.fr.privilege.providers.dao.AbstractPasswordEncode; + +public class TestPasswordValidatorUser extends AbstractPasswordEncode { + + /** + * 三个参数的密码加密算法:满足数据库密码=FR+用户名+密码+RF,返回true + * + * @param localPassword 存储在数据库中的密码 + * @param clientPassword 用户输入的密码 + * @param clientUsername 用户名 + * @return 是否验证成功 + */ + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + public String encodePassword(String clientPassword, String clientUsername) { + return "FR" + clientUsername + clientPassword + "RF"; + + } + + /** + * 验证密码时是否要忽略用户名 + */ + public boolean shouldIgnoreUsername() { + return false; + } + + @Override + public String encodePassword(String arg0) { + // TODO Auto-generated method stub + return null; + } + + /** + * 2个参数的密码验证方法,直接return false + */ +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/test/gauthority.java b/plugin-report-doc-demo/src/com/fr/test/gauthority.java new file mode 100644 index 0000000..19dd38d --- /dev/null +++ b/plugin-report-doc-demo/src/com/fr/test/gauthority.java @@ -0,0 +1,77 @@ +package com.fr.test; + +import com.fr.base.FRContext; +import com.fr.base.Formula; +import com.fr.general.FArray; +import com.fr.json.JSONObject; +import com.fr.script.AbstractFunction; +import com.fr.script.Calculator; +import com.fr.stable.Primitive; + +public class gauthority extends AbstractFunction { + public gauthority() { + } + + public Object run(Object[] args) { + int[] newArgs = new int[args.length]; + + for (int i = 0; i < args.length; ++i) { + if (!(args[i] instanceof Integer) || (Integer) args[i] <= 0) { + return Primitive.ERROR_NAME; + } + + newArgs[i] = (Integer) args[i]; + } + + FArray res = new FArray(); + Calculator ca = this.getCalculator(); + Formula f = new Formula("$fr_userposition"); + + try { + Object dp = ca.eval(f); + if (dp instanceof FArray) { + FArray fa = (FArray) dp; + + for (int i = 0; i < fa.length(); ++i) { + JSONObject jo = (JSONObject) fa.elementAt(i); + String dName = jo.getString("jobTitle"); + if (newArgs.length == 0) { + res.add(dName); + } else { + String[] dNames = dName.split(","); + res.add(this.buildRes(dNames, newArgs)); + } + } + } + } catch (Exception var12) { + FRContext.getLogger().error(var12.getMessage(), var12); + } + + return res; + } + + private String buildRes(String[] dNames, int[] args) { + StringBuffer sb = new StringBuffer(); + + for (int i = 0; i < args.length; ++i) { + int index = args[i]; + if (dNames.length >= index) { + sb.append(dNames[index - 1]).append(","); + } + } + + return sb.substring(0, sb.length() > 0 ? sb.length() - 1 : 0); + } + + public Type getType() { + return OTHER; + } + + public String getCN() { + return "GETUSERDEPARTMENTS():返回角色部门\n示例:\nGETUSERDEPARTMENTS():返回角色所有部门,若多个部门则数组\nGETUSERDEPARTMENTS(3,2):返回角色该部门的第三层和第二层名字,\n若多个部门则返回数组,若没有第三层则只显示第二层"; + } + + public String getEN() { + return ""; + } +} diff --git a/plugin-report-doc-demo/src/main/java/com/fr/learn/Leaner.java b/plugin-report-doc-demo/src/main/java/com/fr/learn/Leaner.java new file mode 100644 index 0000000..c35f2ab --- /dev/null +++ b/plugin-report-doc-demo/src/main/java/com/fr/learn/Leaner.java @@ -0,0 +1,16 @@ +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); + } +} diff --git a/plugin-report-doc-demo/src/main/java/com/fr/learn/Learner4Debug.java b/plugin-report-doc-demo/src/main/java/com/fr/learn/Learner4Debug.java new file mode 100644 index 0000000..94b77f6 --- /dev/null +++ b/plugin-report-doc-demo/src/main/java/com/fr/learn/Learner4Debug.java @@ -0,0 +1,8 @@ +package com.fr.learn; + +public class Learner4Debug { + + public static void main(String... args) { + org.swingexplorer.Launcher.main(new String[]{"com.fr.start.Designer"}); + } +} diff --git a/plugin-report-doc-demo/src/mobile/MobileCodeWSCallbackHandler.java b/plugin-report-doc-demo/src/mobile/MobileCodeWSCallbackHandler.java new file mode 100644 index 0000000..f7a3e59 --- /dev/null +++ b/plugin-report-doc-demo/src/mobile/MobileCodeWSCallbackHandler.java @@ -0,0 +1,71 @@ +/** + * MobileCodeWSCallbackHandler.java + *

+ * This file was auto-generated from WSDL + * by the Apache Axis2 version: 1.7.3 Built on : May 30, 2016 (04:08:57 BST) + */ +package mobile; + + +/** + * MobileCodeWSCallbackHandler Callback class, Users can extend this class and implement + * their own receiveResult and receiveError methods. + */ +public abstract class MobileCodeWSCallbackHandler { + protected Object clientData; + + /** + * User can pass in any object that needs to be accessed once the NonBlocking + * Web service call is finished and appropriate method of this CallBack is called. + * + * @param clientData Object mechanism by which the user can pass in user data + * that will be avilable at the time this callback is called. + */ + public MobileCodeWSCallbackHandler(Object clientData) { + this.clientData = clientData; + } + + /** + * Please use this constructor if you don't want to set any clientData + */ + public MobileCodeWSCallbackHandler() { + this.clientData = null; + } + + /** + * Get the client data + */ + public Object getClientData() { + return clientData; + } + + /** + * auto generated Axis2 call back method for getMobileCodeInfo method + * override this method for handling normal response from getMobileCodeInfo operation + */ + public void receiveResultgetMobileCodeInfo( + mobile.MobileCodeWSStub.GetMobileCodeInfoResponse result) { + } + + /** + * auto generated Axis2 Error handler + * override this method for handling error response from getMobileCodeInfo operation + */ + public void receiveErrorgetMobileCodeInfo(Exception e) { + } + + /** + * auto generated Axis2 call back method for getDatabaseInfo method + * override this method for handling normal response from getDatabaseInfo operation + */ + public void receiveResultgetDatabaseInfo( + mobile.MobileCodeWSStub.GetDatabaseInfoResponse result) { + } + + /** + * auto generated Axis2 Error handler + * override this method for handling error response from getDatabaseInfo operation + */ + public void receiveErrorgetDatabaseInfo(Exception e) { + } +} diff --git a/plugin-report-doc-demo/src/mobile/MobileCodeWSStub.java b/plugin-report-doc-demo/src/mobile/MobileCodeWSStub.java new file mode 100644 index 0000000..8f6199b --- /dev/null +++ b/plugin-report-doc-demo/src/mobile/MobileCodeWSStub.java @@ -0,0 +1,3780 @@ +/** + * MobileCodeWSStub.java + *

+ * This file was auto-generated from WSDL + * by the Apache Axis2 version: 1.7.3 Built on : May 30, 2016 (04:08:57 BST) + */ +package mobile; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + + +/* + * MobileCodeWSStub java implementation + */ +public class MobileCodeWSStub extends org.apache.axis2.client.Stub { + private static int counter = 0; + protected org.apache.axis2.description.AxisOperation[] _operations; + + //hashmaps to keep the fault mapping + private java.util.HashMap faultExceptionNameMap = new java.util.HashMap(); + private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap(); + private java.util.HashMap faultMessageMap = new java.util.HashMap(); + private QName[] opNameArray = null; + + /** + * Constructor that takes in a configContext + */ + public MobileCodeWSStub( + org.apache.axis2.context.ConfigurationContext configurationContext, + java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault { + this(configurationContext, targetEndpoint, false); + } + + /** + * Constructor that takes in a configContext and useseperate listner + */ + public MobileCodeWSStub( + org.apache.axis2.context.ConfigurationContext configurationContext, + java.lang.String targetEndpoint, boolean useSeparateListener) + throws org.apache.axis2.AxisFault { + //To populate AxisService + populateAxisService(); + populateFaults(); + + _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext, + _service); + + _serviceClient.getOptions() + .setTo(new org.apache.axis2.addressing.EndpointReference( + targetEndpoint)); + _serviceClient.getOptions().setUseSeparateListener(useSeparateListener); + + //Set the soap version + _serviceClient.getOptions() + .setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); + } + + /** + * Default Constructor + */ + public MobileCodeWSStub( + org.apache.axis2.context.ConfigurationContext configurationContext) + throws org.apache.axis2.AxisFault { + this(configurationContext, + "http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx"); + } + + /** + * Default Constructor + */ + public MobileCodeWSStub() throws org.apache.axis2.AxisFault { + this("http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx"); + } + + /** + * Constructor taking the target endpoint + */ + public MobileCodeWSStub(java.lang.String targetEndpoint) + throws org.apache.axis2.AxisFault { + this(null, targetEndpoint); + } + + private static synchronized java.lang.String getUniqueSuffix() { + // reset the counter if it is greater than 99999 + if (counter > 99999) { + counter = 0; + } + + counter = counter + 1; + + return Long.toString(System.currentTimeMillis()) + + "_" + counter; + } + + private void populateAxisService() throws org.apache.axis2.AxisFault { + //creating the Service with a unique name + _service = new org.apache.axis2.description.AxisService("MobileCodeWS" + + getUniqueSuffix()); + addAnonymousOperations(); + + //creating the operations + org.apache.axis2.description.AxisOperation __operation; + + _operations = new org.apache.axis2.description.AxisOperation[2]; + + __operation = new org.apache.axis2.description.OutInAxisOperation(); + + __operation.setName(new QName( + "http://WebXml.com.cn/", "getDatabaseInfo")); + _service.addOperation(__operation); + + _operations[0] = __operation; + + __operation = new org.apache.axis2.description.OutInAxisOperation(); + + __operation.setName(new QName( + "http://WebXml.com.cn/", "getMobileCodeInfo")); + _service.addOperation(__operation); + + _operations[1] = __operation; + } + + //populates the faults + private void populateFaults() { + } + + /** + * Auto generated method signature + * <br /><h3>获得国内手机号码归属地数据库信息</h3><p>输入参数:无;返回数据:�?��字符串数组(省份 城市 记录数量)�?</p><br /> + * + * @param getDatabaseInfo0 + * @see mobile.MobileCodeWS#getDatabaseInfo + */ + public GetDatabaseInfoResponse getDatabaseInfo( + GetDatabaseInfo getDatabaseInfo0) + throws java.rmi.RemoteException { + org.apache.axis2.context.MessageContext _messageContext = null; + + try { + org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName()); + _operationClient.getOptions() + .setAction("http://WebXml.com.cn/getDatabaseInfo"); + _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); + + addPropertyToOperationClient(_operationClient, + org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, + "&"); + + // create a message context + _messageContext = new org.apache.axis2.context.MessageContext(); + + // create SOAP envelope with that payload + org.apache.axiom.soap.SOAPEnvelope env = null; + + env = toEnvelope(getFactory(_operationClient.getOptions() + .getSoapVersionURI()), + getDatabaseInfo0, + optimizeContent( + new QName("http://WebXml.com.cn/", + "getDatabaseInfo")), + new QName("http://WebXml.com.cn/", + "getDatabaseInfo")); + + //adding SOAP soap_headers + _serviceClient.addHeadersToEnvelope(env); + // set the message context with that soap envelope + _messageContext.setEnvelope(env); + + // add the message contxt to the operation client + _operationClient.addMessageContext(_messageContext); + + //execute the operation client + _operationClient.execute(true); + + org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE); + org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope(); + + Object object = fromOM(_returnEnv.getBody() + .getFirstElement(), + GetDatabaseInfoResponse.class); + + return (GetDatabaseInfoResponse) object; + } catch (org.apache.axis2.AxisFault f) { + org.apache.axiom.om.OMElement faultElt = f.getDetail(); + + if (faultElt != null) { + if (faultExceptionNameMap.containsKey( + new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), "getDatabaseInfo"))) { + //make the fault by reflection + try { + java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), "getDatabaseInfo")); + Class exceptionClass = Class.forName(exceptionClassName); + java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class}); + Exception ex = (Exception) constructor.newInstance(new Object[]{f.getMessage()}); + + //message class + java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), "getDatabaseInfo")); + Class messageClass = Class.forName(messageClassName); + Object messageObject = fromOM(faultElt, + messageClass); + java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", + new Class[]{messageClass}); + m.invoke(ex, new Object[]{messageObject}); + + throw new java.rmi.RemoteException(ex.getMessage(), ex); + } catch (ClassCastException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } catch (ClassNotFoundException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } catch (NoSuchMethodException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } catch (java.lang.reflect.InvocationTargetException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } catch (IllegalAccessException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } catch (InstantiationException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } + } else { + throw f; + } + } else { + throw f; + } + } finally { + if (_messageContext.getTransportOut() != null) { + _messageContext.getTransportOut().getSender() + .cleanup(_messageContext); + } + } + } + + /** + * Auto generated method signature for Asynchronous Invocations + * <br /><h3>获得国内手机号码归属地数据库信息</h3><p>输入参数:无;返回数据:�?��字符串数组(省份 城市 记录数量)�?</p><br /> + * + * @param getDatabaseInfo0 + * @see mobile.MobileCodeWS#startgetDatabaseInfo + */ + public void startgetDatabaseInfo( + GetDatabaseInfo getDatabaseInfo0, + final MobileCodeWSCallbackHandler callback) + throws java.rmi.RemoteException { + org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName()); + _operationClient.getOptions() + .setAction("http://WebXml.com.cn/getDatabaseInfo"); + _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); + + addPropertyToOperationClient(_operationClient, + org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, + "&"); + + // create SOAP envelope with that payload + org.apache.axiom.soap.SOAPEnvelope env = null; + final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext(); + + //Style is Doc. + env = toEnvelope(getFactory(_operationClient.getOptions() + .getSoapVersionURI()), + getDatabaseInfo0, + optimizeContent( + new QName("http://WebXml.com.cn/", + "getDatabaseInfo")), + new QName("http://WebXml.com.cn/", + "getDatabaseInfo")); + + // adding SOAP soap_headers + _serviceClient.addHeadersToEnvelope(env); + // create message context with that soap envelope + _messageContext.setEnvelope(env); + + // add the message context to the operation client + _operationClient.addMessageContext(_messageContext); + + _operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() { + public void onMessage( + org.apache.axis2.context.MessageContext resultContext) { + try { + org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope(); + + Object object = fromOM(resultEnv.getBody() + .getFirstElement(), + GetDatabaseInfoResponse.class); + callback.receiveResultgetDatabaseInfo((GetDatabaseInfoResponse) object); + } catch (org.apache.axis2.AxisFault e) { + callback.receiveErrorgetDatabaseInfo(e); + } + } + + public void onError(Exception error) { + if (error instanceof org.apache.axis2.AxisFault) { + org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error; + org.apache.axiom.om.OMElement faultElt = f.getDetail(); + + if (faultElt != null) { + if (faultExceptionNameMap.containsKey( + new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), + "getDatabaseInfo"))) { + //make the fault by reflection + try { + java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), + "getDatabaseInfo")); + Class exceptionClass = Class.forName(exceptionClassName); + java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class}); + Exception ex = (Exception) constructor.newInstance(new Object[]{f.getMessage()}); + + //message class + java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), + "getDatabaseInfo")); + Class messageClass = Class.forName(messageClassName); + Object messageObject = fromOM(faultElt, + messageClass); + java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", + new Class[]{messageClass}); + m.invoke(ex, + new Object[]{messageObject}); + + callback.receiveErrorgetDatabaseInfo(new java.rmi.RemoteException( + ex.getMessage(), ex)); + } catch (ClassCastException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetDatabaseInfo(f); + } catch (ClassNotFoundException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetDatabaseInfo(f); + } catch (NoSuchMethodException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetDatabaseInfo(f); + } catch (java.lang.reflect.InvocationTargetException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetDatabaseInfo(f); + } catch (IllegalAccessException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetDatabaseInfo(f); + } catch (InstantiationException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetDatabaseInfo(f); + } catch (org.apache.axis2.AxisFault e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetDatabaseInfo(f); + } + } else { + callback.receiveErrorgetDatabaseInfo(f); + } + } else { + callback.receiveErrorgetDatabaseInfo(f); + } + } else { + callback.receiveErrorgetDatabaseInfo(error); + } + } + + public void onFault( + org.apache.axis2.context.MessageContext faultContext) { + org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext); + onError(fault); + } + + public void onComplete() { + try { + _messageContext.getTransportOut().getSender() + .cleanup(_messageContext); + } catch (org.apache.axis2.AxisFault axisFault) { + callback.receiveErrorgetDatabaseInfo(axisFault); + } + } + }); + + org.apache.axis2.util.CallbackReceiver _callbackReceiver = null; + + if ((_operations[0].getMessageReceiver() == null) && + _operationClient.getOptions().isUseSeparateListener()) { + _callbackReceiver = new org.apache.axis2.util.CallbackReceiver(); + _operations[0].setMessageReceiver(_callbackReceiver); + } + + //execute the operation client + _operationClient.execute(false); + } + + /** + * Auto generated method signature + * <br /><h3>获得国内手机号码归属地省份�?地区和手机卡类型信息</h3><p>输入参数:mobileCode = 字符串(手机号码,最少前7位数字),userID = 字符串(商业用户ID�?免费用户为空字符串;返回数据:字符串(手机号码:省份 城市 手机卡类型)�?lt;/p><br /> + * + * @param getMobileCodeInfo2 + * @see mobile.MobileCodeWS#getMobileCodeInfo + */ + public GetMobileCodeInfoResponse getMobileCodeInfo( + GetMobileCodeInfo getMobileCodeInfo2) + throws java.rmi.RemoteException { + org.apache.axis2.context.MessageContext _messageContext = null; + + try { + org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName()); + _operationClient.getOptions() + .setAction("http://WebXml.com.cn/getMobileCodeInfo"); + _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); + + addPropertyToOperationClient(_operationClient, + org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, + "&"); + + // create a message context + _messageContext = new org.apache.axis2.context.MessageContext(); + + // create SOAP envelope with that payload + org.apache.axiom.soap.SOAPEnvelope env = null; + + env = toEnvelope(getFactory(_operationClient.getOptions() + .getSoapVersionURI()), + getMobileCodeInfo2, + optimizeContent( + new QName("http://WebXml.com.cn/", + "getMobileCodeInfo")), + new QName("http://WebXml.com.cn/", + "getMobileCodeInfo")); + + //adding SOAP soap_headers + _serviceClient.addHeadersToEnvelope(env); + // set the message context with that soap envelope + _messageContext.setEnvelope(env); + + // add the message contxt to the operation client + _operationClient.addMessageContext(_messageContext); + + //execute the operation client + _operationClient.execute(true); + + org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE); + org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope(); + + Object object = fromOM(_returnEnv.getBody() + .getFirstElement(), + GetMobileCodeInfoResponse.class); + + return (GetMobileCodeInfoResponse) object; + } catch (org.apache.axis2.AxisFault f) { + org.apache.axiom.om.OMElement faultElt = f.getDetail(); + + if (faultElt != null) { + if (faultExceptionNameMap.containsKey( + new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), "getMobileCodeInfo"))) { + //make the fault by reflection + try { + java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), "getMobileCodeInfo")); + Class exceptionClass = Class.forName(exceptionClassName); + java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class}); + Exception ex = (Exception) constructor.newInstance(new Object[]{new Object[]{f.getMessage()}}); + + //message class + java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), "getMobileCodeInfo")); + Class messageClass = Class.forName(messageClassName); + Object messageObject = fromOM(faultElt, + messageClass); + java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", + new Class[]{messageClass}); + m.invoke(ex, new Object[]{messageObject}); + + throw new java.rmi.RemoteException(ex.getMessage(), ex); + } catch (ClassCastException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } catch (ClassNotFoundException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } catch (NoSuchMethodException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } catch (java.lang.reflect.InvocationTargetException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } catch (IllegalAccessException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } catch (InstantiationException e) { + // we cannot intantiate the class - throw the original Axis fault + throw f; + } + } else { + throw f; + } + } else { + throw f; + } + } finally { + if (_messageContext.getTransportOut() != null) { + _messageContext.getTransportOut().getSender() + .cleanup(_messageContext); + } + } + } + + /** + * Auto generated method signature for Asynchronous Invocations + * <br /><h3>获得国内手机号码归属地省份�?地区和手机卡类型信息</h3><p>输入参数:mobileCode = 字符串(手机号码,最少前7位数字),userID = 字符串(商业用户ID�?免费用户为空字符串;返回数据:字符串(手机号码:省份 城市 手机卡类型)�?lt;/p><br /> + * + * @param getMobileCodeInfo2 + * @see mobile.MobileCodeWS#startgetMobileCodeInfo + */ + public void startgetMobileCodeInfo( + GetMobileCodeInfo getMobileCodeInfo2, + final MobileCodeWSCallbackHandler callback) + throws java.rmi.RemoteException { + org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName()); + _operationClient.getOptions() + .setAction("http://WebXml.com.cn/getMobileCodeInfo"); + _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); + + addPropertyToOperationClient(_operationClient, + org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, + "&"); + + // create SOAP envelope with that payload + org.apache.axiom.soap.SOAPEnvelope env = null; + final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext(); + + //Style is Doc. + env = toEnvelope(getFactory(_operationClient.getOptions() + .getSoapVersionURI()), + getMobileCodeInfo2, + optimizeContent( + new QName("http://WebXml.com.cn/", + "getMobileCodeInfo")), + new QName("http://WebXml.com.cn/", + "getMobileCodeInfo")); + + // adding SOAP soap_headers + _serviceClient.addHeadersToEnvelope(env); + // create message context with that soap envelope + _messageContext.setEnvelope(env); + + // add the message context to the operation client + _operationClient.addMessageContext(_messageContext); + + _operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() { + public void onMessage( + org.apache.axis2.context.MessageContext resultContext) { + try { + org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope(); + + Object object = fromOM(resultEnv.getBody() + .getFirstElement(), + GetMobileCodeInfoResponse.class); + callback.receiveResultgetMobileCodeInfo((GetMobileCodeInfoResponse) object); + } catch (org.apache.axis2.AxisFault e) { + callback.receiveErrorgetMobileCodeInfo(e); + } + } + + public void onError(Exception error) { + if (error instanceof org.apache.axis2.AxisFault) { + org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error; + org.apache.axiom.om.OMElement faultElt = f.getDetail(); + + if (faultElt != null) { + if (faultExceptionNameMap.containsKey( + new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), + "getMobileCodeInfo"))) { + //make the fault by reflection + try { + java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), + "getMobileCodeInfo")); + Class exceptionClass = Class.forName(exceptionClassName); + java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class}); + Exception ex = (Exception) constructor.newInstance(new Object[]{f.getMessage()}); + + //message class + java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey( + faultElt.getQName(), + "getMobileCodeInfo")); + Class messageClass = Class.forName(messageClassName); + Object messageObject = fromOM(faultElt, + messageClass); + java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", + new Class[]{messageClass}); + m.invoke(ex, + new Object[]{messageObject}); + + callback.receiveErrorgetMobileCodeInfo(new java.rmi.RemoteException( + ex.getMessage(), ex)); + } catch (ClassCastException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetMobileCodeInfo(f); + } catch (ClassNotFoundException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetMobileCodeInfo(f); + } catch (NoSuchMethodException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetMobileCodeInfo(f); + } catch (java.lang.reflect.InvocationTargetException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetMobileCodeInfo(f); + } catch (IllegalAccessException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetMobileCodeInfo(f); + } catch (InstantiationException e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetMobileCodeInfo(f); + } catch (org.apache.axis2.AxisFault e) { + // we cannot intantiate the class - throw the original Axis fault + callback.receiveErrorgetMobileCodeInfo(f); + } + } else { + callback.receiveErrorgetMobileCodeInfo(f); + } + } else { + callback.receiveErrorgetMobileCodeInfo(f); + } + } else { + callback.receiveErrorgetMobileCodeInfo(error); + } + } + + public void onFault( + org.apache.axis2.context.MessageContext faultContext) { + org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext); + onError(fault); + } + + public void onComplete() { + try { + _messageContext.getTransportOut().getSender() + .cleanup(_messageContext); + } catch (org.apache.axis2.AxisFault axisFault) { + callback.receiveErrorgetMobileCodeInfo(axisFault); + } + } + }); + + org.apache.axis2.util.CallbackReceiver _callbackReceiver = null; + + if ((_operations[1].getMessageReceiver() == null) && + _operationClient.getOptions().isUseSeparateListener()) { + _callbackReceiver = new org.apache.axis2.util.CallbackReceiver(); + _operations[1].setMessageReceiver(_callbackReceiver); + } + + //execute the operation client + _operationClient.execute(false); + } + + private boolean optimizeContent(QName opName) { + if (opNameArray == null) { + return false; + } + + for (int i = 0; i < opNameArray.length; i++) { + if (opName.equals(opNameArray[i])) { + return true; + } + } + + return false; + } + + private org.apache.axiom.om.OMElement toOM( + GetDatabaseInfo param, boolean optimizeContent) + throws org.apache.axis2.AxisFault { + try { + return param.getOMElement(GetDatabaseInfo.MY_QNAME, + org.apache.axiom.om.OMAbstractFactory.getOMFactory()); + } catch (org.apache.axis2.databinding.ADBException e) { + throw org.apache.axis2.AxisFault.makeFault(e); + } + } + + private org.apache.axiom.om.OMElement toOM( + GetDatabaseInfoResponse param, + boolean optimizeContent) throws org.apache.axis2.AxisFault { + try { + return param.getOMElement(GetDatabaseInfoResponse.MY_QNAME, + org.apache.axiom.om.OMAbstractFactory.getOMFactory()); + } catch (org.apache.axis2.databinding.ADBException e) { + throw org.apache.axis2.AxisFault.makeFault(e); + } + } + + private org.apache.axiom.om.OMElement toOM( + GetMobileCodeInfo param, boolean optimizeContent) + throws org.apache.axis2.AxisFault { + try { + return param.getOMElement(GetMobileCodeInfo.MY_QNAME, + org.apache.axiom.om.OMAbstractFactory.getOMFactory()); + } catch (org.apache.axis2.databinding.ADBException e) { + throw org.apache.axis2.AxisFault.makeFault(e); + } + } + + private org.apache.axiom.om.OMElement toOM( + GetMobileCodeInfoResponse param, + boolean optimizeContent) throws org.apache.axis2.AxisFault { + try { + return param.getOMElement(GetMobileCodeInfoResponse.MY_QNAME, + org.apache.axiom.om.OMAbstractFactory.getOMFactory()); + } catch (org.apache.axis2.databinding.ADBException e) { + throw org.apache.axis2.AxisFault.makeFault(e); + } + } + + private org.apache.axiom.soap.SOAPEnvelope toEnvelope( + org.apache.axiom.soap.SOAPFactory factory, + GetDatabaseInfo param, boolean optimizeContent, + QName elementQName) + throws org.apache.axis2.AxisFault { + try { + org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); + emptyEnvelope.getBody() + .addChild(param.getOMElement( + GetDatabaseInfo.MY_QNAME, factory)); + + return emptyEnvelope; + } catch (org.apache.axis2.databinding.ADBException e) { + throw org.apache.axis2.AxisFault.makeFault(e); + } + } + + /* methods to provide back word compatibility */ + private org.apache.axiom.soap.SOAPEnvelope toEnvelope( + org.apache.axiom.soap.SOAPFactory factory, + GetMobileCodeInfo param, + boolean optimizeContent, QName elementQName) + throws org.apache.axis2.AxisFault { + try { + org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); + emptyEnvelope.getBody() + .addChild(param.getOMElement( + GetMobileCodeInfo.MY_QNAME, factory)); + + return emptyEnvelope; + } catch (org.apache.axis2.databinding.ADBException e) { + throw org.apache.axis2.AxisFault.makeFault(e); + } + } + + /* methods to provide back word compatibility */ + + /** + * get the default envelope + */ + private org.apache.axiom.soap.SOAPEnvelope toEnvelope( + org.apache.axiom.soap.SOAPFactory factory) { + return factory.getDefaultEnvelope(); + } + + private Object fromOM(org.apache.axiom.om.OMElement param, + Class type) throws org.apache.axis2.AxisFault { + try { + if (GetDatabaseInfo.class.equals(type)) { + return GetDatabaseInfo.Factory.parse(param.getXMLStreamReaderWithoutCaching()); + } + + if (GetDatabaseInfoResponse.class.equals( + type)) { + return GetDatabaseInfoResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); + } + + if (GetMobileCodeInfo.class.equals(type)) { + return GetMobileCodeInfo.Factory.parse(param.getXMLStreamReaderWithoutCaching()); + } + + if (GetMobileCodeInfoResponse.class.equals( + type)) { + return GetMobileCodeInfoResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); + } + } catch (Exception e) { + throw org.apache.axis2.AxisFault.makeFault(e); + } + + return null; + } + + //http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx + public static class ArrayOfStringE implements org.apache.axis2.databinding.ADBBean { + public static final QName MY_QNAME = new QName("http://WebXml.com.cn/", + "ArrayOfString", "ns1"); + + /** + * field for ArrayOfString + */ + protected ArrayOfString localArrayOfString; + + /** + * Auto generated getter method + * + * @return ArrayOfString + */ + public ArrayOfString getArrayOfString() { + return localArrayOfString; + } + + /** + * Auto generated setter method + * + * @param param ArrayOfString + */ + public void setArrayOfString(ArrayOfString param) { + this.localArrayOfString = param; + } + + /** + * @param parentQName + * @param factory + * @return org.apache.axiom.om.OMElement + */ + public org.apache.axiom.om.OMElement getOMElement( + final QName parentQName, + final org.apache.axiom.om.OMFactory factory) + throws org.apache.axis2.databinding.ADBException { + return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource( + this, MY_QNAME), parentQName); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + serialize(parentQName, xmlWriter, false); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + //We can safely assume an element has only one type associated with it + if (localArrayOfString == null) { + java.lang.String namespace = "http://WebXml.com.cn/"; + writeStartElement(null, namespace, "ArrayOfString", xmlWriter); + + // write the nil attribute + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", + xmlWriter); + xmlWriter.writeEndElement(); + } else { + localArrayOfString.serialize(MY_QNAME, xmlWriter); + } + } + + private static java.lang.String generatePrefix( + java.lang.String namespace) { + if (namespace.equals("http://WebXml.com.cn/")) { + return "ns1"; + } + + return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + /** + * Utility method to write an element start tag. + */ + private void writeStartElement(java.lang.String prefix, + java.lang.String namespace, java.lang.String localPart, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeStartElement(writerPrefix, localPart, namespace); + } else { + if (namespace.length() == 0) { + prefix = ""; + } else if (prefix == null) { + prefix = generatePrefix(namespace); + } + + xmlWriter.writeStartElement(prefix, localPart, namespace); + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + } + + /** + * Util method to write an attribute with the ns prefix + */ + private void writeAttribute(java.lang.String prefix, + java.lang.String namespace, java.lang.String attName, + java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeAttribute(writerPrefix, namespace, attName, + attValue); + } else { + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + xmlWriter.writeAttribute(prefix, namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeAttribute(java.lang.String namespace, + java.lang.String attName, java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attValue); + } else { + xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), + namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeQNameAttribute(java.lang.String namespace, + java.lang.String attName, QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String attributeNamespace = qname.getNamespaceURI(); + java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); + + if (attributePrefix == null) { + attributePrefix = registerPrefix(xmlWriter, attributeNamespace); + } + + java.lang.String attributeValue; + + if (attributePrefix.trim().length() > 0) { + attributeValue = attributePrefix + ":" + qname.getLocalPart(); + } else { + attributeValue = qname.getLocalPart(); + } + + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attributeValue); + } else { + registerPrefix(xmlWriter, namespace); + xmlWriter.writeAttribute(attributePrefix, namespace, attName, + attributeValue); + } + } + + /** + * method to handle Qnames + */ + private void writeQName(QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String namespaceURI = qname.getNamespaceURI(); + + if (namespaceURI != null) { + java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); + + if (prefix == null) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + xmlWriter.writeCharacters(prefix + ":" + + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } else { + // i.e this is the default namespace + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } else { + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } + + private void writeQNames(QName[] qnames, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (qnames != null) { + // we have to store this data until last moment since it is not possible to write any + // namespace data after writing the charactor data + StringBuffer stringToWrite = new StringBuffer(); + java.lang.String namespaceURI = null; + java.lang.String prefix = null; + + for (int i = 0; i < qnames.length; i++) { + if (i > 0) { + stringToWrite.append(" "); + } + + namespaceURI = qnames[i].getNamespaceURI(); + + if (namespaceURI != null) { + prefix = xmlWriter.getPrefix(namespaceURI); + + if ((prefix == null) || (prefix.length() == 0)) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + stringToWrite.append(prefix).append(":") + .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } + + xmlWriter.writeCharacters(stringToWrite.toString()); + } + } + + /** + * Register a namespace prefix + */ + private java.lang.String registerPrefix( + javax.xml.stream.XMLStreamWriter xmlWriter, + java.lang.String namespace) + throws XMLStreamException { + java.lang.String prefix = xmlWriter.getPrefix(namespace); + + if (prefix == null) { + prefix = generatePrefix(namespace); + + javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); + + while (true) { + java.lang.String uri = nsContext.getNamespaceURI(prefix); + + if ((uri == null) || (uri.length() == 0)) { + break; + } + + prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + + return prefix; + } + + /** + * Factory class that keeps the parse method + */ + public static class Factory { + private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class); + + /** + * static method to create the object + * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable + * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element + * Postcondition: If this object is an element, the reader is positioned at its end element + * If this object is a complex type, the reader is positioned at the end element of its outer element + */ + public static ArrayOfStringE parse( + XMLStreamReader reader) + throws Exception { + ArrayOfStringE object = new ArrayOfStringE(); + + int event; + QName currentQName = null; + java.lang.String nillableValue = null; + java.lang.String prefix = ""; + java.lang.String namespaceuri = ""; + + try { + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + currentQName = reader.getName(); + + nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "nil"); + + if ("true".equals(nillableValue) || + "1".equals(nillableValue)) { + // Skip the element and report the null value. It cannot have subelements. + while (!reader.isEndElement()) + reader.next(); + + return object; + } + + // Note all attributes that were handled. Used to differ normal attributes + // from anyAttributes. + java.util.Vector handledAttributes = new java.util.Vector(); + + while (!reader.isEndElement()) { + if (reader.isStartElement()) { + if ((reader.isStartElement() && + new QName( + "http://WebXml.com.cn/", "ArrayOfString").equals( + reader.getName())) || + new QName("", + "ArrayOfString").equals( + reader.getName())) { + nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "nil"); + + if ("true".equals(nillableValue) || + "1".equals(nillableValue)) { + object.setArrayOfString(null); + reader.next(); + } else { + object.setArrayOfString(ArrayOfString.Factory.parse( + reader)); + } + } // End of if for expected property start element + + else { + // 3 - A start element we are not expecting indicates an invalid parameter was passed + throw new org.apache.axis2.databinding.ADBException( + "Unexpected subelement " + + reader.getName()); + } + } else { + reader.next(); + } + } // end of while loop + } catch (XMLStreamException e) { + throw new Exception(e); + } + + return object; + } + } //end of factory class + + public XMLStreamReader getPullParser(QName arg0) + throws XMLStreamException { + // TODO Auto-generated method stub + return null; + } + } + + public static class GetDatabaseInfo implements org.apache.axis2.databinding.ADBBean { + public static final QName MY_QNAME = new QName("http://WebXml.com.cn/", + "getDatabaseInfo", "ns1"); + + /** + * @param parentQName + * @param factory + * @return org.apache.axiom.om.OMElement + */ + public org.apache.axiom.om.OMElement getOMElement( + final QName parentQName, + final org.apache.axiom.om.OMFactory factory) + throws org.apache.axis2.databinding.ADBException { + return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource( + this, MY_QNAME), parentQName); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + serialize(parentQName, xmlWriter, false); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + java.lang.String prefix = null; + java.lang.String namespace = null; + + prefix = parentQName.getPrefix(); + namespace = parentQName.getNamespaceURI(); + writeStartElement(prefix, namespace, parentQName.getLocalPart(), + xmlWriter); + + if (serializeType) { + java.lang.String namespacePrefix = registerPrefix(xmlWriter, + "http://WebXml.com.cn/"); + + if ((namespacePrefix != null) && + (namespacePrefix.trim().length() > 0)) { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + namespacePrefix + ":getDatabaseInfo", xmlWriter); + } else { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + "getDatabaseInfo", xmlWriter); + } + } + + xmlWriter.writeEndElement(); + } + + private static java.lang.String generatePrefix( + java.lang.String namespace) { + if (namespace.equals("http://WebXml.com.cn/")) { + return "ns1"; + } + + return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + /** + * Utility method to write an element start tag. + */ + private void writeStartElement(java.lang.String prefix, + java.lang.String namespace, java.lang.String localPart, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeStartElement(writerPrefix, localPart, namespace); + } else { + if (namespace.length() == 0) { + prefix = ""; + } else if (prefix == null) { + prefix = generatePrefix(namespace); + } + + xmlWriter.writeStartElement(prefix, localPart, namespace); + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + } + + /** + * Util method to write an attribute with the ns prefix + */ + private void writeAttribute(java.lang.String prefix, + java.lang.String namespace, java.lang.String attName, + java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeAttribute(writerPrefix, namespace, attName, + attValue); + } else { + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + xmlWriter.writeAttribute(prefix, namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeAttribute(java.lang.String namespace, + java.lang.String attName, java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attValue); + } else { + xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), + namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeQNameAttribute(java.lang.String namespace, + java.lang.String attName, QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String attributeNamespace = qname.getNamespaceURI(); + java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); + + if (attributePrefix == null) { + attributePrefix = registerPrefix(xmlWriter, attributeNamespace); + } + + java.lang.String attributeValue; + + if (attributePrefix.trim().length() > 0) { + attributeValue = attributePrefix + ":" + qname.getLocalPart(); + } else { + attributeValue = qname.getLocalPart(); + } + + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attributeValue); + } else { + registerPrefix(xmlWriter, namespace); + xmlWriter.writeAttribute(attributePrefix, namespace, attName, + attributeValue); + } + } + + /** + * method to handle Qnames + */ + private void writeQName(QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String namespaceURI = qname.getNamespaceURI(); + + if (namespaceURI != null) { + java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); + + if (prefix == null) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + xmlWriter.writeCharacters(prefix + ":" + + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } else { + // i.e this is the default namespace + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } else { + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } + + private void writeQNames(QName[] qnames, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (qnames != null) { + // we have to store this data until last moment since it is not possible to write any + // namespace data after writing the charactor data + StringBuffer stringToWrite = new StringBuffer(); + java.lang.String namespaceURI = null; + java.lang.String prefix = null; + + for (int i = 0; i < qnames.length; i++) { + if (i > 0) { + stringToWrite.append(" "); + } + + namespaceURI = qnames[i].getNamespaceURI(); + + if (namespaceURI != null) { + prefix = xmlWriter.getPrefix(namespaceURI); + + if ((prefix == null) || (prefix.length() == 0)) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + stringToWrite.append(prefix).append(":") + .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } + + xmlWriter.writeCharacters(stringToWrite.toString()); + } + } + + /** + * Register a namespace prefix + */ + private java.lang.String registerPrefix( + javax.xml.stream.XMLStreamWriter xmlWriter, + java.lang.String namespace) + throws XMLStreamException { + java.lang.String prefix = xmlWriter.getPrefix(namespace); + + if (prefix == null) { + prefix = generatePrefix(namespace); + + javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); + + while (true) { + java.lang.String uri = nsContext.getNamespaceURI(prefix); + + if ((uri == null) || (uri.length() == 0)) { + break; + } + + prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + + return prefix; + } + + /** + * Factory class that keeps the parse method + */ + public static class Factory { + private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class); + + /** + * static method to create the object + * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable + * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element + * Postcondition: If this object is an element, the reader is positioned at its end element + * If this object is a complex type, the reader is positioned at the end element of its outer element + */ + public static GetDatabaseInfo parse( + XMLStreamReader reader) + throws Exception { + GetDatabaseInfo object = new GetDatabaseInfo(); + + int event; + QName currentQName = null; + java.lang.String nillableValue = null; + java.lang.String prefix = ""; + java.lang.String namespaceuri = ""; + + try { + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + currentQName = reader.getName(); + + if (reader.getAttributeValue( + "http://www.w3.org/2001/XMLSchema-instance", + "type") != null) { + java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "type"); + + if (fullTypeName != null) { + java.lang.String nsPrefix = null; + + if (fullTypeName.indexOf(":") > -1) { + nsPrefix = fullTypeName.substring(0, + fullTypeName.indexOf(":")); + } + + nsPrefix = (nsPrefix == null) ? "" : nsPrefix; + + java.lang.String type = fullTypeName.substring(fullTypeName.indexOf( + ":") + 1); + + if (!"getDatabaseInfo".equals(type)) { + //find namespace for the prefix + java.lang.String nsUri = reader.getNamespaceContext() + .getNamespaceURI(nsPrefix); + + return (GetDatabaseInfo) ExtensionMapper.getTypeObject(nsUri, + type, reader); + } + } + } + + // Note all attributes that were handled. Used to differ normal attributes + // from anyAttributes. + java.util.Vector handledAttributes = new java.util.Vector(); + + reader.next(); + } catch (XMLStreamException e) { + throw new Exception(e); + } + + return object; + } + } //end of factory class + + public XMLStreamReader getPullParser(QName arg0) + throws XMLStreamException { + // TODO Auto-generated method stub + return null; + } + } + + public static class String implements org.apache.axis2.databinding.ADBBean { + public static final QName MY_QNAME = new QName("http://WebXml.com.cn/", + "string", "ns1"); + + /** + * field for String + */ + protected java.lang.String localString; + + /** + * Auto generated getter method + * + * @return java.lang.String + */ + public java.lang.String getString() { + return localString; + } + + /** + * Auto generated setter method + * + * @param param String + */ + public void setString(java.lang.String param) { + this.localString = param; + } + + /** + * @param parentQName + * @param factory + * @return org.apache.axiom.om.OMElement + */ + public org.apache.axiom.om.OMElement getOMElement( + final QName parentQName, + final org.apache.axiom.om.OMFactory factory) + throws org.apache.axis2.databinding.ADBException { + return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource( + this, MY_QNAME), parentQName); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + serialize(parentQName, xmlWriter, false); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + //We can safely assume an element has only one type associated with it + java.lang.String namespace = "http://WebXml.com.cn/"; + java.lang.String _localName = "string"; + + writeStartElement(null, namespace, _localName, xmlWriter); + + // add the type details if this is used in a simple type + if (serializeType) { + java.lang.String namespacePrefix = registerPrefix(xmlWriter, + "http://WebXml.com.cn/"); + + if ((namespacePrefix != null) && + (namespacePrefix.trim().length() > 0)) { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + namespacePrefix + ":string", xmlWriter); + } else { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + "string", xmlWriter); + } + } + + if (localString == null) { + // write the nil attribute + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", + xmlWriter); + } else { + xmlWriter.writeCharacters(localString); + } + + xmlWriter.writeEndElement(); + } + + private static java.lang.String generatePrefix( + java.lang.String namespace) { + if (namespace.equals("http://WebXml.com.cn/")) { + return "ns1"; + } + + return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + /** + * Utility method to write an element start tag. + */ + private void writeStartElement(java.lang.String prefix, + java.lang.String namespace, java.lang.String localPart, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeStartElement(writerPrefix, localPart, namespace); + } else { + if (namespace.length() == 0) { + prefix = ""; + } else if (prefix == null) { + prefix = generatePrefix(namespace); + } + + xmlWriter.writeStartElement(prefix, localPart, namespace); + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + } + + /** + * Util method to write an attribute with the ns prefix + */ + private void writeAttribute(java.lang.String prefix, + java.lang.String namespace, java.lang.String attName, + java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeAttribute(writerPrefix, namespace, attName, + attValue); + } else { + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + xmlWriter.writeAttribute(prefix, namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeAttribute(java.lang.String namespace, + java.lang.String attName, java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attValue); + } else { + xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), + namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeQNameAttribute(java.lang.String namespace, + java.lang.String attName, QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String attributeNamespace = qname.getNamespaceURI(); + java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); + + if (attributePrefix == null) { + attributePrefix = registerPrefix(xmlWriter, attributeNamespace); + } + + java.lang.String attributeValue; + + if (attributePrefix.trim().length() > 0) { + attributeValue = attributePrefix + ":" + qname.getLocalPart(); + } else { + attributeValue = qname.getLocalPart(); + } + + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attributeValue); + } else { + registerPrefix(xmlWriter, namespace); + xmlWriter.writeAttribute(attributePrefix, namespace, attName, + attributeValue); + } + } + + /** + * method to handle Qnames + */ + private void writeQName(QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String namespaceURI = qname.getNamespaceURI(); + + if (namespaceURI != null) { + java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); + + if (prefix == null) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + xmlWriter.writeCharacters(prefix + ":" + + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } else { + // i.e this is the default namespace + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } else { + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } + + private void writeQNames(QName[] qnames, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (qnames != null) { + // we have to store this data until last moment since it is not possible to write any + // namespace data after writing the charactor data + StringBuffer stringToWrite = new StringBuffer(); + java.lang.String namespaceURI = null; + java.lang.String prefix = null; + + for (int i = 0; i < qnames.length; i++) { + if (i > 0) { + stringToWrite.append(" "); + } + + namespaceURI = qnames[i].getNamespaceURI(); + + if (namespaceURI != null) { + prefix = xmlWriter.getPrefix(namespaceURI); + + if ((prefix == null) || (prefix.length() == 0)) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + stringToWrite.append(prefix).append(":") + .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } + + xmlWriter.writeCharacters(stringToWrite.toString()); + } + } + + /** + * Register a namespace prefix + */ + private java.lang.String registerPrefix( + javax.xml.stream.XMLStreamWriter xmlWriter, + java.lang.String namespace) + throws XMLStreamException { + java.lang.String prefix = xmlWriter.getPrefix(namespace); + + if (prefix == null) { + prefix = generatePrefix(namespace); + + javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); + + while (true) { + java.lang.String uri = nsContext.getNamespaceURI(prefix); + + if ((uri == null) || (uri.length() == 0)) { + break; + } + + prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + + return prefix; + } + + /** + * Factory class that keeps the parse method + */ + public static class Factory { + private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class); + + /** + * static method to create the object + * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable + * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element + * Postcondition: If this object is an element, the reader is positioned at its end element + * If this object is a complex type, the reader is positioned at the end element of its outer element + */ + public static String parse(XMLStreamReader reader) + throws Exception { + String object = new String(); + + int event; + QName currentQName = null; + java.lang.String nillableValue = null; + java.lang.String prefix = ""; + java.lang.String namespaceuri = ""; + + try { + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + currentQName = reader.getName(); + + nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "nil"); + + if ("true".equals(nillableValue) || + "1".equals(nillableValue)) { + // Skip the element and report the null value. It cannot have subelements. + while (!reader.isEndElement()) + reader.next(); + + return object; + } + + // Note all attributes that were handled. Used to differ normal attributes + // from anyAttributes. + java.util.Vector handledAttributes = new java.util.Vector(); + + while (!reader.isEndElement()) { + if (reader.isStartElement()) { + if ((reader.isStartElement() && + new QName( + "http://WebXml.com.cn/", "string").equals( + reader.getName())) || + new QName("", "string").equals( + reader.getName())) { + nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "nil"); + + if (!"true".equals(nillableValue) && + !"1".equals(nillableValue)) { + java.lang.String content = reader.getElementText(); + + object.setString(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + content)); + } else { + reader.getElementText(); // throw away text nodes if any. + } + } // End of if for expected property start element + + else { + // 3 - A start element we are not expecting indicates an invalid parameter was passed + throw new org.apache.axis2.databinding.ADBException( + "Unexpected subelement " + + reader.getName()); + } + } else { + reader.next(); + } + } // end of while loop + } catch (XMLStreamException e) { + throw new Exception(e); + } + + return object; + } + } //end of factory class + + public XMLStreamReader getPullParser(QName arg0) + throws XMLStreamException { + // TODO Auto-generated method stub + return null; + } + } + + public static class ExtensionMapper { + public static Object getTypeObject( + java.lang.String namespaceURI, java.lang.String typeName, + XMLStreamReader reader) throws Exception { + if ("http://WebXml.com.cn/".equals(namespaceURI) && + "ArrayOfString".equals(typeName)) { + return ArrayOfString.Factory.parse(reader); + } + + throw new org.apache.axis2.databinding.ADBException( + "Unsupported type " + namespaceURI + " " + typeName); + } + } + + public static class GetDatabaseInfoResponse implements org.apache.axis2.databinding.ADBBean { + public static final QName MY_QNAME = new QName("http://WebXml.com.cn/", + "getDatabaseInfoResponse", "ns1"); + + /** + * field for GetDatabaseInfoResult + */ + protected ArrayOfString localGetDatabaseInfoResult; + + /* This tracker boolean wil be used to detect whether the user called the set method + * for this attribute. It will be used to determine whether to include this field + * in the serialized XML + */ + protected boolean localGetDatabaseInfoResultTracker = false; + + public boolean isGetDatabaseInfoResultSpecified() { + return localGetDatabaseInfoResultTracker; + } + + /** + * Auto generated getter method + * + * @return ArrayOfString + */ + public ArrayOfString getGetDatabaseInfoResult() { + return localGetDatabaseInfoResult; + } + + /** + * Auto generated setter method + * + * @param param GetDatabaseInfoResult + */ + public void setGetDatabaseInfoResult(ArrayOfString param) { + localGetDatabaseInfoResultTracker = param != null; + + this.localGetDatabaseInfoResult = param; + } + + /** + * @param parentQName + * @param factory + * @return org.apache.axiom.om.OMElement + */ + public org.apache.axiom.om.OMElement getOMElement( + final QName parentQName, + final org.apache.axiom.om.OMFactory factory) + throws org.apache.axis2.databinding.ADBException { + return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource( + this, MY_QNAME), parentQName); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + serialize(parentQName, xmlWriter, false); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + java.lang.String prefix = null; + java.lang.String namespace = null; + + prefix = parentQName.getPrefix(); + namespace = parentQName.getNamespaceURI(); + writeStartElement(prefix, namespace, parentQName.getLocalPart(), + xmlWriter); + + if (serializeType) { + java.lang.String namespacePrefix = registerPrefix(xmlWriter, + "http://WebXml.com.cn/"); + + if ((namespacePrefix != null) && + (namespacePrefix.trim().length() > 0)) { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + namespacePrefix + ":getDatabaseInfoResponse", xmlWriter); + } else { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + "getDatabaseInfoResponse", xmlWriter); + } + } + + if (localGetDatabaseInfoResultTracker) { + if (localGetDatabaseInfoResult == null) { + throw new org.apache.axis2.databinding.ADBException( + "getDatabaseInfoResult cannot be null!!"); + } + + localGetDatabaseInfoResult.serialize(new QName( + "http://WebXml.com.cn/", "getDatabaseInfoResult"), + xmlWriter); + } + + xmlWriter.writeEndElement(); + } + + private static java.lang.String generatePrefix( + java.lang.String namespace) { + if (namespace.equals("http://WebXml.com.cn/")) { + return "ns1"; + } + + return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + /** + * Utility method to write an element start tag. + */ + private void writeStartElement(java.lang.String prefix, + java.lang.String namespace, java.lang.String localPart, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeStartElement(writerPrefix, localPart, namespace); + } else { + if (namespace.length() == 0) { + prefix = ""; + } else if (prefix == null) { + prefix = generatePrefix(namespace); + } + + xmlWriter.writeStartElement(prefix, localPart, namespace); + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + } + + /** + * Util method to write an attribute with the ns prefix + */ + private void writeAttribute(java.lang.String prefix, + java.lang.String namespace, java.lang.String attName, + java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeAttribute(writerPrefix, namespace, attName, + attValue); + } else { + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + xmlWriter.writeAttribute(prefix, namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeAttribute(java.lang.String namespace, + java.lang.String attName, java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attValue); + } else { + xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), + namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeQNameAttribute(java.lang.String namespace, + java.lang.String attName, QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String attributeNamespace = qname.getNamespaceURI(); + java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); + + if (attributePrefix == null) { + attributePrefix = registerPrefix(xmlWriter, attributeNamespace); + } + + java.lang.String attributeValue; + + if (attributePrefix.trim().length() > 0) { + attributeValue = attributePrefix + ":" + qname.getLocalPart(); + } else { + attributeValue = qname.getLocalPart(); + } + + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attributeValue); + } else { + registerPrefix(xmlWriter, namespace); + xmlWriter.writeAttribute(attributePrefix, namespace, attName, + attributeValue); + } + } + + /** + * method to handle Qnames + */ + private void writeQName(QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String namespaceURI = qname.getNamespaceURI(); + + if (namespaceURI != null) { + java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); + + if (prefix == null) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + xmlWriter.writeCharacters(prefix + ":" + + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } else { + // i.e this is the default namespace + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } else { + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } + + private void writeQNames(QName[] qnames, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (qnames != null) { + // we have to store this data until last moment since it is not possible to write any + // namespace data after writing the charactor data + StringBuffer stringToWrite = new StringBuffer(); + java.lang.String namespaceURI = null; + java.lang.String prefix = null; + + for (int i = 0; i < qnames.length; i++) { + if (i > 0) { + stringToWrite.append(" "); + } + + namespaceURI = qnames[i].getNamespaceURI(); + + if (namespaceURI != null) { + prefix = xmlWriter.getPrefix(namespaceURI); + + if ((prefix == null) || (prefix.length() == 0)) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + stringToWrite.append(prefix).append(":") + .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } + + xmlWriter.writeCharacters(stringToWrite.toString()); + } + } + + /** + * Register a namespace prefix + */ + private java.lang.String registerPrefix( + javax.xml.stream.XMLStreamWriter xmlWriter, + java.lang.String namespace) + throws XMLStreamException { + java.lang.String prefix = xmlWriter.getPrefix(namespace); + + if (prefix == null) { + prefix = generatePrefix(namespace); + + javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); + + while (true) { + java.lang.String uri = nsContext.getNamespaceURI(prefix); + + if ((uri == null) || (uri.length() == 0)) { + break; + } + + prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + + return prefix; + } + + /** + * Factory class that keeps the parse method + */ + public static class Factory { + private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class); + + /** + * static method to create the object + * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable + * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element + * Postcondition: If this object is an element, the reader is positioned at its end element + * If this object is a complex type, the reader is positioned at the end element of its outer element + */ + public static GetDatabaseInfoResponse parse( + XMLStreamReader reader) + throws Exception { + GetDatabaseInfoResponse object = new GetDatabaseInfoResponse(); + + int event; + QName currentQName = null; + java.lang.String nillableValue = null; + java.lang.String prefix = ""; + java.lang.String namespaceuri = ""; + + try { + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + currentQName = reader.getName(); + + if (reader.getAttributeValue( + "http://www.w3.org/2001/XMLSchema-instance", + "type") != null) { + java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "type"); + + if (fullTypeName != null) { + java.lang.String nsPrefix = null; + + if (fullTypeName.indexOf(":") > -1) { + nsPrefix = fullTypeName.substring(0, + fullTypeName.indexOf(":")); + } + + nsPrefix = (nsPrefix == null) ? "" : nsPrefix; + + java.lang.String type = fullTypeName.substring(fullTypeName.indexOf( + ":") + 1); + + if (!"getDatabaseInfoResponse".equals(type)) { + //find namespace for the prefix + java.lang.String nsUri = reader.getNamespaceContext() + .getNamespaceURI(nsPrefix); + + return (GetDatabaseInfoResponse) ExtensionMapper.getTypeObject(nsUri, + type, reader); + } + } + } + + // Note all attributes that were handled. Used to differ normal attributes + // from anyAttributes. + java.util.Vector handledAttributes = new java.util.Vector(); + + reader.next(); + + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + if ((reader.isStartElement() && + new QName( + "http://WebXml.com.cn/", "getDatabaseInfoResult").equals( + reader.getName())) || + new QName("", + "getDatabaseInfoResult").equals( + reader.getName())) { + object.setGetDatabaseInfoResult(ArrayOfString.Factory.parse( + reader)); + + reader.next(); + } // End of if for expected property start element + + else { + } + + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + if (reader.isStartElement()) { + // 2 - A start element we are not expecting indicates a trailing invalid property + throw new org.apache.axis2.databinding.ADBException( + "Unexpected subelement " + reader.getName()); + } + } catch (XMLStreamException e) { + throw new Exception(e); + } + + return object; + } + } //end of factory class + + public XMLStreamReader getPullParser(QName arg0) + throws XMLStreamException { + // TODO Auto-generated method stub + return null; + } + } + + public static class ArrayOfString implements org.apache.axis2.databinding.ADBBean { + /* This type was generated from the piece of schema that had + name = ArrayOfString + Namespace URI = http://WebXml.com.cn/ + Namespace Prefix = ns1 + */ + + /** + * field for String + * This was an Array! + */ + protected java.lang.String[] localString; + + /* This tracker boolean wil be used to detect whether the user called the set method + * for this attribute. It will be used to determine whether to include this field + * in the serialized XML + */ + protected boolean localStringTracker = false; + + public boolean isStringSpecified() { + return localStringTracker; + } + + /** + * Auto generated getter method + * + * @return java.lang.String[] + */ + public java.lang.String[] getString() { + return localString; + } + + /** + * validate the array for String + */ + protected void validateString(java.lang.String[] param) { + } + + /** + * Auto generated setter method + * + * @param param String + */ + public void setString(java.lang.String[] param) { + validateString(param); + + localStringTracker = true; + + this.localString = param; + } + + /** + * Auto generated add method for the array for convenience + * + * @param param java.lang.String + */ + public void addString(java.lang.String param) { + if (localString == null) { + localString = new java.lang.String[]{}; + } + + //update the setting tracker + localStringTracker = true; + + java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil.toList(localString); + list.add(param); + this.localString = (java.lang.String[]) list.toArray(new java.lang.String[list.size()]); + } + + /** + * @param parentQName + * @param factory + * @return org.apache.axiom.om.OMElement + */ + public org.apache.axiom.om.OMElement getOMElement( + final QName parentQName, + final org.apache.axiom.om.OMFactory factory) + throws org.apache.axis2.databinding.ADBException { + return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource( + this, parentQName), parentQName); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + serialize(parentQName, xmlWriter, false); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + java.lang.String prefix = null; + java.lang.String namespace = null; + + prefix = parentQName.getPrefix(); + namespace = parentQName.getNamespaceURI(); + writeStartElement(prefix, namespace, parentQName.getLocalPart(), + xmlWriter); + + if (serializeType) { + java.lang.String namespacePrefix = registerPrefix(xmlWriter, + "http://WebXml.com.cn/"); + + if ((namespacePrefix != null) && + (namespacePrefix.trim().length() > 0)) { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + namespacePrefix + ":ArrayOfString", xmlWriter); + } else { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + "ArrayOfString", xmlWriter); + } + } + + if (localStringTracker) { + if (localString != null) { + namespace = "http://WebXml.com.cn/"; + + for (int i = 0; i < localString.length; i++) { + if (localString[i] != null) { + writeStartElement(null, namespace, "string", + xmlWriter); + + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + localString[i])); + + xmlWriter.writeEndElement(); + } else { + // write null attribute + namespace = "http://WebXml.com.cn/"; + writeStartElement(null, namespace, "string", + xmlWriter); + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", + "nil", "1", xmlWriter); + xmlWriter.writeEndElement(); + } + } + } else { + // write the null attribute + // write null attribute + writeStartElement(null, "http://WebXml.com.cn/", "string", + xmlWriter); + + // write the nil attribute + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "nil", + "1", xmlWriter); + xmlWriter.writeEndElement(); + } + } + + xmlWriter.writeEndElement(); + } + + private static java.lang.String generatePrefix( + java.lang.String namespace) { + if (namespace.equals("http://WebXml.com.cn/")) { + return "ns1"; + } + + return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + /** + * Utility method to write an element start tag. + */ + private void writeStartElement(java.lang.String prefix, + java.lang.String namespace, java.lang.String localPart, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeStartElement(writerPrefix, localPart, namespace); + } else { + if (namespace.length() == 0) { + prefix = ""; + } else if (prefix == null) { + prefix = generatePrefix(namespace); + } + + xmlWriter.writeStartElement(prefix, localPart, namespace); + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + } + + /** + * Util method to write an attribute with the ns prefix + */ + private void writeAttribute(java.lang.String prefix, + java.lang.String namespace, java.lang.String attName, + java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeAttribute(writerPrefix, namespace, attName, + attValue); + } else { + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + xmlWriter.writeAttribute(prefix, namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeAttribute(java.lang.String namespace, + java.lang.String attName, java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attValue); + } else { + xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), + namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeQNameAttribute(java.lang.String namespace, + java.lang.String attName, QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String attributeNamespace = qname.getNamespaceURI(); + java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); + + if (attributePrefix == null) { + attributePrefix = registerPrefix(xmlWriter, attributeNamespace); + } + + java.lang.String attributeValue; + + if (attributePrefix.trim().length() > 0) { + attributeValue = attributePrefix + ":" + qname.getLocalPart(); + } else { + attributeValue = qname.getLocalPart(); + } + + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attributeValue); + } else { + registerPrefix(xmlWriter, namespace); + xmlWriter.writeAttribute(attributePrefix, namespace, attName, + attributeValue); + } + } + + /** + * method to handle Qnames + */ + private void writeQName(QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String namespaceURI = qname.getNamespaceURI(); + + if (namespaceURI != null) { + java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); + + if (prefix == null) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + xmlWriter.writeCharacters(prefix + ":" + + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } else { + // i.e this is the default namespace + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } else { + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } + + private void writeQNames(QName[] qnames, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (qnames != null) { + // we have to store this data until last moment since it is not possible to write any + // namespace data after writing the charactor data + StringBuffer stringToWrite = new StringBuffer(); + java.lang.String namespaceURI = null; + java.lang.String prefix = null; + + for (int i = 0; i < qnames.length; i++) { + if (i > 0) { + stringToWrite.append(" "); + } + + namespaceURI = qnames[i].getNamespaceURI(); + + if (namespaceURI != null) { + prefix = xmlWriter.getPrefix(namespaceURI); + + if ((prefix == null) || (prefix.length() == 0)) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + stringToWrite.append(prefix).append(":") + .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } + + xmlWriter.writeCharacters(stringToWrite.toString()); + } + } + + /** + * Register a namespace prefix + */ + private java.lang.String registerPrefix( + javax.xml.stream.XMLStreamWriter xmlWriter, + java.lang.String namespace) + throws XMLStreamException { + java.lang.String prefix = xmlWriter.getPrefix(namespace); + + if (prefix == null) { + prefix = generatePrefix(namespace); + + javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); + + while (true) { + java.lang.String uri = nsContext.getNamespaceURI(prefix); + + if ((uri == null) || (uri.length() == 0)) { + break; + } + + prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + + return prefix; + } + + /** + * Factory class that keeps the parse method + */ + public static class Factory { + private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class); + + /** + * static method to create the object + * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable + * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element + * Postcondition: If this object is an element, the reader is positioned at its end element + * If this object is a complex type, the reader is positioned at the end element of its outer element + */ + public static ArrayOfString parse( + XMLStreamReader reader) + throws Exception { + ArrayOfString object = new ArrayOfString(); + + int event; + QName currentQName = null; + java.lang.String nillableValue = null; + java.lang.String prefix = ""; + java.lang.String namespaceuri = ""; + + try { + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + currentQName = reader.getName(); + + if (reader.getAttributeValue( + "http://www.w3.org/2001/XMLSchema-instance", + "type") != null) { + java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "type"); + + if (fullTypeName != null) { + java.lang.String nsPrefix = null; + + if (fullTypeName.indexOf(":") > -1) { + nsPrefix = fullTypeName.substring(0, + fullTypeName.indexOf(":")); + } + + nsPrefix = (nsPrefix == null) ? "" : nsPrefix; + + java.lang.String type = fullTypeName.substring(fullTypeName.indexOf( + ":") + 1); + + if (!"ArrayOfString".equals(type)) { + //find namespace for the prefix + java.lang.String nsUri = reader.getNamespaceContext() + .getNamespaceURI(nsPrefix); + + return (ArrayOfString) ExtensionMapper.getTypeObject(nsUri, + type, reader); + } + } + } + + // Note all attributes that were handled. Used to differ normal attributes + // from anyAttributes. + java.util.Vector handledAttributes = new java.util.Vector(); + + reader.next(); + + java.util.ArrayList list1 = new java.util.ArrayList(); + + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + if ((reader.isStartElement() && + new QName( + "http://WebXml.com.cn/", "string").equals( + reader.getName())) || + new QName("", "string").equals( + reader.getName())) { + // Process the array and step past its final element's end. + nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "nil"); + + if ("true".equals(nillableValue) || + "1".equals(nillableValue)) { + list1.add(null); + + reader.next(); + } else { + list1.add(reader.getElementText()); + } + + //loop until we find a start element that is not part of this array + boolean loopDone1 = false; + + while (!loopDone1) { + // Ensure we are at the EndElement + while (!reader.isEndElement()) { + reader.next(); + } + + // Step out of this element + reader.next(); + + // Step to next element event. + while (!reader.isStartElement() && + !reader.isEndElement()) + reader.next(); + + if (reader.isEndElement()) { + //two continuous end elements means we are exiting the xml structure + loopDone1 = true; + } else { + if (new QName( + "http://WebXml.com.cn/", "string").equals( + reader.getName())) { + nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "nil"); + + if ("true".equals(nillableValue) || + "1".equals(nillableValue)) { + list1.add(null); + + reader.next(); + } else { + list1.add(reader.getElementText()); + } + } else { + loopDone1 = true; + } + } + } + + // call the converter utility to convert and set the array + object.setString((java.lang.String[]) list1.toArray( + new java.lang.String[list1.size()])); + } // End of if for expected property start element + + else { + } + + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + if (reader.isStartElement()) { + // 2 - A start element we are not expecting indicates a trailing invalid property + throw new org.apache.axis2.databinding.ADBException( + "Unexpected subelement " + reader.getName()); + } + } catch (XMLStreamException e) { + throw new Exception(e); + } + + return object; + } + } //end of factory class + + public XMLStreamReader getPullParser(QName arg0) + throws XMLStreamException { + // TODO Auto-generated method stub + return null; + } + } + + public static class GetMobileCodeInfoResponse implements org.apache.axis2.databinding.ADBBean { + public static final QName MY_QNAME = new QName("http://WebXml.com.cn/", + "getMobileCodeInfoResponse", "ns1"); + + /** + * field for GetMobileCodeInfoResult + */ + protected java.lang.String localGetMobileCodeInfoResult; + + /* This tracker boolean wil be used to detect whether the user called the set method + * for this attribute. It will be used to determine whether to include this field + * in the serialized XML + */ + protected boolean localGetMobileCodeInfoResultTracker = false; + + public boolean isGetMobileCodeInfoResultSpecified() { + return localGetMobileCodeInfoResultTracker; + } + + /** + * Auto generated getter method + * + * @return java.lang.String + */ + public java.lang.String getGetMobileCodeInfoResult() { + return localGetMobileCodeInfoResult; + } + + /** + * Auto generated setter method + * + * @param param GetMobileCodeInfoResult + */ + public void setGetMobileCodeInfoResult(java.lang.String param) { + localGetMobileCodeInfoResultTracker = param != null; + + this.localGetMobileCodeInfoResult = param; + } + + /** + * @param parentQName + * @param factory + * @return org.apache.axiom.om.OMElement + */ + public org.apache.axiom.om.OMElement getOMElement( + final QName parentQName, + final org.apache.axiom.om.OMFactory factory) + throws org.apache.axis2.databinding.ADBException { + return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource( + this, MY_QNAME), parentQName); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + serialize(parentQName, xmlWriter, false); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + java.lang.String prefix = null; + java.lang.String namespace = null; + + prefix = parentQName.getPrefix(); + namespace = parentQName.getNamespaceURI(); + writeStartElement(prefix, namespace, parentQName.getLocalPart(), + xmlWriter); + + if (serializeType) { + java.lang.String namespacePrefix = registerPrefix(xmlWriter, + "http://WebXml.com.cn/"); + + if ((namespacePrefix != null) && + (namespacePrefix.trim().length() > 0)) { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + namespacePrefix + ":getMobileCodeInfoResponse", + xmlWriter); + } else { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + "getMobileCodeInfoResponse", xmlWriter); + } + } + + if (localGetMobileCodeInfoResultTracker) { + namespace = "http://WebXml.com.cn/"; + writeStartElement(null, namespace, "getMobileCodeInfoResult", + xmlWriter); + + if (localGetMobileCodeInfoResult == null) { + // write the nil attribute + throw new org.apache.axis2.databinding.ADBException( + "getMobileCodeInfoResult cannot be null!!"); + } else { + xmlWriter.writeCharacters(localGetMobileCodeInfoResult); + } + + xmlWriter.writeEndElement(); + } + + xmlWriter.writeEndElement(); + } + + private static java.lang.String generatePrefix( + java.lang.String namespace) { + if (namespace.equals("http://WebXml.com.cn/")) { + return "ns1"; + } + + return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + /** + * Utility method to write an element start tag. + */ + private void writeStartElement(java.lang.String prefix, + java.lang.String namespace, java.lang.String localPart, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeStartElement(writerPrefix, localPart, namespace); + } else { + if (namespace.length() == 0) { + prefix = ""; + } else if (prefix == null) { + prefix = generatePrefix(namespace); + } + + xmlWriter.writeStartElement(prefix, localPart, namespace); + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + } + + /** + * Util method to write an attribute with the ns prefix + */ + private void writeAttribute(java.lang.String prefix, + java.lang.String namespace, java.lang.String attName, + java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeAttribute(writerPrefix, namespace, attName, + attValue); + } else { + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + xmlWriter.writeAttribute(prefix, namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeAttribute(java.lang.String namespace, + java.lang.String attName, java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attValue); + } else { + xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), + namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeQNameAttribute(java.lang.String namespace, + java.lang.String attName, QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String attributeNamespace = qname.getNamespaceURI(); + java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); + + if (attributePrefix == null) { + attributePrefix = registerPrefix(xmlWriter, attributeNamespace); + } + + java.lang.String attributeValue; + + if (attributePrefix.trim().length() > 0) { + attributeValue = attributePrefix + ":" + qname.getLocalPart(); + } else { + attributeValue = qname.getLocalPart(); + } + + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attributeValue); + } else { + registerPrefix(xmlWriter, namespace); + xmlWriter.writeAttribute(attributePrefix, namespace, attName, + attributeValue); + } + } + + /** + * method to handle Qnames + */ + private void writeQName(QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String namespaceURI = qname.getNamespaceURI(); + + if (namespaceURI != null) { + java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); + + if (prefix == null) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + xmlWriter.writeCharacters(prefix + ":" + + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } else { + // i.e this is the default namespace + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } else { + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } + + private void writeQNames(QName[] qnames, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (qnames != null) { + // we have to store this data until last moment since it is not possible to write any + // namespace data after writing the charactor data + StringBuffer stringToWrite = new StringBuffer(); + java.lang.String namespaceURI = null; + java.lang.String prefix = null; + + for (int i = 0; i < qnames.length; i++) { + if (i > 0) { + stringToWrite.append(" "); + } + + namespaceURI = qnames[i].getNamespaceURI(); + + if (namespaceURI != null) { + prefix = xmlWriter.getPrefix(namespaceURI); + + if ((prefix == null) || (prefix.length() == 0)) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + stringToWrite.append(prefix).append(":") + .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } + + xmlWriter.writeCharacters(stringToWrite.toString()); + } + } + + /** + * Register a namespace prefix + */ + private java.lang.String registerPrefix( + javax.xml.stream.XMLStreamWriter xmlWriter, + java.lang.String namespace) + throws XMLStreamException { + java.lang.String prefix = xmlWriter.getPrefix(namespace); + + if (prefix == null) { + prefix = generatePrefix(namespace); + + javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); + + while (true) { + java.lang.String uri = nsContext.getNamespaceURI(prefix); + + if ((uri == null) || (uri.length() == 0)) { + break; + } + + prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + + return prefix; + } + + /** + * Factory class that keeps the parse method + */ + public static class Factory { + private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class); + + /** + * static method to create the object + * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable + * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element + * Postcondition: If this object is an element, the reader is positioned at its end element + * If this object is a complex type, the reader is positioned at the end element of its outer element + */ + public static GetMobileCodeInfoResponse parse( + XMLStreamReader reader) + throws Exception { + GetMobileCodeInfoResponse object = new GetMobileCodeInfoResponse(); + + int event; + QName currentQName = null; + java.lang.String nillableValue = null; + java.lang.String prefix = ""; + java.lang.String namespaceuri = ""; + + try { + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + currentQName = reader.getName(); + + if (reader.getAttributeValue( + "http://www.w3.org/2001/XMLSchema-instance", + "type") != null) { + java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "type"); + + if (fullTypeName != null) { + java.lang.String nsPrefix = null; + + if (fullTypeName.indexOf(":") > -1) { + nsPrefix = fullTypeName.substring(0, + fullTypeName.indexOf(":")); + } + + nsPrefix = (nsPrefix == null) ? "" : nsPrefix; + + java.lang.String type = fullTypeName.substring(fullTypeName.indexOf( + ":") + 1); + + if (!"getMobileCodeInfoResponse".equals(type)) { + //find namespace for the prefix + java.lang.String nsUri = reader.getNamespaceContext() + .getNamespaceURI(nsPrefix); + + return (GetMobileCodeInfoResponse) ExtensionMapper.getTypeObject(nsUri, + type, reader); + } + } + } + + // Note all attributes that were handled. Used to differ normal attributes + // from anyAttributes. + java.util.Vector handledAttributes = new java.util.Vector(); + + reader.next(); + + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + if ((reader.isStartElement() && + new QName( + "http://WebXml.com.cn/", + "getMobileCodeInfoResult").equals( + reader.getName())) || + new QName("", + "getMobileCodeInfoResult").equals( + reader.getName())) { + nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "nil"); + + if ("true".equals(nillableValue) || + "1".equals(nillableValue)) { + throw new org.apache.axis2.databinding.ADBException( + "The element: " + "getMobileCodeInfoResult" + + " cannot be null"); + } + + java.lang.String content = reader.getElementText(); + + object.setGetMobileCodeInfoResult(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + content)); + + reader.next(); + } // End of if for expected property start element + + else { + } + + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + if (reader.isStartElement()) { + // 2 - A start element we are not expecting indicates a trailing invalid property + throw new org.apache.axis2.databinding.ADBException( + "Unexpected subelement " + reader.getName()); + } + } catch (XMLStreamException e) { + throw new Exception(e); + } + + return object; + } + } //end of factory class + + public XMLStreamReader getPullParser(QName arg0) + throws XMLStreamException { + // TODO Auto-generated method stub + return null; + } + } + + public static class GetMobileCodeInfo implements org.apache.axis2.databinding.ADBBean { + public static final QName MY_QNAME = new QName("http://WebXml.com.cn/", + "getMobileCodeInfo", "ns1"); + + /** + * field for MobileCode + */ + protected java.lang.String localMobileCode; + + /* This tracker boolean wil be used to detect whether the user called the set method + * for this attribute. It will be used to determine whether to include this field + * in the serialized XML + */ + protected boolean localMobileCodeTracker = false; + + /** + * field for UserID + */ + protected java.lang.String localUserID; + + /* This tracker boolean wil be used to detect whether the user called the set method + * for this attribute. It will be used to determine whether to include this field + * in the serialized XML + */ + protected boolean localUserIDTracker = false; + + public boolean isMobileCodeSpecified() { + return localMobileCodeTracker; + } + + /** + * Auto generated getter method + * + * @return java.lang.String + */ + public java.lang.String getMobileCode() { + return localMobileCode; + } + + /** + * Auto generated setter method + * + * @param param MobileCode + */ + public void setMobileCode(java.lang.String param) { + localMobileCodeTracker = param != null; + + this.localMobileCode = param; + } + + public boolean isUserIDSpecified() { + return localUserIDTracker; + } + + /** + * Auto generated getter method + * + * @return java.lang.String + */ + public java.lang.String getUserID() { + return localUserID; + } + + /** + * Auto generated setter method + * + * @param param UserID + */ + public void setUserID(java.lang.String param) { + localUserIDTracker = param != null; + + this.localUserID = param; + } + + /** + * @param parentQName + * @param factory + * @return org.apache.axiom.om.OMElement + */ + public org.apache.axiom.om.OMElement getOMElement( + final QName parentQName, + final org.apache.axiom.om.OMFactory factory) + throws org.apache.axis2.databinding.ADBException { + return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource( + this, MY_QNAME), parentQName); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + serialize(parentQName, xmlWriter, false); + } + + public void serialize(final QName parentQName, + javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) + throws XMLStreamException, + org.apache.axis2.databinding.ADBException { + java.lang.String prefix = null; + java.lang.String namespace = null; + + prefix = parentQName.getPrefix(); + namespace = parentQName.getNamespaceURI(); + writeStartElement(prefix, namespace, parentQName.getLocalPart(), + xmlWriter); + + if (serializeType) { + java.lang.String namespacePrefix = registerPrefix(xmlWriter, + "http://WebXml.com.cn/"); + + if ((namespacePrefix != null) && + (namespacePrefix.trim().length() > 0)) { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + namespacePrefix + ":getMobileCodeInfo", xmlWriter); + } else { + writeAttribute("xsi", + "http://www.w3.org/2001/XMLSchema-instance", "type", + "getMobileCodeInfo", xmlWriter); + } + } + + if (localMobileCodeTracker) { + namespace = "http://WebXml.com.cn/"; + writeStartElement(null, namespace, "mobileCode", xmlWriter); + + if (localMobileCode == null) { + // write the nil attribute + throw new org.apache.axis2.databinding.ADBException( + "mobileCode cannot be null!!"); + } else { + xmlWriter.writeCharacters(localMobileCode); + } + + xmlWriter.writeEndElement(); + } + + if (localUserIDTracker) { + namespace = "http://WebXml.com.cn/"; + writeStartElement(null, namespace, "userID", xmlWriter); + + if (localUserID == null) { + // write the nil attribute + throw new org.apache.axis2.databinding.ADBException( + "userID cannot be null!!"); + } else { + xmlWriter.writeCharacters(localUserID); + } + + xmlWriter.writeEndElement(); + } + + xmlWriter.writeEndElement(); + } + + private static java.lang.String generatePrefix( + java.lang.String namespace) { + if (namespace.equals("http://WebXml.com.cn/")) { + return "ns1"; + } + + return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + /** + * Utility method to write an element start tag. + */ + private void writeStartElement(java.lang.String prefix, + java.lang.String namespace, java.lang.String localPart, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeStartElement(writerPrefix, localPart, namespace); + } else { + if (namespace.length() == 0) { + prefix = ""; + } else if (prefix == null) { + prefix = generatePrefix(namespace); + } + + xmlWriter.writeStartElement(prefix, localPart, namespace); + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + } + + /** + * Util method to write an attribute with the ns prefix + */ + private void writeAttribute(java.lang.String prefix, + java.lang.String namespace, java.lang.String attName, + java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); + + if (writerPrefix != null) { + xmlWriter.writeAttribute(writerPrefix, namespace, attName, + attValue); + } else { + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + xmlWriter.writeAttribute(prefix, namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeAttribute(java.lang.String namespace, + java.lang.String attName, java.lang.String attValue, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attValue); + } else { + xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), + namespace, attName, attValue); + } + } + + /** + * Util method to write an attribute without the ns prefix + */ + private void writeQNameAttribute(java.lang.String namespace, + java.lang.String attName, QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String attributeNamespace = qname.getNamespaceURI(); + java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); + + if (attributePrefix == null) { + attributePrefix = registerPrefix(xmlWriter, attributeNamespace); + } + + java.lang.String attributeValue; + + if (attributePrefix.trim().length() > 0) { + attributeValue = attributePrefix + ":" + qname.getLocalPart(); + } else { + attributeValue = qname.getLocalPart(); + } + + if (namespace.equals("")) { + xmlWriter.writeAttribute(attName, attributeValue); + } else { + registerPrefix(xmlWriter, namespace); + xmlWriter.writeAttribute(attributePrefix, namespace, attName, + attributeValue); + } + } + + /** + * method to handle Qnames + */ + private void writeQName(QName qname, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + java.lang.String namespaceURI = qname.getNamespaceURI(); + + if (namespaceURI != null) { + java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); + + if (prefix == null) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + xmlWriter.writeCharacters(prefix + ":" + + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } else { + // i.e this is the default namespace + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } else { + xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qname)); + } + } + + private void writeQNames(QName[] qnames, + javax.xml.stream.XMLStreamWriter xmlWriter) + throws XMLStreamException { + if (qnames != null) { + // we have to store this data until last moment since it is not possible to write any + // namespace data after writing the charactor data + StringBuffer stringToWrite = new StringBuffer(); + java.lang.String namespaceURI = null; + java.lang.String prefix = null; + + for (int i = 0; i < qnames.length; i++) { + if (i > 0) { + stringToWrite.append(" "); + } + + namespaceURI = qnames[i].getNamespaceURI(); + + if (namespaceURI != null) { + prefix = xmlWriter.getPrefix(namespaceURI); + + if ((prefix == null) || (prefix.length() == 0)) { + prefix = generatePrefix(namespaceURI); + xmlWriter.writeNamespace(prefix, namespaceURI); + xmlWriter.setPrefix(prefix, namespaceURI); + } + + if (prefix.trim().length() > 0) { + stringToWrite.append(prefix).append(":") + .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } else { + stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + qnames[i])); + } + } + + xmlWriter.writeCharacters(stringToWrite.toString()); + } + } + + /** + * Register a namespace prefix + */ + private java.lang.String registerPrefix( + javax.xml.stream.XMLStreamWriter xmlWriter, + java.lang.String namespace) + throws XMLStreamException { + java.lang.String prefix = xmlWriter.getPrefix(namespace); + + if (prefix == null) { + prefix = generatePrefix(namespace); + + javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); + + while (true) { + java.lang.String uri = nsContext.getNamespaceURI(prefix); + + if ((uri == null) || (uri.length() == 0)) { + break; + } + + prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); + } + + xmlWriter.writeNamespace(prefix, namespace); + xmlWriter.setPrefix(prefix, namespace); + } + + return prefix; + } + + /** + * Factory class that keeps the parse method + */ + public static class Factory { + private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class); + + /** + * static method to create the object + * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable + * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element + * Postcondition: If this object is an element, the reader is positioned at its end element + * If this object is a complex type, the reader is positioned at the end element of its outer element + */ + public static GetMobileCodeInfo parse( + XMLStreamReader reader) + throws Exception { + GetMobileCodeInfo object = new GetMobileCodeInfo(); + + int event; + QName currentQName = null; + java.lang.String nillableValue = null; + java.lang.String prefix = ""; + java.lang.String namespaceuri = ""; + + try { + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + currentQName = reader.getName(); + + if (reader.getAttributeValue( + "http://www.w3.org/2001/XMLSchema-instance", + "type") != null) { + java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "type"); + + if (fullTypeName != null) { + java.lang.String nsPrefix = null; + + if (fullTypeName.indexOf(":") > -1) { + nsPrefix = fullTypeName.substring(0, + fullTypeName.indexOf(":")); + } + + nsPrefix = (nsPrefix == null) ? "" : nsPrefix; + + java.lang.String type = fullTypeName.substring(fullTypeName.indexOf( + ":") + 1); + + if (!"getMobileCodeInfo".equals(type)) { + //find namespace for the prefix + java.lang.String nsUri = reader.getNamespaceContext() + .getNamespaceURI(nsPrefix); + + return (GetMobileCodeInfo) ExtensionMapper.getTypeObject(nsUri, + type, reader); + } + } + } + + // Note all attributes that were handled. Used to differ normal attributes + // from anyAttributes. + java.util.Vector handledAttributes = new java.util.Vector(); + + reader.next(); + + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + if ((reader.isStartElement() && + new QName( + "http://WebXml.com.cn/", "mobileCode").equals( + reader.getName())) || + new QName("", "mobileCode").equals( + reader.getName())) { + nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "nil"); + + if ("true".equals(nillableValue) || + "1".equals(nillableValue)) { + throw new org.apache.axis2.databinding.ADBException( + "The element: " + "mobileCode" + + " cannot be null"); + } + + java.lang.String content = reader.getElementText(); + + object.setMobileCode(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + content)); + + reader.next(); + } // End of if for expected property start element + + else { + } + + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + if ((reader.isStartElement() && + new QName( + "http://WebXml.com.cn/", "userID").equals( + reader.getName())) || + new QName("", "userID").equals( + reader.getName())) { + nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", + "nil"); + + if ("true".equals(nillableValue) || + "1".equals(nillableValue)) { + throw new org.apache.axis2.databinding.ADBException( + "The element: " + "userID" + + " cannot be null"); + } + + java.lang.String content = reader.getElementText(); + + object.setUserID(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + content)); + + reader.next(); + } // End of if for expected property start element + + else { + } + + while (!reader.isStartElement() && !reader.isEndElement()) + reader.next(); + + if (reader.isStartElement()) { + // 2 - A start element we are not expecting indicates a trailing invalid property + throw new org.apache.axis2.databinding.ADBException( + "Unexpected subelement " + reader.getName()); + } + } catch (XMLStreamException e) { + throw new Exception(e); + } + + return object; + } + } //end of factory class + + public XMLStreamReader getPullParser(QName arg0) + throws XMLStreamException { + // TODO Auto-generated method stub + return null; + } + } +}