Browse Source

REPORT-15312 开放API整理任务 补充一些新增的api 修正之前有问题的api

pull/3/head
zack 6 years ago
parent
commit
e5ffbcb32b
  1. 5
      plugin-report-doc-demo/plugin.xml
  2. 14
      plugin-report-doc-demo/src/com/fr/io/ExcuteDemo.java
  3. 16
      plugin-report-doc-demo/src/com/fr/io/ExportApi.java
  4. 13
      plugin-report-doc-demo/src/com/fr/io/ExportBatch.java
  5. 17
      plugin-report-doc-demo/src/com/fr/io/ExportExcel.java
  6. 18
      plugin-report-doc-demo/src/com/fr/io/ExportReports.java
  7. 15
      plugin-report-doc-demo/src/com/fr/io/JavaPrint.java
  8. 13
      plugin-report-doc-demo/src/com/fr/io/SetParameterWindow.java
  9. 13
      plugin-report-doc-demo/src/com/fr/io/SimpleDemo.java
  10. 73
      plugin-report-doc-demo/src/com/fr/openapi/remote/TemplateRead.java
  11. 15
      plugin-report-doc-demo/src/com/fr/plugin/core/MyLocaleFinder.java
  12. 18
      plugin-report-doc-demo/src/com/fr/plugin/core/secondary/ResourcePathTransformerImpl.java
  13. 23
      plugin-report-doc-demo/src/com/fr/plugin/core/secondary/SiteTransformerImpl.java

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

@ -4,7 +4,7 @@
<name><![CDATA[文档demo代码集成]]></name>
<active>yes</active>
<hidden>no</hidden>
<version>1.1.1</version>
<version>1.2</version>
<env-version>10.0~</env-version>
<jartime>2018-08-02</jartime>
<vendor>finereport</vendor>
@ -13,8 +13,9 @@
[2018-01-25] 发布。<br>
[2018-08-02] 插件适配10
]]></change-notes>
<function-recorder class="com.fr.plugin.core.MyLocaleFinder"/>
<extra-core>
<SiteTransformer class="com.fr.plugin.core.secondary.SiteTransformerImpl"/>
</extra-core>
<extra-designer>

14
plugin-report-doc-demo/src/com/fr/io/ExcuteDemo.java

@ -10,12 +10,8 @@ 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;
@ -26,18 +22,12 @@ public class ExcuteDemo {
public static void main(String[] args) {
try {
// 首先需要定义执行所在的环境,这样才能正确读取数据库信息
// 定义报表运行环境,用于执行报表
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new BaseDBActivator(),
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WorkspaceRegister(),
new ServerWorkspaceRegister(),
new SerializationActivator());
new ReportActivator());
String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径
SimpleWork.checkIn(envpath);
module.start();

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

@ -20,12 +20,8 @@ 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;
@ -35,19 +31,13 @@ import java.io.FileOutputStream;
public class ExportApi {
public static void main(String[] args) {
// 定义报表运行环境,才能执行报表
// 定义报表运行环境,用于执行报表
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new BaseDBActivator(),
Module module = ActivatorToolBox.simpleLink(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";//工程路径
new ReportActivator());
String envpath = "D:\\FineReport_10.0\\webapps\\webroot\\WEB-INF";
SimpleWork.checkIn(envpath);
module.start();
ResultWorkBook rworkbook = null;

13
plugin-report-doc-demo/src/com/fr/io/ExportBatch.java

@ -11,13 +11,9 @@ 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;
@ -33,17 +29,12 @@ public class ExportBatch {
public static void main(String[] args) {
try {
// 定义报表运行环境,用于执行报表
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new BaseDBActivator(),
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WorkspaceRegister(),
new ServerWorkspaceRegister(),
new SerializationActivator());
new ReportActivator());
String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径
SimpleWork.checkIn(envpath);
module.start();

17
plugin-report-doc-demo/src/com/fr/io/ExportExcel.java

@ -1,6 +1,9 @@
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.ExcelExporter;
import com.fr.io.exporter.LargeDataPageExcelExporter;
@ -11,9 +14,13 @@ 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.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.report.ReportActivator;
import com.fr.report.core.ReportUtils;
import com.fr.report.module.EngineModule;
import com.fr.report.module.ReportBaseActivator;
import com.fr.stable.WriteActor;
import com.fr.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
import java.io.File;
@ -23,9 +30,15 @@ import java.io.FileOutputStream;
public class ExportExcel {
public static void main(String[] args) {
// 定义报表运行环境,才能执行报表
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator());
String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
SimpleWork.checkIn(envpath);
ModuleContext.startModule(EngineModule.class.getName());
module.start();
ResultWorkBook rworkbook = null;
try {
// 未执行模板工作薄

18
plugin-report-doc-demo/src/com/fr/io/ExportReports.java

@ -1,14 +1,21 @@
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.PageExcelExporter;
import com.fr.main.TemplateWorkBook;
import com.fr.main.workbook.PageWorkBook;
import com.fr.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.report.ReportActivator;
import com.fr.report.core.ReportUtils;
import com.fr.report.module.EngineModule;
import com.fr.report.module.ReportBaseActivator;
import com.fr.report.report.PageReport;
import com.fr.stable.PageActor;
import com.fr.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
import java.io.File;
@ -18,9 +25,16 @@ import java.io.OutputStream;
public class ExportReports {
public static void main(String[] args) {
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator());
String envpath = "D:\\FineReport\\develop\\code\\build\\package\\WebReport\\WEB-INF";
SimpleWork.checkIn(envpath);
ModuleContext.startModule(EngineModule.class.getName());
module.start();
// <EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һЩ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
try {
// δִ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

15
plugin-report-doc-demo/src/com/fr/io/JavaPrint.java

@ -1,8 +1,16 @@
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.main.TemplateWorkBook;
import com.fr.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.print.PrintUtils;
import com.fr.report.ReportActivator;
import com.fr.report.module.ReportBaseActivator;
import com.fr.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
import java.util.HashMap;
@ -11,8 +19,15 @@ import java.util.HashMap;
public class JavaPrint {
public static void main(String[] args) {
// 定义报表运行环境,才能执行报表
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator());
String envPath = "D:\\FineReport\\develop\\code\\build\\package\\WebReport\\WEB-INF";
SimpleWork.checkIn(envPath);
module.start();
try {
TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook("GettingStarted.cpt");
// 参数传值

13
plugin-report-doc-demo/src/com/fr/io/SetParameterWindow.java

@ -13,11 +13,7 @@ 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;
@ -28,17 +24,12 @@ public class SetParameterWindow {
public static void main(String[] args) {
try {
// 定义报表运行环境,用于执行报表
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new BaseDBActivator(),
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WorkspaceRegister(),
new ServerWorkspaceRegister(),
new SerializationActivator());
new ReportActivator());
String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径
SimpleWork.checkIn(envpath);
module.start();

13
plugin-report-doc-demo/src/com/fr/io/SimpleDemo.java

@ -13,11 +13,7 @@ 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;
@ -27,17 +23,12 @@ import java.io.FileOutputStream;
public class SimpleDemo {
public static void main(String[] args) {
// 定义报表运行环境,用于执行报表
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new BaseDBActivator(),
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
new StateServerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WorkspaceRegister(),
new ServerWorkspaceRegister(),
new SerializationActivator());
new ReportActivator());
String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径
SimpleWork.checkIn(envpath);
module.start();

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

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

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

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

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

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

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

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