|
|
@ -18,8 +18,6 @@ import com.fr.module.tool.ActivatorToolBox; |
|
|
|
import com.fr.report.ReportActivator; |
|
|
|
import com.fr.report.ReportActivator; |
|
|
|
import com.fr.report.RestrictionActivator; |
|
|
|
import com.fr.report.RestrictionActivator; |
|
|
|
import com.fr.report.module.ReportBaseActivator; |
|
|
|
import com.fr.report.module.ReportBaseActivator; |
|
|
|
import com.fr.report.write.WriteActivator; |
|
|
|
|
|
|
|
import com.fr.scheduler.SchedulerActivator; |
|
|
|
|
|
|
|
import com.fr.store.StateServiceActivator; |
|
|
|
import com.fr.store.StateServiceActivator; |
|
|
|
import com.fr.workspace.simple.SimpleWork; |
|
|
|
import com.fr.workspace.simple.SimpleWork; |
|
|
|
|
|
|
|
|
|
|
@ -27,25 +25,41 @@ import java.io.File; |
|
|
|
import java.io.FileOutputStream; |
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
|
|
|
|
|
|
|
public class ExportApi_frm { |
|
|
|
public class ExportApi_frm { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 这段静态代码块仅在main函数测试时使用, |
|
|
|
|
|
|
|
* 实际生产环境中一般使用web容器,集成帆软后帆软服务会自动启动,不再需要下面的静态代码,直接写导出的业务逻辑即可。 |
|
|
|
|
|
|
|
* web集成注意事项: |
|
|
|
|
|
|
|
* 1、集成环境需要依赖【当前使用jdk对应版本的】tools.jar,一般从jdk中直接复制即可; |
|
|
|
|
|
|
|
* 2、帆软服务自动启动成功后,使用的工作目录自动识别为web应用下的WEB-INF目录,所以需要把下面代码中envpath指向的工作目录拷贝到集成环境下web应用的WEB-INF目录, |
|
|
|
|
|
|
|
* 这样才能沿用原先帆软的配置及模板。如果集群环境,会自动使用文件服务器的模板。 |
|
|
|
|
|
|
|
* 3、可以访问集成环境的地址: ip:port/应用名/decision 。如果能成功访问且不需要初始化配置则代表帆软服务启动成功 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
static { |
|
|
|
|
|
|
|
Module preModule = ModuleContext.getModule(ReportActivator.class); |
|
|
|
|
|
|
|
boolean running = preModule != null && preModule.isRunning(); |
|
|
|
|
|
|
|
if (!running) { |
|
|
|
|
|
|
|
/**定义报表运行环境,用于执行报表*/ |
|
|
|
|
|
|
|
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), |
|
|
|
|
|
|
|
new ConfigurationActivator(), |
|
|
|
|
|
|
|
new ResourceRepositoryActivator(), |
|
|
|
|
|
|
|
new StandaloneModeActivator(), |
|
|
|
|
|
|
|
new ModuleHealActivator(), |
|
|
|
|
|
|
|
new StateServiceActivator(), |
|
|
|
|
|
|
|
new ReportBaseActivator(), |
|
|
|
|
|
|
|
new RestrictionActivator(), |
|
|
|
|
|
|
|
new ReportActivator(), |
|
|
|
|
|
|
|
new ChartBaseActivator()); |
|
|
|
|
|
|
|
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); |
|
|
|
|
|
|
|
//定义工程路径
|
|
|
|
|
|
|
|
String envpath = "D:\\FineReport_11.0\\webapps\\webroot\\WEB-INF\\"; |
|
|
|
|
|
|
|
SimpleWork.checkIn(envpath); |
|
|
|
|
|
|
|
I18nResource.getInstance(); |
|
|
|
|
|
|
|
module.start(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
public static void main(String[] args) { |
|
|
|
// 定义报表运行环境,用于执行报表
|
|
|
|
|
|
|
|
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), |
|
|
|
|
|
|
|
new ConfigurationActivator(), |
|
|
|
|
|
|
|
new ResourceRepositoryActivator(), |
|
|
|
|
|
|
|
new StandaloneModeActivator(), |
|
|
|
|
|
|
|
new ModuleHealActivator(), |
|
|
|
|
|
|
|
new StateServiceActivator(), |
|
|
|
|
|
|
|
new SchedulerActivator(), |
|
|
|
|
|
|
|
new ReportBaseActivator(), |
|
|
|
|
|
|
|
new RestrictionActivator(), |
|
|
|
|
|
|
|
new ReportActivator(), |
|
|
|
|
|
|
|
new WriteActivator(), |
|
|
|
|
|
|
|
new ChartBaseActivator()); |
|
|
|
|
|
|
|
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); |
|
|
|
|
|
|
|
String envpath = "C:\\Users\\hipsh\\Desktop\\apache-tomcat-8.5.38-10.0\\webapps\\webroot\\WEB-INF\\";//工程路径
|
|
|
|
|
|
|
|
SimpleWork.checkIn(envpath); |
|
|
|
|
|
|
|
I18nResource.getInstance(); |
|
|
|
|
|
|
|
module.start(); |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
java.util.Map parameterMap = new java.util.HashMap(); |
|
|
|
java.util.Map parameterMap = new java.util.HashMap(); |
|
|
@ -66,11 +80,8 @@ public class ExportApi_frm { |
|
|
|
ImageExporter ImageExport = new ImageExporter(); |
|
|
|
ImageExporter ImageExport = new ImageExporter(); |
|
|
|
ImageExport.export(outputStream, re); |
|
|
|
ImageExport.export(outputStream, re); |
|
|
|
outputStream.close(); |
|
|
|
outputStream.close(); |
|
|
|
module.stop(); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
} finally { |
|
|
|
|
|
|
|
SimpleWork.checkOut(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |