diff --git a/build.xml b/build.xml
index d046c95..2e1aa50 100644
--- a/build.xml
+++ b/build.xml
@@ -84,8 +84,8 @@
-
-
+
+
diff --git a/src/main/java/com/fr/data/XMLDemoTableData.java b/src/main/java/com/fr/data/XMLDemoTableData.java
index f9ed76b..66e9498 100644
--- a/src/main/java/com/fr/data/XMLDemoTableData.java
+++ b/src/main/java/com/fr/data/XMLDemoTableData.java
@@ -77,6 +77,8 @@ public class XMLDemoTableData extends AbstractParameterTableData {
try {
in = new BufferedInputStream(new FileInputStream(new File(filePath)));
XMLEventReader reader = inputFactory.createXMLEventReader(in);
+ deep=0;
+ flag=false;
readCol(reader,list);
in.close();
} catch (Exception e) {
@@ -195,4 +197,4 @@ public class XMLDemoTableData extends AbstractParameterTableData {
e.printStackTrace();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/fr/demo/NewReadFrmFromDatabase.java b/src/main/java/com/fr/demo/NewReadFrmFromDatabase.java
index 8186fe9..a802f3d 100644
--- a/src/main/java/com/fr/demo/NewReadFrmFromDatabase.java
+++ b/src/main/java/com/fr/demo/NewReadFrmFromDatabase.java
@@ -1,16 +1,18 @@
package com.fr.demo;
import com.fr.data.core.db.DBUtils;
-import com.fr.web.weblet.DBFormlet;
import com.fr.form.main.Form;
-import java.sql.SQLException;
-import javax.servlet.http.HttpServletRequest;
import com.fr.log.FineLoggerFactory;
+import com.fr.web.session.SessionLocalManager;
+import com.fr.web.weblet.DBFormlet;
+
+import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
+import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;
@@ -43,12 +45,12 @@ public class NewReadFrmFromDatabase extends DBFormlet {
return form;
}
} catch (Exception e) {
- e.printStackTrace();
+ throw SessionLocalManager.createLogPackedException(e);
}finally {
DBUtils.closeConnection(connection);
}
- return null;
+ return form;
}
private static Connection getConnection() throws ClassNotFoundException, SQLException {
diff --git a/src/main/java/com/fr/demo/ReadFromDatabase.java b/src/main/java/com/fr/demo/ReadFromDatabase.java
index c5ad4eb..f78c426 100644
--- a/src/main/java/com/fr/demo/ReadFromDatabase.java
+++ b/src/main/java/com/fr/demo/ReadFromDatabase.java
@@ -5,6 +5,8 @@ import com.fr.main.impl.WorkBook;
import com.fr.web.core.Reportlet;
import com.fr.web.request.ReportletRequest;
import com.fr.log.FineLoggerFactory;
+import com.fr.web.session.SessionLocalManager;
+
import java.io.InputStream;
import java.sql.Blob;
import java.sql.Connection;
@@ -40,7 +42,7 @@ public class ReadFromDatabase extends Reportlet {
workbook.readStream(ins);
}
} catch (Exception e) {
- e.printStackTrace();
+ throw SessionLocalManager.createLogPackedException(e);
}
return workbook;
}
diff --git a/src/main/java/com/fr/demo/ReadfrmFromDatabase.java b/src/main/java/com/fr/demo/ReadfrmFromDatabase.java
index 601fca0..143ea1f 100644
--- a/src/main/java/com/fr/demo/ReadfrmFromDatabase.java
+++ b/src/main/java/com/fr/demo/ReadfrmFromDatabase.java
@@ -1,10 +1,12 @@
package com.fr.demo;
+import com.fr.form.main.Form;
import com.fr.io.utils.ResourceIOUtils;
+import com.fr.log.FineLoggerFactory;
+import com.fr.web.session.SessionLocalManager;
import com.fr.web.weblet.Formlet;
-import com.fr.form.main.Form;
+
import javax.servlet.http.HttpServletRequest;
-import com.fr.log.FineLoggerFactory;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.Connection;
@@ -42,7 +44,7 @@ public class ReadfrmFromDatabase extends Formlet {
form.readStream(ins);
}
} catch (Exception e) {
- e.printStackTrace();
+ throw SessionLocalManager.createLogPackedException(e);
}
System.out.println(ResourceIOUtils.getRealPath("assets"));
return form;
diff --git a/src/main/java/com/fr/io/ExportApi.java b/src/main/java/com/fr/io/ExportApi.java
index f6cad8c..1d43079 100644
--- a/src/main/java/com/fr/io/ExportApi.java
+++ b/src/main/java/com/fr/io/ExportApi.java
@@ -7,8 +7,6 @@ import com.fr.config.activator.BaseDBActivator;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.env.operator.CommonOperatorImpl;
import com.fr.general.I18nResource;
-import com.fr.general.log.Log4jConfig;
-import com.fr.general.log.parser.ExtraPatternParserManager;
import com.fr.health.activator.ModuleHealActivator;
import com.fr.io.exporter.CSVExporter;
import com.fr.io.exporter.EmbeddedTableDataExporter;
@@ -27,25 +25,18 @@ import com.fr.report.module.ReportBaseActivator;
import com.fr.report.write.WriteActivator;
import com.fr.scheduler.SchedulerActivator;
import com.fr.stable.WriteActor;
-import com.fr.stable.resource.ResourceLoader;
import com.fr.store.StateServiceActivator;
-import com.fr.third.apache.log4j.Level;
-import com.fr.third.apache.log4j.PropertyConfigurator;
import com.fr.workspace.simple.SimpleWork;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import java.util.Properties;
public class ExportApi {
public static void main(String[] args) {
- initLog4j();
-
/**定义报表运行环境,用于执行报表*/
com.fr.module.Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
@@ -91,6 +82,7 @@ public class ExportApi {
/**将结果工作薄导出为2003Excel文件*/
outputStream = new FileOutputStream(new java.io.File(outputUrl+"ExcelExport2003.xls"));
ExcelExporter ExcelExport = new ExcelExporter();
+ ExcelExport.setVersion(true);
ExcelExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
/**将结果工作薄导出为2007Excel文件*/
@@ -137,24 +129,4 @@ public class ExportApi {
}
}
- private static void initLog4j() {
-
- PropertyConfigurator.configure(loadLog4jPropertiesFromJar(Level.toLevel("INFO")));
- }
-
- private static Properties loadLog4jPropertiesFromJar(Level level) {
-
- Properties properties = new Properties();
-
- System.setProperty("LOG_HOME", System.getProperty("user.dir"));
- System.setProperty("LOG_ROOT_LEVEL", level.toString());
- ExtraPatternParserManager.setSystemProperty();
- try {
- properties.load(ResourceLoader.getResourceAsStream("/com/fr/general/log/log4j.properties", Log4jConfig.class));
- } catch (IOException ignore) {
- //do nothing
- }
-
- return properties;
- }
}
diff --git a/src/main/java/com/fr/io/SaveReportToDatabase.java b/src/main/java/com/fr/io/SaveReportToDatabase.java
deleted file mode 100644
index 1608a48..0000000
--- a/src/main/java/com/fr/io/SaveReportToDatabase.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.fr.io;
-
-import com.fr.base.operator.common.CommonOperator;
-import com.fr.chart.activator.ChartBaseActivator;
-import com.fr.cluster.engine.activator.standalone.StandaloneModeActivator;
-import com.fr.config.activator.BaseDBActivator;
-import com.fr.config.activator.ConfigurationActivator;
-import com.fr.env.operator.CommonOperatorImpl;
-import com.fr.general.I18nResource;
-import com.fr.health.activator.ModuleHealActivator;
-import com.fr.module.Module;
-import com.fr.module.tool.ActivatorToolBox;
-import com.fr.report.ReportActivator;
-import com.fr.report.RestrictionActivator;
-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.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 driver = "com.mysql.jdbc.Driver";
- String url = "jdbc:mysql://review.finedevelop.com:3306/susie";
- String user = "root";
- String pass = "ilovejava";
- Class.forName(driver);
- Connection conn = DriverManager.getConnection(url, user, pass);
- PreparedStatement presmt = conn
- .prepareStatement("insert into report values(?,?)");
- // 读进需要保存入库的模板文件
- // 首先需要定义执行所在的环境,这样才能正确读取数据库信息
- // 定义报表运行环境,用于执行报表
- Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
- new ConfigurationActivator(),
- new ResourceRepositoryActivator(),
- new StandaloneModeActivator(),
- new ModuleHealActivator(),
- new StateServiceActivator(),
- new ChartBaseActivator(),
- new SchedulerActivator(),
- new ReportBaseActivator(),
- new RestrictionActivator(),
- new ReportActivator(),
- new WriteActivator());
- SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
- String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
- SimpleWork.checkIn(envpath);
- I18nResource.getInstance();
- module.start();
-
- File cptfile = new File("//doc//Primary//Parameter//Parameter.cpt");
- int lens = (int) cptfile.length();
- InputStream ins = new FileInputStream(cptfile);
- // 将模板保存入库
- presmt.setString(1, "Parameter.cpt"); // 第一个字段存放模板相对路径
- presmt.setBinaryStream(2, ins, lens); // 第二个字段存放模板文件的二进制流
- presmt.execute();
- conn.commit();
- presmt.close();
- conn.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/main/java/com/fr/demo/ExportApiTest.java b/src/test/main/java/com/fr/demo/ExportApiTest.java
index 061a20f..ff72887 100644
--- a/src/test/main/java/com/fr/demo/ExportApiTest.java
+++ b/src/test/main/java/com/fr/demo/ExportApiTest.java
@@ -7,6 +7,8 @@ import com.fr.config.activator.BaseDBActivator;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.env.operator.CommonOperatorImpl;
import com.fr.general.I18nResource;
+import com.fr.health.activator.ModuleHealActivator;
+import com.fr.io.ResourceRepositoryActivator;
import com.fr.io.TemplateWorkBookIO;
import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter;
import com.fr.log.FineLoggerFactory;
diff --git a/src/test/main/java/com/fr/demo/ModuleStartTest.java b/src/test/main/java/com/fr/demo/ModuleStartTest.java
index 63c6f4b..b578cff 100644
--- a/src/test/main/java/com/fr/demo/ModuleStartTest.java
+++ b/src/test/main/java/com/fr/demo/ModuleStartTest.java
@@ -8,6 +8,8 @@ import com.fr.config.activator.ConfigurationActivator;
import com.fr.env.operator.CommonOperatorImpl;
import com.fr.general.FRLogger;
import com.fr.general.I18nResource;
+import com.fr.health.activator.ModuleHealActivator;
+import com.fr.io.ResourceRepositoryActivator;
import com.fr.io.TemplateWorkBookIO;
import com.fr.log.FineLoggerFactory;
import com.fr.log.LogHandler;