diff --git a/README.md b/README.md index 2f1f7aa..fd6605a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,26 @@ -# 文档demo代码插件 +# 工程配置指南 -## 只是为了验证文档demo代码是否能够编译,插件本身无任何作用。 \ No newline at end of file +## 安装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/lib/report/.gitkeep b/plugin-report-doc-demo/lib/report/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/plugin-report-doc-demo/plugin.xml b/plugin-report-doc-demo/plugin.xml deleted file mode 100644 index 9bcebc7..0000000 --- a/plugin-report-doc-demo/plugin.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - com.fr.plugin.doc.demo.v10 - - yes - no - 1.2 - 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 deleted file mode 100644 index fd6605a..0000000 --- a/plugin-report-doc-demo/readme.md +++ /dev/null @@ -1,26 +0,0 @@ -# 工程配置指南 - -## 安装maven -用于构建开发工程,文档参考:http://wiki.jikexueyuan.com/project/maven/environment-setup.html - -## 安装ant -用于构建插件安装包,文档参考:http://wiki.jikexueyuan.com/project/ant/environment-setup.html - -## 配置开发工程 -直接使用IntelliJ IDEA打开这个目录即可。 - -如果需要复制jar包到webroot/WEB-INF/lib下,可以执行命令:```mvn install``` - -## 启动设计器 -如果希望正常的进行插件开发,使用```com.fr.learn.Leaner```启动设计器。 - -如果希望进行设计器调试,则使用```com.fr.learn.Leaner4Debug```启动设计器。 - -## 修改依赖的jar版本 -只需要更改pom.xml中的common-version属性即可。 - -|common-version|含义| -|--------------|----| -|10.0-RELEASE-SNAPSHOT|10.0的测试版本快照| -|10.0-SNAPSHOT|10.0的正式版本快照| -|10.0|10.0的正式版本| \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/DataModelDemo.java b/plugin-report-doc-demo/src/com/fr/data/DataModelDemo.java deleted file mode 100644 index 2de39d6..0000000 --- a/plugin-report-doc-demo/src/com/fr/data/DataModelDemo.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.fr.data; - -import examples.ejb.ejb20.basic.beanManaged.Account; -import examples.ejb.ejb20.basic.beanManaged.AccountHome; - -import javax.naming.Context; -import javax.naming.InitialContext; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -/** - * @author fanruan - */ -public class DataModelDemo extends AbstractTableData { - private String[] columnNames; - private ArrayList valueList = null; - - public DataModelDemo() { - String[] columnNames = {"Name", "Score"}; - this.columnNames = columnNames; - } - - // 实现其他四个方法 - - @Override - public int getColumnCount() { - return columnNames.length; - } - - @Override - public String getColumnName(int columnIndex) { - return columnNames[columnIndex]; - } - - @Override - public int getRowCount() { - init(); - return valueList.size(); - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - init(); - return ((Object[]) valueList.get(rowIndex))[columnIndex]; - } - - // 准备数据 - public void init() { - // 确保只被执行一次 - if (valueList != null) { - return; - } - // 保存得到的结果集 - valueList = new ArrayList(); - Context ctx = null; - Account ac = null; - AccountHome home = null; - try { - // Contact the AccountBean container (the "AccountHome") through - // JNDI. - ctx = new InitialContext(); - home = (AccountHome) ctx - .lookup("java:/comp/env/BeanManagedAccountEJB"); - double balanceGreaterThan = 100; - Collection col = home.findBigAccounts(balanceGreaterThan); - if (col != null) { - // 用对象保存数据 - Object[] objArray = null; - Iterator iter = col.iterator(); - while (iter.hasNext()) { - Account bigAccount = (Account) iter.next(); - objArray = new Object[2]; - objArray[0] = bigAccount.getPrimaryKey(); - objArray[1] = bigAccount.balance(); - // 在valueList中加入这一行数据 - valueList.add(objArray); - } - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} \ 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 deleted file mode 100644 index ed6b2ff..0000000 --- a/plugin-report-doc-demo/src/com/fr/data/GetXmlDate.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.fr.data; - -import com.fr.stable.xml.XMLReadable; -import com.fr.stable.xml.XMLableReader; - -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; - -public class GetXmlDate { - // 定义返回值数组 - private String[] Value = new String[3]; - // 定义查询的name值 - private String[] Name = null; - - protected String[] readerXMLSource(InputStream in, String[] name) - throws Exception { - Name = name; - InputStreamReader reader = new InputStreamReader(in, "utf-8"); - readXMLSource(reader); - return Value; - } - - protected void readXMLSource(Reader reader) throws Exception { - XMLableReader xmlReader = XMLableReader.createXMLableReader(reader); - if (xmlReader != null) { - xmlReader.readXMLObject(new Content()); - - } - } - - private class Content implements XMLReadable { - public void readXML(XMLableReader reader) { - if (reader.isChildNode()) { - if (reader.getTagName().equals("Field")) { - Field field = new Field(); - reader.readXMLObject(field); - // 获得name对应的value值 - if (Name[0].equals(field.name)) { - Value[0] = field.value; - } else if (Name[1].equals(field.name)) { - Value[1] = field.value; - } else if (Name[2].equals(field.name)) { - Value[2] = field.value; - } - } - } - } - } - - // 定义每个field的结构 - private class Field implements XMLReadable { - private String name; - private String type; - private String value; - - public void readXML(XMLableReader reader) { - if (reader.isChildNode()) { - String tagName = reader.getTagName(); - if (tagName.equals("Name")) { - this.name = reader.getElementValue(); - } else if (tagName.equals("Type")) { - this.type = reader.getElementValue(); - } else if (tagName.equals("Value")) { - this.value = reader.getElementValue(); - } - } - } - } -} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/ParamTableDataDemo.java b/plugin-report-doc-demo/src/com/fr/data/ParamTableDataDemo.java deleted file mode 100644 index 8024cfa..0000000 --- a/plugin-report-doc-demo/src/com/fr/data/ParamTableDataDemo.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.fr.data; - -import com.fr.base.FRContext; -import com.fr.file.DatasourceManager; -import com.fr.stable.ParameterProvider; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.Statement; -import java.util.ArrayList; - -/** - * 带参数的程序数据集Demo - * - * @author fanruan - */ -public class ParamTableDataDemo extends AbstractTableData { - /** - * 列名数组,保存程序数据集所有列名 - */ - private String[] columnNames; - /** - * 定义程序数据集的列数量 - */ - private int columnNum = 10; - /** - * 保存查询表的实际列数量 - */ - private int colNum = 0; - /** - * 保存查询得到列值 - */ - private ArrayList valueList = null; - - /** - * 构造函数,定义表结构,该表有10个数据列,列名为column#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 deleted file mode 100644 index 127f658..0000000 --- a/plugin-report-doc-demo/src/com/fr/data/WebServiceTableData.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fr.data; - -import com.fr.general.data.TableDataException; -import org.apache.axis.client.Call; -import org.apache.axis.client.Service; - -import javax.xml.namespace.QName; - -public class WebServiceTableData extends AbstractTableData { - private String[][] data; - - public WebServiceTableData() { - this.data = this.getWebServiceTableData(); - } - - //获取列数 - - @Override - public int getColumnCount() throws TableDataException { - return data[0].length; - } - - //获取列的名称为数组中第一行的值 - - @Override - public String getColumnName(int columnIndex) throws TableDataException { - return data[0][columnIndex]; - } - - //获取行数为数据的长度-1 - - @Override - public int getRowCount() throws TableDataException { - return data.length - 1; - } - - //获取值 - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - return data[rowIndex + 1][columnIndex]; - } - - public String[][] getWebServiceTableData() { - try { - String endpoint = "http://localhost:8080/axis/TestWS2TDClient.jws"; - Service service = new Service(); - Call call = (Call) service.createCall(); - call.setTargetEndpointAddress(new java.net.URL(endpoint)); - call.setOperationName(new QName("http://localhost:8080/axis/TestWS2TDClient.jws", - "getTD")); - return (String[][]) call.invoke(new Object[]{}); - } catch (Exception e) { - e.printStackTrace(); - } - return new String[][]{}; - } -} \ 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 deleted file mode 100644 index 5477b97..0000000 --- a/plugin-report-doc-demo/src/com/fr/data/XMLDemoTableData.java +++ /dev/null @@ -1,202 +0,0 @@ -package com.fr.data; - -import com.fr.base.Parameter; -import com.fr.config.holder.impl.xml.XmlColConf; -import com.fr.general.data.DataModel; -import com.fr.script.Calculator; -import com.fr.stable.ParameterProvider; -import com.fr.stable.StringUtils; - -import javax.xml.stream.XMLEventReader; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.events.XMLEvent; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * XMLDemoTableData - *

- * 这是一个按参数来解析不同地址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 deleted file mode 100644 index 70619f6..0000000 --- a/plugin-report-doc-demo/src/com/fr/data/XMLParseDemoDataModel.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.fr.data; - -import com.fr.base.FRContext; -import com.fr.general.ComparatorUtils; -import com.fr.general.data.TableDataException; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -/** - * XMLParseDemoDataModel - *

- * 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 deleted file mode 100644 index ef3bc4d..0000000 --- a/plugin-report-doc-demo/src/com/fr/data/XMLRead.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.fr.data; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.Statement; -import java.util.ArrayList; - -/** - * @author fanruan - */ -public class XMLRead extends AbstractTableData { - /** - * 列名数组,保存程序数据集所有列名 - */ - private String[] columnNames = {"id", "name", "MemoryFreeSize", - "MemoryTotalSize", "MemoryUsage"}; - /** - * 保存表数据 - */ - private ArrayList valueList = null; - - @Override - public int getColumnCount() { - return 5; - } - - @Override - public String getColumnName(int columnIndex) { - return columnNames[columnIndex]; - } - - @Override - public int getRowCount() { - init(); - return valueList.size(); - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - init(); - return ((Object[]) valueList.get(rowIndex))[columnIndex]; - } - - private void init() { - // 确保只被执行一次 - if (valueList != null) { - return; - } - valueList = new ArrayList(); - String sql = "SELECT * FROM xmltest"; - String[] name = {"MemoryFreeSize", "MemoryTotalSize", "MemoryUsage"}; - Connection conn = this.getConnection(); - try { - Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery(sql); - // 用对象保存数据 - Object[] objArray; - while (rs.next()) { - objArray = new Object[5]; - String[] xmlData; - objArray[0] = rs.getObject(1); - objArray[1] = rs.getObject(2); - InputStream in; - String str = "中文stream"; - in = new ByteArrayInputStream(str.getBytes("UTF-8")); - GetXmlData getXMLData = new GetXmlData(); - // 对xml流进行解析,返回的为name对应的value值数组 - xmlData = getXMLData.readerXMLSource(in, name); - // 将解析后的值存于最终结果ArrayList中 - objArray[2] = xmlData[0]; - objArray[3] = xmlData[1]; - objArray[4] = xmlData[2]; - valueList.add(objArray); - } - // 释放数据源 - rs.close(); - stmt.close(); - conn.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private Connection getConnection() { - String driverName = "oracle.jdbc.driver.OracleDriver"; - String url = "jdbc:oracle:thin:@env.finedevelop.com:55702:fr"; - String username = "system"; - String password = "123"; - Connection con; - - try { - Class.forName(driverName); - con = DriverManager.getConnection(url, username, password); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - return con; - - } - - /** - * 释放一些资源,因为可能会有重复调用,所以需释放valueList,将上次查询的结果释放掉 - * - * @throws Exception e - */ - @Override - public void release() throws Exception { - super.release(); - this.valueList = null; - } -} \ 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 deleted file mode 100644 index b38d639..0000000 --- a/plugin-report-doc-demo/src/com/fr/demo/NewDateDemo.java +++ /dev/null @@ -1,40 +0,0 @@ -//��̬�޸����� -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 deleted file mode 100644 index be146dc..0000000 --- a/plugin-report-doc-demo/src/com/fr/demo/ReadFromDatabase.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.fr.demo; - -import com.fr.base.FRContext; -import com.fr.main.TemplateWorkBook; -import com.fr.main.impl.WorkBook; -import com.fr.web.core.Reportlet; -import com.fr.web.request.ReportletRequest; -import com.fr.workspace.simple.SimpleWork; - -import java.io.InputStream; -import java.sql.Blob; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.Statement; -import java.util.Map; - - -public class ReadFromDatabase extends Reportlet { - public TemplateWorkBook createReport(ReportletRequest reportletRequest) { - // 定义报表运行环境,才能执行报表 - String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF"; - SimpleWork.checkIn(envpath); - - WorkBook workbook = new WorkBook(); - String name = reportletRequest.getParameter("cptname").toString(); - try { - // 定义数据连接 - String driver = "com.mysql.jdbc.Driver"; - String url = "jdbc:mysql://112.124.109.239:3306/yourdatebase"; - String user = "yourusername"; - String pass = "yourpassword"; - Class.forName(driver); - Connection conn = DriverManager.getConnection(url, user, pass); - // 从数据库中读模板 - String sql = "select cpt from report where cptname = '" + name - + "'"; - Statement smt = conn.createStatement(); - ResultSet rs = smt.executeQuery(sql); - while (rs.next()) { - Blob blob = rs.getBlob(1); // 取第一列的值,即cpt列 - FRContext.getLogger().info(blob.toString()); - InputStream ins = blob.getBinaryStream(); - workbook.readStream(ins); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - SimpleWork.checkOut(); - } - return workbook; - } - - @Override - public void setParameterMap(Map arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setTplPath(String arg0) { - // TODO Auto-generated method stub - - } -} \ 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 deleted file mode 100644 index 0f04f30..0000000 --- a/plugin-report-doc-demo/src/com/fr/demo/SaveReportToDatabase.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.fr.demo; - -import com.fr.workspace.simple.SimpleWork; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; - -public class SaveReportToDatabase { - public static void main(String[] args) { - SaveReport(); - } - - private static void SaveReport() { - try { - // 定义报表运行环境,才能执行报表 - String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF"; - SimpleWork.checkIn(envpath); - // 连接数据库 - String driver = "com.mysql.jdbc.Driver"; - String url = "jdbc:mysql://112.124.109.239:3306/yourdatabase"; - String user = "yourusername"; - String pass = "yourpassword"; - Class.forName(driver); - Connection conn = DriverManager.getConnection(url, user, pass); //注意表名是否区分大小写 - conn.setAutoCommit(false); - PreparedStatement presmt = conn - .prepareStatement("INSERT INTO report VALUES(?,?)"); - // 读进需要保存入库的模板文件 - File cptfile = new File(envpath - + "\\reportlets\\GettingStarted.cpt"); - int lens = (int) cptfile.length(); - InputStream ins = new FileInputStream(cptfile); - // 将模板保存入库 - presmt.setString(1, "GettingStarted.cpt"); // 第一个字段存放模板相对路径 - presmt.setBinaryStream(2, ins, lens); // 第二个字段存放模板文件的二进制流 - presmt.execute(); - conn.commit(); - presmt.close(); - conn.close(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - SimpleWork.checkOut(); - } - } -} \ 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 deleted file mode 100644 index b051b1a..0000000 --- a/plugin-report-doc-demo/src/com/fr/demo/SimpleReportletDemo.java +++ /dev/null @@ -1,42 +0,0 @@ -//程序网络报表 -package com.fr.demo; - -import com.fr.io.TemplateWorkBookIO; -import com.fr.main.TemplateWorkBook; -import com.fr.web.core.Reportlet; -import com.fr.web.request.ReportletRequest; -import com.fr.workspace.simple.SimpleWork; - -import java.util.Map; - - -public class SimpleReportletDemo extends Reportlet { - public TemplateWorkBook createReport(ReportletRequest reportletrequest) { - String envPath = "D:\\FineReport_8.0\\WebReport\\WEB-INF"; - SimpleWork.checkIn(envPath); - // 新建一个WorkBook对象,用于保存最终返回的报表 - TemplateWorkBook WorkBook = null; - try { - // 读取模板,将模板保存为workbook对象并返回 - WorkBook = TemplateWorkBookIO.readTemplateWorkBook( - "\\doc\\Primary\\Parameter\\Parameter.cpt"); - } catch (Exception e) { - e.getStackTrace(); - } finally { - SimpleWork.checkOut(); - } - return WorkBook; - } - - @Override - public void setParameterMap(Map arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setTplPath(String arg0) { - // TODO Auto-generated method stub - - } -} \ 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 deleted file mode 100644 index 6ee0a16..0000000 --- a/plugin-report-doc-demo/src/com/fr/function/JFreeToChart.java +++ /dev/null @@ -1,86 +0,0 @@ -// 引入JFreeChart图表 -package com.fr.function; - -import com.fr.script.AbstractFunction; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.axis.CategoryAxis; -import org.jfree.chart.axis.CategoryLabelPositions; -import org.jfree.chart.axis.NumberAxis; -import org.jfree.chart.plot.CategoryPlot; -import org.jfree.chart.plot.DatasetRenderingOrder; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.chart.renderer.category.LineAndShapeRenderer; -import org.jfree.chart.title.TextTitle; -import org.jfree.data.DataUtilities; -import org.jfree.data.DefaultKeyedValues; -import org.jfree.data.category.CategoryDataset; -import org.jfree.data.general.DatasetUtilities; -import org.jfree.util.SortOrder; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.text.NumberFormat; - -public class JFreeToChart extends AbstractFunction { - private String x, y; - - public Object run(Object[] args) { - this.x = args[0].toString(); - this.y = args[1].toString(); - BufferedImage image = createImage(600, 400); - return image; - } - - private BufferedImage createImage(int width, int height) { - CategoryDataset acategorydataset[] = createDatasets(); - JFreeChart jfreechart = createChart(acategorydataset); - return jfreechart.createBufferedImage(width, height); - } - - private CategoryDataset[] createDatasets() { - DefaultKeyedValues defaultkeyedvalues = new DefaultKeyedValues(); - String[] xValue = this.x.split(","); - String[] yValue = this.y.split(","); - for (int i = 0; i < xValue.length; i++) { - defaultkeyedvalues.addValue(xValue[i], Double.valueOf(yValue[i])); - } - defaultkeyedvalues.sortByValues(SortOrder.DESCENDING); - org.jfree.data.KeyedValues keyedvalues = DataUtilities - .getCumulativePercentages(defaultkeyedvalues); - CategoryDataset categorydataset = DatasetUtilities - .createCategoryDataset("Languages", defaultkeyedvalues); - CategoryDataset categorydataset1 = DatasetUtilities - .createCategoryDataset("Cumulative", keyedvalues); - return (new CategoryDataset[]{categorydataset, categorydataset1}); - - } - - private JFreeChart createChart(CategoryDataset acategorydataset[]) { - JFreeChart jfreechart = ChartFactory.createBarChart( - "Freshmeat Software Projects", "Language", "Projects", - acategorydataset[0], PlotOrientation.VERTICAL, true, true, - false); - jfreechart.addSubtitle(new TextTitle("By Programming Language")); - jfreechart.addSubtitle(new TextTitle("As at 5 March 2003")); - jfreechart.setBackgroundPaint(Color.white); - CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); - categoryplot.setBackgroundPaint(Color.lightGray); - categoryplot.setRangeGridlinePaint(Color.white); - CategoryAxis categoryaxis = categoryplot.getDomainAxis(); - categoryaxis.setLowerMargin(0.02D); - categoryaxis.setUpperMargin(0.02D); - categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); - NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); - numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); - LineAndShapeRenderer lineandshaperenderer = new LineAndShapeRenderer(); - NumberAxis numberaxis1 = new NumberAxis("Percent"); - numberaxis1.setNumberFormatOverride(NumberFormat.getPercentInstance()); - categoryplot.setRangeAxis(1, numberaxis1); - categoryplot.setDataset(1, acategorydataset[1]); - categoryplot.setRenderer(1, lineandshaperenderer); - categoryplot.mapDatasetToRangeAxis(1, 1); - categoryplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); - return jfreechart; - } -} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/StringCat.java b/plugin-report-doc-demo/src/com/fr/function/StringCat.java deleted file mode 100644 index 8db60a7..0000000 --- a/plugin-report-doc-demo/src/com/fr/function/StringCat.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fr.function; - -import com.fr.script.AbstractFunction; - -public class StringCat extends AbstractFunction { - public StringCat() { - } - - public Object run(Object[] args) { - StringBuilder result = new StringBuilder(); - - for (int i = 0; i < args.length; ++i) { - Object para = args[i]; - result.append(para.toString()); - } - - return result.toString(); - } -} diff --git a/plugin-report-doc-demo/src/com/fr/function/StringImage.java b/plugin-report-doc-demo/src/com/fr/function/StringImage.java deleted file mode 100644 index 5b01967..0000000 --- a/plugin-report-doc-demo/src/com/fr/function/StringImage.java +++ /dev/null @@ -1,73 +0,0 @@ -//图片在下文字在上 -package com.fr.function; - -import com.fr.base.BaseUtils; -import com.fr.base.GraphHelper; -import com.fr.script.AbstractFunction; -import com.fr.stable.CoreGraphHelper; - -import javax.imageio.ImageIO; -import javax.swing.JFrame; -import javax.swing.JPanel; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; - - -public class StringImage extends AbstractFunction { - public Object run(Object[] args) { - Image result = null; - int p = 0; - Object[] ob = new Object[2]; - for (int i = 0; (i < args.length && p <= 1); i++) { - if (args[i] == null) { - continue; - } - ob[p] = args[i]; - p++; - - } - try { - result = initStringImage(ob[0], ob[1]); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return result; - } - - public Image initStringImage(Object nameOb, Object imageOb) - throws IOException { - String name = (String) nameOb; - Image image = null; - if (imageOb instanceof Image) - image = (Image) imageOb; - else - ; - Image stringImage = null; - BufferedImage splashBuffedImage = CoreGraphHelper.toBufferedImage(image); - stringImage = splashBuffedImage; - Graphics2D splashG2d = splashBuffedImage.createGraphics(); - double centerX = 25; - double centerY = 25; - GraphHelper.drawString(splashG2d, name, centerX, centerY); - // - String FilePath = "Test.png"; - File f = new File(FilePath); - ImageIO.write(splashBuffedImage, "png", f); - // - return splashBuffedImage; - } - - public static void main(String arg[]) throws IOException { - StringImage tt = new StringImage(); - Image image = BaseUtils.readImage("D:\\1.jpg"); - String name = "12314124"; - Image aa = tt.initStringImage(name, image); - JFrame jf = new JFrame(); - JPanel jp = new JPanel(); - - } -} \ 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 deleted file mode 100644 index c8af6e1..0000000 --- a/plugin-report-doc-demo/src/com/fr/io/ExcelToCpt.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.io; - -import com.fr.general.ModuleContext; -import com.fr.io.importer.ExcelReportImporter; -import com.fr.main.TemplateWorkBook; -import com.fr.main.impl.WorkBook; -import com.fr.report.module.EngineModule; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.OutputStream; - -public class ExcelToCpt { - public static void main(String[] args) throws Exception { - File excelFile = new File("D:\\API.xls"); - FileInputStream a = new FileInputStream(excelFile); - ModuleContext.startModule(EngineModule.class.getName()); - TemplateWorkBook tpl = new ExcelReportImporter().generateWorkBookByStream(a); - OutputStream outputStream = new FileOutputStream(new File("D:\\abc.cpt")); - ((WorkBook) tpl).export(outputStream); - outputStream.close(); - ModuleContext.stopModules(); - } -} \ 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 deleted file mode 100644 index 3523d25..0000000 --- a/plugin-report-doc-demo/src/com/fr/io/ExportApi.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.fr.io; - -import com.fr.base.Parameter; -import com.fr.config.activator.BaseDBActivator; -import com.fr.config.activator.ConfigurationActivator; -import com.fr.data.impl.config.activator.RestrictionActivator; -import com.fr.general.ModuleContext; -import com.fr.io.exporter.CSVExporter; -import com.fr.io.exporter.EmbeddedTableDataExporter; -import com.fr.io.exporter.ExcelExporter; -import com.fr.io.exporter.ImageExporter; -import com.fr.io.exporter.PDFExporter; -import com.fr.io.exporter.SVGExporter; -import com.fr.io.exporter.TextExporter; -import com.fr.io.exporter.WordExporter; -import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter; -import com.fr.main.impl.WorkBook; -import com.fr.main.workbook.ResultWorkBook; -import com.fr.module.Module; -import com.fr.module.tool.ActivatorToolBox; -import com.fr.report.ReportActivator; -import com.fr.report.module.ReportBaseActivator; -import com.fr.stable.WriteActor; -import com.fr.store.StateServerActivator; -import com.fr.workspace.simple.SimpleWork; - -import java.io.File; -import java.io.FileOutputStream; - - -public class ExportApi { - public static void main(String[] args) { - // 定义报表运行环境,才能执行报表 - Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), - new ConfigurationActivator(), - new StateServerActivator(), - new ReportBaseActivator(), - new RestrictionActivator(), - new ReportActivator()); - String envpath = "D:\\FineReport_10.0\\webapps\\webroot\\WEB-INF"; - SimpleWork.checkIn(envpath); - module.start(); - ResultWorkBook rworkbook = null; - try { - // 未执行模板工作薄 - WorkBook workbook = (WorkBook) TemplateWorkBookIO - .readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt"); - // 获取报表参数并设置值,导出内置数据集时数据集会根据参数值查询出结果从而转为内置数据集 - Parameter[] parameters = workbook.getParameters(); - parameters[0].setValue("华东"); - // 定义parametermap用于执行报表,将执行后的结果工作薄保存为rworkBook - java.util.Map parameterMap = new java.util.HashMap(); - for (int i = 0; i < parameters.length; i++) { - parameterMap.put(parameters[i].getName(), parameters[i] - .getValue()); - } - // 定义输出流 - FileOutputStream outputStream; - // 将未执行模板工作薄导出为内置数据集模板 - outputStream = new FileOutputStream(new File("D:\\EmbExport.cpt")); - EmbeddedTableDataExporter templateExporter = new EmbeddedTableDataExporter(); - templateExporter.export(outputStream, workbook); - // 将模板工作薄导出模板文件,在导出前您可以编辑导入的模板工作薄,可参考报表调用章节 - outputStream = new FileOutputStream(new File("D:\\TmpExport.cpt")); - ((WorkBook) workbook).export(outputStream); - // 将结果工作薄导出为2003Excel文件 - outputStream = new FileOutputStream(new File("D:\\ExcelExport.xls")); - ExcelExporter ExcelExport = new ExcelExporter(); - ExcelExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - // 将结果工作薄导出为Excel文件 - outputStream = new FileOutputStream(new File("D:\\ExcelExport.xlsx")); - StreamExcel2007Exporter ExcelExport1 = new StreamExcel2007Exporter(); - ExcelExport1.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - // 将结果工作薄导出为Word文件 - outputStream = new FileOutputStream(new File("D:\\WordExport.doc")); - WordExporter WordExport = new WordExporter(); - WordExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - // 将结果工作薄导出为Pdf文件 - outputStream = new FileOutputStream(new File("D:\\PdfExport.pdf")); - PDFExporter PdfExport = new PDFExporter(); - PdfExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - // 将结果工作薄导出为Txt文件(txt文件本身不支持表格、图表等,被导出模板一般为明细表) - outputStream = new FileOutputStream(new File("D:\\TxtExport.txt")); - TextExporter TxtExport = new TextExporter(); - TxtExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - // 将结果工作薄导出为Csv文件 - outputStream = new FileOutputStream(new File("D:\\CsvExport.csv")); - CSVExporter CsvExport = new CSVExporter(); - CsvExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - //将结果工作薄导出为SVG文件 - outputStream = new FileOutputStream(new File("D:\\SvgExport.svg")); - SVGExporter SvgExport = new SVGExporter(); - SvgExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - //将结果工作薄导出为image文件 - outputStream = new FileOutputStream(new File("D:\\PngExport.png")); - ImageExporter ImageExport = new ImageExporter(); - ImageExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - outputStream.close(); - ModuleContext.stopModules(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - SimpleWork.checkOut(); - } - } -} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/openapi/remote/TemplateRead.java b/plugin-report-doc-demo/src/com/fr/openapi/remote/TemplateRead.java deleted file mode 100644 index 3775266..0000000 --- a/plugin-report-doc-demo/src/com/fr/openapi/remote/TemplateRead.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.fr.openapi.remote; - -import com.fr.config.activator.ConfigurationActivator; -import com.fr.data.impl.config.activator.RestrictionActivator; -import com.fr.design.env.DesignerWorkspaceGenerator; -import com.fr.design.env.RemoteDesignerWorkspaceInfo; -import com.fr.io.TemplateWorkBookIO; -import com.fr.log.FineLoggerFactory; -import com.fr.main.TemplateWorkBook; -import com.fr.main.workbook.ResultWorkBook; -import com.fr.module.Activator; -import com.fr.module.Module; -import com.fr.module.tool.ActivatorToolBox; -import com.fr.report.ReportActivator; -import com.fr.report.module.ReportBaseActivator; -import com.fr.serialization.SerializationActivator; -import com.fr.stable.PageActor; -import com.fr.startup.WorkspaceRegister; -import com.fr.store.StateServerActivator; -import com.fr.workspace.WorkContext; -import com.fr.workspace.connect.WorkspaceConnectionInfo; -import com.fr.workspace.engine.WorkspaceActivator; -import com.fr.workspace.server.ServerWorkspaceRegister; - -import java.util.HashMap; - -/** - * 远程环境读取模板 - */ -public class TemplateRead { - - public static void main(String[] args) { - try { - Module module = ActivatorToolBox.simpleLink( - new WorkspaceActivator(), - new SerializationActivator(), - new Activator() { - @Override - public void start() { - WorkspaceConnectionInfo connectionInfo = new WorkspaceConnectionInfo("http://远程服务器地址:8080/webroot/decision", "admin", "ilovejava", "", ""); - try { - WorkContext.switchTo(DesignerWorkspaceGenerator.generate(RemoteDesignerWorkspaceInfo.create(connectionInfo))); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void stop() { - - } - }, - new ConfigurationActivator(), - new StateServerActivator(), - new ReportBaseActivator(), - new RestrictionActivator(), - new ReportActivator(), - new WorkspaceRegister(), - new ServerWorkspaceRegister() - ); - module.start(); - TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook("12345678.cpt"); - ResultWorkBook result = workbook.execute(new HashMap(), new PageActor()); - - module.stop();//停止module - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - - } - - } - -} \ 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 deleted file mode 100644 index 0c08b92..0000000 --- a/plugin-report-doc-demo/src/com/fr/output/FTPUpload.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.fr.output; - -import com.fr.data.dao.CompatiableIDFCMapper; -import com.fr.data.dao.ObjectTableMapper; -import com.fr.json.JSONException; -import com.fr.json.JSONObject; -import com.fr.schedule.output.AbstractOutputFileAction; -import com.fr.schedule.output.FTPTransmission; -import com.fr.schedule.output.OutputFileAction; -import com.fr.schedule.output.ftp.DefaultFTPTransmit; - -import java.io.File; - -public class FTPUpload extends AbstractOutputFileAction { - @Override - public ObjectTableMapper objectTableMapper2Register() { - return null; - } - - @Override - public long getId() { - return 0; - } - - @Override - public File[] getFilesToDealWith(File[] files) { - return files; - } - - @Override - public void doFileAction(File[] files) { - FTPTransmission ftp = new FTPTransmission(); - ftp.setServerAddress("env.finedevelop.com"); - ftp.setPort(58321); - ftp.setSavePath("connie"); - ftp.setUsername("fr"); - ftp.setPassword("ilovejava"); - try { - new DefaultFTPTransmit().transmit(files, ftp.getServerAddress(), ftp.getPort(), ftp.getUsername(), ftp.getPassword(), ftp.getSavePath()); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - @Override - public CompatiableIDFCMapper getExtraOutputFileActionForeignKey() { - return null; - } - - @Override - public boolean isEmailNotification() { - // TODO Auto-generated method stub - return false; - } - - @Override - public OutputFileAction analyzeJSON(JSONObject arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public JSONObject createJSONConfig() throws JSONException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getJsonTag() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/plugin-report-doc-demo/src/com/fr/output/OutputExcel.java b/plugin-report-doc-demo/src/com/fr/output/OutputExcel.java deleted file mode 100644 index 1471580..0000000 --- a/plugin-report-doc-demo/src/com/fr/output/OutputExcel.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.fr.output; - -import com.fr.data.dao.CompatiableIDFCMapper; -import com.fr.data.dao.ObjectTableMapper; -import com.fr.json.JSONException; -import com.fr.json.JSONObject; -import com.fr.schedule.output.AbstractOutputFileAction; -import com.fr.schedule.output.OutputFileAction; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -public class OutputExcel extends AbstractOutputFileAction { - - @Override - public File[] getFilesToDealWith(File[] files) { - return files; - } - - @Override - public void doFileAction(File[] files) { -// OutputStream out=new BufferedOutputStream(new FileOutputStream(new File(files.)));; - System.out.println(files[0].getName()); - for (int i = 0; i < files.length; i++) { - String name = files[i].getName(); - String path = "D:/" + name; - BufferedInputStream in = null; - OutputStream out = null; - try { - out = new BufferedOutputStream(new FileOutputStream(new File(path))); - in = new BufferedInputStream(new FileInputStream(files[i])); - byte[] ba = new byte[in.available()]; - in.read(ba); - out.write(ba); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - try { - if (in != null) { - in.close(); - } - if (out != null) { - out.close(); - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - } - } - - @Override - public ObjectTableMapper objectTableMapper2Register() { - return null; - } - - @Override - public CompatiableIDFCMapper getExtraOutputFileActionForeignKey() { - return null; - } - - @Override - public long getId() { - return 0; - } - - @Override - public boolean isEmailNotification() { - // TODO Auto-generated method stub - return false; - } - - @Override - public OutputFileAction analyzeJSON(JSONObject arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public JSONObject createJSONConfig() throws JSONException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getJsonTag() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/MyLocaleFinder.java b/plugin-report-doc-demo/src/com/fr/plugin/core/MyLocaleFinder.java deleted file mode 100644 index 9818a20..0000000 --- a/plugin-report-doc-demo/src/com/fr/plugin/core/MyLocaleFinder.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.intelli.record.Focus; -import com.fr.intelli.record.Original; -import com.fr.record.analyzer.EnableMetrics; -import com.fr.stable.fun.impl.AbstractLocaleFinder; - -@EnableMetrics -public class MyLocaleFinder extends AbstractLocaleFinder { - @Override - @Focus(id = "com.fr.plugin.function", text = "插件全家桶", source = Original.PLUGIN) - public String find() { - return "com/fr/plugin/demo"; - } -} diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/secondary/ResourcePathTransformerImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/secondary/ResourcePathTransformerImpl.java deleted file mode 100644 index 8749367..0000000 --- a/plugin-report-doc-demo/src/com/fr/plugin/core/secondary/ResourcePathTransformerImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.fr.plugin.core.secondary; - -import com.fr.stable.fun.impl.AbstractResourcePathTransformer; - -/** - * 资源路径接口 - */ -public class ResourcePathTransformerImpl extends AbstractResourcePathTransformer{ - @Override - public boolean accept(String s) { - return true; - } - - @Override - public String transform(String s) { - return s; - } -} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/secondary/SiteTransformerImpl.java b/plugin-report-doc-demo/src/com/fr/plugin/core/secondary/SiteTransformerImpl.java deleted file mode 100644 index e962783..0000000 --- a/plugin-report-doc-demo/src/com/fr/plugin/core/secondary/SiteTransformerImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fr.plugin.core.secondary; - -import com.fr.stable.fun.impl.AbstractSiteTransformer; - -/** - * cloudcenter地址接口 - */ -public class SiteTransformerImpl extends AbstractSiteTransformer{ - @Override - public boolean match(String s) { - return true; - } - - @Override - public String transform() { - return ""; - } - - @Override - public String transform(String s) { - return s; - } -} \ No newline at end of file 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 deleted file mode 100644 index c35f2ab..0000000 --- a/plugin-report-doc-demo/src/main/java/com/fr/learn/Leaner.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.fr.learn; - -import com.fr.start.Designer; - -public class Leaner extends Designer { - - static { - // 这段代码让插件能支持远程设计的时候的调试 - String workDir = System.getProperty("user.dir"); - System.setProperty("fine.plugin.home", workDir + "/webroot/WEB-INF/plugins"); - } - - public Leaner(String[] strings) { - super(strings); - } -} 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 deleted file mode 100644 index 94b77f6..0000000 --- a/plugin-report-doc-demo/src/main/java/com/fr/learn/Learner4Debug.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.fr.learn; - -public class Learner4Debug { - - public static void main(String... args) { - org.swingexplorer.Launcher.main(new String[]{"com.fr.start.Designer"}); - } -} diff --git a/src/com/fr/data/ArrayTableDataDemo.java b/src/com/fr/data/ArrayTableDataDemo.java deleted file mode 100644 index cc6a50e..0000000 --- a/src/com/fr/data/ArrayTableDataDemo.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fr.data; - -/** - * @author fanruan - */ -public class ArrayTableDataDemo extends AbstractTableData { - /** - * 定义程序数据集的列名与数据保存位置 - */ - private String[] columnNames; - private Object[][] rowData; - - /** - * 实现构建函数,在构建函数中准备数据 - */ - public ArrayTableDataDemo() { - String[] columnNames = {"Name", "Score"}; - Object[][] datas = {{"Alex", 15}, - {"Helly", 22}, {"Bobby", 99}}; - this.columnNames = columnNames; - this.rowData = datas; - } - - //实现ArrayTableData的其他四个方法,因为AbstractTableData已经实现了hasRow方法 - - @Override - public int getColumnCount() { - return columnNames.length; - } - - @Override - public String getColumnName(int columnIndex) { - return columnNames[columnIndex]; - } - - @Override - public int getRowCount() { - return rowData.length; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - return rowData[rowIndex][columnIndex]; - } -} diff --git a/src/com/fr/data/Commit3.java b/src/com/fr/data/Commit3.java deleted file mode 100644 index 551d137..0000000 --- a/src/com/fr/data/Commit3.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.fr.data; - -import com.fr.cache.Attachment; -import com.fr.data.impl.SubmitJobValue; -import com.fr.general.FArray; -import com.fr.general.FRLogger; -import com.fr.script.Calculator; -import com.fr.stable.xml.FRFile; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLableReader; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.logging.Level; -import java.util.logging.Logger; - - -/** - * @author fanruan - */ -public class Commit3 implements SubmitJob { - private Object attach; - /** - * 定义文件路径 - */ - private SubmitJobValue filePath; - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - @Override - public void doJob(Calculator ca) { - FRLogger.getLogger().info("begin to upload file..."); - final Object attachO = attach; - if (attachO instanceof FArray && ((FArray) attachO).length() != 0) { - new Thread() { - @Override - public void run() { - int i; - FArray attachmentList = (FArray) attachO; - for (i = 0; i < attachmentList.length(); i++) { - if (!(attachmentList.elementAt(i) instanceof Attachment)) { - continue; - } else { - FRLogger.getLogger().info("filePath.value:" + filePath.getValue().toString()); - FRLogger.getLogger().info("filePath.valueState:" + filePath.getValueState() + - "注:valueState 0,1,2,3 分别表示 默认值,插入行,值改变,删除行"); - - String FilePath = filePath.getValue().toString(); - String FileName = ((Attachment) (attachmentList.elementAt(i))).getFilename(); - String Path = FilePath + "\\" + FileName; - File fileDir = new File(FilePath); - if (!fileDir.exists()) { - fileDir.mkdirs(); - } - try { - //新建文件夹,并且写入内 - mkfile(FilePath, FileName, new ByteArrayInputStream( - ((Attachment) (attachmentList.elementAt(i))).getBytes())); - } catch (Exception e) { - Logger.getLogger("FR").log(Level.WARNING, - e.getMessage() + "/nmkfileerror", e); - } - } - } - } - }.start(); - } else if (attach instanceof FRFile) { - String filepath = filePath.getValue().toString(); - String filename = ((FRFile) attach).getFileName(); - File fileDir = new File(filepath); - if (!fileDir.exists()) { - fileDir.mkdirs(); - } - try { - //新建文件夹,并且写入内 - mkfile(filepath, filename, new ByteArrayInputStream( - ((FRFile) attach).getBytes())); - } catch (Exception e) { - Logger.getLogger("FR").log(Level.WARNING, - e.getMessage() + "/nmkfileerror", e); - } - } - } - - private static void mkfile(String path, String filename, InputStream source) throws IOException { - File fileout = new File(path, filename); - - // 检查是否存在 - if (fileout.exists()) { - // 删除文件 - fileout.delete(); - FRLogger.getLogger().info("old file deleted"); - } - // 在当前目录下建立一个名为FileName的文件 - if (fileout.createNewFile()) { - FRLogger.getLogger().info(path + filename + "created!!"); - } - FileOutputStream outputStream = new FileOutputStream(fileout); - byte[] bytes = new byte[1024]; - int read = source.read(bytes); - //把source写入新建的文件 - while (read != -1) { - outputStream.write(bytes, 0, read); - outputStream.flush(); - read = source.read(bytes); - } - - outputStream.close(); - } - - @Override - public void readXML(XMLableReader reader) { - } - - @Override - public void writeXML(XMLPrintWriter writer) { - } - - @Override - public void doFinish(Calculator arg0) { - } - - @Override - public String getJobType() { - return null; - } -} diff --git a/src/com/fr/data/CustomTableData.java b/src/com/fr/data/CustomTableData.java deleted file mode 100644 index 2e65af1..0000000 --- a/src/com/fr/data/CustomTableData.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.fr.data; - - -/** - * @author fanruan - */ -public class CustomTableData extends AbstractTableData { - - /** - * 获取数据集的列数 - * - * @return 数据集的列 - */ - @Override - public int getColumnCount() { - return 0; - } - - /** - * 获取数据集指定列的列名 - * - * @param columnIndex 指定列的索引 - * @return 指定列的列名 - */ - @Override - public String getColumnName(int columnIndex) { - return null; - } - - /** - * 获取数据集的行数 - * - * @return 数据集数据行数 - */ - @Override - public int getRowCount() { - return 0; - } - - /** - * 获取数据集指定位置上的值 - * - * @param rowIndex 指定的行索引 - * @param columnIndex 指定的列索引 - * @return 指定位置的值 - */ - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - return null; - } -} diff --git a/src/com/fr/data/DemoSubmitJob1.java b/src/com/fr/data/DemoSubmitJob1.java deleted file mode 100644 index c543350..0000000 --- a/src/com/fr/data/DemoSubmitJob1.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.fr.data; - -import com.fr.script.Calculator; - -/** - * @author fanruan - */ -public class DemoSubmitJob1 extends DefinedSubmitJob { - /** - * 当模板自定义事件增加的属性 名称与下面变量有对应时,则会自动赋值于此对应变量 - */ - // JobValue对应单元格 - - private JobValue studentNo; - private JobValue name; - private JobValue grade; - - // 非单元格,则对应具体类型值 - - private boolean isPass; - - /** - * 每一条记录执行一次此方法 - * 同一提交事件在一个处理事务内,此对象是唯一的 - */ - @Override - public void doJob(Calculator calculator) { - // JobValue的getValueState()方法获取此对应单元格的状态 - if (studentNo.getValueState() == JobValue.VALUE_STATE_CHANGED) { - // 此单元格的值在报表初始化后被修改过 - } else if (studentNo.getValueState() == JobValue.VALUE_STATE_INSERT) { - // 此单元格是在报表初始化后新增的(例如执行了插入行操作) - } else if (studentNo.getValueState() == JobValue.VALUE_STATE_DELETED) { - // 此单元格所在的记录被执行了删除操作 - } else if (studentNo.getValueState() == JobValue.VALUE_STATE_DEFAULT) { - // 此单元格在报表初始化后没有变化 - } - - // 值获取,通过JobValue的getValue方法获得单元格的值 - System.out.print(" 学号: " + studentNo.getValue()); - System.out.print(" 姓名: " + name.getValue()); - System.out.print(" 总分: " + grade.getValue()); - System.out.print(" 是否达标: " + isPass); - System.out.println(); - } - - @Override - public String getJobType() { - return null; - } -} diff --git a/src/com/fr/data/DemoSubmitJob2.java b/src/com/fr/data/DemoSubmitJob2.java deleted file mode 100644 index 64b341f..0000000 --- a/src/com/fr/data/DemoSubmitJob2.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.fr.data; - -import com.fr.script.Calculator; - -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -/** - * @author fanruan - */ -public class DemoSubmitJob2 extends DefinedSubmitJob { - - /** - * 每一条记录执行一次此方法 - * 同一提交事件在一个处理事务内,此对象是唯一的 - */ - @Override - public void doJob(Calculator calculator) { - // 同样可以直接在传入的calculator中获取定义的属性及其对应的值 - Map map = (Map) calculator.getAttribute(PROPERTY_VALUE); - if (map == null) { - return; - } - Set set = map.entrySet(); - Iterator it = set.iterator(); - Entry entry; - // 遍历Map获取所有属性及其值 - while (it.hasNext()) { - entry = (Entry) it.next(); - System.out.print(" " + entry.getKey() + ": "); - - // JobValue对应单元格 - if (entry.getValue() instanceof JobValue) { - JobValue ce = (JobValue) entry.getValue(); - // JobValue的getValueState()方法获取此对应单元格的状态 - if (ce.getValueState() == JobValue.VALUE_STATE_CHANGED) { - // 此单元格的值在报表初始化后被修改过 - System.out.println(); - } else if (ce.getValueState() == JobValue.VALUE_STATE_INSERT) { - // 此单元格是在报表初始化后新增的(例如执行了插入行操作) - System.out.println(); - } else if (ce.getValueState() == JobValue.VALUE_STATE_DELETED) { - // 此单元格所在的记录被执行了删除操作 - System.out.println(); - } else if (ce.getValueState() == JobValue.VALUE_STATE_DEFAULT) { - // 此单元格在报表初始化后没有变化 - System.out.println(); - } - // 通过JobValue的getValue方法获得单元格的值 - System.out.print(ce.getValue()); - } else { - // 非单元格,则对应具体类型值 - System.out.print(entry.getValue().toString()); - } - } - } - - @Override - public String getJobType() { - return null; - } -} diff --git a/src/com/fr/data/DemoTotalSubmitJob.java b/src/com/fr/data/DemoTotalSubmitJob.java deleted file mode 100644 index aaa9b92..0000000 --- a/src/com/fr/data/DemoTotalSubmitJob.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.fr.data; - -import com.fr.script.Calculator; - -/** - * @author fanruan - */ -public class DemoTotalSubmitJob extends TotalSubmitJob { - - /** - * 同一提交事件,在一个提交事务内只执行一次 - * - * @param data 以二维表排列的所有提交数据 - */ - @Override - protected void doTotalJob(Data data, Calculator calculator) { - // 获取列的数量,每一列对应一个添加的属性 - data.getColumnCount(); - for (int i = 0; i < data.getColumnCount(); i++) { - // 获取对应的属性名称 - System.out.println(data.getColumnName(i)); - } - - // getRowCount 获取一共多少行数据 - for (int i = 0; i < data.getRowCount(); i++) { - System.out.print("ROW " + i + " {"); - for (int j = 0; j < data.getColumnCount(); j++) { - if (j > 0) { - System.out.print(", "); - } - // 获取对应位置的值 - Object value = data.getValueAt(i, j); - if (value instanceof JobValue) { - JobValue ce = (JobValue) value; - // JobValue的getValueState()方法获取此对应单元格的状态 - if (ce.getValueState() == JobValue.VALUE_STATE_CHANGED) { - // 此单元格的值在报表初始化后被修改过 - System.out.println(); - } else if (ce.getValueState() == JobValue.VALUE_STATE_INSERT) { - // 此单元格是在报表初始化后新增的(例如执行了插入行操作) - System.out.println(); - } else if (ce.getValueState() == JobValue.VALUE_STATE_DELETED) { - // 此单元格所在的记录被执行了删除操作 - System.out.println(); - } else if (ce.getValueState() == JobValue.VALUE_STATE_DEFAULT) { - // 此单元格在报表初始化后没有变化 - System.out.println(); - } - // 通过JobValue的getValue方法获得单元格的值 - value = ce.getValue(); - } - - System.out.print(data.getColumnName(j) + " : " + value); - } - System.out.print("}"); - System.out.println(); - } - } -} diff --git a/src/com/fr/data/GetXmlData.java b/src/com/fr/data/GetXmlData.java deleted file mode 100644 index 9a6f887..0000000 --- a/src/com/fr/data/GetXmlData.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.fr.data; - -import com.fr.stable.xml.XMLReadable; -import com.fr.stable.xml.XMLableReader; - -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; - -/** - * @author fanruan - */ -public class GetXmlData { - /** - * 定义返回值数组 - */ - private String[] value = new String[3]; - /** - * 定义查询的name值 - */ - private String[] name = null; - - protected String[] readerXMLSource(InputStream in, String[] name) - throws Exception { - this.name = name; - InputStreamReader reader = new InputStreamReader(in, "utf-8"); - readXMLSource(reader); - return value; - } - - protected void readXMLSource(Reader reader) throws Exception { - XMLableReader xmlReader = XMLableReader.createXMLableReader(reader); - if (xmlReader != null) { - xmlReader.readXMLObject(new Content()); - - } - } - - private class Content implements XMLReadable { - @Override - public void readXML(XMLableReader reader) { - if (reader.isChildNode()) { - if ("Field".equals(reader.getTagName())) { - Field field = new Field(); - reader.readXMLObject(field); - // 获得name对应的value值 - if (name[0].equals(field.name)) { - value[0] = field.value; - } else if (name[1].equals(field.name)) { - value[1] = field.value; - } else if (name[2].equals(field.name)) { - value[2] = field.value; - } - } - } - } - } - - /** - * 定义每个field的结构 - */ - private class Field implements XMLReadable { - private String name; - private String type; - private String value; - - @Override - public void readXML(XMLableReader reader) { - if (reader.isChildNode()) { - String tagName = reader.getTagName(); - if ("name".equals(tagName)) { - this.name = reader.getElementValue(); - } else if ("Type".equals(tagName)) { - this.type = reader.getElementValue(); - } else if ("value".equals(tagName)) { - this.value = reader.getElementValue(); - } - } - } - } -} \ No newline at end of file diff --git a/src/com/fr/data/MobileTableWsdlDataDemo.java b/src/com/fr/data/MobileTableWsdlDataDemo.java deleted file mode 100644 index bd0535a..0000000 --- a/src/com/fr/data/MobileTableWsdlDataDemo.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.fr.data; - -import com.fr.general.data.TableDataException; -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMNamespace; -import org.apache.axis2.addressing.EndpointReference; -import org.apache.axis2.client.Options; -import org.apache.axis2.client.ServiceClient; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * @author fanruan - */ -public class MobileTableWsdlDataDemo extends AbstractTableData { - private String[][] data; - - public MobileTableWsdlDataDemo() { - this.data = this.getMobileTableWsdlData(); - } - - @Override - public int getColumnCount() throws TableDataException { - return data[0].length; - } - - //获取列的名称为数组中第一行的值 - - @Override - public String getColumnName(int columnIndex) throws TableDataException { - return data[0][columnIndex]; - } - - //获取行数为数据的长度-1 - - @Override - public int getRowCount() throws TableDataException { - return data.length - 1; - } - - //获取值 - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - return data[rowIndex + 1][columnIndex]; - } - - public static String[][] getResults(OMElement element) { - if (element == null) { - return null; - } - Iterator iterator = element.getChildElements(); - Iterator innerItr; - List 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/src/com/fr/data/MobileWsdlTableDataDemo.java b/src/com/fr/data/MobileWsdlTableDataDemo.java deleted file mode 100644 index 44eca53..0000000 --- a/src/com/fr/data/MobileWsdlTableDataDemo.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.fr.data; - -import com.fr.base.AbstractTableData; -import com.fr.general.data.DataModel; -import com.fr.general.data.TableDataException; -import com.fr.script.Calculator; -import com.fr.stable.ParameterProvider; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLableReader; -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMNamespace; -import org.apache.axis2.addressing.EndpointReference; -import org.apache.axis2.client.Options; -import org.apache.axis2.client.ServiceClient; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class MobileWsdlTableDataDemo extends AbstractTableData { - private String[][] data; - - public MobileWsdlTableDataDemo() { - this.data = this.getMobileWsdlTableData(); - } - - public int getColumnCount() throws TableDataException { - return data[0].length; - } - - //��ȡ�е�����Ϊ�����е�һ�е�ֵ - 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/src/com/fr/data/MobileWsdlTableDataDemo1.java b/src/com/fr/data/MobileWsdlTableDataDemo1.java deleted file mode 100644 index c46fc03..0000000 --- a/src/com/fr/data/MobileWsdlTableDataDemo1.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.fr.data; - -import com.fr.general.data.TableDataException; -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMNamespace; -import org.apache.axis2.addressing.EndpointReference; -import org.apache.axis2.client.Options; -import org.apache.axis2.client.ServiceClient; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class MobileWsdlTableDataDemo1 extends AbstractTableData { - private String[][] data; - - public MobileWsdlTableDataDemo1() { - this.data = this.getMobileWsdlTableData(); - } - - public int getColumnCount() throws TableDataException { - return data[0].length; - } - - //获取列的名称为数组中第一行的值 - public String getColumnName(int columnIndex) throws TableDataException { - return data[0][columnIndex]; - } - - //获取行数为数据的长度-1 - public int getRowCount() throws TableDataException { - return data.length - 1; - } - - //获取值 - public Object getValueAt(int rowIndex, int columnIndex) { - return data[rowIndex + 1][columnIndex]; - } - - public static String[][] getResults(OMElement element) { - if (element == null) { - return null; - } - Iterator iterator = element.getChildElements(); - Iterator innerItr; - List 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/src/com/fr/data/MobileWsdlTableDataDemo2.java b/src/com/fr/data/MobileWsdlTableDataDemo2.java deleted file mode 100644 index 76509d9..0000000 --- a/src/com/fr/data/MobileWsdlTableDataDemo2.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.fr.data; - -import com.fr.general.data.TableDataException; -import mobile.MobileCodeWSStub; - -public class MobileWsdlTableDataDemo2 extends AbstractTableData { - private String[][] data; - - public MobileWsdlTableDataDemo2() { - // this.data = this.getData(); - } - - public int getColumnCount() throws TableDataException { - return data[0].length; - } - - //获取列的名称为数组中第一行的值 - public String getColumnName(int columnIndex) throws TableDataException { - return data[0][columnIndex]; - } - - //获取行数为数据的长度-1 - public int getRowCount() throws TableDataException { - return data.length - 1; - } - - //获取值 - public Object getValueAt(int rowIndex, int columnIndex) { - return data[rowIndex + 1][columnIndex]; - } - - public static void main(String agrs[]) { -// public String[][] getData() { - try { - String url = "http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl"; - MobileCodeWSStub stub = new MobileCodeWSStub(url); -// MobileCodeWSStub.GetMobileCodeInfo aa = new MobileCodeWSStub.GetMobileCodeInfo(); - MobileCodeWSStub.GetDatabaseInfo bb = new MobileCodeWSStub.GetDatabaseInfo(); -// aa.setMobileCode("18795842832"); -// String rs=stub.getMobileCodeInfo(aa).getGetMobileCodeInfoResult(); - String[] p = stub.getDatabaseInfo(bb).getGetDatabaseInfoResult().getString(); - String result[][] = new String[p.length][3]; - String b1, b2, b3; - for (int i = 0; i < p.length; i++) { - if (p[i].length() != 0) { - b1 = p[i].substring(0, p[i].indexOf(" ")); - b2 = p[i].substring(p[i].indexOf(" ") + 1).substring(0, p[i].substring(p[i].indexOf(" ") + 1).indexOf(" ")); - b3 = p[i].substring(p[i].indexOf(" ") + 1).substring(p[i].substring(p[i].indexOf(" ") + 1).indexOf(" ") + 1); - result[i][0] = b1; - result[i][1] = b2; - result[i][2] = b3; - // System.out.println(b1); - } - } - // return result; - } catch (org.apache.axis2.AxisFault e) { - e.printStackTrace(); - } catch (java.rmi.RemoteException e) { - e.printStackTrace(); - } - // return new String[][] { {} }; - } - -} - diff --git a/src/com/fr/data/MobileWsdlTableDataDemoPara.java b/src/com/fr/data/MobileWsdlTableDataDemoPara.java deleted file mode 100644 index fb12108..0000000 --- a/src/com/fr/data/MobileWsdlTableDataDemoPara.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.fr.data; - -import com.fr.general.FRLogger; -import com.fr.general.data.TableDataException; -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMNamespace; -import org.apache.axis2.addressing.EndpointReference; -import org.apache.axis2.client.Options; -import org.apache.axis2.client.ServiceClient; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class MobileWsdlTableDataDemoPara extends AbstractTableData { - private String[][] data; - - public MobileWsdlTableDataDemoPara() { - this.data = this.getMobileWsdlTableData(); - } - - public int getColumnCount() throws TableDataException { - return data[0].length; - } - - //获取列的名称为数组中第一行的值 - public String getColumnName(int columnIndex) throws TableDataException { - return data[0][columnIndex]; - } - - //获取行数为数据的长度-1 - public int getRowCount() throws TableDataException { - return data.length - 1; - } - - //获取值 - public Object getValueAt(int rowIndex, int columnIndex) { - return data[rowIndex + 1][columnIndex]; - } - - public static String[][] getResults(OMElement element) { - if (element == null) { - return null; - } - Iterator iterator = element.getChildElements(); - //Iterator innerItr; - List 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/src/com/fr/data/ParamSAPDataTest.java b/src/com/fr/data/ParamSAPDataTest.java deleted file mode 100644 index 9b06dba..0000000 --- a/src/com/fr/data/ParamSAPDataTest.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.fr.data; - -import com.fr.base.FRContext; -import com.fr.config.holder.impl.xml.XmlColConf; -import com.fr.function.ConnectSAPServer; -import com.fr.stable.ParameterProvider; -import com.sap.conn.jco.JCoDestination; -import com.sap.conn.jco.JCoException; -import com.sap.conn.jco.JCoFunction; -import com.sap.conn.jco.JCoTable; - -import java.util.ArrayList; -import java.util.Collection; - -public class ParamSAPDataTest extends AbstractTableData { - private String[] columnNames = null; - - private int columnNum = 3; - - - private String[][] rowData; - private static JCoDestination jCoDestination; - - public ParamSAPDataTest() { - ArrayList 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/src/com/fr/data/WebServiceWsdlTableDataDemo2.java b/src/com/fr/data/WebServiceWsdlTableDataDemo2.java deleted file mode 100644 index a4f16e8..0000000 --- a/src/com/fr/data/WebServiceWsdlTableDataDemo2.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.fr.data; - -import com.fr.general.data.TableDataException; -import mobile.MobileCodeWSStub; - -public class WebServiceWsdlTableDataDemo2 extends AbstractTableData { - /** - * - */ - private static final long serialVersionUID = 1L; - private String[][] data; - - public WebServiceWsdlTableDataDemo2() { - this.data = this.getWebServiceWsdlTableData(); - } - - public int getColumnCount() throws TableDataException { - return data[0].length; - } - - //获取列的名称为数组中第一行的值 - public String getColumnName(int columnIndex) throws TableDataException { - return data[0][columnIndex]; - } - - //获取行数为数据的长度-1 - public int getRowCount() throws TableDataException { - return data.length - 1; - } - - //获取值 - public Object getValueAt(int rowIndex, int columnIndex) { - return data[rowIndex + 1][columnIndex]; - } - - public String[][] getWebServiceWsdlTableData() { - try { - String url = "http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl"; - MobileCodeWSStub stub = new MobileCodeWSStub(url); -// MobileCodeWSStub.GetMobileCodeInfo aa = new MobileCodeWSStub.GetMobileCodeInfo(); - MobileCodeWSStub.GetDatabaseInfo bb = new MobileCodeWSStub.GetDatabaseInfo(); -// aa.setMobileCode("18795842832"); -// String rs=stub.getMobileCodeInfo(aa).getGetMobileCodeInfoResult(); - String[] p = stub.getDatabaseInfo(bb).getGetDatabaseInfoResult().getString(); - String result[][] = new String[p.length][3]; - String b1, b2, b3; - for (int i = 0; i < p.length; i++) { - if (p[i].length() != 0) { - b1 = p[i].substring(0, p[i].indexOf(" ")); - b2 = p[i].substring(p[i].indexOf(" ") + 1).substring(0, p[i].substring(p[i].indexOf(" ") + 1).indexOf(" ")); - b3 = p[i].substring(p[i].indexOf(" ") + 1).substring(p[i].substring(p[i].indexOf(" ") + 1).indexOf(" ") + 1); - result[i][0] = b1; - result[i][1] = b2; - result[i][2] = b3; - } - } - return result; - } catch (java.rmi.RemoteException e) { - e.printStackTrace(); - } - return new String[][]{{}}; - } - - public static void main(String[] args) { - for (int i = 0; i < new WebServiceWsdlTableDataDemo2().getWebServiceWsdlTableData().length; i++) { - System.out.println(new WebServiceWsdlTableDataDemo2().getWebServiceWsdlTableData()[i]); - } - } -} \ No newline at end of file diff --git a/src/com/fr/data/XMLColumnNameType4Demo.java b/src/com/fr/data/XMLColumnNameType4Demo.java deleted file mode 100644 index 7e42fbf..0000000 --- a/src/com/fr/data/XMLColumnNameType4Demo.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fr.data; - -public class XMLColumnNameType4Demo { - private int type = -1; - private String name = null; - - public XMLColumnNameType4Demo(String name, int type) { - this.name = name; - this.type = type; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } -} \ No newline at end of file diff --git a/src/com/fr/data/impl/Commit1.java b/src/com/fr/data/impl/Commit1.java deleted file mode 100644 index 49bdac1..0000000 --- a/src/com/fr/data/impl/Commit1.java +++ /dev/null @@ -1,126 +0,0 @@ -// -// Source code recreated from a .class file by IntelliJ IDEA -// (powered by Fernflower decompiler) -// - -package com.fr.data.impl; - -import com.fr.base.Formula; -import com.fr.cache.Attachment; -import com.fr.data.SubmitJob; -import com.fr.general.FArray; -import com.fr.script.Calculator; -import com.fr.stable.UtilEvalError; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLableReader; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.sql.Statement; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * @author fanruan - */ -public class Commit1 implements SubmitJob { - private Object attach; - private String filePath; - - public Commit1() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - private Object getAttach(Calculator ca) { - if (this.attach != null && this.attach instanceof Formula) { - try { - return ca.eval(((Formula) this.attach).getContent()); - } catch (UtilEvalError var3) { - var3.printStackTrace(); - return ""; - } - } else { - return ca.resolveVariable("attach"); - } - } - - @Override - public void doJob(Calculator ca) { - final Object attachO = this.getAttach(ca); - if (attachO instanceof FArray && ((FArray) attachO).length() != 0) { - (new Thread() { - @Override - public void run() { - FArray attachmentlist = (FArray) attachO; - - for (int i = 0; i < attachmentlist.length(); ++i) { - Statement sm = null; - String command = null; - String result = null; - if (attachmentlist.elementAt(i) instanceof Attachment) { - String FilePath = Commit1.this.filePath; - String FileName = ((Attachment) attachmentlist.elementAt(i)).getFilename(); - (new StringBuilder(String.valueOf(FilePath))).append("\\").append(FileName).toString(); - File fileDir = new File(FilePath); - if (!fileDir.exists()) { - fileDir.mkdirs(); - } - - try { - Commit1.mkfile(FilePath, FileName, new ByteArrayInputStream(((Attachment) attachmentlist.elementAt(i)).getBytes())); - } catch (Exception var11) { - Logger.getLogger("FR").log(Level.WARNING, var11.getMessage() + "/nmkfileerror", var11); - } - } - } - - } - }).start(); - } - - } - - @Override - public void doFinish(Calculator calculator) { - - } - - private static void mkfile(String path, String FileName, InputStream source) throws FileNotFoundException, IOException { - File fileout = new File(path, FileName); - if (fileout.exists()) { - fileout.delete(); - } - - fileout.createNewFile(); - FileOutputStream outputStream = new FileOutputStream(fileout); - byte[] bytes = new byte[1024]; - - for (int read = source.read(bytes); read != -1; read = source.read(bytes)) { - outputStream.write(bytes, 0, read); - outputStream.flush(); - } - - outputStream.close(); - } - - @Override - public void readXML(XMLableReader reader) { - } - - @Override - public void writeXML(XMLPrintWriter writer) { - } - - @Override - public String getJobType() { - return null; - } -} diff --git a/src/com/fr/data/impl/Commit3.java b/src/com/fr/data/impl/Commit3.java deleted file mode 100644 index 4697f6f..0000000 --- a/src/com/fr/data/impl/Commit3.java +++ /dev/null @@ -1,131 +0,0 @@ -// -// Source code recreated from a .class file by IntelliJ IDEA -// (powered by Fernflower decompiler) -// - -package com.fr.data.impl; - -import com.fr.base.FRContext; -import com.fr.base.Formula; -import com.fr.cache.Attachment; -import com.fr.data.JobValue; -import com.fr.data.SubmitJob; -import com.fr.general.FArray; -import com.fr.script.Calculator; -import com.fr.stable.UtilEvalError; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLableReader; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * @author fanruan - */ -public class Commit3 implements SubmitJob { - private Object attach; - private JobValue filePath; - - public Commit3() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - @Override - public void doJob(Calculator ca) throws Exception { - FRContext.getLogger().info("begin to upload file..."); - final Object attachO = this.getAttach(ca); - if (attachO instanceof FArray && ((FArray) attachO).length() != 0) { - (new Thread() { - @Override - public void run() { - FArray attachmentlist = (FArray) attachO; - - for (int i = 0; i < attachmentlist.length(); ++i) { - if (attachmentlist.elementAt(i) instanceof Attachment) { - FRContext.getLogger().info("filePath.value:" + Commit3.this.filePath.getValue().toString()); - FRContext.getLogger().info("filePath.valueState:" + Commit3.this.filePath.getValueState() + "注:valueState 0,1,2,3 分别表示 默认值,插入行,值改变,删除行"); - String FilePath = Commit3.this.filePath.getValue().toString(); - String FileName = ((Attachment) attachmentlist.elementAt(i)).getFilename(); - (new StringBuilder(String.valueOf(FilePath))).append("\\").append(FileName).toString(); - File fileDir = new File(FilePath); - if (!fileDir.exists()) { - fileDir.mkdirs(); - } - - try { - Commit3.mkfile(FilePath, FileName, new ByteArrayInputStream(((Attachment) attachmentlist.elementAt(i)).getBytes())); - } catch (Exception var8) { - Logger.getLogger("FR").log(Level.WARNING, var8.getMessage() + "/nmkfileerror", var8); - } - } - } - - } - }).start(); - } - - } - - @Override - public void doFinish(Calculator calculator) throws Exception { - - } - - private Object getAttach(Calculator ca) { - if (this.attach != null && this.attach instanceof Formula) { - try { - return ca.eval(((Formula) this.attach).getContent()); - } catch (UtilEvalError var3) { - var3.printStackTrace(); - return ""; - } - } else { - return ca.resolveVariable("attach"); - } - } - - private static void mkfile(String path, String FileName, InputStream source) throws FileNotFoundException, IOException { - File fileout = new File(path, FileName); - if (fileout.exists()) { - fileout.delete(); - FRContext.getLogger().info("old file deleted"); - } - - if (fileout.createNewFile()) { - FRContext.getLogger().info(path + FileName + "created!!"); - } - - FileOutputStream outputStream = new FileOutputStream(fileout); - byte[] bytes = new byte[1024]; - - for (int read = source.read(bytes); read != -1; read = source.read(bytes)) { - outputStream.write(bytes, 0, read); - outputStream.flush(); - } - - outputStream.close(); - } - - @Override - public void readXML(XMLableReader reader) { - } - - @Override - public void writeXML(XMLPrintWriter writer) { - } - - @Override - public String getJobType() { - return null; - } -} diff --git a/src/com/fr/demo/ChangeRowAndCol.java b/src/com/fr/demo/ChangeRowAndCol.java deleted file mode 100644 index 61afa9b..0000000 --- a/src/com/fr/demo/ChangeRowAndCol.java +++ /dev/null @@ -1,79 +0,0 @@ -//遍历单元格 -package com.fr.demo; - -import com.fr.io.TemplateWorkBookIO; -import com.fr.main.TemplateWorkBook; -import com.fr.report.cell.TemplateCellElement; -import com.fr.report.elementcase.TemplateElementCase; -import com.fr.report.worksheet.WorkSheet; -import com.fr.web.core.Reportlet; -import com.fr.web.request.ReportletRequest; -import com.fr.workspace.simple.SimpleWork; - -import java.util.Map; - - -public class ChangeRowAndCol extends Reportlet { - public TemplateWorkBook createReport(ReportletRequest reportletrequest) { - // 定义最终需要返回的WorkBook对象 - TemplateWorkBook workbook = null; - String envPath = "D:\\FineReport_8.0\\WebReport\\WEB-INF"; - SimpleWork.checkIn(envPath); - WorkSheet newworksheet = new WorkSheet(); - String change = "0"; - try { - // 读取模板保存为WorkBook对象 - workbook = TemplateWorkBookIO.readTemplateWorkBook( - "\\doc\\Primary\\GroupReport\\Group.cpt"); - // 读取请求中的参数判断是否需要切换行列显示,0表示不切换,1表示切换 - if (reportletrequest.getParameter("change") != null) { - change = reportletrequest.getParameter("change").toString(); - } - if (change.equals("1")) { - // 获得单元格需要首先获得单元格所在的报表 - TemplateElementCase report = (TemplateElementCase) workbook - .getTemplateReport(0); - // 遍历单元格 - int col = 0, row = 0; - byte direction = 0; - java.util.Iterator it = report.cellIterator(); - while (it.hasNext()) { - TemplateCellElement cell = (TemplateCellElement) it.next(); - // 获取单元格的行号与列号并互换 - col = cell.getColumn(); - row = cell.getRow(); - cell.setColumn(row); - cell.setRow(col); - // 获取原单元格的扩展方向,0表示纵向扩展,1表示横向扩展 - direction = cell.getCellExpandAttr().getDirection(); - if (direction == 0) { - cell.getCellExpandAttr().setDirection((byte) 1); - } else if (direction == 1) { - cell.getCellExpandAttr().setDirection((byte) 0); - } - // 将改变后的单元格添加进新的WorkSheet中 - newworksheet.addCellElement(cell); - } - // 替换原sheet - workbook.setReport(0, newworksheet); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - SimpleWork.checkOut(); - } - return workbook; - } - - @Override - public void setParameterMap(Map arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setTplPath(String arg0) { - // TODO Auto-generated method stub - - } -} \ No newline at end of file diff --git a/src/com/fr/demo/CreateReportletDemo.java b/src/com/fr/demo/CreateReportletDemo.java deleted file mode 100644 index 54f08e4..0000000 --- a/src/com/fr/demo/CreateReportletDemo.java +++ /dev/null @@ -1,50 +0,0 @@ -//创建程序报表 -package com.fr.demo; - -import com.fr.base.Style; -import com.fr.general.FRFont; -import com.fr.main.TemplateWorkBook; -import com.fr.main.impl.WorkBook; -import com.fr.report.cell.DefaultTemplateCellElement; -import com.fr.report.cell.TemplateCellElement; -import com.fr.report.worksheet.WorkSheet; -import com.fr.stable.unit.OLDPIX; -import com.fr.web.core.Reportlet; -import com.fr.web.request.ReportletRequest; - -import java.awt.Color; -import java.util.Map; - -public class CreateReportletDemo extends Reportlet { - public TemplateWorkBook createReport(ReportletRequest arg0) { - //创建一个WorkBook工作薄,在工作薄中插入一个WorkSheet - WorkBook workbook = new WorkBook(); - WorkSheet sheet1 = new WorkSheet(); - - TemplateCellElement CellA1 = new DefaultTemplateCellElement(0, 0, - "FineReport"); - Style style = Style.getInstance(); - - FRFont frfont = FRFont.getInstance("Arial", 1, 20.0F, Color.red); - style = style.deriveFRFont(frfont); - CellA1.setStyle(style); - sheet1.addCellElement(CellA1); - - sheet1.setColumnWidth(0, new OLDPIX(150.0F)); - sheet1.setRowHeight(1, new OLDPIX(35.0F)); - workbook.addReport(sheet1); - return workbook; - } - - @Override - public void setParameterMap(Map arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setTplPath(String arg0) { - // TODO Auto-generated method stub - - } -} \ No newline at end of file diff --git a/src/com/fr/demo/SaveReportToDatabase.java b/src/com/fr/demo/SaveReportToDatabase.java deleted file mode 100644 index 0f04f30..0000000 --- a/src/com/fr/demo/SaveReportToDatabase.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.fr.demo; - -import com.fr.workspace.simple.SimpleWork; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; - -public class SaveReportToDatabase { - public static void main(String[] args) { - SaveReport(); - } - - private static void SaveReport() { - try { - // 定义报表运行环境,才能执行报表 - String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF"; - SimpleWork.checkIn(envpath); - // 连接数据库 - String driver = "com.mysql.jdbc.Driver"; - String url = "jdbc:mysql://112.124.109.239:3306/yourdatabase"; - String user = "yourusername"; - String pass = "yourpassword"; - Class.forName(driver); - Connection conn = DriverManager.getConnection(url, user, pass); //注意表名是否区分大小写 - conn.setAutoCommit(false); - PreparedStatement presmt = conn - .prepareStatement("INSERT INTO report VALUES(?,?)"); - // 读进需要保存入库的模板文件 - File cptfile = new File(envpath - + "\\reportlets\\GettingStarted.cpt"); - int lens = (int) cptfile.length(); - InputStream ins = new FileInputStream(cptfile); - // 将模板保存入库 - presmt.setString(1, "GettingStarted.cpt"); // 第一个字段存放模板相对路径 - presmt.setBinaryStream(2, ins, lens); // 第二个字段存放模板文件的二进制流 - presmt.execute(); - conn.commit(); - presmt.close(); - conn.close(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - SimpleWork.checkOut(); - } - } -} \ No newline at end of file diff --git a/src/com/fr/demo/SetCellElementStyle.java b/src/com/fr/demo/SetCellElementStyle.java deleted file mode 100644 index 3b19637..0000000 --- a/src/com/fr/demo/SetCellElementStyle.java +++ /dev/null @@ -1,71 +0,0 @@ -//单元格格式设置 -package com.fr.demo; - -import com.fr.base.Style; -import com.fr.base.background.ColorBackground; -import com.fr.general.FRFont; -import com.fr.main.TemplateWorkBook; -import com.fr.main.impl.WorkBook; -import com.fr.report.cell.DefaultTemplateCellElement; -import com.fr.report.cell.TemplateCellElement; -import com.fr.report.worksheet.WorkSheet; -import com.fr.stable.Constants; -import com.fr.stable.unit.OLDPIX; -import com.fr.web.core.Reportlet; -import com.fr.web.request.ReportletRequest; - -import java.awt.Color; -import java.awt.Font; -import java.util.Map; - - -public class SetCellElementStyle extends Reportlet { - public TemplateWorkBook createReport(ReportletRequest arg0) { - // 新建报表 - WorkBook workbook = new WorkBook(); - WorkSheet worksheet = new WorkSheet(); - // 新建一个单元格,位置为(1,1),列占2单元格,行占2单元格,文本值为 "FineReport" - TemplateCellElement cellElement = new DefaultTemplateCellElement(1, 1, - 2, 2, "FineReport"); - // 设置列宽为300px,设置行高为30px - worksheet.setColumnWidth(1, new OLDPIX(300)); - worksheet.setRowHeight(1, new OLDPIX(30)); - // 得到CellElement的样式,如果没有新建默认样式 - Style style = cellElement.getStyle(); - if (style == null) { - style = Style.getInstance(); - } - // 设置字体和前景的颜色 - FRFont frFont = FRFont.getInstance("Dialog", Font.BOLD, 16); - frFont = frFont.applyForeground(new Color(21, 76, 160)); - style = style.deriveFRFont(frFont); - // 设置背景 - ColorBackground background = ColorBackground.getInstance(new Color(255, - 255, 177)); - style = style.deriveBackground(background); - // 设置水平居中 - style = style.deriveHorizontalAlignment(Constants.CENTER); - // 设置边框 - style = style.deriveBorder(Constants.LINE_DASH, Color.red, - Constants.LINE_DOT, Color.gray, Constants.LINE_DASH_DOT, - Color.BLUE, Constants.LINE_DOUBLE, Color.CYAN); - // 改变单元格的样式 - cellElement.setStyle(style); - // 将单元格添加到报表中 - worksheet.addCellElement(cellElement); - workbook.addReport(worksheet); - return workbook; - } - - @Override - public void setParameterMap(Map arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setTplPath(String arg0) { - // TODO Auto-generated method stub - - } -} \ No newline at end of file diff --git a/src/com/fr/demo/TotalVerifyJobDemo.java b/src/com/fr/demo/TotalVerifyJobDemo.java deleted file mode 100644 index 7a0247c..0000000 --- a/src/com/fr/demo/TotalVerifyJobDemo.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.fr.demo; - -import com.fr.base.Utils; -import com.fr.data.JobValue; -import com.fr.data.TotalVerifyJob; -import com.fr.data.Verifier; -import com.fr.script.Calculator; - -public class TotalVerifyJobDemo extends TotalVerifyJob { - /* - * type : 必须要定义此私有变量,变量名可改,表示校验状态 - * 0 表示校验成功,默认校验状态位为0 - * 1 表示校验失败 - */ - private int type = 0; - - @Override - protected void doTotalJob(Data data, Calculator calculator) - throws Exception { // @param data 以二维表排列的所有提交数据 - int sale, min; - JobValue salenum, minnum; - - int row = data.getRowCount(); // 获取一共多少行数据 - for (int i = 0; i < row; i++) { // 遍历每行,进行校验 - salenum = (JobValue) data.getValueAt(i, 0); - sale = Integer.parseInt(Utils.objectToString(salenum.getValue())); - - minnum = (JobValue) data.getValueAt(i, 1); - min = Integer.parseInt(Utils.objectToString(minnum.getValue())); - - if (sale < min) { //校验判断 - type = 1; - } - } - - } - - public String getMessage() { - // 根据校验状态是成功还是失败,设置对应的返回信息 - if (type == 0) { - return "恭喜你,校验成功"; - } else { - return "销量值不能小于最小基数"; - } - } - - public Verifier.Status getType() { - // 返回校验状态 - return Verifier.Status.parse(type); - } - - public String getJobType() { - return "totalVerifyJob"; - } -} diff --git a/src/com/fr/demo/URLParameterDemo.java b/src/com/fr/demo/URLParameterDemo.java deleted file mode 100644 index c4dac4f..0000000 --- a/src/com/fr/demo/URLParameterDemo.java +++ /dev/null @@ -1,53 +0,0 @@ -// 程序网络报表中获取request中的值 -package com.fr.demo; - -import com.fr.base.Parameter; -import com.fr.general.ModuleContext; -import com.fr.io.TemplateWorkBookIO; -import com.fr.main.TemplateWorkBook; -import com.fr.report.module.EngineModule; -import com.fr.web.core.Reportlet; -import com.fr.web.request.ReportletRequest; -import com.fr.workspace.simple.SimpleWork; - -import java.util.Map; - - -public class URLParameterDemo extends Reportlet { - public TemplateWorkBook createReport(ReportletRequest reportletRequest) { - - String envPath = "D:\\FineReport_8.0\\WebReport\\WEB-INF"; - SimpleWork.checkIn(envPath); - ModuleContext.startModule(EngineModule.class.getName()); - // 获取外部传来的参数 - TemplateWorkBook wbTpl = null; - String countryValue = reportletRequest.getParameter("地区").toString(); - try { - wbTpl = TemplateWorkBookIO.readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt"); - // 提取报表参数组,由于原模板只有country一个参数,因此直接取index为0的参数,并将外部传入的值赋给该参数 - Parameter[] ps = wbTpl.getParameters(); - ps[0].setValue(countryValue); - // 原模板定义有参数界面,参数已经从外部获得,去掉参数页面 - // 若您想保留参数界面,则将模板设置为不延迟报表展示,再传入参数后直接根据参数值显示结果,否则还需要再次点击查询按钮 - wbTpl.getReportParameterAttr().setParameterUI(null); - } catch (Exception e) { - e.printStackTrace(); - } finally { - SimpleWork.checkOut(); - } - return wbTpl; - } - - @Override - public void setParameterMap(Map arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void setTplPath(String arg0) { - // TODO Auto-generated method stub - - } - -} \ No newline at end of file diff --git a/src/com/fr/demo/VerifyJobDemo.java b/src/com/fr/demo/VerifyJobDemo.java deleted file mode 100644 index 77b0e40..0000000 --- a/src/com/fr/demo/VerifyJobDemo.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.fr.demo; - -import com.fr.base.Utils; -import com.fr.data.DefinedVerifyJob; -import com.fr.data.JobValue; -import com.fr.data.Verifier; -import com.fr.script.Calculator; - -public class VerifyJobDemo extends DefinedVerifyJob { - /* - * 必须要定义此私有变量,变量名可改,表示校验状态 - * 0 表示校验成功,默认校验状态位为0 - * 1 表示校验失败 - */ - private int type = 0; - - /** - * 当模板自定义事件增加的属性 名称与下面变量有对应时,则会自动赋值于此对应变量 - */ - private JobValue salenum; // JobValue对应单元格 - private int minnum; // 非单元格,则对应具体类型值 - - public void doJob(Calculator calculator) throws Exception { - /* - * 如这边提供一个简单的判断来模拟执行过程 - * 校验规则为销量需要大于等于最小基数:salenum >= minnum - * 校验不通过,提示“销量值不能小于最小基数” - */ - if (salenum != null) { - int sale = 0; - if (salenum.getValue() instanceof Integer) { //将单元格值转为整型以便用于比较 - sale = (Integer) salenum.getValue(); - - - } else { - sale = Integer.parseInt(Utils.objectToString(salenum.getValue())); - } - - if (sale < minnum) { //校验判断 - type = 1; - } - } else { - type = 1; - } - - } - - public String getMessage() { - // 根据校验状态是成功还是失败,设置对应的返回信息 - if (type == 0) { - return "恭喜你,校验成功"; - } else { - return "销量值不能小于最小基数"; - } - - } - - public Verifier.Status getType() { - // 返回校验状态 - return Verifier.Status.parse(type); - } - - public void doFinish(Calculator arg0) throws Exception { - // TODO Auto-generated method stub - - } - -} \ No newline at end of file diff --git a/src/com/fr/function/BinaryImage.java b/src/com/fr/function/BinaryImage.java deleted file mode 100644 index 65ac6eb..0000000 --- a/src/com/fr/function/BinaryImage.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.fr.function; - -import com.fr.data.core.db.BinaryObject; -import com.fr.script.AbstractFunction; -import com.sun.jna.Library; -import com.sun.jna.Native; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - -public class BinaryImage extends AbstractFunction { - - //加载dll,"E:\\bmp\\WltRS"是dll的文件完整路径,但不带后缀名,生成WltRS.class - static WltRS wltrs = (WltRS) Native.loadLibrary("E:\\bmp\\WltRS", WltRS.class); - - static int index = 0; - - public Object run(Object[] args) { - - int current = index; - - //args[0] 是 BinaryObject对象,取为bo - BinaryObject bo = (BinaryObject) args[0]; - - //将bo转换为.wlt文件,并保存在位置E:\bmp\;本地方法GetBmp的第一个参数是wlt文件的路径 - getFile(bo.getBytes(), "E:\\bmp\\", current + ".wlt"); - - //读取.wlt为文件 - File file = new File("E:\\bmp\\" + current + ".wlt"); - - //调用本地方法,在相同路径下生产.bmp - wltrs.GetBmp("E:\\bmp\\" + current + ".wlt", 1); - - //读取并返回图片 - File imagefile = new File("E:\\bmp\\" + current + ".bmp"); - BufferedImage buffer = null; - try { - buffer = ImageIO.read(imagefile); - } catch (IOException e) { - e.printStackTrace(); - } - - index = (++index) % 300; - return buffer; - } - - - // byte[]转换为file的方法 - public static void getFile(byte[] bfile, String filePath, String fileName) { - BufferedOutputStream bos = null; - FileOutputStream fos = null; - File file = null; - try { - File dir = new File(filePath); - if (!dir.exists() && dir.isDirectory()) {//判断文件目录是否存在 - dir.mkdirs(); - } - file = new File(filePath + "\\" + fileName); - fos = new FileOutputStream(file); - bos = new BufferedOutputStream(fos); - bos.write(bfile); - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (bos != null) { - try { - bos.close(); - } catch (IOException e1) { - e1.printStackTrace(); - } - } - if (fos != null) { - try { - fos.close(); - } catch (IOException e1) { - e1.printStackTrace(); - } - } - } - } -} - -//用jna调用本地方法的必须步骤,具体含义不明 -interface WltRS extends Library { - //定义要调用的本地方法 - void GetBmp(String str, int i); -} \ No newline at end of file diff --git a/src/com/fr/function/CellSum.java b/src/com/fr/function/CellSum.java deleted file mode 100644 index 008009b..0000000 --- a/src/com/fr/function/CellSum.java +++ /dev/null @@ -1,15 +0,0 @@ -// 自定义函数中获取公式所在单元格 -package com.fr.function; - -import com.fr.base.Utils; -import com.fr.script.AbstractFunction; - -public class CellSum extends AbstractFunction { - public Object run(Object[] args) { - String sum = Utils.objectToNumber(new SUM().run(args), false) - .toString(); // 直接调用FR内部的SUM方法 - String result = "所在单元格为:" + this.getCalculator().getCurrentColumnRow() - + ";总和为:" + sum; // 获取当前单元格拼出最终结果 - return result; - } -} \ No newline at end of file diff --git a/src/com/fr/function/ConnectSAPServer.java b/src/com/fr/function/ConnectSAPServer.java deleted file mode 100644 index e97c7b7..0000000 --- a/src/com/fr/function/ConnectSAPServer.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fr.function; - -import com.sap.conn.jco.JCoDestination; -import com.sap.conn.jco.JCoDestinationManager; -import com.sap.conn.jco.JCoException; -import com.sap.conn.jco.ext.DestinationDataProvider; - -import java.io.File; -import java.io.FileOutputStream; -import java.util.Properties; - -public class ConnectSAPServer { - static String ABAP_AS_POOLED = "ABAP_AS_WITH_POOL"; - - static { - Properties connectProperties = new Properties(); - connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, - "SAP服务器IP地址"); - connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "系统编号"); - connectProperties - .setProperty(DestinationDataProvider.JCO_CLIENT, "客户端编号(SAP中的,和客户端没关系)"); - connectProperties.setProperty(DestinationDataProvider.JCO_USER, - "用户名"); - connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, - "密码"); - connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "ZH"); - connectProperties.setProperty( - DestinationDataProvider.JCO_POOL_CAPACITY, "10"); - connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, - "10"); - createDataFile(ABAP_AS_POOLED, "jcoDestination", connectProperties); - } - - static void createDataFile(String name, String suffix, Properties properties) { - File cfg = new File(name + "." + suffix); - if (!cfg.exists()) { - try { - FileOutputStream fos = new FileOutputStream(cfg, false); - properties.store(fos, "SAP连接配置文件"); - fos.close(); - } catch (Exception e) { - throw new RuntimeException( - "Unable to create the destination file " - + cfg.getName(), e); - } - } - } - - public static JCoDestination Connect() { - JCoDestination destination = null; - try { - destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED); - } catch (JCoException e) { - e.getCause(); - } - return destination; - } -} \ No newline at end of file diff --git a/src/com/fr/function/FlagHtmlColor.java b/src/com/fr/function/FlagHtmlColor.java deleted file mode 100644 index 76da40b..0000000 --- a/src/com/fr/function/FlagHtmlColor.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.fr.function; -import com.fr.script.AbstractFunction; -import com.fr.stable.Primitive; -public class FlagHtmlColor extends AbstractFunction { - public Object run(Object[] args) { - String txt=""; - String color=""; - String flag=""; - if(null==args||args.length==0){ - return Primitive.ERROR_NAME; - }else if(args.length==1){ - txt=args[0].toString(); - color="red"; - flag="N"; - }else if(args.length==2){ - txt=args[0].toString(); - color=args[1].toString(); - flag="N"; - }else{ - txt=args[0].toString(); - color=args[1].toString(); - flag=args[2].toString(); - } - String result=getHtmlStr(txt, color, flag); - return result; - } - public String getHtmlStr(String txt,String color,String flag){ - String starthtml=""; - 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/src/com/fr/function/GETIP.java b/src/com/fr/function/GETIP.java deleted file mode 100644 index f247c53..0000000 --- a/src/com/fr/function/GETIP.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fr.function; - -import com.fr.script.AbstractFunction; - -import java.net.InetAddress; - -public class GETIP extends AbstractFunction { - - @Override - public Object run(Object[] objects) { - try { - InetAddress ia = InetAddress.getLocalHost(); - return ia.getHostAddress(); - } catch (Exception e) { - return e.getMessage(); - - } - } - - public static InetAddress getInetAddress() { - return null; - } -} \ No newline at end of file diff --git a/src/com/fr/function/Lunar.java b/src/com/fr/function/Lunar.java deleted file mode 100644 index 8f003c2..0000000 --- a/src/com/fr/function/Lunar.java +++ /dev/null @@ -1,15 +0,0 @@ -//自定义函数把阳历转换成阴历 -package com.fr.function; - -import com.fr.script.AbstractFunction; - -public class Lunar extends AbstractFunction { - public Object run(Object[] args) { - String result = ""; - int y = Integer.parseInt(args[0].toString()); - int m = Integer.parseInt(args[1].toString()); - int d = Integer.parseInt(args[2].toString()); - result = SolarToLunar.today(y, m, d); - return result; - } -} \ No newline at end of file diff --git a/src/com/fr/function/ParamSAPDataTest.java b/src/com/fr/function/ParamSAPDataTest.java deleted file mode 100644 index e98088d..0000000 --- a/src/com/fr/function/ParamSAPDataTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fr.function; - -import com.fr.data.AbstractTableData; -import com.sap.conn.jco.JCoDestination; -import com.sap.conn.jco.JCoException; - -public class ParamSAPDataTest extends AbstractTableData { - private String[] columnNames; - private int columnNum; - private String[][] rowData; - private static JCoDestination jCoDestination; - - public ParamSAPDataTest() { - throw new Error("Unresolved compilation problems: \n\tThe declared package \"com.fr.data\" does not match the expected package \"com.fr.function\"\n\tThe import com.sap cannot be resolved\n\tThe import com.sap cannot be resolved\n\tThe import com.sap cannot be resolved\n\tThe import com.sap cannot be resolved\n\tAbstractTableData cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tparameters cannot be resolved or is not a field\n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n\tJCoException cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tThe method Connect() from the type ConnectSAPServer refers to the missing type JCoDestination\n\tJCoFunction cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tparameters cannot be resolved or is not a field\n\tparameters cannot be resolved or is not a field\n\tJCoDestination cannot be resolved to a type\n\tJCoTable cannot be resolved to a type\n\tAbstractTableData cannot be resolved to a type\n"); - } - - public int getColumnCount() { - throw new Error("Unresolved compilation problem: \n"); - } - - public String getColumnName(int columnIndex) { - throw new Error("Unresolved compilation problem: \n"); - } - - public int getRowCount() { - throw new Error("Unresolved compilation problems: \n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n"); - } - - public Object getValueAt(int rowIndex, int columnIndex) { - throw new Error("Unresolved compilation problems: \n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n"); - } - - public void init() throws JCoException { - throw new Error("Unresolved compilation problems: \n\tJCoException cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tThe method Connect() from the type ConnectSAPServer refers to the missing type JCoDestination\n\tJCoFunction cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tparameters cannot be resolved or is not a field\n\tparameters cannot be resolved or is not a field\n\tJCoDestination cannot be resolved to a type\n\tJCoTable cannot be resolved to a type\n"); - } - - public void release() throws Exception { - throw new Error("Unresolved compilation problem: \n\tAbstractTableData cannot be resolved to a type\n"); - } -} \ No newline at end of file diff --git a/src/com/fr/function/ReportCheck.java b/src/com/fr/function/ReportCheck.java deleted file mode 100644 index 5ea8448..0000000 --- a/src/com/fr/function/ReportCheck.java +++ /dev/null @@ -1,105 +0,0 @@ -// 自定义函数实现表间校验 -package com.fr.function; - -import com.fr.base.ResultFormula; -import com.fr.io.TemplateWorkBookIO; -import com.fr.json.JSONArray; -import com.fr.json.JSONObject; -import com.fr.main.impl.WorkBook; -import com.fr.main.workbook.ResultWorkBook; -import com.fr.report.cell.CellElement; -import com.fr.report.report.ResultReport; -import com.fr.script.AbstractFunction; -import com.fr.stable.WriteActor; -import com.fr.write.cal.WB; - -import java.util.HashMap; - -public class ReportCheck extends AbstractFunction { - private static HashMap wMap = new HashMap(); - - public Object run(Object[] args) { - // 获取公式中的参数 - String cptname = args[0].toString(); // 获取报表名称 - int colnumber = Integer.parseInt(args[2].toString()); // 所取单元格所在列 - int rownumber = Integer.parseInt(args[3].toString()); // 所取单元格所在行 - // 定义返回的值 - Object returnValue = null; - // 定义报表运行环境,才能运行读取的报表 - try { - ResultWorkBook rworkbook = null; - // 读取模板 - WorkBook workbook = (WorkBook) TemplateWorkBookIO - .readTemplateWorkBook(cptname); - // 获取需要传递给报表的参数名与参数值,格式如[{"name":para1name,"value":para1value},{"name":para2name,"value":para2value},......] - JSONArray parasArray = new JSONArray(args[1].toString()); - // 需要判断是否是5秒内执行过的 - // 取出保存的resultworkbook; - Object tempWObj = wMap.get(cptname + parasArray.toString()); - if (tempWObj != null) { - // 取出hashmap里面保存的TpObj; - TpObj curTpObj = (TpObj) tempWObj; - - if ((System.currentTimeMillis() - curTpObj.getExeTime()) < 8000) { - rworkbook = curTpObj.getRworkbook(); - } else { - wMap.remove(cptname + parasArray.toString()); - } - } - // 如果没有设置,需要生成 - if (rworkbook == null) { - JSONObject jo = new JSONObject(); - // 定义报表执行时使用的paraMap,保存参数名与值 - java.util.Map parameterMap = new java.util.HashMap(); - if (parasArray.length() > 0) { - for (int i = 0; i < parasArray.length(); i++) { - jo = parasArray.getJSONObject(i); - parameterMap.put(jo.get("name"), jo.get("value")); - } - } - // 执行报表 - rworkbook = workbook.execute(parameterMap, new WriteActor()); - // 保存下来 - wMap.put(cptname + parasArray.toString(), new TpObj(rworkbook, - System.currentTimeMillis())); - } - // 获取报表结果中对应Cell的值 - ResultReport report = rworkbook.getResultReport(0); - CellElement cellElement = ((WB) report).getCellElement(colnumber, rownumber); - returnValue = cellElement.getValue().toString(); - if (cellElement.getValue() instanceof ResultFormula) { - returnValue = ((ResultFormula) cellElement.getValue()).getResult().toString(); - } - } catch (Exception e) { - e.printStackTrace(); - } - return returnValue; - } - - class TpObj { - private ResultWorkBook rworkbook = null; - private long exeTime = System.currentTimeMillis(); - - public TpObj(ResultWorkBook rworkbook, long exeTime) { - this.setRworkbook(rworkbook); - this.setExeTime(exeTime); - } - - public ResultWorkBook getRworkbook() { - return rworkbook; - } - - public void setRworkbook(ResultWorkBook rworkbook) { - this.rworkbook = rworkbook; - } - - public long getExeTime() { - return exeTime; - } - - public void setExeTime(long exeTime) { - this.exeTime = exeTime; - } - } - -} diff --git a/src/com/fr/function/SolarToLunar.java b/src/com/fr/function/SolarToLunar.java deleted file mode 100644 index c70a634..0000000 --- a/src/com/fr/function/SolarToLunar.java +++ /dev/null @@ -1,381 +0,0 @@ -//自定义函数把阳历转换成阴历 -package com.fr.function; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.GregorianCalendar; - -public class SolarToLunar { - final private static long[] lunarInfo = new long[]{0x04bd8, 0x04ae0, - 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, - 0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, - 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, 0x04970, 0x0a4b0, 0x0b4b5, - 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, - 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, - 0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, - 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0, - 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8, - 0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, - 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5, - 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0, - 0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, - 0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5, 0x04970, 0x064b0, - 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, - 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, - 0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, - 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954, - 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, - 0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, - 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, 0x0b5a0, 0x056d0, - 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, - 0x0ada0}; - - final private static int[] year20 = new int[]{1, 4, 1, 2, 1, 2, 1, 1, 2, - 1, 2, 1}; - - final private static int[] year19 = new int[]{0, 3, 0, 1, 0, 1, 0, 0, 1, - 0, 1, 0}; - - final private static int[] year2000 = new int[]{0, 3, 1, 2, 1, 2, 1, 1, - 2, 1, 2, 1}; - - public final static String[] nStr1 = new String[]{"", "正", "二", "三", "四", - "五", "六", "七", "八", "九", "十", "十一", "十二"}; - - private final static String[] Gan = new String[]{"甲", "乙", "丙", "丁", "戊", - "己", "庚", "辛", "壬", "癸"}; - - private final static String[] Zhi = new String[]{"子", "丑", "寅", "卯", "辰", - "巳", "午", "未", "申", "酉", "戌", "亥"}; - - private final static String[] Animals = new String[]{"鼠", "牛", "虎", "兔", - "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"}; - - private final static String[] solarTerm = new String[]{"小寒", "大寒", "立春", - "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", - "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至"}; - - private final static String[] sFtv = new String[]{"0101*元旦", "0214 情人节", - "0308 妇女节", "0312 植树节", "0315 消费者权益日", "0401 愚人节", "0501 劳动节", - "0504 青年节", "0512 护士节", "0601 儿童节", "0701 建党节", "0801 建军节", - "0808 父亲节", "0909 毛泽东逝世纪念", "0910 教师节", "0928 孔子诞辰", "1001*国庆节", - "1006 老人节", "1024 联合国日", "1112 孙中山诞辰", "1220 澳门回归", "1225 圣诞节", - "1226 毛泽东诞辰"}; - - private final static String[] lFtv = new String[]{"0101*农历春节", - "0115 元宵节", "0505 端午节", "0707 七夕情人节", "0815 中秋节", "0909 重阳节", - "1208 腊八节", "1224 小年", "0100*除夕"}; - - /** - * 传回农历 y年的总天数 - * - * @param y - * @return - */ - final private static int lYearDays(int y) { - int i, sum = 348; - for (i = 0x8000; i > 0x8; i >>= 1) { - if ((lunarInfo[y - 1900] & i) != 0) - sum += 1; - } - return (sum + leapDays(y)); - } - - /** - * 传回农历 y年闰月的天数 - * - * @param y - * @return - */ - final private static int leapDays(int y) { - if (leapMonth(y) != 0) { - if ((lunarInfo[y - 1900] & 0x10000) != 0) - return 30; - else - return 29; - } else - return 0; - } - - /** - * 传回农历 y年闰哪个月 1-12 , 没闰传回 0 - * - * @param y - * @return - */ - final private static int leapMonth(int y) { - return (int) (lunarInfo[y - 1900] & 0xf); - } - - /** - * 传回农历 y年m月的总天数 - * - * @param y - * @param m - * @return - */ - final private static int monthDays(int y, int m) { - if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0) - return 29; - else - return 30; - } - - /** - * 传回农历 y年的生肖 - * - * @param y - * @return - */ - final public static String AnimalsYear(int y) { - return Animals[(y - 4) % 12]; - } - - /** - * 传入 月日的offset 传回干支,0=甲子 - * - * @param num - * @return - */ - final private static String cyclicalm(int num) { - return (Gan[num % 10] + Zhi[num % 12]); - } - - /** - * 传入 offset 传回干支, 0=甲子 - * - * @param y - * @return - */ - final public static String cyclical(int y) { - int num = y - 1900 + 36; - return (cyclicalm(num)); - } - - /** - * 传出农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6 - * - * @param y - * @param m - * @return - */ - final private long[] Lunar(int y, int m) { - long[] nongDate = new long[7]; - int i = 0, temp = 0, leap = 0; - Date baseDate = new GregorianCalendar(1900 + 1900, 1, 31).getTime(); - Date objDate = new GregorianCalendar(y + 1900, m, 1).getTime(); - long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L; - if (y < 2000) - offset += year19[m - 1]; - if (y > 2000) - offset += year20[m - 1]; - if (y == 2000) - offset += year2000[m - 1]; - nongDate[5] = offset + 40; - nongDate[4] = 14; - - for (i = 1900; i < 2050 && offset > 0; i++) { - temp = lYearDays(i); - offset -= temp; - nongDate[4] += 12; - } - if (offset < 0) { - offset += temp; - i--; - nongDate[4] -= 12; - } - nongDate[0] = i; - nongDate[3] = i - 1864; - leap = leapMonth(i); // 闰哪个月 - nongDate[6] = 0; - - for (i = 1; i < 13 && offset > 0; i++) { - // 闰月 - if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) { - --i; - nongDate[6] = 1; - temp = leapDays((int) nongDate[0]); - } else { - temp = monthDays((int) nongDate[0], i); - } - - // 解除闰月 - if (nongDate[6] == 1 && i == (leap + 1)) - nongDate[6] = 0; - offset -= temp; - if (nongDate[6] == 0) - nongDate[4]++; - } - - if (offset == 0 && leap > 0 && i == leap + 1) { - if (nongDate[6] == 1) { - nongDate[6] = 0; - } else { - nongDate[6] = 1; - --i; - --nongDate[4]; - } - } - if (offset < 0) { - offset += temp; - --i; - --nongDate[4]; - } - nongDate[1] = i; - nongDate[2] = offset + 1; - return nongDate; - } - - /** - * 传出y年m月d日对应的农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6 - * - * @param y - * @param m - * @param d - * @return - */ - final public static long[] calElement(int y, int m, int d) { - long[] nongDate = new long[7]; - int i = 0, temp = 0, leap = 0; - Date baseDate = new GregorianCalendar(0 + 1900, 0, 31).getTime(); - Date objDate = new GregorianCalendar(y, m - 1, d).getTime(); - long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L; - nongDate[5] = offset + 40; - nongDate[4] = 14; - - for (i = 1900; i < 2050 && offset > 0; i++) { - temp = lYearDays(i); - offset -= temp; - nongDate[4] += 12; - } - if (offset < 0) { - offset += temp; - i--; - nongDate[4] -= 12; - } - nongDate[0] = i; - nongDate[3] = i - 1864; - leap = leapMonth(i); // 闰哪个月 - nongDate[6] = 0; - - for (i = 1; i < 13 && offset > 0; i++) { - // 闰月 - if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) { - --i; - nongDate[6] = 1; - temp = leapDays((int) nongDate[0]); - } else { - temp = monthDays((int) nongDate[0], i); - } - - // 解除闰月 - if (nongDate[6] == 1 && i == (leap + 1)) - nongDate[6] = 0; - offset -= temp; - if (nongDate[6] == 0) - nongDate[4]++; - } - - if (offset == 0 && leap > 0 && i == leap + 1) { - if (nongDate[6] == 1) { - nongDate[6] = 0; - } else { - nongDate[6] = 1; - --i; - --nongDate[4]; - } - } - if (offset < 0) { - offset += temp; - --i; - --nongDate[4]; - } - nongDate[1] = i; - nongDate[2] = offset + 1; - return nongDate; - } - - public final static String getChinaDate(int day) { - String a = ""; - if (day == 10) - return "初十"; - if (day == 20) - return "二十"; - if (day == 30) - return "三十"; - int two = (int) ((day) / 10); - if (two == 0) - a = "初"; - if (two == 1) - a = "十"; - if (two == 2) - a = "廿"; - if (two == 3) - a = "三"; - int one = (int) (day % 10); - switch (one) { - case 1: - a += "一"; - break; - case 2: - a += "二"; - break; - case 3: - a += "三"; - break; - case 4: - a += "四"; - break; - case 5: - a += "五"; - break; - case 6: - a += "六"; - break; - case 7: - a += "七"; - break; - case 8: - a += "八"; - break; - case 9: - a += "九"; - break; - } - return a; - } - - public static String today(int y, int m, int d) { - int year = y; - int month = m; - int date = d; - long[] l = calElement(year, month, date); - StringBuffer sToday = new StringBuffer(); - try { - - sToday.append(" 农历"); - sToday.append(cyclical(year)); - sToday.append('('); - sToday.append(AnimalsYear(year)); - sToday.append(")年"); - sToday.append(nStr1[(int) l[1]]); - sToday.append("月"); - sToday.append(getChinaDate((int) (l[2]))); - return sToday.toString(); - } finally { - sToday = null; - } - } - - private static SimpleDateFormat sdf = new SimpleDateFormat( - "yyyy年M月d日 EEEEE"); - - /** - * 农历日历工具使用演示 - * - * @param args - */ - public static void main(String[] args) { - System.out.println(today(1988, 10, 27)); - } -} diff --git a/src/com/fr/function/StringCat.java b/src/com/fr/function/StringCat.java deleted file mode 100644 index 8db60a7..0000000 --- a/src/com/fr/function/StringCat.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fr.function; - -import com.fr.script.AbstractFunction; - -public class StringCat extends AbstractFunction { - public StringCat() { - } - - public Object run(Object[] args) { - StringBuilder result = new StringBuilder(); - - for (int i = 0; i < args.length; ++i) { - Object para = args[i]; - result.append(para.toString()); - } - - return result.toString(); - } -} diff --git a/src/com/fr/function/StringImage.java b/src/com/fr/function/StringImage.java deleted file mode 100644 index 5b01967..0000000 --- a/src/com/fr/function/StringImage.java +++ /dev/null @@ -1,73 +0,0 @@ -//图片在下文字在上 -package com.fr.function; - -import com.fr.base.BaseUtils; -import com.fr.base.GraphHelper; -import com.fr.script.AbstractFunction; -import com.fr.stable.CoreGraphHelper; - -import javax.imageio.ImageIO; -import javax.swing.JFrame; -import javax.swing.JPanel; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; - - -public class StringImage extends AbstractFunction { - public Object run(Object[] args) { - Image result = null; - int p = 0; - Object[] ob = new Object[2]; - for (int i = 0; (i < args.length && p <= 1); i++) { - if (args[i] == null) { - continue; - } - ob[p] = args[i]; - p++; - - } - try { - result = initStringImage(ob[0], ob[1]); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return result; - } - - public Image initStringImage(Object nameOb, Object imageOb) - throws IOException { - String name = (String) nameOb; - Image image = null; - if (imageOb instanceof Image) - image = (Image) imageOb; - else - ; - Image stringImage = null; - BufferedImage splashBuffedImage = CoreGraphHelper.toBufferedImage(image); - stringImage = splashBuffedImage; - Graphics2D splashG2d = splashBuffedImage.createGraphics(); - double centerX = 25; - double centerY = 25; - GraphHelper.drawString(splashG2d, name, centerX, centerY); - // - String FilePath = "Test.png"; - File f = new File(FilePath); - ImageIO.write(splashBuffedImage, "png", f); - // - return splashBuffedImage; - } - - public static void main(String arg[]) throws IOException { - StringImage tt = new StringImage(); - Image image = BaseUtils.readImage("D:\\1.jpg"); - String name = "12314124"; - Image aa = tt.initStringImage(name, image); - JFrame jf = new JFrame(); - JPanel jp = new JPanel(); - - } -} \ No newline at end of file diff --git a/src/com/fr/function/SubSection.java b/src/com/fr/function/SubSection.java deleted file mode 100644 index a502c9c..0000000 --- a/src/com/fr/function/SubSection.java +++ /dev/null @@ -1,45 +0,0 @@ -//SubSection函数-Oracle查询参数个数限制 -package com.fr.function; - -import com.fr.general.FArray; -import com.fr.script.AbstractFunction; - -public class SubSection extends AbstractFunction { - public Object run(Object[] args) { - // 获取第一个对象,即取得传入的参数 - Object para = args[0]; - String parastr = para.toString(); - // 由于是复选参数,因此要去掉前后的"("和")" - if (parastr.startsWith("(") && parastr.endsWith(")")) { - parastr = parastr.substring(1, parastr.length() - 1); - } - // 将字符串转为","分割的数组 - String test[] = parastr.split(","); - int len = test.length; - int loopnum = len / 500; - if (len % 500 != 0) { - loopnum += 1; - } - ; - // 返回的值是数组,需要定义成我们内部的类型FArray - FArray result = new FArray(); - String str = ""; - int k = 1; - for (int i = 0; i < loopnum; i++) { - for (int j = 500 * i; j < 500 * (i + 1) && j < len; j++) { - if (k != 500 && j != (len - 1)) { - str += test[j] + ","; - } else { - str += test[j]; - } - k++; - } - // 每500个形成一组并在每组外部加上"("和")" - str = "(" + str + ")"; - result.add(str); - str = ""; - k = 1; - } - return result; - } -} \ No newline at end of file diff --git a/src/com/fr/function/Ubm.java b/src/com/fr/function/Ubm.java deleted file mode 100644 index 3501fb7..0000000 --- a/src/com/fr/function/Ubm.java +++ /dev/null @@ -1,25 +0,0 @@ -// 自定义函数Unicode编码转化为中文 -package com.fr.function; - -import com.fr.script.AbstractFunction; - -public class Ubm extends AbstractFunction { - public Object run(Object[] args) { - String str = args[0].toString(); - String st = ""; - StringBuffer buffer = new StringBuffer(); - while (str.length() > 0) { - if (str.startsWith("%u")) { - st = str.substring(2, 6); - char ch = (char) Integer.parseInt(String.valueOf(st), 16); - buffer.append(new Character(ch).toString()); - str = str.substring(6); - } else { - st = str.substring(0, str.indexOf("%u")); - buffer.append(st); - str = str.substring(st.length()); - } - } - return buffer.toString(); - } -} \ No newline at end of file diff --git a/src/com/fr/function/Upc.java b/src/com/fr/function/Upc.java deleted file mode 100644 index b922952..0000000 --- a/src/com/fr/function/Upc.java +++ /dev/null @@ -1,35 +0,0 @@ -// 自定义函数生成UPC条形码 -package com.fr.function; - -import com.fr.script.AbstractFunction; -import org.krysalis.barcode4j.impl.upcean.UPCABean; -import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider; -import org.krysalis.barcode4j.tools.UnitConv; - -import java.awt.image.BufferedImage; - -public class Upc extends AbstractFunction { - public Object run(Object[] args) { - if (args == null || args.length < 1) { - return "参数不对,必须有一个参数"; - } - try { - // 创建一个UPC编码生成器 - UPCABean bean = new UPCABean(); - // 设置条形码高度,BufferedImage.TYPE_BYTE_BINARY代表常量值12,可直接使用常量值 - final int dpi = Integer.parseInt(args[1].toString()); - bean.setModuleWidth(UnitConv.in2mm(1.0f / dpi)); - bean.doQuietZone(false); - BitmapCanvasProvider canvas = new BitmapCanvasProvider(dpi, - BufferedImage.TYPE_BYTE_BINARY, false, 0); - // 创建条形码 - bean.generateBarcode(canvas, String.valueOf(args[0])); - canvas.finish(); - // 返回图片显示 - return canvas.getBufferedImage(); - } catch (Exception e) { - e.printStackTrace(); - } - return args[0]; - } -} \ No newline at end of file diff --git a/src/com/fr/function/Widget2Image.java b/src/com/fr/function/Widget2Image.java deleted file mode 100644 index b809ce6..0000000 --- a/src/com/fr/function/Widget2Image.java +++ /dev/null @@ -1,105 +0,0 @@ -// 导出打印单选按钮及复选框 -package com.fr.function; - -import com.fr.base.AbstractPainter; -import com.fr.base.BaseUtils; -import com.fr.base.GraphHelper; -import com.fr.base.Style; -import com.fr.general.FArray; -import com.fr.general.FRFont; -import com.fr.script.AbstractFunction; -import com.fr.stable.Primitive; -import com.fr.stable.StringUtils; - -import java.awt.Color; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Image; - -public class Widget2Image extends AbstractFunction { - public Object run(Object[] args) { - if (args.length < 3) - return Primitive.NULL; - // 第一个参数:控件类型,不区分大小写 - String type = args[0].toString().toLowerCase(); - if (!("checkbox".equals(type) || "radiobutton".equals(type))) - return Primitive.ERROR_VALUE; - // 第二个参数:控件按钮个数 - int num = Integer.parseInt(args[1].toString()); - // 第三个参数:按钮组的值,哪些被选中 - String selection = args[2].toString(); - // 第四个参数:可选参数,按钮组对应的显示值数组 - FArray textArray = new FArray(); - if (args.length == 4 && args[3] instanceof FArray) { - textArray = (FArray) args[3]; - } - return new WidgetPaint(type, num, selection, textArray); - } - - public static class WidgetPaint extends AbstractPainter { - public static String CHECK_ON = "/com/fr/web/images/checkon.gif"; - public static String CHECK_OFF = "/com/fr/web/images/checkoff.gif"; - public static String RADIO_ON = "/com/fr/web/images/radioon.gif"; - public static String RADIO_OFF = "/com/fr/web/images/radiooff.gif"; - public static FRFont DEFUALT_FONT = FRFont.getInstance(); - public static FontMetrics FontMetrics = GraphHelper - .getFontMetrics(DEFUALT_FONT); - private String type; - private int num; - private String selection; - private FArray textArray; - - { - DEFUALT_FONT = DEFUALT_FONT.applyForeground(Color.BLACK); - } - - public WidgetPaint(String type, int num, String selection, - FArray textArray) { - this.type = type; - this.num = num; - this.selection = selection; - this.textArray = textArray; - } - - private String resolveText(int i) { - if (i < this.textArray.length()) { - return this.textArray.elementAt(i).toString(); - } - return StringUtils.EMPTY; - } - - public void paint(Graphics g, int width, int height, int resolution, - Style style) { - String OFF = CHECK_OFF; - String ON = CHECK_ON; - if ("radiobutton".equals(type)) { - OFF = RADIO_OFF; - ON = RADIO_ON; - } - Image[] checkOFFON = {BaseUtils.readImage(OFF), - BaseUtils.readImage(ON)}; - int[] imgWidths = {checkOFFON[0].getWidth(null), - checkOFFON[1].getWidth(null)}; - int[] imgHeights = {checkOFFON[0].getHeight(null), - checkOFFON[1].getHeight(null)}; - Graphics2D g2d = (Graphics2D) g; - g2d.setFont(FRFont.getInstance()); - g2d.setPaint(Color.BLACK); - int x = 2; - int y = (height - imgHeights[0]) / 2; - String select = selection; - for (int i = 0; i < num; i++) { - int bit = Integer.parseInt(select.substring(i, i + 1)); - g2d.drawImage(checkOFFON[bit], x, y, imgWidths[bit], - imgHeights[bit], null); - x += imgWidths[bit] + 2; - String text = resolveText(i); - g2d.setBackground(Color.BLACK); - g2d.drawString(text, (float) x, (float) (y + FontMetrics - .getAscent())); - x += FontMetrics.stringWidth(text) + 2; - } - } - } -} \ No newline at end of file diff --git a/src/com/fr/io/ExcelToCpt.java b/src/com/fr/io/ExcelToCpt.java deleted file mode 100644 index c8af6e1..0000000 --- a/src/com/fr/io/ExcelToCpt.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.io; - -import com.fr.general.ModuleContext; -import com.fr.io.importer.ExcelReportImporter; -import com.fr.main.TemplateWorkBook; -import com.fr.main.impl.WorkBook; -import com.fr.report.module.EngineModule; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.OutputStream; - -public class ExcelToCpt { - public static void main(String[] args) throws Exception { - File excelFile = new File("D:\\API.xls"); - FileInputStream a = new FileInputStream(excelFile); - ModuleContext.startModule(EngineModule.class.getName()); - TemplateWorkBook tpl = new ExcelReportImporter().generateWorkBookByStream(a); - OutputStream outputStream = new FileOutputStream(new File("D:\\abc.cpt")); - ((WorkBook) tpl).export(outputStream); - outputStream.close(); - ModuleContext.stopModules(); - } -} \ No newline at end of file diff --git a/src/com/fr/io/ExcelToCptpage.java b/src/com/fr/io/ExcelToCptpage.java deleted file mode 100644 index eb3a391..0000000 --- a/src/com/fr/io/ExcelToCptpage.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.fr.io; - -import com.fr.io.importer.ExcelReportImporter; -import com.fr.main.TemplateWorkBook; -import com.fr.main.impl.WorkBook; -import com.fr.report.cell.CellElement; -import com.fr.report.cell.cellattr.CellPageAttr; -import com.fr.report.elementcase.AbstractElementCase; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.Iterator; - -public class ExcelToCptpage { - public static void main(String[] args) throws Exception { - File excelFile = new File("D:\\API.xls"); // 获取EXCEL文件 - FileInputStream a = new FileInputStream(excelFile); - TemplateWorkBook tpl = new ExcelReportImporter().generateWorkBookByStream(a); - Iterator it = tpl.getReport(0).iteratorOfElementCase(); - - while (it.hasNext()) { - AbstractElementCase ec = (AbstractElementCase) it.next(); - Iterator cellIt = ec.cellIterator(); - while (cellIt.hasNext()) { - CellElement obj = (CellElement) cellIt.next(); - if (matchCell(obj, Integer.parseInt("1"), Integer.parseInt("0"))) { - CellPageAttr cpa = new CellPageAttr(); - cpa.setPageAfterRow(true); - obj.setCellPageAttr(cpa); - } - - } - } - OutputStream outputStream = new FileOutputStream(new File("D:\\abc.cpt")); // 转换成cpt模板 - ((WorkBook) tpl).export(outputStream); - } - - - private static boolean matchCell(CellElement cell, int row, int col) { - if (cell.getRow() == row && cell.getColumn() == col) - return true; - return false; - } -} \ No newline at end of file diff --git a/src/com/fr/io/ExcuteDemo.java b/src/com/fr/io/ExcuteDemo.java deleted file mode 100644 index d77fa1c..0000000 --- a/src/com/fr/io/ExcuteDemo.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.fr.io; - -import com.fr.config.activator.BaseDBActivator; -import com.fr.config.activator.ConfigurationActivator; -import com.fr.data.impl.config.activator.RestrictionActivator; -import com.fr.io.exporter.ExcelExporter; -import com.fr.main.TemplateWorkBook; -import com.fr.main.workbook.ResultWorkBook; -import com.fr.module.Module; -import com.fr.module.tool.ActivatorToolBox; -import com.fr.report.ReportActivator; -import com.fr.report.module.ReportBaseActivator; -import com.fr.serialization.SerializationActivator; -import com.fr.stable.WriteActor; -import com.fr.startup.WorkspaceRegister; -import com.fr.store.StateServerActivator; -import com.fr.workspace.engine.WorkspaceActivator; -import com.fr.workspace.server.ServerWorkspaceRegister; -import com.fr.workspace.simple.SimpleWork; - -import java.io.File; -import java.io.FileOutputStream; - - -public class ExcuteDemo { - public static void main(String[] args) { - try { - // 首先需要定义执行所在的环境,这样才能正确读取数据库信息 - // 定义报表运行环境,用于执行报表 - Module module = ActivatorToolBox.simpleLink( - new WorkspaceActivator(), - new BaseDBActivator(), - new ConfigurationActivator(), - new StateServerActivator(), - new ReportBaseActivator(), - new RestrictionActivator(), - new ReportActivator(), - new WorkspaceRegister(), - new ServerWorkspaceRegister(), - new SerializationActivator()); - String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径 - SimpleWork.checkIn(envpath); - module.start(); - // 读取模板 - TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt"); - /* - * 生成参数map,注入参数与对应的值,用于执行报表 该模板中只有一个参数地区,给其赋值华北 - * 若参数在发送请求时传过来,可以通过req.getParameter(name)获得 - * 获得的参数put进map中,paraMap.put(paraname,paravalue) - */ - java.util.Map paraMap = new java.util.HashMap(); - paraMap.put("地区", "华北"); - // 使用paraMap执行生成结果 - ResultWorkBook result = workbook.execute(paraMap, new WriteActor()); - // 使用结果如导出至excel - FileOutputStream outputStream = new FileOutputStream(new File( - "D:\\Parameter.xls")); - ExcelExporter excelExporter = new ExcelExporter(); - excelExporter.export(outputStream, result); - } catch (Exception e) { - e.printStackTrace(); - } finally { - SimpleWork.checkOut(); - } - } -} \ No newline at end of file diff --git a/src/com/fr/io/ExportBatch.java b/src/com/fr/io/ExportBatch.java deleted file mode 100644 index efe2a29..0000000 --- a/src/com/fr/io/ExportBatch.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.fr.io; - -import com.fr.config.activator.BaseDBActivator; -import com.fr.config.activator.ConfigurationActivator; -import com.fr.data.impl.config.activator.RestrictionActivator; -import com.fr.general.ModuleContext; -import com.fr.io.exporter.ExcelExporter; -import com.fr.main.TemplateWorkBook; -import com.fr.main.workbook.ResultWorkBook; -import com.fr.module.Module; -import com.fr.module.tool.ActivatorToolBox; -import com.fr.report.ReportActivator; -import com.fr.report.module.ReportBaseActivator; -import com.fr.serialization.SerializationActivator; -import com.fr.stable.StableUtils; -import com.fr.stable.WriteActor; -import com.fr.startup.WorkspaceRegister; -import com.fr.store.StateServerActivator; -import com.fr.workspace.engine.WorkspaceActivator; -import com.fr.workspace.server.ServerWorkspaceRegister; -import com.fr.workspace.simple.SimpleWork; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.util.Arrays; - - -public class ExportBatch { - public static void main(String[] args) { - try { - // 定义报表运行环境,用于执行报表 - Module module = ActivatorToolBox.simpleLink( - new WorkspaceActivator(), - new BaseDBActivator(), - new ConfigurationActivator(), - new StateServerActivator(), - new ReportBaseActivator(), - new RestrictionActivator(), - new ReportActivator(), - new WorkspaceRegister(), - new ServerWorkspaceRegister(), - new SerializationActivator()); - String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径 - SimpleWork.checkIn(envpath); - module.start(); - // 读取环境下的模板文件 - TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook( - "doc\\Primary\\DetailReport\\Details.cpt"); - // 读取用于保存的参数值的txt文件 - File parafile = new File(envpath + "\\para.txt"); - FileInputStream fileinputstream; - fileinputstream = new FileInputStream(parafile); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileinputstream)); - // 定义保存参数的map,用于执行报表 - java.util.Map paramap = new java.util.HashMap(); - /* - * 遍历参数值所在txt文件,txt文件中参数保存形式为 para1,para2 江苏,陈羽 江苏,安娜 首先取出第一行保存参数名称 - * 遍历每个参数组合,如para1=江苏、para2=陈羽,根据参数执行模板,并将结果导出excel excel文件名为名称+导出编号 - */ - // 读第一行,保存参数名称 - String lineText = bufferedReader.readLine(); - lineText = lineText.trim(); - String[] paraname = StableUtils.splitString(lineText, ","); - System.out.println(Arrays.toString(paraname)); - // 遍历每个参数组合,执行模板,导出结果 - int number = 0; - while ((lineText = bufferedReader.readLine()) != null) { - lineText = lineText.trim(); - String[] paravalue = StableUtils.splitString(lineText, ","); - for (int j = 0; j < paravalue.length; j++) { - paramap.put(paraname[j], paravalue[j]); - } - ResultWorkBook result = workbook.execute(paramap,new WriteActor()); - OutputStream outputstream = new FileOutputStream(new File("E:\\ExportEg" + number + ".xls")); - ExcelExporter excelexporter = new ExcelExporter(); - excelexporter.export(outputstream, result); - // 最后要清空一下参数map,用于下次计算 - paramap.clear(); - number++; - outputstream.close(); - } - ModuleContext.stopModules(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/src/com/fr/io/ExportExcel.java b/src/com/fr/io/ExportExcel.java deleted file mode 100644 index a7a1d83..0000000 --- a/src/com/fr/io/ExportExcel.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.fr.io; - -import com.fr.base.Parameter; -import com.fr.general.ModuleContext; -import com.fr.io.exporter.ExcelExporter; -import com.fr.io.exporter.LargeDataPageExcelExporter; -import com.fr.io.exporter.PageExcel2007Exporter; -import com.fr.io.exporter.PageExcelExporter; -import com.fr.io.exporter.PageToSheetExcel2007Exporter; -import com.fr.io.exporter.PageToSheetExcelExporter; -import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter; -import com.fr.main.impl.WorkBook; -import com.fr.main.workbook.ResultWorkBook; -import com.fr.report.core.ReportUtils; -import com.fr.report.module.EngineModule; -import com.fr.stable.WriteActor; -import com.fr.workspace.simple.SimpleWork; - -import java.io.File; -import java.io.FileOutputStream; - - -public class ExportExcel { - public static void main(String[] args) { - // 定义报表运行环境,才能执行报表 - String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF"; - SimpleWork.checkIn(envpath); - ModuleContext.startModule(EngineModule.class.getName()); - ResultWorkBook rworkbook = null; - try { - // 未执行模板工作薄 - WorkBook workbook = (WorkBook) TemplateWorkBookIO - .readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt"); - // 获取报表参数并设置值,导出内置数据集时数据集会根据参数值查询出结果从而转为内置数据集 - Parameter[] parameters = workbook.getParameters(); - parameters[0].setValue("华东"); - // 定义parametermap用于执行报表,将执行后的结果工作薄保存为rworkBook - java.util.Map parameterMap = new java.util.HashMap(); - for (int i = 0; i < parameters.length; i++) { - parameterMap.put(parameters[i].getName(), parameters[i] - .getValue()); - } - // 定义输出流 - FileOutputStream outputStream; - - //原样导出excel2003 - outputStream = new FileOutputStream(new File("E:\\ExcelExport.xls")); - ExcelExporter excel = new ExcelExporter(); - excel.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - - //原样导出excel2007 - outputStream = new FileOutputStream(new File("E:\\ExcelExport.xlsx")); - StreamExcel2007Exporter excel1 = new StreamExcel2007Exporter(); - excel.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - - //分页导出excel2003 - outputStream = new FileOutputStream(new File("E:\\PageExcelExport.xls")); - PageExcelExporter page = new PageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap, new WriteActor()))); - page.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - - //分页导出excel2007 - outputStream = new FileOutputStream(new File("E:\\PageExcelExport.xlsx")); - PageExcel2007Exporter page1 = new PageExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook)); - page1.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - - //分页分sheet导出excel2003 - outputStream = new FileOutputStream(new File("E:\\PageSheetExcelExport.xls")); - PageToSheetExcelExporter sheet = new PageToSheetExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap, new WriteActor()))); - sheet.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - - //分页分sheet导出excel2007 - outputStream = new FileOutputStream(new File("E:\\PageSheetExcelExport.xlsx")); - PageToSheetExcel2007Exporter sheet1 = new PageToSheetExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook)); - sheet1.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - - //大数据量导出 - outputStream = new FileOutputStream(new File("E:\\LargeExcelExport.zip")); - LargeDataPageExcelExporter large = new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap, new WriteActor())), true); - //导出2007版outputStream = new FileOutputStream(new File("E:\\LargeExcelExport.xlsx")); excel LargeDataPageExcel2007Exporter large = new LargeDataPageExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook), true); - large.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - - outputStream.close(); - ModuleContext.stopModules(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/src/com/fr/io/ExportReports.java b/src/com/fr/io/ExportReports.java deleted file mode 100644 index 96a20cc..0000000 --- a/src/com/fr/io/ExportReports.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fr.io; - -import com.fr.base.Parameter; -import com.fr.general.ModuleContext; -import com.fr.io.exporter.PageExcelExporter; -import com.fr.main.TemplateWorkBook; -import com.fr.main.workbook.PageWorkBook; -import com.fr.report.core.ReportUtils; -import com.fr.report.module.EngineModule; -import com.fr.report.report.PageReport; -import com.fr.stable.PageActor; -import com.fr.workspace.simple.SimpleWork; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; - -public class ExportReports { - public static void main(String[] args) { - // ���屨�����л���,����ִ�б��� - 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/src/com/fr/io/JavaPrint.java b/src/com/fr/io/JavaPrint.java deleted file mode 100644 index 7a7cad8..0000000 --- a/src/com/fr/io/JavaPrint.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fr.io; - -import com.fr.base.Parameter; -import com.fr.main.TemplateWorkBook; -import com.fr.print.PrintUtils; -import com.fr.workspace.simple.SimpleWork; - -import java.util.HashMap; - - -public class JavaPrint { - public static void main(String[] args) { - // 定义报表运行环境,才能执行报表 - String envPath = "D:\\FineReport\\develop\\code\\build\\package\\WebReport\\WEB-INF"; - SimpleWork.checkIn(envPath); - try { - TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook("GettingStarted.cpt"); - // 参数传值 - Parameter[] parameters = workbook.getParameters(); - HashMap 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/src/com/fr/io/SetParameterWindow.java b/src/com/fr/io/SetParameterWindow.java deleted file mode 100644 index aec2d19..0000000 --- a/src/com/fr/io/SetParameterWindow.java +++ /dev/null @@ -1,78 +0,0 @@ -// �����������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/src/com/fr/io/SimpleDemo.java b/src/com/fr/io/SimpleDemo.java deleted file mode 100644 index 8a0357f..0000000 --- a/src/com/fr/io/SimpleDemo.java +++ /dev/null @@ -1,71 +0,0 @@ -//��ȡ�޸ı��� -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/src/com/fr/log/LogApi.java b/src/com/fr/log/LogApi.java deleted file mode 100644 index dd50e08..0000000 --- a/src/com/fr/log/LogApi.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.fr.log; - -/** - * 后台输出log信息-http://help.finereport.com/doc-view-746.html - */ -public class LogApi { - public static void main(String[] args) { - FineLoggerFactory.getLogger().info( "This is level info"); //需要服务器log级别为info时才会显示 - FineLoggerFactory.getLogger().warn("This is level warning"); //需要服务器log级别为info、warning时才会显示 - FineLoggerFactory.getLogger().error("This is level error"); //需要服务器log级别为info、warning、error时才会显示,10.0取消了server级别日志记录 - } -} \ No newline at end of file diff --git a/src/com/fr/output/FTPUpload.java b/src/com/fr/output/FTPUpload.java deleted file mode 100644 index 0c08b92..0000000 --- a/src/com/fr/output/FTPUpload.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.fr.output; - -import com.fr.data.dao.CompatiableIDFCMapper; -import com.fr.data.dao.ObjectTableMapper; -import com.fr.json.JSONException; -import com.fr.json.JSONObject; -import com.fr.schedule.output.AbstractOutputFileAction; -import com.fr.schedule.output.FTPTransmission; -import com.fr.schedule.output.OutputFileAction; -import com.fr.schedule.output.ftp.DefaultFTPTransmit; - -import java.io.File; - -public class FTPUpload extends AbstractOutputFileAction { - @Override - public ObjectTableMapper objectTableMapper2Register() { - return null; - } - - @Override - public long getId() { - return 0; - } - - @Override - public File[] getFilesToDealWith(File[] files) { - return files; - } - - @Override - public void doFileAction(File[] files) { - FTPTransmission ftp = new FTPTransmission(); - ftp.setServerAddress("env.finedevelop.com"); - ftp.setPort(58321); - ftp.setSavePath("connie"); - ftp.setUsername("fr"); - ftp.setPassword("ilovejava"); - try { - new DefaultFTPTransmit().transmit(files, ftp.getServerAddress(), ftp.getPort(), ftp.getUsername(), ftp.getPassword(), ftp.getSavePath()); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - @Override - public CompatiableIDFCMapper getExtraOutputFileActionForeignKey() { - return null; - } - - @Override - public boolean isEmailNotification() { - // TODO Auto-generated method stub - return false; - } - - @Override - public OutputFileAction analyzeJSON(JSONObject arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public JSONObject createJSONConfig() throws JSONException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getJsonTag() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/fr/output/OutputExcel.java b/src/com/fr/output/OutputExcel.java deleted file mode 100644 index 1471580..0000000 --- a/src/com/fr/output/OutputExcel.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.fr.output; - -import com.fr.data.dao.CompatiableIDFCMapper; -import com.fr.data.dao.ObjectTableMapper; -import com.fr.json.JSONException; -import com.fr.json.JSONObject; -import com.fr.schedule.output.AbstractOutputFileAction; -import com.fr.schedule.output.OutputFileAction; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -public class OutputExcel extends AbstractOutputFileAction { - - @Override - public File[] getFilesToDealWith(File[] files) { - return files; - } - - @Override - public void doFileAction(File[] files) { -// OutputStream out=new BufferedOutputStream(new FileOutputStream(new File(files.)));; - System.out.println(files[0].getName()); - for (int i = 0; i < files.length; i++) { - String name = files[i].getName(); - String path = "D:/" + name; - BufferedInputStream in = null; - OutputStream out = null; - try { - out = new BufferedOutputStream(new FileOutputStream(new File(path))); - in = new BufferedInputStream(new FileInputStream(files[i])); - byte[] ba = new byte[in.available()]; - in.read(ba); - out.write(ba); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - try { - if (in != null) { - in.close(); - } - if (out != null) { - out.close(); - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - } - } - - @Override - public ObjectTableMapper objectTableMapper2Register() { - return null; - } - - @Override - public CompatiableIDFCMapper getExtraOutputFileActionForeignKey() { - return null; - } - - @Override - public long getId() { - return 0; - } - - @Override - public boolean isEmailNotification() { - // TODO Auto-generated method stub - return false; - } - - @Override - public OutputFileAction analyzeJSON(JSONObject arg0) { - // TODO Auto-generated method stub - return null; - } - - @Override - public JSONObject createJSONConfig() throws JSONException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getJsonTag() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/fr/plugin/chart/IndependentChartProviderImpl.java b/src/com/fr/plugin/chart/IndependentChartProviderImpl.java deleted file mode 100644 index bd1b741..0000000 --- a/src/com/fr/plugin/chart/IndependentChartProviderImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.fr.plugin.chart; - -import com.fr.chart.chartattr.Chart; -import com.fr.chart.fun.impl.AbstractIndependentChartProvider; - -public class IndependentChartProviderImpl extends AbstractIndependentChartProvider { - @Override - public void init() { - - } - - @Override - public void destroy() { - - } - - @Override - public String getChartName() { - return ""; - } - - @Override - public Chart[] getChartTypes() { - return null; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/chart/IndependentChartUIProviderImpl.java b/src/com/fr/plugin/chart/IndependentChartUIProviderImpl.java deleted file mode 100644 index 9445e2d..0000000 --- a/src/com/fr/plugin/chart/IndependentChartUIProviderImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.fr.plugin.chart; - -import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; -import com.fr.extended.chart.AbstractExtendedChartTableDataPane; -import com.fr.extended.chart.AbstractExtendedChartUIProvider; - -public class IndependentChartUIProviderImpl extends AbstractExtendedChartUIProvider { - @Override - protected AbstractExtendedChartTableDataPane getTableDataSourcePane() { - return null; - } - - @Override - protected AbstractReportDataContentPane getReportDataSourcePane() { - return null; - } - - @Override - public String getIconPath() { - return ""; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/ActionCMDImpl.java b/src/com/fr/plugin/core/ActionCMDImpl.java deleted file mode 100644 index 436ef9c..0000000 --- a/src/com/fr/plugin/core/ActionCMDImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.web.core.ActionCMD; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class ActionCMDImpl implements ActionCMD { - @Override - public String getCMD() { - return ""; - } - - @Override - public void actionCMD(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s) throws Exception { - - } - - @Override - public void actionCMD(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { - - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/AttachmentDownloaderImpl.java b/src/com/fr/plugin/core/AttachmentDownloaderImpl.java deleted file mode 100644 index 1909f32..0000000 --- a/src/com/fr/plugin/core/AttachmentDownloaderImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.stable.fun.impl.AbstractAttachmentDownloader; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class AttachmentDownloaderImpl extends AbstractAttachmentDownloader { - @Override - public void download(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s, String[] strings) throws Exception { - - } - - @Override - public String createDownloadScript(String s) { - return ""; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/CellValueProcessorImpl.java b/src/com/fr/plugin/core/CellValueProcessorImpl.java deleted file mode 100644 index a140b57..0000000 --- a/src/com/fr/plugin/core/CellValueProcessorImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.base.Style; -import com.fr.report.cell.cellattr.CellGUIAttr; -import com.fr.report.fun.impl.AbstractCellValueProvider; -import com.fr.stable.script.CalculatorProvider; - -public class CellValueProcessorImpl extends AbstractCellValueProvider { - @Override - public Object process(Object o, CalculatorProvider calculatorProvider) { - return null; - } - - @Override - public Object processBeforeToTag(Object o, CellGUIAttr cellGUIAttr, Style style, int i, int i1) { - return null; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/CssFileHandlerImpl.java b/src/com/fr/plugin/core/CssFileHandlerImpl.java deleted file mode 100644 index d164ce2..0000000 --- a/src/com/fr/plugin/core/CssFileHandlerImpl.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.stable.fun.impl.AbstractCssFileHandler; - -public class CssFileHandlerImpl extends AbstractCssFileHandler { - @Override - public String[] pathsForFiles() { - return null; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/DebugLogProviderImpl.java b/src/com/fr/plugin/core/DebugLogProviderImpl.java deleted file mode 100644 index 08fe2dc..0000000 --- a/src/com/fr/plugin/core/DebugLogProviderImpl.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.fr.plugin.core; - -public class DebugLogProviderImpl { - public static void main(String[] args) { - - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/DialectCreatorImpl.java b/src/com/fr/plugin/core/DialectCreatorImpl.java deleted file mode 100644 index 167513c..0000000 --- a/src/com/fr/plugin/core/DialectCreatorImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.stable.UrlDriver; -import com.fr.stable.fun.impl.AbstractDialectCreator; - -import java.sql.Connection; - -public class DialectCreatorImpl extends AbstractDialectCreator { - @Override - public Class generate(UrlDriver urlDriver) { - return null; - } - - @Override - public Class generate(Connection connection) { - return null; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/EmailProcessorImpl.java b/src/com/fr/plugin/core/EmailProcessorImpl.java deleted file mode 100644 index 1c6af76..0000000 --- a/src/com/fr/plugin/core/EmailProcessorImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.stable.fun.impl.AbstractEmailProcessor; - -import java.util.HashMap; -import java.util.Map; - -public class EmailProcessorImpl extends AbstractEmailProcessor { - @Override - public Map loadMailProperties(String s, String s1, String s2, String s3, String s4) { - return new HashMap(); - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java b/src/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java deleted file mode 100644 index f75368f..0000000 --- a/src/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.stable.fun.impl.AbstractExcelExportCellValueProvider; -import com.fr.stable.script.CalculatorProvider; - -public class ExcelExportCellValueProviderImpl extends AbstractExcelExportCellValueProvider { - @Override - public Object getCellValue(Object o, Object o1, CalculatorProvider calculatorProvider) { - return null; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/ExcelExportProcessorImpl.java b/src/com/fr/plugin/core/ExcelExportProcessorImpl.java deleted file mode 100644 index 1fb65a6..0000000 --- a/src/com/fr/plugin/core/ExcelExportProcessorImpl.java +++ /dev/null @@ -1,6 +0,0 @@ -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/src/com/fr/plugin/core/FunctionDefineProviderImpl.java b/src/com/fr/plugin/core/FunctionDefineProviderImpl.java deleted file mode 100644 index 7983e36..0000000 --- a/src/com/fr/plugin/core/FunctionDefineProviderImpl.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.stable.fun.FunctionDefineProvider; - -public class FunctionDefineProviderImpl implements FunctionDefineProvider { - @Override - public int currentAPILevel() { - return 0; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/GraphDrawProcessorImpl.java b/src/com/fr/plugin/core/GraphDrawProcessorImpl.java deleted file mode 100644 index 7149894..0000000 --- a/src/com/fr/plugin/core/GraphDrawProcessorImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.stable.fun.impl.AbstractGraphDrawProcessor; - -import java.awt.Graphics; -import java.awt.Image; - -public class GraphDrawProcessorImpl extends AbstractGraphDrawProcessor { - @Override - public void paintImage(Graphics graphics, int i, int i1, Image image, int i2, int i3, int i4, int i5, int i6) { - - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/HttpAuthProcessorImpl.java b/src/com/fr/plugin/core/HttpAuthProcessorImpl.java deleted file mode 100644 index e7bfffb..0000000 --- a/src/com/fr/plugin/core/HttpAuthProcessorImpl.java +++ /dev/null @@ -1,10 +0,0 @@ -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/src/com/fr/plugin/core/JavaScriptFileHandlerImpl.java b/src/com/fr/plugin/core/JavaScriptFileHandlerImpl.java deleted file mode 100644 index 95ee326..0000000 --- a/src/com/fr/plugin/core/JavaScriptFileHandlerImpl.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.stable.fun.impl.AbstractJavaScriptFileHandler; - -public class JavaScriptFileHandlerImpl extends AbstractJavaScriptFileHandler { - @Override - public String[] pathsForFiles() { - return null; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/LogDBRecordProcessorImpl.java b/src/com/fr/plugin/core/LogDBRecordProcessorImpl.java deleted file mode 100644 index 40e22f2..0000000 --- a/src/com/fr/plugin/core/LogDBRecordProcessorImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.stable.fun.impl.AbstractLogDBRecordProcessor; - -public class LogDBRecordProcessorImpl extends AbstractLogDBRecordProcessor { - @Override - public String driver() { - return ""; - } - - @Override - public String url() { - return ""; - } - - @Override - public String username() { - return ""; - } - - @Override - public String password() { - return ""; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/LogProviderImpl.java b/src/com/fr/plugin/core/LogProviderImpl.java deleted file mode 100644 index 95b2aa9..0000000 --- a/src/com/fr/plugin/core/LogProviderImpl.java +++ /dev/null @@ -1,6 +0,0 @@ -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/src/com/fr/plugin/core/PrintCellValueProviderImpl.java b/src/com/fr/plugin/core/PrintCellValueProviderImpl.java deleted file mode 100644 index c93ed4b..0000000 --- a/src/com/fr/plugin/core/PrintCellValueProviderImpl.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.report.cell.cellattr.CellGUIAttr; -import com.fr.report.cell.cellattr.PageExportCellElement; -import com.fr.report.fun.impl.AbstractPrintCellValueProvider; - -public class PrintCellValueProviderImpl extends AbstractPrintCellValueProvider { - @Override - public Object getCellValue(PageExportCellElement pageExportCellElement, CellGUIAttr cellGUIAttr, Object o, int i, int i1) { - return null; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/core/RequestParameterCollectorImpl.java b/src/com/fr/plugin/core/RequestParameterCollectorImpl.java deleted file mode 100644 index 46de013..0000000 --- a/src/com/fr/plugin/core/RequestParameterCollectorImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.fr.plugin.core; - -import com.fr.stable.fun.impl.AbstractRequestParameterCollector; - -import javax.servlet.http.HttpServletRequest; -import java.util.Map; - -public class RequestParameterCollectorImpl extends AbstractRequestParameterCollector { - @Override - public Map 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/src/com/fr/plugin/core/RequestParameterHandlerImpl.java b/src/com/fr/plugin/core/RequestParameterHandlerImpl.java deleted file mode 100644 index 340bb25..0000000 --- a/src/com/fr/plugin/core/RequestParameterHandlerImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -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/src/com/fr/plugin/core/ServiceImpl.java b/src/com/fr/plugin/core/ServiceImpl.java deleted file mode 100644 index fb31d2b..0000000 --- a/src/com/fr/plugin/core/ServiceImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -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/src/com/fr/plugin/core/SpecialCharProcessorImpl.java b/src/com/fr/plugin/core/SpecialCharProcessorImpl.java deleted file mode 100644 index c52d360..0000000 --- a/src/com/fr/plugin/core/SpecialCharProcessorImpl.java +++ /dev/null @@ -1,10 +0,0 @@ -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/src/com/fr/plugin/core/TableDataProviderImpl.java b/src/com/fr/plugin/core/TableDataProviderImpl.java deleted file mode 100644 index 0e6b92f..0000000 --- a/src/com/fr/plugin/core/TableDataProviderImpl.java +++ /dev/null @@ -1,6 +0,0 @@ -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/src/com/fr/plugin/core/WidgetSwitcherImpl.java b/src/com/fr/plugin/core/WidgetSwitcherImpl.java deleted file mode 100644 index f5495c0..0000000 --- a/src/com/fr/plugin/core/WidgetSwitcherImpl.java +++ /dev/null @@ -1,10 +0,0 @@ -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/src/com/fr/plugin/core/XMLFileManagerProviderImpl.java b/src/com/fr/plugin/core/XMLFileManagerProviderImpl.java deleted file mode 100644 index 16f7155..0000000 --- a/src/com/fr/plugin/core/XMLFileManagerProviderImpl.java +++ /dev/null @@ -1,7 +0,0 @@ -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/src/com/fr/plugin/design/CellAttributeProviderImpl.java b/src/com/fr/plugin/design/CellAttributeProviderImpl.java deleted file mode 100644 index d0cb46d..0000000 --- a/src/com/fr/plugin/design/CellAttributeProviderImpl.java +++ /dev/null @@ -1,11 +0,0 @@ -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/src/com/fr/plugin/design/CellWidgetOptionProviderImpl.java b/src/com/fr/plugin/design/CellWidgetOptionProviderImpl.java deleted file mode 100644 index e236aff..0000000 --- a/src/com/fr/plugin/design/CellWidgetOptionProviderImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -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/src/com/fr/plugin/design/ConnectionProviderImpl.java b/src/com/fr/plugin/design/ConnectionProviderImpl.java deleted file mode 100644 index 46a6015..0000000 --- a/src/com/fr/plugin/design/ConnectionProviderImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -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/src/com/fr/plugin/design/FormWidgetOptionProviderImpl.java b/src/com/fr/plugin/design/FormWidgetOptionProviderImpl.java deleted file mode 100644 index 0fccb52..0000000 --- a/src/com/fr/plugin/design/FormWidgetOptionProviderImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -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/src/com/fr/plugin/design/GlobalListenerProviderImpl.java b/src/com/fr/plugin/design/GlobalListenerProviderImpl.java deleted file mode 100644 index 169cf08..0000000 --- a/src/com/fr/plugin/design/GlobalListenerProviderImpl.java +++ /dev/null @@ -1,12 +0,0 @@ -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/src/com/fr/plugin/design/HighlightProviderImpl.java b/src/com/fr/plugin/design/HighlightProviderImpl.java deleted file mode 100644 index ff5ab5c..0000000 --- a/src/com/fr/plugin/design/HighlightProviderImpl.java +++ /dev/null @@ -1,17 +0,0 @@ -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/src/com/fr/plugin/design/IndentationUnitProcessorImpl.java b/src/com/fr/plugin/design/IndentationUnitProcessorImpl.java deleted file mode 100644 index 36aa2e4..0000000 --- a/src/com/fr/plugin/design/IndentationUnitProcessorImpl.java +++ /dev/null @@ -1,6 +0,0 @@ -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/src/com/fr/plugin/design/JavaScriptActionProviderImpl.java b/src/com/fr/plugin/design/JavaScriptActionProviderImpl.java deleted file mode 100644 index abda85c..0000000 --- a/src/com/fr/plugin/design/JavaScriptActionProviderImpl.java +++ /dev/null @@ -1,12 +0,0 @@ -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/src/com/fr/plugin/design/ParameterWidgetOptionProviderImpl.java b/src/com/fr/plugin/design/ParameterWidgetOptionProviderImpl.java deleted file mode 100644 index 1bbaa88..0000000 --- a/src/com/fr/plugin/design/ParameterWidgetOptionProviderImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -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/src/com/fr/plugin/design/PreviewProviderImpl.java b/src/com/fr/plugin/design/PreviewProviderImpl.java deleted file mode 100644 index d182b6c..0000000 --- a/src/com/fr/plugin/design/PreviewProviderImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -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/src/com/fr/plugin/design/ShortCutImpl.java b/src/com/fr/plugin/design/ShortCutImpl.java deleted file mode 100644 index c10dfe9..0000000 --- a/src/com/fr/plugin/design/ShortCutImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -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/src/com/fr/plugin/design/SubmitProviderImpl.java b/src/com/fr/plugin/design/SubmitProviderImpl.java deleted file mode 100644 index e0ae021..0000000 --- a/src/com/fr/plugin/design/SubmitProviderImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -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/src/com/fr/plugin/design/TableDataDefineProviderImpl.java b/src/com/fr/plugin/design/TableDataDefineProviderImpl.java deleted file mode 100644 index ba8b9e0..0000000 --- a/src/com/fr/plugin/design/TableDataDefineProviderImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -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/src/com/fr/plugin/design/TitlePlaceProcessorImpl.java b/src/com/fr/plugin/design/TitlePlaceProcessorImpl.java deleted file mode 100644 index b8f959e..0000000 --- a/src/com/fr/plugin/design/TitlePlaceProcessorImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -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/src/com/fr/plugin/design/UIFormulaProcessorImpl.java b/src/com/fr/plugin/design/UIFormulaProcessorImpl.java deleted file mode 100644 index 0c04c5d..0000000 --- a/src/com/fr/plugin/design/UIFormulaProcessorImpl.java +++ /dev/null @@ -1,16 +0,0 @@ -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/src/com/fr/plugin/design/WidgetDesignHandlerImpl.java b/src/com/fr/plugin/design/WidgetDesignHandlerImpl.java deleted file mode 100644 index 10d0c8f..0000000 --- a/src/com/fr/plugin/design/WidgetDesignHandlerImpl.java +++ /dev/null @@ -1,11 +0,0 @@ -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/src/com/fr/plugin/report/ActorProviderImpl.java b/src/com/fr/plugin/report/ActorProviderImpl.java deleted file mode 100644 index 09fb693..0000000 --- a/src/com/fr/plugin/report/ActorProviderImpl.java +++ /dev/null @@ -1,11 +0,0 @@ -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/src/com/fr/plugin/report/CellTooltipProcessorImpl.java b/src/com/fr/plugin/report/CellTooltipProcessorImpl.java deleted file mode 100644 index 9840b74..0000000 --- a/src/com/fr/plugin/report/CellTooltipProcessorImpl.java +++ /dev/null @@ -1,12 +0,0 @@ -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/src/com/fr/plugin/report/ExcelExportAppProviderImpl.java b/src/com/fr/plugin/report/ExcelExportAppProviderImpl.java deleted file mode 100644 index 24e7e04..0000000 --- a/src/com/fr/plugin/report/ExcelExportAppProviderImpl.java +++ /dev/null @@ -1,10 +0,0 @@ -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/src/com/fr/plugin/report/ExcelImportProcessor.java b/src/com/fr/plugin/report/ExcelImportProcessor.java deleted file mode 100644 index 75932d1..0000000 --- a/src/com/fr/plugin/report/ExcelImportProcessor.java +++ /dev/null @@ -1,14 +0,0 @@ -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/src/com/fr/plugin/report/ExportEncodeProviderImpl.java b/src/com/fr/plugin/report/ExportEncodeProviderImpl.java deleted file mode 100644 index 700d368..0000000 --- a/src/com/fr/plugin/report/ExportEncodeProviderImpl.java +++ /dev/null @@ -1,6 +0,0 @@ -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/src/com/fr/plugin/report/ExportExtensionProcessorImpl.java b/src/com/fr/plugin/report/ExportExtensionProcessorImpl.java deleted file mode 100644 index b874a58..0000000 --- a/src/com/fr/plugin/report/ExportExtensionProcessorImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -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/src/com/fr/plugin/report/ExportOperateProviderImpl.java b/src/com/fr/plugin/report/ExportOperateProviderImpl.java deleted file mode 100644 index 84c2b71..0000000 --- a/src/com/fr/plugin/report/ExportOperateProviderImpl.java +++ /dev/null @@ -1,16 +0,0 @@ -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/src/com/fr/plugin/report/FromExportProcessorImpl.java b/src/com/fr/plugin/report/FromExportProcessorImpl.java deleted file mode 100644 index 0818d01..0000000 --- a/src/com/fr/plugin/report/FromExportProcessorImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -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/src/com/fr/plugin/report/PageCalObjectProcessorImpl.java b/src/com/fr/plugin/report/PageCalObjectProcessorImpl.java deleted file mode 100644 index 50c7866..0000000 --- a/src/com/fr/plugin/report/PageCalObjectProcessorImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -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/src/com/fr/plugin/report/ReportPretreatmentProcessorImpl.java b/src/com/fr/plugin/report/ReportPretreatmentProcessorImpl.java deleted file mode 100644 index 16c2bb3..0000000 --- a/src/com/fr/plugin/report/ReportPretreatmentProcessorImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -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/src/com/fr/privilege/RSAUtil.java b/src/com/fr/privilege/RSAUtil.java deleted file mode 100644 index d9d98e8..0000000 --- a/src/com/fr/privilege/RSAUtil.java +++ /dev/null @@ -1,205 +0,0 @@ -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/src/com/fr/privilege/TestPasswordValidator.java b/src/com/fr/privilege/TestPasswordValidator.java deleted file mode 100644 index 973278a..0000000 --- a/src/com/fr/privilege/TestPasswordValidator.java +++ /dev/null @@ -1,21 +0,0 @@ -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/src/com/fr/privilege/TestPasswordValidatorRSA.java b/src/com/fr/privilege/TestPasswordValidatorRSA.java deleted file mode 100644 index 0e4c229..0000000 --- a/src/com/fr/privilege/TestPasswordValidatorRSA.java +++ /dev/null @@ -1,33 +0,0 @@ -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/src/com/fr/privilege/TestPasswordValidatorUser.java b/src/com/fr/privilege/TestPasswordValidatorUser.java deleted file mode 100644 index 8642817..0000000 --- a/src/com/fr/privilege/TestPasswordValidatorUser.java +++ /dev/null @@ -1,46 +0,0 @@ -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/src/com/fr/test/gauthority.java b/src/com/fr/test/gauthority.java deleted file mode 100644 index 19dd38d..0000000 --- a/src/com/fr/test/gauthority.java +++ /dev/null @@ -1,77 +0,0 @@ -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/src/main/java/SimpleService.java b/src/main/java/SimpleService.java new file mode 100644 index 0000000..0c3c52c --- /dev/null +++ b/src/main/java/SimpleService.java @@ -0,0 +1,11 @@ +public class SimpleService +{ + public String getGreeting(String name) + { + return "你好 " + name; + } + public int getPrice() + { + return new java.util.Random().nextInt(1000); + } +} \ No newline at end of file diff --git a/src/main/java/TestWS2TDClient.java b/src/main/java/TestWS2TDClient.java new file mode 100644 index 0000000..3886142 --- /dev/null +++ b/src/main/java/TestWS2TDClient.java @@ -0,0 +1,8 @@ +public class TestWS2TDClient { + public String[][] getTD() { + String[][] a = { { "城市", "销售员", "销售额" }, { "江苏", "Anna", "230" }, { "江苏", "Alex", "190" }, + + { "江苏", "Jack", "320" }, { "江苏", "Apple", "210" }, { "浙江", "Faye", "150" }, { "浙江", "Sammi", "280" } }; + return a; + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/FrFilter.java b/src/main/java/com/fr/FrFilter.java new file mode 100644 index 0000000..c90d9b4 --- /dev/null +++ b/src/main/java/com/fr/FrFilter.java @@ -0,0 +1,111 @@ +package com.fr; + +import com.fr.data.NetworkHelper; +import com.fr.decision.mobile.terminal.TerminalHandler; +import com.fr.decision.webservice.utils.DecisionServiceConstants; +import com.fr.decision.webservice.v10.login.LoginService; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.security.JwtUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.web.Device; +import org.jasig.cas.client.validation.Assertion; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +/** + * Created by Zed on 2018/9/11. + */ +public class FrFilter implements Filter { + + public FrFilter() { + + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { + FineLoggerFactory.getLogger().info("fr cas login"); + HttpServletRequest req = (HttpServletRequest) servletRequest; + HttpServletResponse res = (HttpServletResponse) servletResponse; + HttpSession session = req.getSession(true); + FineLoggerFactory.getLogger().info("URL:" + req.getRequestURI()); + String username; + //获取cas传递过来的username + Object object = req.getSession().getAttribute("_const_cas_assertion_"); + if (object != null) { + Assertion assertion = (Assertion) object; + username = assertion.getPrincipal().getName(); + } else { + username = (String) session.getAttribute("edu.yale.its.tp.cas.client.filter.user"); + } + + try { + //用户名为空,登录请求有问题,直接报错 + if (StringUtils.isNotEmpty(username)) { + FineLoggerFactory.getLogger().error("username:" + username); + //获取请求携带的token + Object oldToken = session.getAttribute(DecisionServiceConstants.FINE_AUTH_TOKEN_NAME); + + //token不存在,或者token过期了,走后台登录方法 + if (oldToken == null || !checkTokenValid(req, (String) oldToken, username)) { + login(req, res, session, username); + filterChain.doFilter(req, res); + } else { + //放行 + filterChain.doFilter(req, res); + FineLoggerFactory.getLogger().info("no need"); + } + } else { + throw new Exception("username is empty"); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + /** + * 后台登录方法 + */ + private void login(HttpServletRequest req, HttpServletResponse res, HttpSession session, String username) throws Exception { + String token = LoginService.getInstance().login(req, res, username); + session.setAttribute(DecisionServiceConstants.FINE_AUTH_TOKEN_NAME, token); + FineLoggerFactory.getLogger().info("fr FrFilter is over with username is ###" + username); + } + + /** + * 校验token是否有效 + */ + private boolean checkTokenValid(HttpServletRequest req, String token, String currentUserName) { + try { + //当前登录用户和token对应的用户名不同,需要重新生成token + if (!ComparatorUtils.equals(currentUserName, JwtUtils.parseJWT(token).getSubject())) { + FineLoggerFactory.getLogger().info("username changed:" + currentUserName); + return false; + } + Device device = NetworkHelper.getDevice(req); + LoginService.getInstance().loginStatusValid(token, TerminalHandler.getTerminal(req, device)); + return true; + } catch (Exception ignore) { + } + + return false; + } + + @Override + public void destroy() { + + } +} diff --git a/src/main/java/com/fr/FrLoginFilter.java b/src/main/java/com/fr/FrLoginFilter.java new file mode 100644 index 0000000..30aaa56 --- /dev/null +++ b/src/main/java/com/fr/FrLoginFilter.java @@ -0,0 +1,60 @@ +package com.fr; + +import com.fr.decision.authority.data.User; +import com.fr.decision.webservice.exception.user.UserNotExistException; +import com.fr.decision.webservice.v10.login.LoginService; +import com.fr.decision.webservice.v10.login.TokenResource; +import com.fr.decision.webservice.v10.user.UserService; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; +import com.fr.web.utils.WebUtils; +import java.io.IOException; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class FrLoginFilter implements Filter { + public FrLoginFilter() { + } + + public void init(FilterConfig filterConfig) throws ServletException { + } + + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { + HttpServletRequest req = (HttpServletRequest)servletRequest; + HttpServletResponse res = (HttpServletResponse)servletResponse; + String username = WebUtils.getHTTPRequestParameter(req, "username"); + + try { + if (StringUtils.isNotEmpty(username)) { + FineLoggerFactory.getLogger().error("username:" + username); + User user = UserService.getInstance().getUserByUserName(username); + if (user == null) { + throw new UserNotExistException(); + } + + String oldToken = TokenResource.COOKIE.getToken(req); + if (oldToken == null) { + String token = LoginService.getInstance().login(req, res, username); + req.setAttribute("fine_auth_token", token); + filterChain.doFilter(req, res); + } else { + filterChain.doFilter(req, res); + } + } else { + filterChain.doFilter(req, res); + } + } catch (Exception var10) { + FineLoggerFactory.getLogger().error(var10.getMessage(), var10); + } + + } + + public void destroy() { + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/HttpUtil.java b/src/main/java/com/fr/HttpUtil.java new file mode 100644 index 0000000..39fd825 --- /dev/null +++ b/src/main/java/com/fr/HttpUtil.java @@ -0,0 +1,228 @@ +package com.fr; + +import java.security.*; +import javax.net.ssl.*; +import com.fr.third.org.hsqldb.lib.*; +import java.net.*; +import java.io.*; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.HashMap; +import java.util.Map; + +public class HttpUtil +{ + private static final String DEFAULT_CHARSET = "UTF-8"; + private static final String METHOD_POST = "POST"; + private static final String METHOD_GET = "GET"; + private static final int CONNECTTIMEOUT = 5000; + private static final int READTIMEOUT = 5000; + + private static class DefaultTrustManager implements X509TrustManager { + + @Override + public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { + + } + + @Override + public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { + + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + } + private static HttpURLConnection getConnection(final URL url, final String method, final String ctype) throws IOException { + HttpURLConnection conn = null; + if ("https".equals(url.getProtocol())) { + SSLContext ctx = null; + try { + ctx = SSLContext.getInstance("TLS"); + ctx.init(new KeyManager[0], new TrustManager[] { new DefaultTrustManager() }, new SecureRandom()); + } + catch (Exception e) { + throw new IOException(e); + } + final HttpsURLConnection connHttps = (HttpsURLConnection)url.openConnection(); + connHttps.setSSLSocketFactory(ctx.getSocketFactory()); + connHttps.setHostnameVerifier(new HostnameVerifier() { + @Override + public boolean verify(String s, SSLSession sslSession) { + return true; + } + }); + conn = connHttps; + } + else { + conn = (HttpURLConnection)url.openConnection(); + } + conn.setRequestMethod(method); + conn.setDoInput(true); + conn.setDoOutput(true); + conn.setRequestProperty("User-Agent", "quantangle- apiclient-java"); + conn.setRequestProperty("Content-Type", ctype); + conn.setRequestProperty("Connection", "Keep-Alive"); + return conn; + } + + public static String doGet(final String url, final Map params) throws IOException { + return doGet(url, params, "UTF-8"); + } + + public static String doGet(String url, final Map params, final String charset) throws IOException { + if (StringUtil.isEmpty(url) || params == null) { + return null; + } + String response = ""; + url = url + "?" + buildQuery(params, charset); + HttpURLConnection conn = null; + final String ctype = "application/x-www-form- urlencoded;charset=" + charset; + conn = getConnection(new URL(url), "GET", ctype); + response = getResponseAsString(conn); + return response; + } + + public static String doPost(final String url, final Map params) throws IOException { + return doPost(url, params, 5000, 5000); + } + + public static String doPost(final String url, final Map params, final int connectTimeOut, final int readTimeOut) throws IOException { + return doPost(url, params, "UTF-8", connectTimeOut, readTimeOut); + } + + public static String doPost(final String url, final Map params, final String charset, final int connectTimeOut, final int readTimeOut) throws IOException { + HttpURLConnection conn = null; + String response = ""; + final String ctype = "application/x-www-form- urlencoded;charset=" + charset; + conn = getConnection(new URL(url), "POST", ctype); + conn.setConnectTimeout(connectTimeOut); + conn.setReadTimeout(readTimeOut); + conn.getOutputStream().write(buildQuery(params, charset).getBytes(charset)); + response = getResponseAsString(conn); + return response; + } + + public static String buildQuery(final Map params, final String charset) { + if (params == null || params.isEmpty()) { + return null; + } + final StringBuilder sb = new StringBuilder(); + boolean first = true; + for (final Map.Entry entry : params.entrySet()) { + if (first) { + first = false; + } + else { + sb.append("&"); + } + final String key = entry.getKey(); + final String value = entry.getValue(); + if (!StringUtil.isEmpty(key) && !StringUtil.isEmpty(value)) { + try { + sb.append(key).append("=").append(URLEncoder.encode(value, charset)); + } + catch (UnsupportedEncodingException ex) {} + } + } + return sb.toString(); + } + + public static Map splitQuery(final String query, final String charset) { + final Map ret = new HashMap(); + if (!StringUtil.isEmpty(query)) { + final String[] split2; + final String[] splits = split2 = query.split("\\&"); + for (final String split : split2) { + final String[] keyAndValue = split.split("\\="); + boolean flag = true; + for (int i = 0, len = keyAndValue.length; i < len; ++i) { + if (StringUtil.isEmpty(keyAndValue[i])) { + flag = false; + break; + } + } + if (flag && keyAndValue.length == 2) { + try { + ret.put(keyAndValue[0], URLDecoder.decode(keyAndValue[1], charset)); + } + catch (UnsupportedEncodingException ex) {} + } + } + } + return ret; + } + + private static byte[] getTextEntry(final String fieldName, final String fieldValue, final String charset) throws IOException { + final StringBuilder entry = new StringBuilder(); + entry.append("Content-Disposition:form-data;name=\""); + entry.append(fieldName); + entry.append("\"\r\nContent-Type:text/plain\r\n\r\n"); + entry.append(fieldValue); + return entry.toString().getBytes(charset); + } + + private static byte[] getFileEntry(final String fieldName, final String fileName, final String mimeType, final String charset) throws IOException { + final StringBuilder entry = new StringBuilder(); + entry.append("Content-Disposition:form-data;name=\""); + entry.append(fieldName); + entry.append("\";filename=\""); + entry.append(fileName); + entry.append("\"\r\nContent-Type:"); + entry.append(mimeType); + entry.append("\r\n\r\n"); + return entry.toString().getBytes(charset); + } + + private static String getResponseAsString(final HttpURLConnection conn) throws IOException { + final String charset = getResponseCharset(conn.getContentType()); + final InputStream es = conn.getErrorStream(); + if (es == null) { + return getStreamAsString(conn.getInputStream(), charset); + } + final String msg = getStreamAsString(es, charset); + if (StringUtil.isEmpty(msg)) { + throw new IOException("{\"" + conn.getResponseCode() + "\":\"" + conn.getResponseMessage() + "\"}"); + } + throw new IOException(msg); + } + + private static String getStreamAsString(final InputStream input, final String charset) throws IOException { + final StringBuilder sb = new StringBuilder(); + BufferedReader bf = null; + try { + bf = new BufferedReader(new InputStreamReader(input, charset)); + String str; + while ((str = bf.readLine()) != null) { + sb.append(str); + } + return sb.toString(); + } + finally { + if (bf != null) { + bf.close(); + bf = null; + } + } + } + + private static String getResponseCharset(final String ctype) { + String charset = "UTF-8"; + if (!StringUtil.isEmpty(ctype)) { + final String[] split; + final String[] params = split = ctype.split("\\;"); + for (String param : split) { + param = param.trim(); + if (param.startsWith("charset")) { + final String[] pair = param.split("\\="); + if (pair.length == 2) { + charset = pair[1].trim(); + } + } + } + } + return charset; + } +} diff --git a/src/main/java/com/fr/SSLConnectionClient.java b/src/main/java/com/fr/SSLConnectionClient.java new file mode 100644 index 0000000..7429154 --- /dev/null +++ b/src/main/java/com/fr/SSLConnectionClient.java @@ -0,0 +1,111 @@ +package com.fr; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.net.URL; +import java.net.URLConnection; +import java.security.SecureRandom; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.KeyManager; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.utils.OAuthUtils; + +public class SSLConnectionClient implements HttpClient { + public SSLConnectionClient() { + } + + public T execute(OAuthClientRequest request, Map headers, String requestMethod, Class responseClass) throws OAuthSystemException, OAuthProblemException { + String responseBody = null; + URLConnection c = null; + boolean var7 = false; + + int responseCode; + try { + URL url = new URL(request.getLocationUri()); + c = url.openConnection(); + responseCode = -1; + if (c instanceof HttpsURLConnection) { + HttpsURLConnection httpsURLConnection = (HttpsURLConnection) c; + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init((KeyManager[]) null, new TrustManager[]{new TrustAnyTrustManager()}, new SecureRandom()); + httpsURLConnection.setSSLSocketFactory(sslContext.getSocketFactory()); + httpsURLConnection.setHostnameVerifier(new TrustAnyHostnameVerifier()); + if (headers != null && !headers.isEmpty()) { + Iterator var11 = headers.entrySet().iterator(); + + while (var11.hasNext()) { + Entry header = (Entry) var11.next(); + httpsURLConnection.addRequestProperty((String) header.getKey(), (String) header.getValue()); + } + } + + if (!OAuthUtils.isEmpty(requestMethod)) { + httpsURLConnection.setRequestMethod(requestMethod); + if (requestMethod.equals("POST")) { + httpsURLConnection.setDoOutput(true); + OutputStream ost = httpsURLConnection.getOutputStream(); + PrintWriter pw = new PrintWriter(ost); + pw.print(request.getBody()); + pw.flush(); + pw.close(); + } + } else { + httpsURLConnection.setRequestMethod("GET"); + } + + httpsURLConnection.connect(); + responseCode = httpsURLConnection.getResponseCode(); + InputStream inputStream; + if (responseCode == 400) { + inputStream = httpsURLConnection.getErrorStream(); + } else { + inputStream = httpsURLConnection.getInputStream(); + } + + responseBody = OAuthUtils.saveStreamAsString(inputStream); + } + } catch (Exception var13) { + throw new OAuthSystemException(var13); + } + + return OAuthClientResponseFactory.createCustomResponse(responseBody, c.getContentType(), responseCode, responseClass); + } + + public void shutdown() { + } + + static class TrustAnyTrustManager implements X509TrustManager { + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[]{}; + } + } + + static class TrustAnyHostnameVerifier implements HostnameVerifier { + public boolean verify(String hostname, SSLSession session) { + return true; + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/StartFRDesigner.java b/src/main/java/com/fr/StartFRDesigner.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/StartFRDesigner.java rename to src/main/java/com/fr/StartFRDesigner.java diff --git a/src/main/java/com/fr/Test2.java b/src/main/java/com/fr/Test2.java new file mode 100644 index 0000000..c2910f2 --- /dev/null +++ b/src/main/java/com/fr/Test2.java @@ -0,0 +1,58 @@ +import com.fr.cert.token.JwtBuilder; +import com.fr.cert.token.Jwts; +import com.fr.cert.token.SignatureAlgorithm; +import sun.misc.BASE64Encoder; +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.util.Date; + +public class Test2 { + + public static void main(String[] args) { + //数字签名有效时长 + long validTime = 30 * 60 * 1000; + //数字签名内容,以访问资源的相对路径作为内容 + String path = "GettingStarted.cpt"; + //数字签名用的HS256的密钥 + String key = createSecret(); + //生成fine_digital_signature + String fine_digital_signature = createJwt("", "", path, validTime, key); + //输出密钥 + System.out.println(key); + //输出fine_digital_signature + System.out.println(fine_digital_signature); + } + + private static String createJwt(String issuer, String id, String subject, long validTime, String key) { + SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; + Date currentTime = new Date(); + Date expirationTime = new Date(currentTime.getTime() + validTime); + JwtBuilder builder = Jwts.builder() + .setIssuer(issuer) + .setSubject(subject) + .setIssuedAt(currentTime) + .setExpiration(expirationTime) + .setId(id) + .signWith(signatureAlgorithm, key); + return builder.compact(); + } + + private static String createSecret() { + try { + //secret可以自定义的 + String secret = "2222222"; + String message = ""; + Mac sha256Hmac = Mac.getInstance("HmacSHA256"); + SecretKeySpec secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256"); + sha256Hmac.init(secret_key); + BASE64Encoder encoder = new BASE64Encoder(); + String hash = encoder.encode(sha256Hmac.doFinal(message.getBytes())); + return hash; + + } catch (Exception e) { + System.out.println(e.getMessage()); + } + return ""; + } + +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/ArrayTableDataDemo.java b/src/main/java/com/fr/data/ArrayTableDataDemo.java similarity index 97% rename from plugin-report-doc-demo/src/com/fr/data/ArrayTableDataDemo.java rename to src/main/java/com/fr/data/ArrayTableDataDemo.java index cc6a50e..c474161 100644 --- a/plugin-report-doc-demo/src/com/fr/data/ArrayTableDataDemo.java +++ b/src/main/java/com/fr/data/ArrayTableDataDemo.java @@ -1,8 +1,5 @@ package com.fr.data; -/** - * @author fanruan - */ public class ArrayTableDataDemo extends AbstractTableData { /** * 定义程序数据集的列名与数据保存位置 @@ -42,4 +39,4 @@ public class ArrayTableDataDemo extends AbstractTableData { public Object getValueAt(int rowIndex, int columnIndex) { return rowData[rowIndex][columnIndex]; } -} +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/Commit3.java b/src/main/java/com/fr/data/Commit3.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/Commit3.java rename to src/main/java/com/fr/data/Commit3.java diff --git a/plugin-report-doc-demo/src/com/fr/data/CustomTableData.java b/src/main/java/com/fr/data/CustomTableData.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/CustomTableData.java rename to src/main/java/com/fr/data/CustomTableData.java diff --git a/src/com/fr/data/DataModelDemo.java b/src/main/java/com/fr/data/DataModelDemo.java similarity index 80% rename from src/com/fr/data/DataModelDemo.java rename to src/main/java/com/fr/data/DataModelDemo.java index 2de39d6..64f5c03 100644 --- a/src/com/fr/data/DataModelDemo.java +++ b/src/main/java/com/fr/data/DataModelDemo.java @@ -1,50 +1,29 @@ 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 - */ +import javax.naming.*; +import java.util.*; +import examples.ejb.ejb20.basic.beanManaged.*; public class DataModelDemo extends AbstractTableData { private String[] columnNames; private ArrayList valueList = null; - public DataModelDemo() { - String[] columnNames = {"Name", "Score"}; + 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() { // 确保只被执行一次 @@ -72,7 +51,7 @@ public class DataModelDemo extends AbstractTableData { Account bigAccount = (Account) iter.next(); objArray = new Object[2]; objArray[0] = bigAccount.getPrimaryKey(); - objArray[1] = bigAccount.balance(); + objArray[1] = new Double(bigAccount.balance()); // 在valueList中加入这一行数据 valueList.add(objArray); } diff --git a/plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob1.java b/src/main/java/com/fr/data/DemoSubmitJob1.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob1.java rename to src/main/java/com/fr/data/DemoSubmitJob1.java diff --git a/plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob2.java b/src/main/java/com/fr/data/DemoSubmitJob2.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/DemoSubmitJob2.java rename to src/main/java/com/fr/data/DemoSubmitJob2.java diff --git a/plugin-report-doc-demo/src/com/fr/data/DemoTotalSubmitJob.java b/src/main/java/com/fr/data/DemoTotalSubmitJob.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/DemoTotalSubmitJob.java rename to src/main/java/com/fr/data/DemoTotalSubmitJob.java diff --git a/plugin-report-doc-demo/src/com/fr/data/GetXmlData.java b/src/main/java/com/fr/data/GetXmlData.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/GetXmlData.java rename to src/main/java/com/fr/data/GetXmlData.java diff --git a/src/com/fr/data/GetXmlDate.java b/src/main/java/com/fr/data/GetXmlDate.java similarity index 93% rename from src/com/fr/data/GetXmlDate.java rename to src/main/java/com/fr/data/GetXmlDate.java index ed6b2ff..96b65cf 100644 --- a/src/com/fr/data/GetXmlDate.java +++ b/src/main/java/com/fr/data/GetXmlDate.java @@ -1,16 +1,15 @@ 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; +import com.fr.stable.xml.XMLReadable; +import com.fr.stable.xml.XMLableReader; public class GetXmlDate { - // 定义返回值数组 + // 定义返回值数组 private String[] Value = new String[3]; - // 定义查询的name值 + // 定义查询的name值 private String[] Name = null; protected String[] readerXMLSource(InputStream in, String[] name) @@ -35,7 +34,7 @@ public class GetXmlDate { if (reader.getTagName().equals("Field")) { Field field = new Field(); reader.readXMLObject(field); - // 获得name对应的value值 + // 获得name对应的value值 if (Name[0].equals(field.name)) { Value[0] = field.value; } else if (Name[1].equals(field.name)) { @@ -48,7 +47,7 @@ public class GetXmlDate { } } - // 定义每个field的结构 + // 定义每个field的结构 private class Field implements XMLReadable { private String name; private String type; diff --git a/plugin-report-doc-demo/src/com/fr/data/MobileTableWsdlDataDemo.java b/src/main/java/com/fr/data/MobileTableWsdlDataDemo.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/MobileTableWsdlDataDemo.java rename to src/main/java/com/fr/data/MobileTableWsdlDataDemo.java diff --git a/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo.java b/src/main/java/com/fr/data/MobileWsdlTableDataDemo.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo.java rename to src/main/java/com/fr/data/MobileWsdlTableDataDemo.java diff --git a/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo1.java b/src/main/java/com/fr/data/MobileWsdlTableDataDemo1.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo1.java rename to src/main/java/com/fr/data/MobileWsdlTableDataDemo1.java diff --git a/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo2.java b/src/main/java/com/fr/data/MobileWsdlTableDataDemo2.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemo2.java rename to src/main/java/com/fr/data/MobileWsdlTableDataDemo2.java diff --git a/plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemoPara.java b/src/main/java/com/fr/data/MobileWsdlTableDataDemoPara.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/MobileWsdlTableDataDemoPara.java rename to src/main/java/com/fr/data/MobileWsdlTableDataDemoPara.java diff --git a/plugin-report-doc-demo/src/com/fr/data/ParamSAPDataTest.java b/src/main/java/com/fr/data/ParamSAPDataTest.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/ParamSAPDataTest.java rename to src/main/java/com/fr/data/ParamSAPDataTest.java diff --git a/src/com/fr/data/ParamTableDataDemo.java b/src/main/java/com/fr/data/ParamTableDataDemo.java similarity index 97% rename from src/com/fr/data/ParamTableDataDemo.java rename to src/main/java/com/fr/data/ParamTableDataDemo.java index 8024cfa..ba217bf 100644 --- a/src/com/fr/data/ParamTableDataDemo.java +++ b/src/main/java/com/fr/data/ParamTableDataDemo.java @@ -3,7 +3,6 @@ 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; @@ -129,7 +128,7 @@ public class ParamTableDataDemo extends AbstractTableData { public Connection getConnection() { String driverName = "org.sqlite.JDBC"; - String url = "jdbc:sqlite://E:\\8.0-master\\env\\WebReport\\FRDemo.db"; + String url = "jdbc:sqlite:////Applications//FineReport10_325//webapps//webroot//help//FRDemo.db"; String username = ""; String password = ""; Connection con; diff --git a/src/com/fr/data/WebServiceTableData.java b/src/main/java/com/fr/data/WebServiceTableData.java similarity index 80% rename from src/com/fr/data/WebServiceTableData.java rename to src/main/java/com/fr/data/WebServiceTableData.java index 127f658..b9f8e51 100644 --- a/src/com/fr/data/WebServiceTableData.java +++ b/src/main/java/com/fr/data/WebServiceTableData.java @@ -1,47 +1,39 @@ package com.fr.data; -import com.fr.general.data.TableDataException; +import javax.xml.namespace.QName; import org.apache.axis.client.Call; import org.apache.axis.client.Service; +import com.fr.data.AbstractTableData; +import com.fr.general.data.TableDataException; -import javax.xml.namespace.QName; - -public class WebServiceTableData extends AbstractTableData { +public class WebServiceTableData extends AbstractTableData{ private String[][] data; public WebServiceTableData() { - this.data = this.getWebServiceTableData(); + this.data = this.createData(); } //获取列数 - - @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() { + public String[][] createData() { try { String endpoint = "http://localhost:8080/axis/TestWS2TDClient.jws"; Service service = new Service(); @@ -49,10 +41,11 @@ public class WebServiceTableData extends AbstractTableData { call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperationName(new QName("http://localhost:8080/axis/TestWS2TDClient.jws", "getTD")); - return (String[][]) call.invoke(new Object[]{}); + String[][] ret = (String[][])call.invoke(new Object[] {}); + return ret; } catch (Exception e) { e.printStackTrace(); } - return new String[][]{}; + return new String[][] {}; } } \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/data/WebServiceWsdlTableDataDemo2.java b/src/main/java/com/fr/data/WebServiceWsdlTableDataDemo2.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/WebServiceWsdlTableDataDemo2.java rename to src/main/java/com/fr/data/WebServiceWsdlTableDataDemo2.java diff --git a/plugin-report-doc-demo/src/com/fr/data/XMLColumnNameType4Demo.java b/src/main/java/com/fr/data/XMLColumnNameType4Demo.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/XMLColumnNameType4Demo.java rename to src/main/java/com/fr/data/XMLColumnNameType4Demo.java diff --git a/src/com/fr/data/XMLDemoTableData.java b/src/main/java/com/fr/data/XMLDemoTableData.java similarity index 65% rename from src/com/fr/data/XMLDemoTableData.java rename to src/main/java/com/fr/data/XMLDemoTableData.java index 5477b97..f9ed76b 100644 --- a/src/com/fr/data/XMLDemoTableData.java +++ b/src/main/java/com/fr/data/XMLDemoTableData.java @@ -1,38 +1,36 @@ package com.fr.data; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.*; +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.events.XMLEvent; 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; +import com.fr.config.holder.impl.xml.XmlColConf; /** - * XMLDemoTableData - *

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

- * AbstractParameterTableData 包装了有参数数据集的基本实现 + * 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")); + // 定义需要的参数,这里定义一个参数,参数名为filename,给其一个默认值"Northwind.xml" + Parameter[] parameters = new Parameter[1]; + parameters[0] = new Parameter("filename", "Northwind"); + setParameters(parameters); } /** @@ -42,52 +40,53 @@ public class XMLDemoTableData extends AbstractParameterTableData { */ @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(); + filename = (String)params[i].getValue(); } } String filePath; if (StringUtils.isBlank(filename)) { - filePath = "D://DefaultFile.xml"; + filePath = "/Users/susie/Downloads/DefaultFile.xml"; } else { - filePath = "D://" + filename + ".xml"; + filePath = "/Users/susie/Downloads/" + 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(); + // 定义需要解析的数据列,机器 +// 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); + readCol(reader,list); in.close(); } catch (Exception e) { - // TODO Auto-generated catch block + // TODO Auto-generated catch block e.printStackTrace(); } - XMLColumnNameType4Demo[] columns = (XMLColumnNameType4Demo[]) list.toArray(new XMLColumnNameType4Demo[0]); + XMLColumnNameType4Demo[] columns=(XMLColumnNameType4Demo[])list.toArray(new XMLColumnNameType4Demo[0]); - // 定义解析的数据在xml文件结构中的位置 + // 定义解析的数据在xml文件结构中的位置 String[] xpath = new String[2]; xpath[0] = "Northwind"; xpath[1] = "Customers"; @@ -113,38 +112,36 @@ public class XMLDemoTableData extends AbstractParameterTableData { * /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) + 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是控制层数的,只把xml中对应的层的加入到列名中 deep++; - //表示已经进入到了列名那一层 - if (deep == COL_DEEP) { - flag = true; + //表示已经进入到了列名那一层 + if(deep==COL_DEEP){ + flag=true; } - //如果在高层,并且已经进入到了col层,则退出 - if (deep < COL_DEEP && flag) { + //如果在高层,并且已经进入到了col层,则退出 + if(deep + * * 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; @@ -98,18 +97,16 @@ public class XMLParseDemoDataModel extends AbstractDataModel { /** ************************************************** */ /** ************以下为解析XML文件的方法**************** */ - /** - * ************************************************* - */ + /** ************************************************** */ - // 一次性将数据取出来 + // 一次性将数据取出来 protected void init() throws TableDataException { if (this.row_list != null) return; this.row_list = new ArrayList(); try { - // 使用SAX解析XML文件, 使用方法请参见JAVA SAX解析 + // 使用SAX解析XML文件, 使用方法请参见JAVA SAX解析 SAXParserFactory f = SAXParserFactory.newInstance(); SAXParser parser = f.newSAXParser(); @@ -126,20 +123,20 @@ public class XMLParseDemoDataModel extends AbstractDataModel { * 发现节点结束标记时,调用endElement */ private class DemoHandler extends DefaultHandler { - private List levelList = new ArrayList(); // 记录当前节点的路径 - private Object[] values; // 缓存一条记录 - private int recordIndex = -1; // 当前记录所对应的列的序号,-1表示不需要记录 + 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之后执行时,根据这个列序号来设置值存放的位置。 + // 看看其对应的列序号,下面的characters之后执行时,根据这个列序号来设置值存放的位置。 recordIndex = getColumnIndex(qName); } } @@ -147,7 +144,7 @@ public class XMLParseDemoDataModel extends AbstractDataModel { 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; @@ -168,7 +165,7 @@ public class XMLParseDemoDataModel extends AbstractDataModel { throws SAXException { try { if (isRecordWrapTag()) { - // 一条记录结束,就add进list中 + // 一条记录结束,就add进list中 XMLParseDemoDataModel.this.row_list.add(values); values = null; } else if (needReadRecord()) { @@ -179,7 +176,7 @@ public class XMLParseDemoDataModel extends AbstractDataModel { } } - // 正好匹配路径,确定是记录外部的Tag + // 正好匹配路径,确定是记录外部的Tag private boolean isRecordWrapTag() { if (levelList.size() == XMLParseDemoDataModel.this.xPath.length && compareXPath()) { @@ -189,7 +186,7 @@ public class XMLParseDemoDataModel extends AbstractDataModel { return false; } - // 需要记录一条记录 + // 需要记录一条记录 private boolean needReadRecord() { if (levelList.size() == (XMLParseDemoDataModel.this.xPath.length + 1) && compareXPath()) { @@ -199,7 +196,7 @@ public class XMLParseDemoDataModel extends AbstractDataModel { return false; } - // 是否匹配设定的XPath路径 + // 是否匹配设定的XPath路径 private boolean compareXPath() { String[] xPath = XMLParseDemoDataModel.this.xPath; for (int i = 0; i < xPath.length; i++) { @@ -211,7 +208,7 @@ public class XMLParseDemoDataModel extends AbstractDataModel { return true; } - // 获取该字段的序号 + // 获取该字段的序号 private int getColumnIndex(String columnName) { XMLColumnNameType4Demo[] nts = XMLParseDemoDataModel.this.columns; for (int i = 0; i < nts.length; i++) { diff --git a/src/com/fr/data/XMLRead.java b/src/main/java/com/fr/data/XMLRead.java similarity index 58% rename from src/com/fr/data/XMLRead.java rename to src/main/java/com/fr/data/XMLRead.java index ef3bc4d..8f1b982 100644 --- a/src/com/fr/data/XMLRead.java +++ b/src/main/java/com/fr/data/XMLRead.java @@ -1,44 +1,33 @@ 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; +import java.io.StringBufferInputStream; -/** - * @author fanruan - */ public class XMLRead extends AbstractTableData { - /** - * 列名数组,保存程序数据集所有列名 - */ - private String[] columnNames = {"id", "name", "MemoryFreeSize", - "MemoryTotalSize", "MemoryUsage"}; - /** - * 保存表数据 - */ + // 列名数组,保存程序数据集所有列名 + 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]; @@ -50,29 +39,28 @@ public class XMLRead extends AbstractTableData { return; } valueList = new ArrayList(); - String sql = "SELECT * FROM xmltest"; - String[] name = {"MemoryFreeSize", "MemoryTotalSize", "MemoryUsage"}; - Connection conn = this.getConnection(); + String sql = "select * from xmltest"; + String[] name = { "MemoryFreeSize", "MemoryTotalSize", "MemoryUsage" }; + Connection conn = this.getConncetion(); try { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql); // 用对象保存数据 - Object[] objArray; + Object[] objArray = null; while (rs.next()) { objArray = new Object[5]; - String[] xmlData; + String[] xmldata = null; 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(); + InputStream in = new StringBufferInputStream("" + + rs.getObject(3).toString() + ""); + GetXmlDate getxmldata = new GetXmlDate(); // 对xml流进行解析,返回的为name对应的value值数组 - xmlData = getXMLData.readerXMLSource(in, name); + xmldata = getxmldata.readerXMLSource(in, name); // 将解析后的值存于最终结果ArrayList中 - objArray[2] = xmlData[0]; - objArray[3] = xmlData[1]; - objArray[4] = xmlData[2]; + objArray[2] = xmldata[0]; + objArray[3] = xmldata[1]; + objArray[4] = xmldata[2]; valueList.add(objArray); } // 释放数据源 @@ -84,12 +72,12 @@ public class XMLRead extends AbstractTableData { } } - 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; + public Connection getConncetion() { + String driverName = "com.mysql.jdbc.Driver"; + String url = "jdbc:mysql://review.finedevelop.com:3306/susie"; + String username = "root"; + String password = "ilovejava"; + Connection con = null; try { Class.forName(driverName); @@ -102,12 +90,7 @@ public class XMLRead extends AbstractTableData { } - /** - * 释放一些资源,因为可能会有重复调用,所以需释放valueList,将上次查询的结果释放掉 - * - * @throws Exception e - */ - @Override + // 释放一些资源,因为可能会有重复调用,所以需释放valueList,将上次查询的结果释放掉 public void release() throws Exception { super.release(); this.valueList = null; diff --git a/plugin-report-doc-demo/src/com/fr/data/impl/Commit1.java b/src/main/java/com/fr/data/impl/Commit1.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/impl/Commit1.java rename to src/main/java/com/fr/data/impl/Commit1.java diff --git a/plugin-report-doc-demo/src/com/fr/data/impl/Commit3.java b/src/main/java/com/fr/data/impl/Commit3.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/data/impl/Commit3.java rename to src/main/java/com/fr/data/impl/Commit3.java diff --git a/src/com/fr/output/session.java b/src/main/java/com/fr/data/session.java similarity index 71% rename from src/com/fr/output/session.java rename to src/main/java/com/fr/data/session.java index 1745f9c..a843d67 100644 --- a/src/com/fr/output/session.java +++ b/src/main/java/com/fr/data/session.java @@ -1,48 +1,50 @@ -package com.fr.output; - -import com.fr.stable.CodeUtils; +package com.fr.data; +import javax.servlet.http.HttpSession; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.String; 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; +import com.fr.stable.CodeUtils; public class session extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException { + 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) { + 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") != "") { + if(request.getParameter("sessionvalue")!=null&&request.getParameter("sessionvalue")!=""){ session.setAttribute("sessionname", request.getParameter("sessionvalue")); } - } else { + } + else{ urlid = CodeUtils.decodeText(urlid); - session.setAttribute("sessionname", urlid); //将值赋值给sessionname这个session中 + session.setAttribute("sessionname",urlid); //将值赋值给sessionname这个session中 out.println(""); } out.println(""); out.println(""); } - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException { + throws IOException, ServletException + { doGet(request, response); } -} \ No newline at end of file +} diff --git a/src/main/java/com/fr/decision/privilege/encrpt/Base64PasswordValidator.java b/src/main/java/com/fr/decision/privilege/encrpt/Base64PasswordValidator.java new file mode 100644 index 0000000..fc66308 --- /dev/null +++ b/src/main/java/com/fr/decision/privilege/encrpt/Base64PasswordValidator.java @@ -0,0 +1,19 @@ +package com.fr.decision.privilege.encrpt;; +import com.fr.base.Base64; +import com.fr.base.ServerConfig; +import com.fr.decision.privilege.encrpt.AbstractPasswordValidator; +import com.fr.log.FineLoggerFactory; +import java.io.UnsupportedEncodingException; +public class Base64PasswordValidator extends AbstractPasswordValidator { + public Base64PasswordValidator() { + + } + public String encode(String originText) { + try { + return Base64.encode(originText.getBytes(ServerConfig.getInstance().getServerCharset())); + } catch (UnsupportedEncodingException var3) { + FineLoggerFactory.getLogger().debug(var3.getMessage()); + return ""; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/decision/privilege/encrpt/CustomSHA256PasswordValidator.java b/src/main/java/com/fr/decision/privilege/encrpt/CustomSHA256PasswordValidator.java new file mode 100644 index 0000000..355d03f --- /dev/null +++ b/src/main/java/com/fr/decision/privilege/encrpt/CustomSHA256PasswordValidator.java @@ -0,0 +1,14 @@ +package com.fr.decision.privilege.encrpt; + +import com.fr.security.SecurityToolbox; + +public class CustomSHA256PasswordValidator extends AbstractPasswordValidator { + public CustomSHA256PasswordValidator() { + } + + @Override + public String encode(String originUserName, String originPassword) { //把 用户名+密码 加密成 SHA256字符 + String unionPwd = originUserName + originPassword; + return SecurityToolbox.sha256(unionPwd); + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/demo/ChangeRowAndCol.java b/src/main/java/com/fr/demo/ChangeRowAndCol.java similarity index 89% rename from plugin-report-doc-demo/src/com/fr/demo/ChangeRowAndCol.java rename to src/main/java/com/fr/demo/ChangeRowAndCol.java index 61afa9b..dc4b5b7 100644 --- a/plugin-report-doc-demo/src/com/fr/demo/ChangeRowAndCol.java +++ b/src/main/java/com/fr/demo/ChangeRowAndCol.java @@ -8,7 +8,6 @@ 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; @@ -17,14 +16,11 @@ 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"); + workbook = TemplateWorkBookIO.readTemplateWorkBook("//doc//Primary//GroupReport//Group.cpt"); // 读取请求中的参数判断是否需要切换行列显示,0表示不切换,1表示切换 if (reportletrequest.getParameter("change") != null) { change = reportletrequest.getParameter("change").toString(); @@ -59,8 +55,6 @@ public class ChangeRowAndCol extends Reportlet { } } catch (Exception e) { e.printStackTrace(); - } finally { - SimpleWork.checkOut(); } return workbook; } diff --git a/plugin-report-doc-demo/src/com/fr/demo/CreateReportletDemo.java b/src/main/java/com/fr/demo/CreateReportletDemo.java similarity index 91% rename from plugin-report-doc-demo/src/com/fr/demo/CreateReportletDemo.java rename to src/main/java/com/fr/demo/CreateReportletDemo.java index 54f08e4..8a5c2b1 100644 --- a/plugin-report-doc-demo/src/com/fr/demo/CreateReportletDemo.java +++ b/src/main/java/com/fr/demo/CreateReportletDemo.java @@ -11,12 +11,13 @@ 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) { +public class CreateReportletDemo extends Reportlet +{ + public TemplateWorkBook createReport(ReportletRequest arg0) + { //创建一个WorkBook工作薄,在工作薄中插入一个WorkSheet WorkBook workbook = new WorkBook(); WorkSheet sheet1 = new WorkSheet(); diff --git a/src/com/fr/demo/NewDateDemo.java b/src/main/java/com/fr/demo/NewDateDemo.java similarity index 73% rename from src/com/fr/demo/NewDateDemo.java rename to src/main/java/com/fr/demo/NewDateDemo.java index b38d639..7eee03c 100644 --- a/src/com/fr/demo/NewDateDemo.java +++ b/src/main/java/com/fr/demo/NewDateDemo.java @@ -1,4 +1,4 @@ -//��̬�޸����� +//动态修改数据 package com.fr.demo; import com.fr.data.ArrayTableDataDemo; @@ -14,12 +14,13 @@ 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对象,将模板保存为workbook对象并返回 workbook = TemplateWorkBookIO.readTemplateWorkBook("1.cpt"); - ArrayTableDataDemo a = new ArrayTableDataDemo(); // ���ö���ij������ݼ����� - workbook.putTableData("ds2", a); // ��ģ�帳�µ����ݼ� + ArrayTableDataDemo a = new ArrayTableDataDemo(); //调用定义的程序数据集连接 + workbook.putTableData("ds2", a); //给模板赋新的数据集 } catch (Exception e) { e.getStackTrace(); } diff --git a/src/com/fr/demo/ReadFromDatabase.java b/src/main/java/com/fr/demo/ReadFromDatabase.java similarity index 71% rename from src/com/fr/demo/ReadFromDatabase.java rename to src/main/java/com/fr/demo/ReadFromDatabase.java index be146dc..c5ad4eb 100644 --- a/src/com/fr/demo/ReadFromDatabase.java +++ b/src/main/java/com/fr/demo/ReadFromDatabase.java @@ -1,12 +1,10 @@ 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 com.fr.log.FineLoggerFactory; import java.io.InputStream; import java.sql.Blob; import java.sql.Connection; @@ -16,37 +14,33 @@ 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"; + 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); - // 从数据库中读模板 + // 从数据库中读模板 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()); + Blob blob = rs.getBlob(1); // 取第一列的值,即cpt列 + FineLoggerFactory.getLogger().info(blob.toString()); InputStream ins = blob.getBinaryStream(); workbook.readStream(ins); } } catch (Exception e) { e.printStackTrace(); - } finally { - SimpleWork.checkOut(); } return workbook; } diff --git a/src/main/java/com/fr/demo/SaveReportToDatabase.java b/src/main/java/com/fr/demo/SaveReportToDatabase.java new file mode 100644 index 0000000..5f458fb --- /dev/null +++ b/src/main/java/com/fr/demo/SaveReportToDatabase.java @@ -0,0 +1,71 @@ +package com.fr.demo; + +import com.fr.base.operator.common.CommonOperator; +import com.fr.chart.activator.ChartBaseActivator; +import com.fr.config.activator.BaseDBActivator; +import com.fr.config.activator.ConfigurationActivator; +import com.fr.data.impl.config.activator.RestrictionActivator; +import com.fr.env.operator.CommonOperatorImpl; +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.store.StateServerActivator; +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 { + // 定义报表运行环境,用于执行报表 + Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), + new ConfigurationActivator(), + new StateServerActivator(), + new ReportBaseActivator(), + new RestrictionActivator(), + new ReportActivator(), + new ChartBaseActivator()); + SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); + String envpath= "//Applications//FineReport10_325//webapps//webroot//WEB-INF"; //工程路径 + SimpleWork.checkIn(envpath); + module.start(); + // 连接数据库 + 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); //注意表名是否区分大小写 + 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/src/main/java/com/fr/demo/SetCellElementStyle.java similarity index 86% rename from plugin-report-doc-demo/src/com/fr/demo/SetCellElementStyle.java rename to src/main/java/com/fr/demo/SetCellElementStyle.java index 3b19637..69d1c2a 100644 --- a/plugin-report-doc-demo/src/com/fr/demo/SetCellElementStyle.java +++ b/src/main/java/com/fr/demo/SetCellElementStyle.java @@ -1,11 +1,12 @@ //单元格格式设置 package com.fr.demo; +import java.awt.Color; +import java.awt.Font; +import java.util.Map; 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; @@ -13,45 +14,43 @@ 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; +import com.fr.main.TemplateWorkBook; +import com.fr.main.impl.WorkBook; public class SetCellElementStyle extends Reportlet { public TemplateWorkBook createReport(ReportletRequest arg0) { - // 新建报表 + // 新建报表 WorkBook workbook = new WorkBook(); WorkSheet worksheet = new WorkSheet(); - // 新建一个单元格,位置为(1,1),列占2单元格,行占2单元格,文本值为 "FineReport" + // 新建一个单元格,位置为(1,1),列占2单元格,行占2单元格,文本值为 "FineReport" TemplateCellElement cellElement = new DefaultTemplateCellElement(1, 1, 2, 2, "FineReport"); - // 设置列宽为300px,设置行高为30px + // 设置列宽为300px,设置行高为30px worksheet.setColumnWidth(1, new OLDPIX(300)); worksheet.setRowHeight(1, new OLDPIX(30)); - // 得到CellElement的样式,如果没有新建默认样式 + // 得到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; diff --git a/src/com/fr/demo/SimpleReportletDemo.java b/src/main/java/com/fr/demo/SimpleReportletDemo.java similarity index 60% rename from src/com/fr/demo/SimpleReportletDemo.java rename to src/main/java/com/fr/demo/SimpleReportletDemo.java index b051b1a..2737d5a 100644 --- a/src/com/fr/demo/SimpleReportletDemo.java +++ b/src/main/java/com/fr/demo/SimpleReportletDemo.java @@ -5,25 +5,19 @@ 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对象,用于保存最终返回的报表 + //新建一个WorkBook对象,用于保存最终返回的报表 + TemplateWorkBook WorkBook = null; try { - // 读取模板,将模板保存为workbook对象并返回 - WorkBook = TemplateWorkBookIO.readTemplateWorkBook( - "\\doc\\Primary\\Parameter\\Parameter.cpt"); + //读取模板,将模板保存为workbook对象并返回 + WorkBook = TemplateWorkBookIO.readTemplateWorkBook("//doc//Primary//Parameter//Parameter.cpt"); } catch (Exception e) { e.getStackTrace(); - } finally { - SimpleWork.checkOut(); } return WorkBook; } diff --git a/plugin-report-doc-demo/src/com/fr/demo/TotalVerifyJobDemo.java b/src/main/java/com/fr/demo/TotalVerifyJobDemo.java similarity index 83% rename from plugin-report-doc-demo/src/com/fr/demo/TotalVerifyJobDemo.java rename to src/main/java/com/fr/demo/TotalVerifyJobDemo.java index 7a0247c..e28a503 100644 --- a/plugin-report-doc-demo/src/com/fr/demo/TotalVerifyJobDemo.java +++ b/src/main/java/com/fr/demo/TotalVerifyJobDemo.java @@ -6,7 +6,7 @@ import com.fr.data.TotalVerifyJob; import com.fr.data.Verifier; import com.fr.script.Calculator; -public class TotalVerifyJobDemo extends TotalVerifyJob { +public class TotalVerifyJobDemo extends TotalVerifyJob{ /* * type : 必须要定义此私有变量,变量名可改,表示校验状态 * 0 表示校验成功,默认校验状态位为0 @@ -28,7 +28,7 @@ public class TotalVerifyJobDemo extends TotalVerifyJob { minnum = (JobValue) data.getValueAt(i, 1); min = Integer.parseInt(Utils.objectToString(minnum.getValue())); - if (sale < min) { //校验判断 + if(sale < min){ //校验判断 type = 1; } } @@ -37,9 +37,9 @@ public class TotalVerifyJobDemo extends TotalVerifyJob { public String getMessage() { // 根据校验状态是成功还是失败,设置对应的返回信息 - if (type == 0) { - return "恭喜你,校验成功"; - } else { + if(type == 0){ + return "恭喜你,校验成功";//这个值并没有用,成功的时候不会显示这里的内容,还是显示我们默认的 + }else{ return "销量值不能小于最小基数"; } } @@ -52,4 +52,4 @@ public class TotalVerifyJobDemo extends TotalVerifyJob { public String getJobType() { return "totalVerifyJob"; } -} +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/demo/URLParameterDemo.java b/src/main/java/com/fr/demo/URLParameterDemo.java similarity index 67% rename from plugin-report-doc-demo/src/com/fr/demo/URLParameterDemo.java rename to src/main/java/com/fr/demo/URLParameterDemo.java index c4dac4f..e1cf178 100644 --- a/plugin-report-doc-demo/src/com/fr/demo/URLParameterDemo.java +++ b/src/main/java/com/fr/demo/URLParameterDemo.java @@ -1,39 +1,32 @@ // 程序网络报表中获取request中的值 package com.fr.demo; - -import com.fr.base.Parameter; -import com.fr.general.ModuleContext; -import com.fr.io.TemplateWorkBookIO; +import java.util.Map; 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; +import com.fr.io.TemplateWorkBookIO; +import com.fr.base.Parameter; +@SuppressWarnings("unused") 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"); + wbTpl = TemplateWorkBookIO.readTemplateWorkBook( + "//doc//Primary//Parameter//Parameter.cpt"); // 提取报表参数组,由于原模板只有country一个参数,因此直接取index为0的参数,并将外部传入的值赋给该参数 Parameter[] ps = wbTpl.getParameters(); ps[0].setValue(countryValue); // 原模板定义有参数界面,参数已经从外部获得,去掉参数页面 - // 若您想保留参数界面,则将模板设置为不延迟报表展示,再传入参数后直接根据参数值显示结果,否则还需要再次点击查询按钮 + // 如果想要参数面板,把下面wbTpl.getReportParameterAttr().setParameterUI(null); 这句去掉就行 wbTpl.getReportParameterAttr().setParameterUI(null); } catch (Exception e) { e.printStackTrace(); - } finally { - SimpleWork.checkOut(); + return null; } return wbTpl; } diff --git a/plugin-report-doc-demo/src/com/fr/demo/VerifyJobDemo.java b/src/main/java/com/fr/demo/VerifyJobDemo.java similarity index 75% rename from plugin-report-doc-demo/src/com/fr/demo/VerifyJobDemo.java rename to src/main/java/com/fr/demo/VerifyJobDemo.java index 77b0e40..1d427d4 100644 --- a/plugin-report-doc-demo/src/com/fr/demo/VerifyJobDemo.java +++ b/src/main/java/com/fr/demo/VerifyJobDemo.java @@ -6,7 +6,7 @@ import com.fr.data.JobValue; import com.fr.data.Verifier; import com.fr.script.Calculator; -public class VerifyJobDemo extends DefinedVerifyJob { +public class VerifyJobDemo extends DefinedVerifyJob{ /* * 必须要定义此私有变量,变量名可改,表示校验状态 * 0 表示校验成功,默认校验状态位为0 @@ -26,20 +26,20 @@ public class VerifyJobDemo extends DefinedVerifyJob { * 校验规则为销量需要大于等于最小基数:salenum >= minnum * 校验不通过,提示“销量值不能小于最小基数” */ - if (salenum != null) { + if(salenum != null){ int sale = 0; - if (salenum.getValue() instanceof Integer) { //将单元格值转为整型以便用于比较 - sale = (Integer) salenum.getValue(); + if(salenum.getValue() instanceof Integer){ //将单元格值转为整型以便用于比较 + sale = (Integer)salenum.getValue(); - } else { + }else { sale = Integer.parseInt(Utils.objectToString(salenum.getValue())); } - if (sale < minnum) { //校验判断 + if(sale < minnum){ //校验判断 type = 1; } - } else { + }else { type = 1; } @@ -47,14 +47,13 @@ public class VerifyJobDemo extends DefinedVerifyJob { public String getMessage() { // 根据校验状态是成功还是失败,设置对应的返回信息 - if (type == 0) { - return "恭喜你,校验成功"; - } else { + if(type == 0){ + return "恭喜你,校验成功";//这个值并没有用,成功的时候不会显示这里的内容,还是显示我们默认的 + }else{ return "销量值不能小于最小基数"; } } - public Verifier.Status getType() { // 返回校验状态 return Verifier.Status.parse(type); diff --git a/src/main/java/com/fr/demo/VerifyJobDemo2.java b/src/main/java/com/fr/demo/VerifyJobDemo2.java new file mode 100644 index 0000000..2a141f2 --- /dev/null +++ b/src/main/java/com/fr/demo/VerifyJobDemo2.java @@ -0,0 +1,73 @@ +package com.fr.demo; + +import com.fr.base.FRContext; +import com.fr.base.Utils; +import com.fr.cache.Attachment; +import com.fr.data.DefinedVerifyJob; +import com.fr.data.JobValue; +import com.fr.data.Verifier; +import com.fr.general.FArray; +import com.fr.script.Calculator; +import com.fr.log.FineLoggerFactory; + +public class VerifyJobDemo2 extends DefinedVerifyJob{ + /* + * 必须要定义此私有变量,变量名可改,表示校验状态 + * 0 表示校验成功,默认校验状态位为0 + * 1 表示校验失败 + */ + private int type = 0; + + /** + * 当模板自定义事件增加的属性 名称与下面变量有对应时,则会自动赋值于此对应变量 + */ + private JobValue file; // JobValue对应单元格 + private JobValue yesOrno; + // private int minnum; // 如果是非单元格,则对应具体类型值 + + public void doJob(Calculator calculator) throws Exception { + /* + * 如这边提供一个简单的判断来模拟执行过程 + * 校验规则为yesOrno等于1 并且 file 上传了附件:yesOrno == 1 && file 上传附件 + * 校验不通过,提示“请上传附件” + */ + //这个是fr打印日志的接口,如果是设计器下的话 会在日志里看到对应的日志信息打印出来 + FRContext.getLogger().error("##### start verigy####"); + int yn = 0; + if(yesOrno.getValue() instanceof Integer){ //将单元格值转为整型以便用于比较 + yn = Integer.parseInt(yesOrno.getValue().toString()); + }else { + yn = Integer.parseInt(Utils.objectToString(yesOrno.getValue())); + } + FineLoggerFactory.getLogger().error("##### yn = "+yn +"####"); + if (yn == 1) { + //判断file是否有上传文件 + if (file.getValue() instanceof FArray && ((FArray) file.getValue()).length() > 0 + && ((FArray) file.getValue()).elementAt(0) instanceof Attachment) { + type = 0; + } else { + type = 1; + } + } else { + type = 1; + } + } + + public String getMessage() { + // 根据校验状态是成功还是失败,设置校验失败的返回信息 + if(type == 1){ + return "请上传附件"; + } + 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/src/main/java/com/fr/function/BinaryImage.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/function/BinaryImage.java rename to src/main/java/com/fr/function/BinaryImage.java diff --git a/plugin-report-doc-demo/src/com/fr/function/CellSum.java b/src/main/java/com/fr/function/CellSum.java similarity index 86% rename from plugin-report-doc-demo/src/com/fr/function/CellSum.java rename to src/main/java/com/fr/function/CellSum.java index 008009b..e0b860d 100644 --- a/plugin-report-doc-demo/src/com/fr/function/CellSum.java +++ b/src/main/java/com/fr/function/CellSum.java @@ -1,4 +1,3 @@ -// 自定义函数中获取公式所在单元格 package com.fr.function; import com.fr.base.Utils; @@ -7,9 +6,9 @@ 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方法 + .toString(); // 直接调用FR内部的SUM方法 String result = "所在单元格为:" + this.getCalculator().getCurrentColumnRow() - + ";总和为:" + sum; // 获取当前单元格拼出最终结果 + + ";总和为:" + sum; // 获取当前单元格拼出最终结果 return result; } } \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/ConnectSAPServer.java b/src/main/java/com/fr/function/ConnectSAPServer.java similarity index 99% rename from plugin-report-doc-demo/src/com/fr/function/ConnectSAPServer.java rename to src/main/java/com/fr/function/ConnectSAPServer.java index e97c7b7..2525536 100644 --- a/plugin-report-doc-demo/src/com/fr/function/ConnectSAPServer.java +++ b/src/main/java/com/fr/function/ConnectSAPServer.java @@ -1,17 +1,16 @@ package com.fr.function; +import java.io.File; +import java.io.FileOutputStream; +import java.util.Properties; + 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, diff --git a/src/main/java/com/fr/function/DateDiff.java b/src/main/java/com/fr/function/DateDiff.java new file mode 100644 index 0000000..3066667 --- /dev/null +++ b/src/main/java/com/fr/function/DateDiff.java @@ -0,0 +1,67 @@ +package com.fr.function; + +import com.fr.script.AbstractFunction; +import com.fr.stable.Primitive; +import java.util.Date; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class DateDiff extends AbstractFunction +{ + private static final long serialVersionUID = -2863679010825725885L; + public String format = null; + private Long dif = Long.valueOf(0L); + + public Object run(Object[] paramArrayOfObject) + { + try + { + Long localLong1 = Long.valueOf(((Date)paramArrayOfObject[0]).getTime()); + Long localLong2 = Long.valueOf(((Date)paramArrayOfObject[1]).getTime()); + this.dif = Long.valueOf(localLong2.longValue() - localLong1.longValue()); + this.format = ((String)paramArrayOfObject[2]); + replace("((?i)y)", Long.valueOf(31536000000L)); + replace("((?i)q)", Long.valueOf(7776000000L)); + replace("M", Long.valueOf(2592000000L)); + replace("((?i)w)", Long.valueOf(604800000L)); + replace("((?i)d)", Long.valueOf(86400000L)); + replace("((?i)h)", Long.valueOf(3600000L)); + replace("m", Long.valueOf(60000L)); + replace("((?i)s)", Long.valueOf(1000L)); + try + { + return Long.valueOf(Long.parseLong(this.format)); + } + catch (Exception localException2) + { + return this.format; + } + } + catch (Exception localException1) + { + } + return Primitive.ERROR_VALUE; + } + + public void replace(String paramString, Long paramLong) + { + Pattern localPattern = Pattern.compile(paramString + "\\{\\d*?\\}"); + Matcher localMatcher = localPattern.matcher(this.format); + int i = (int)(this.dif.longValue() / paramLong.longValue()); + int j = 1; + while (localMatcher.find()) + { + String str1 = localMatcher.group(); + str1 = str1.replaceAll(paramString + "\\{", ""); + str1 = str1.replaceAll("\\}", ""); + int k = Integer.parseInt(str1); + String str2 = String.format("%0" + k + "d", new Object[] { Integer.valueOf(i) }); + if (j != 0) + { + j = 0; + this.dif = Long.valueOf(this.dif.longValue() - i * paramLong.longValue()); + } + this.format = this.format.replaceFirst(paramString + "\\{\\d*?\\}", str2); + } + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/FlagHtmlColor.java b/src/main/java/com/fr/function/FlagHtmlColor.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/function/FlagHtmlColor.java rename to src/main/java/com/fr/function/FlagHtmlColor.java diff --git a/plugin-report-doc-demo/src/com/fr/function/GETIP.java b/src/main/java/com/fr/function/GETIP.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/function/GETIP.java rename to src/main/java/com/fr/function/GETIP.java diff --git a/src/main/java/com/fr/function/IRR.java b/src/main/java/com/fr/function/IRR.java new file mode 100644 index 0000000..46bdb96 --- /dev/null +++ b/src/main/java/com/fr/function/IRR.java @@ -0,0 +1,152 @@ +package com.fr.function; + +import java.math.BigDecimal; + +import com.fr.general.FArray; +import com.fr.general.GeneralUtils; +import com.fr.script.AbstractFunction; + +public class IRR extends AbstractFunction { + + private static final long serialVersionUID = 7634415917398642321L; + private static final String ERROR_VALUE = "#NUM!"; + + + @Override + public Object run(Object[] args) { + try{ + if(1 == args.length){ + return run( transArr( (FArray) args[0] ) ); + }else if(2 == args.length){ + return run( transArr( (FArray) args[0] ), trans( args[1] ) ); + } + }catch(Exception e){ + System.out.println(e); + } + return ERROR_VALUE; + } + + /** + * 将其他类型的数字转换为大数(保证精度) + * @param ele + * @return + */ + private static BigDecimal trans(Object ele){ + try{ + String val = GeneralUtils.objectToString(ele); + return new BigDecimal(val); + }catch(Exception e){ + + } + return (BigDecimal) ele; + } + + /** + * 将数组转换为大数数组 + * @param in + * @return + */ + private static FArray transArr(FArray in){ + FArray rt = new FArray(); + for(int i=0;i cashflow){ + return run( cashflow, new BigDecimal(0.1d) ); + } + + private static BigDecimal run(FArray cashflow,BigDecimal guess){ + BigDecimal maxrate = initRateMax(cashflow,guess); + BigDecimal minrate = initRateMin(cashflow,guess); + for( int i=0; i cashflow,BigDecimal guess){ + for( int i=0; i cashflow,BigDecimal guess){ + for( int i=0; i cashflow,BigDecimal rate){ + BigDecimal npv = ZERO; + BigDecimal rpowj = ONE;//(1+r)^0 + BigDecimal radd1 = rate.add(ONE);//1+r + for( int j=0; j 0) { for (int i = 0; i < parasArray.length(); i++) { @@ -57,18 +79,18 @@ public class ReportCheck extends AbstractFunction { 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的值 + // 获取报表结果中对应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(); + if(cellElement.getValue() instanceof ResultFormula) { + returnValue = ((ResultFormula)cellElement.getValue()).getResult().toString(); } } catch (Exception e) { e.printStackTrace(); @@ -102,4 +124,4 @@ public class ReportCheck extends AbstractFunction { } } -} +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/SolarToLunar.java b/src/main/java/com/fr/function/SolarToLunar.java similarity index 88% rename from plugin-report-doc-demo/src/com/fr/function/SolarToLunar.java rename to src/main/java/com/fr/function/SolarToLunar.java index c70a634..d10fc0d 100644 --- a/plugin-report-doc-demo/src/com/fr/function/SolarToLunar.java +++ b/src/main/java/com/fr/function/SolarToLunar.java @@ -1,12 +1,12 @@ //自定义函数把阳历转换成阴历 package com.fr.function; - import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; - +import java.util.Locale; public class SolarToLunar { - final private static long[] lunarInfo = new long[]{0x04bd8, 0x04ae0, + 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, @@ -28,43 +28,43 @@ public class SolarToLunar { 0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, - 0x0ada0}; + 0x0ada0 }; - final private static int[] year20 = new int[]{1, 4, 1, 2, 1, 2, 1, 1, 2, - 1, 2, 1}; + 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[] 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}; + 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[]{"", "正", "二", "三", "四", - "五", "六", "七", "八", "九", "十", "十一", "十二"}; + public final static String[] nStr1 = new String[] { "", "正", "二", "三", "四", + "五", "六", "七", "八", "九", "十", "十一", "十二" }; - private final static String[] Gan = new String[]{"甲", "乙", "丙", "丁", "戊", - "己", "庚", "辛", "壬", "癸"}; + private final static String[] Gan = new String[] { "甲", "乙", "丙", "丁", "戊", + "己", "庚", "辛", "壬", "癸" }; - private final static String[] Zhi = new String[]{"子", "丑", "寅", "卯", "辰", - "巳", "午", "未", "申", "酉", "戌", "亥"}; + private final static String[] Zhi = new String[] { "子", "丑", "寅", "卯", "辰", + "巳", "午", "未", "申", "酉", "戌", "亥" }; - private final static String[] Animals = new String[]{"鼠", "牛", "虎", "兔", - "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"}; + private final static String[] Animals = new String[] { "鼠", "牛", "虎", "兔", + "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪" }; - private final static String[] solarTerm = new String[]{"小寒", "大寒", "立春", + private final static String[] solarTerm = new String[] { "小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", - "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至"}; + "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至" }; - private final static String[] sFtv = new String[]{"0101*元旦", "0214 情人节", + 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 毛泽东诞辰"}; + "1226 毛泽东诞辰" }; - private final static String[] lFtv = new String[]{"0101*农历春节", + private final static String[] lFtv = new String[] { "0101*农历春节", "0115 元宵节", "0505 端午节", "0707 七夕情人节", "0815 中秋节", "0909 重阳节", - "1208 腊八节", "1224 小年", "0100*除夕"}; + "1208 腊八节", "1224 小年", "0100*除夕" }; /** * 传回农历 y年的总天数 @@ -378,4 +378,4 @@ public class SolarToLunar { public static void main(String[] args) { System.out.println(today(1988, 10, 27)); } -} +} \ No newline at end of file diff --git a/src/main/java/com/fr/function/StringCat.java b/src/main/java/com/fr/function/StringCat.java new file mode 100644 index 0000000..00cbf16 --- /dev/null +++ b/src/main/java/com/fr/function/StringCat.java @@ -0,0 +1,15 @@ +package com.fr.function; + +import com.fr.script.AbstractFunction; + +public class StringCat extends AbstractFunction { + public Object run(Object[] args) { + String result = ""; + Object para; + for (int i = 0; i < args.length; i++) { + para = args[i]; + result += para.toString(); + } + return result; + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/function/StringImage.java b/src/main/java/com/fr/function/StringImage.java new file mode 100644 index 0000000..1345f16 --- /dev/null +++ b/src/main/java/com/fr/function/StringImage.java @@ -0,0 +1,59 @@ +//图片在下文字在上 +package com.fr.function; + +import com.fr.base.GraphHelper; +import com.fr.data.core.db.BinaryObject; +import com.fr.log.FineLoggerFactory; +import com.fr.script.AbstractFunction; +import com.fr.stable.CoreGraphHelper; +import javax.imageio.ImageIO; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.io.IOException; + + +/** + * 图片在下文字在上 + */ +public class StringImage extends AbstractFunction { + @Override + 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++; + + } + + if (ob[1] instanceof BinaryObject) { + BinaryObject binaryObject = (BinaryObject) ob[1]; + try { + result = initStringImage((String) ob[0], ImageIO.read(binaryObject.getInputStream())); + } catch (IOException e) { + e.printStackTrace(); + } + } else if (ob[1] instanceof Image) { + result = initStringImage((String) ob[0], (Image) ob[1]); + } else { + FineLoggerFactory.getLogger().warn("Unsupported type of " + ob[1].getClass()); + } + + return result; + } + + private Image initStringImage(String name, Image image) { + BufferedImage splashBuffedImage = CoreGraphHelper.toBufferedImage(image); + Graphics2D splashG2d = splashBuffedImage.createGraphics(); + double centerX = 25; + double centerY = 25; + GraphHelper.drawString(splashG2d, name, centerX, centerY); + return splashBuffedImage; + } + +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/SubSection.java b/src/main/java/com/fr/function/SubSection.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/function/SubSection.java rename to src/main/java/com/fr/function/SubSection.java diff --git a/plugin-report-doc-demo/src/com/fr/function/Ubm.java b/src/main/java/com/fr/function/Ubm.java similarity index 99% rename from plugin-report-doc-demo/src/com/fr/function/Ubm.java rename to src/main/java/com/fr/function/Ubm.java index 3501fb7..12d7aaf 100644 --- a/plugin-report-doc-demo/src/com/fr/function/Ubm.java +++ b/src/main/java/com/fr/function/Ubm.java @@ -22,4 +22,4 @@ public class Ubm extends AbstractFunction { } return buffer.toString(); } -} \ No newline at end of file +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/function/Upc.java b/src/main/java/com/fr/function/Upc.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/function/Upc.java rename to src/main/java/com/fr/function/Upc.java diff --git a/plugin-report-doc-demo/src/com/fr/function/Widget2Image.java b/src/main/java/com/fr/function/Widget2Image.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/function/Widget2Image.java rename to src/main/java/com/fr/function/Widget2Image.java diff --git a/src/main/java/com/fr/io/CreateGenericTemplate.java b/src/main/java/com/fr/io/CreateGenericTemplate.java new file mode 100644 index 0000000..eca3c7e --- /dev/null +++ b/src/main/java/com/fr/io/CreateGenericTemplate.java @@ -0,0 +1,101 @@ +package com.fr.io; +import com.fr.base.TableData; +import com.fr.base.operator.common.CommonOperator; +import com.fr.chart.activator.ChartBaseActivator; +import com.fr.config.activator.BaseDBActivator; +import com.fr.config.activator.ConfigurationActivator; +import com.fr.data.impl.DBTableData; +import com.fr.data.impl.NameDatabaseConnection; +import com.fr.data.impl.config.activator.RestrictionActivator; +import com.fr.env.operator.CommonOperatorImpl; +import com.fr.general.data.TableDataColumn; +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.DefaultTemplateCellElement; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.report.module.ReportBaseActivator; +import com.fr.report.worksheet.WorkSheet; +import com.fr.store.StateServerActivator; +import com.fr.workspace.simple.SimpleWork; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.HashMap; + +public class CreateGenericTemplate { + public static void main(String[] args) throws Exception { + // 首先需要定义执行所在的环境,这样才能正确读取数据库信息 + // 定义报表运行环境,用于执行报表 + Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), + new ConfigurationActivator(), + new StateServerActivator(), + new ReportBaseActivator(), + new RestrictionActivator(), + new ReportActivator(), + new ChartBaseActivator()); + SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); + String envpath= "//Applications//FineReport10_325//webapps//webroot//WEB-INF"; //工程路径 + SimpleWork.checkIn(envpath); + module.start(); + WorkBook wb = new WorkBook(); + //添加新的模板数据集 + TableData td = genericTableData("FRDemo", "SELECT * FROM Equipment"); + wb.putTableData("公司信息", td); + //创建第一个report 也就是sheet页 + WorkSheet report = new WorkSheet(); + wb.addReport(report); + //数据库暂时先不读,弄点假数据 + HashMap map = new HashMap(); + map.put(0, "Company"); + map.put(1, "Tel"); + //添加列头 + DefaultTemplateCellElement title = genericCell(0, 0, null, "这是标题"); + title.setRowSpan(2); + title.setColumnSpan(2); + report.addCellElement(title); + //添加数据列 + for (Integer key : map.keySet()) { + TemplateCellElement cellHeaer = genericCell(2, key, null, map.get(key)); + report.addCellElement(cellHeaer); + TemplateCellElement cell = genericCell(3, key, "公司信息", map.get(key)); + report.addCellElement(cell); + } + //导出模板 + FileOutputStream outputStream = new FileOutputStream(new File("//Users//susie//Downloads//company.cpt")); + wb.export(outputStream); + outputStream.close(); + module.stop(); + System.out.println("finished"); + } + /* + *生成TableData + */ + private static TableData genericTableData(String conString, String sqlQuery) { + NameDatabaseConnection database = new NameDatabaseConnection(conString); + TableData td = new DBTableData(database, sqlQuery); + return td; + } + /** + * 添加单元格 + * row 行号 + * column 列号 + * dsName 数据集名称 如 ds1 + * 数据列名称如 ds1中的id列,则输入 id + */ + private static DefaultTemplateCellElement genericCell(int row, int column, String dsName, String columnName) { + DefaultTemplateCellElement dtCell = new DefaultTemplateCellElement(row, column); + if (dsName != null) { + DSColumn dsColumn = new DSColumn(); + dsColumn.setDSName(dsName); + dsColumn.setColumn(TableDataColumn.createColumn(columnName)); + dtCell.setValue(dsColumn); + } else { + dtCell.setValue(columnName); + } + return dtCell; + } +} +//自动执行存储过程,从里面获取结果集结的部分等研究一下jdbc再补 \ No newline at end of file diff --git a/src/main/java/com/fr/io/ExcelToCpt.java b/src/main/java/com/fr/io/ExcelToCpt.java new file mode 100644 index 0000000..53c973b --- /dev/null +++ b/src/main/java/com/fr/io/ExcelToCpt.java @@ -0,0 +1,46 @@ +package com.fr.io; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.OutputStream; +import com.fr.base.operator.common.CommonOperator; +import com.fr.chart.activator.ChartBaseActivator; +import com.fr.config.activator.BaseDBActivator; +import com.fr.config.activator.ConfigurationActivator; +import com.fr.data.impl.config.activator.RestrictionActivator; +import com.fr.env.operator.CommonOperatorImpl; +import com.fr.main.impl.WorkBook; +import com.fr.io.importer.Excel2007ReportImporter; +import com.fr.main.TemplateWorkBook; +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.store.StateServerActivator; +import com.fr.workspace.simple.SimpleWork; + +public class ExcelToCpt { + public static void main(String[] args) throws Exception { + // 首先需要定义执行所在的环境,这样才能正确读取数据库信息 + // 定义报表运行环境,用于执行报表 + Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), + new ConfigurationActivator(), + new StateServerActivator(), + new ReportBaseActivator(), + new RestrictionActivator(), + new ReportActivator(), + new ChartBaseActivator()); + SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); + String envpath= "//Applications//FineReport10_325//webapps//webroot//WEB-INF"; //工程路径 + SimpleWork.checkIn(envpath); + module.start(); + File excelFile = new File("//Users//susie//Downloads//aa.xlsx"); // 获取EXCEL文件 + FileInputStream a = new FileInputStream(excelFile); + + TemplateWorkBook tpl = new Excel2007ReportImporter().generateWorkBookByStream(a); + OutputStream outputStream = new FileOutputStream(new File("//Users//susie//Downloads//abc.cpt")); // 转换成cpt模板 + ((WorkBook) tpl).export(outputStream); + outputStream.close(); + module.stop(); + } +} diff --git a/plugin-report-doc-demo/src/com/fr/io/ExcelToCptpage.java b/src/main/java/com/fr/io/ExcelToCptpage.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/io/ExcelToCptpage.java rename to src/main/java/com/fr/io/ExcelToCptpage.java diff --git a/plugin-report-doc-demo/src/com/fr/io/ExcuteDemo.java b/src/main/java/com/fr/io/ExcuteDemo.java similarity index 70% rename from plugin-report-doc-demo/src/com/fr/io/ExcuteDemo.java rename to src/main/java/com/fr/io/ExcuteDemo.java index 4c799a6..0abb589 100644 --- a/plugin-report-doc-demo/src/com/fr/io/ExcuteDemo.java +++ b/src/main/java/com/fr/io/ExcuteDemo.java @@ -1,8 +1,10 @@ package com.fr.io; - +import com.fr.base.operator.common.CommonOperator; +import com.fr.chart.activator.ChartBaseActivator; import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.data.impl.config.activator.RestrictionActivator; +import com.fr.env.operator.CommonOperatorImpl; import com.fr.io.exporter.ExcelExporter; import com.fr.main.TemplateWorkBook; import com.fr.main.workbook.ResultWorkBook; @@ -13,7 +15,6 @@ import com.fr.report.module.ReportBaseActivator; import com.fr.stable.WriteActor; import com.fr.store.StateServerActivator; import com.fr.workspace.simple.SimpleWork; - import java.io.File; import java.io.FileOutputStream; @@ -21,18 +22,21 @@ import java.io.FileOutputStream; public class ExcuteDemo { public static void main(String[] args) { try { - // 首先需要定义执行所在的环境,这样才能正确读取数据库信息 + // 首先需要定义执行所在的环境,这样才能正确读取数据库信息 + // 定义报表运行环境,用于执行报表 Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StateServerActivator(), new ReportBaseActivator(), new RestrictionActivator(), - new ReportActivator()); - String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径 + new ReportActivator(), + new ChartBaseActivator()); + SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); + String envpath= "//Applications//FineReport10_325//webapps//webroot//WEB-INF"; //工程路径 SimpleWork.checkIn(envpath); module.start(); - // 读取模板 - TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt"); + // 读取模板 + TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook("//doc//Primary//Parameter//Parameter.cpt"); /* * 生成参数map,注入参数与对应的值,用于执行报表 该模板中只有一个参数地区,给其赋值华北 * 若参数在发送请求时传过来,可以通过req.getParameter(name)获得 @@ -40,13 +44,13 @@ public class ExcuteDemo { */ java.util.Map paraMap = new java.util.HashMap(); paraMap.put("地区", "华北"); - // 使用paraMap执行生成结果 + // 使用paraMap执行生成结果 ResultWorkBook result = workbook.execute(paraMap, new WriteActor()); - // 使用结果如导出至excel + // 使用结果如导出至excel FileOutputStream outputStream = new FileOutputStream(new File( - "D:\\Parameter.xls")); + "//Users//susie//Downloads//Parameter.xls")); ExcelExporter excelExporter = new ExcelExporter(); - excelExporter.export(outputStream, result); + excelExporter.export(outputStream,result); } catch (Exception e) { e.printStackTrace(); } finally { diff --git a/src/com/fr/io/ExportApi.java b/src/main/java/com/fr/io/ExportApi.java similarity index 66% rename from src/com/fr/io/ExportApi.java rename to src/main/java/com/fr/io/ExportApi.java index 8786733..26b0df5 100644 --- a/src/com/fr/io/ExportApi.java +++ b/src/main/java/com/fr/io/ExportApi.java @@ -1,9 +1,12 @@ package com.fr.io; import com.fr.base.Parameter; +import com.fr.base.operator.common.CommonOperator; +import com.fr.chart.activator.ChartBaseActivator; import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.data.impl.config.activator.RestrictionActivator; +import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.ModuleContext; import com.fr.io.exporter.CSVExporter; import com.fr.io.exporter.EmbeddedTableDataExporter; @@ -20,12 +23,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; @@ -34,79 +33,75 @@ 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 ChartBaseActivator()); + SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); + String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径 SimpleWork.checkIn(envpath); module.start(); ResultWorkBook rworkbook = null; try { - // 未执行模板工作薄 + // 未执行模板工作薄 WorkBook workbook = (WorkBook) TemplateWorkBookIO - .readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt"); - // 获取报表参数并设置值,导出内置数据集时数据集会根据参数值查询出结果从而转为内置数据集 + .readTemplateWorkBook("//doc//Primary//Parameter//Parameter.cpt"); + // 获取报表参数并设置值,导出内置数据集时数据集会根据参数值查询出结果从而转为内置数据集 Parameter[] parameters = workbook.getParameters(); parameters[0].setValue("华东"); - // 定义parametermap用于执行报表,将执行后的结果工作薄保存为rworkBook + // 定义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")); + // 将未执行模板工作薄导出为内置数据集模板 + outputStream = new FileOutputStream(new File("/Users//susie//Downloads//EmbExport.cpt")); EmbeddedTableDataExporter templateExporter = new EmbeddedTableDataExporter(); templateExporter.export(outputStream, workbook); - // 将模板工作薄导出模板文件,在导出前您可以编辑导入的模板工作薄,可参考报表调用章节 - outputStream = new FileOutputStream(new File("D:\\TmpExport.cpt")); + // 将模板工作薄导出模板文件,在导出前您可以编辑导入的模板工作薄,可参考报表调用章节 + outputStream = new FileOutputStream(new File("/Users//susie//Downloads//TmpExport.cpt")); ((WorkBook) workbook).export(outputStream); - // 将结果工作薄导出为2003Excel文件 - outputStream = new FileOutputStream(new File("D:\\ExcelExport.xls")); + // 将结果工作薄导出为2003Excel文件 + outputStream = new FileOutputStream(new File("/Users//susie//Downloads//ExcelExport.xls")); ExcelExporter ExcelExport = new ExcelExporter(); ExcelExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - // 将结果工作薄导出为Excel文件 - outputStream = new FileOutputStream(new File("D:\\ExcelExport.xlsx")); + // 将结果工作薄导出为Excel文件 + outputStream = new FileOutputStream(new File("/Users//susie//Downloads//ExcelExport.xlsx")); StreamExcel2007Exporter ExcelExport1 = new StreamExcel2007Exporter(); ExcelExport1.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - // 将结果工作薄导出为Word文件 - outputStream = new FileOutputStream(new File("D:\\WordExport.doc")); + // 将结果工作薄导出为Word文件 + outputStream = new FileOutputStream(new File("/Users//susie//Downloads//WordExport.doc")); WordExporter WordExport = new WordExporter(); WordExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - // 将结果工作薄导出为Pdf文件 - outputStream = new FileOutputStream(new File("D:\\PdfExport.pdf")); + // 将结果工作薄导出为Pdf文件 + outputStream = new FileOutputStream(new File("/Users//susie//Downloads//PdfExport.pdf")); PDFExporter PdfExport = new PDFExporter(); PdfExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - // 将结果工作薄导出为Txt文件(txt文件本身不支持表格、图表等,被导出模板一般为明细表) - outputStream = new FileOutputStream(new File("D:\\TxtExport.txt")); + // 将结果工作薄导出为Txt文件(txt文件本身不支持表格、图表等,被导出模板一般为明细表) + outputStream = new FileOutputStream(new File("/Users//susie//Downloads//TxtExport.txt")); TextExporter TxtExport = new TextExporter(); TxtExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - // 将结果工作薄导出为Csv文件 - outputStream = new FileOutputStream(new File("D:\\CsvExport.csv")); + // 将结果工作薄导出为Csv文件 + outputStream = new FileOutputStream(new File("/Users//susie//Downloads//CsvExport.csv")); CSVExporter CsvExport = new CSVExporter(); CsvExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - //将结果工作薄导出为SVG文件 - outputStream = new FileOutputStream(new File("D:\\SvgExport.svg")); + //将结果工作薄导出为SVG文件 + outputStream = new FileOutputStream(new File("/Users//susie//Downloads//SvgExport.svg")); SVGExporter SvgExport = new SVGExporter(); SvgExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); - //将结果工作薄导出为image文件 - outputStream = new FileOutputStream(new File("D:\\PngExport.png")); + //将结果工作薄导出为image文件 + outputStream = new FileOutputStream(new File("/Users//susie//Downloads//PngExport.png")); ImageExporter ImageExport = new ImageExporter(); ImageExport.export(outputStream, workbook.execute(parameterMap, new WriteActor())); outputStream.close(); - ModuleContext.stopModules(); + module.stop(); } catch (Exception e) { e.printStackTrace(); } finally { diff --git a/plugin-report-doc-demo/src/com/fr/io/ExportBatch.java b/src/main/java/com/fr/io/ExportBatch.java similarity index 75% rename from plugin-report-doc-demo/src/com/fr/io/ExportBatch.java rename to src/main/java/com/fr/io/ExportBatch.java index 227c15b..9968d87 100644 --- a/plugin-report-doc-demo/src/com/fr/io/ExportBatch.java +++ b/src/main/java/com/fr/io/ExportBatch.java @@ -1,9 +1,7 @@ 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; @@ -15,7 +13,9 @@ import com.fr.stable.StableUtils; import com.fr.stable.WriteActor; import com.fr.store.StateServerActivator; import com.fr.workspace.simple.SimpleWork; - +import com.fr.chart.activator.ChartBaseActivator; +import com.fr.base.operator.common.CommonOperator; +import com.fr.env.operator.CommonOperatorImpl; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -34,24 +34,26 @@ public class ExportBatch { new StateServerActivator(), new ReportBaseActivator(), new RestrictionActivator(), - new ReportActivator()); - String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径 + new ReportActivator(), + new ChartBaseActivator()); + SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); + String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径 SimpleWork.checkIn(envpath); module.start(); // 读取环境下的模板文件 TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook( - "doc\\Primary\\DetailReport\\Details.cpt"); + "//doc//Primary//Parameter//Parameter.cpt"); // 读取用于保存的参数值的txt文件 - File parafile = new File(envpath + "\\para.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文件名为名称+导出编号 - */ + /* + * 遍历参数值所在txt文件,txt文件中参数保存形式为 para1,para2 江苏,陈羽 江苏,安娜 首先取出第一行保存参数名称 + * 遍历每个参数组合,如para1=江苏、para2=陈羽,根据参数执行模板,并将结果导出excel excel文件名为名称+导出编号 + */ // 读第一行,保存参数名称 String lineText = bufferedReader.readLine(); lineText = lineText.trim(); @@ -66,7 +68,7 @@ public class ExportBatch { paramap.put(paraname[j], paravalue[j]); } ResultWorkBook result = workbook.execute(paramap,new WriteActor()); - OutputStream outputstream = new FileOutputStream(new File("E:\\ExportEg" + number + ".xls")); + OutputStream outputstream = new FileOutputStream(new File("//Users//susie//Downloads//ExportEg" + number + ".xls")); ExcelExporter excelexporter = new ExcelExporter(); excelexporter.export(outputstream, result); // 最后要清空一下参数map,用于下次计算 @@ -74,7 +76,7 @@ public class ExportBatch { number++; outputstream.close(); } - ModuleContext.stopModules(); + module.stop(); } catch (Exception e) { e.printStackTrace(); } diff --git a/plugin-report-doc-demo/src/com/fr/io/ExportExcel.java b/src/main/java/com/fr/io/ExportExcel.java similarity index 62% rename from plugin-report-doc-demo/src/com/fr/io/ExportExcel.java rename to src/main/java/com/fr/io/ExportExcel.java index 83908a7..5e5e1e6 100644 --- a/plugin-report-doc-demo/src/com/fr/io/ExportExcel.java +++ b/src/main/java/com/fr/io/ExportExcel.java @@ -1,10 +1,14 @@ package com.fr.io; -import com.fr.base.Parameter; +import java.io.File; +import java.io.FileOutputStream; +import com.fr.base.operator.common.CommonOperator; +import com.fr.chart.activator.ChartBaseActivator; 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.env.operator.CommonOperatorImpl; +import com.fr.base.Parameter; import com.fr.io.exporter.ExcelExporter; import com.fr.io.exporter.LargeDataPageExcelExporter; import com.fr.io.exporter.PageExcel2007Exporter; @@ -12,7 +16,7 @@ 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.TemplateWorkBook; import com.fr.main.workbook.ResultWorkBook; import com.fr.module.Module; import com.fr.module.tool.ActivatorToolBox; @@ -23,77 +27,79 @@ import com.fr.stable.WriteActor; import com.fr.store.StateServerActivator; import com.fr.workspace.simple.SimpleWork; -import java.io.File; -import java.io.FileOutputStream; - public class 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"; + new ReportActivator(), + new ChartBaseActivator()); + SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); + String envpath= "//Applications//FineReport10_325//webapps//webroot//WEB-INF"; //工程路径 SimpleWork.checkIn(envpath); module.start(); ResultWorkBook rworkbook = null; try { - // 未执行模板工作薄 - WorkBook workbook = (WorkBook) TemplateWorkBookIO - .readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt"); - // 获取报表参数并设置值,导出内置数据集时数据集会根据参数值查询出结果从而转为内置数据集 + // 未执行模板工作薄 + TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook("//doc//Primary//Parameter//Parameter.cpt"); + // 获取报表参数并设置值,导出内置数据集时数据集会根据参数值查询出结果从而转为内置数据集 Parameter[] parameters = workbook.getParameters(); parameters[0].setValue("华东"); - // 定义parametermap用于执行报表,将执行后的结果工作薄保存为rworkBook + // 定义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")); + outputStream = new FileOutputStream(new File("//Users//susie//Downloads//ExcelExport.xls")); ExcelExporter excel = new ExcelExporter(); - excel.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + excel.setVersion(true); + excel.export(outputStream, workbook.execute(parameterMap,new WriteActor())); //原样导出excel2007 - outputStream = new FileOutputStream(new File("E:\\ExcelExport.xlsx")); + outputStream = new FileOutputStream(new File("//Users//susie//Downloads//ExcelExport.xlsx")); StreamExcel2007Exporter excel1 = new StreamExcel2007Exporter(); - excel.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + 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())); + outputStream = new FileOutputStream(new File("//Users//susie//Downloads//PageExcelExport.xls")); + PageExcelExporter page = new PageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap,new WriteActor()))); + page.setVersion(true); + page.export(outputStream, workbook.execute(parameterMap,new WriteActor())); //分页导出excel2007 - outputStream = new FileOutputStream(new File("E:\\PageExcelExport.xlsx")); + outputStream = new FileOutputStream(new File("//Users//susie//Downloads//PageExcelExport.xlsx")); PageExcel2007Exporter page1 = new PageExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook)); - page1.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + 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())); + outputStream = new FileOutputStream(new File("//Users//susie//Downloads//PageSheetExcelExport.xls")); + PageToSheetExcelExporter sheet = new PageToSheetExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap,new WriteActor()))); + sheet.setVersion(true); + sheet.export(outputStream, workbook.execute(parameterMap,new WriteActor())); //分页分sheet导出excel2007 - outputStream = new FileOutputStream(new File("E:\\PageSheetExcelExport.xlsx")); + outputStream = new FileOutputStream(new File("//Users//susie//Downloads//PageSheetExcelExport.xlsx")); PageToSheetExcel2007Exporter sheet1 = new PageToSheetExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook)); - sheet1.export(outputStream, workbook.execute(parameterMap, new WriteActor())); + 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 = new FileOutputStream(new File("//Users//susie//Downloads//LargeExcelExport.zip")); + LargeDataPageExcelExporter large = new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap,new WriteActor())), true); + //导出2007版outputStream = new FileOutputStream(new File("//Users//susie//Downloads//LargeExcelExport.xlsx")); excel LargeDataPageExcel2007Exporter large = new LargeDataPageExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook), true); + large.export(outputStream, workbook.execute(parameterMap,new WriteActor())); outputStream.close(); - ModuleContext.stopModules(); + module.stop(); } catch (Exception e) { e.printStackTrace(); } diff --git a/plugin-report-doc-demo/src/com/fr/io/ExportReports.java b/src/main/java/com/fr/io/ExportReports.java similarity index 59% rename from plugin-report-doc-demo/src/com/fr/io/ExportReports.java rename to src/main/java/com/fr/io/ExportReports.java index 595e8a0..56128be 100644 --- a/plugin-report-doc-demo/src/com/fr/io/ExportReports.java +++ b/src/main/java/com/fr/io/ExportReports.java @@ -1,10 +1,14 @@ package com.fr.io; - -import com.fr.base.Parameter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import com.fr.base.operator.common.CommonOperator; +import com.fr.chart.activator.ChartBaseActivator; 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.env.operator.CommonOperatorImpl; +import com.fr.base.Parameter; import com.fr.io.exporter.PageExcelExporter; import com.fr.main.TemplateWorkBook; import com.fr.main.workbook.PageWorkBook; @@ -18,55 +22,51 @@ import com.fr.stable.PageActor; import com.fr.store.StateServerActivator; 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) { - // ���屨�����л���,����ִ�б��� + // 首先需要定义执行所在的环境,这样才能正确读取数据库信息 + // 定义报表运行环境,用于执行报表 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"; + new ReportActivator(), + new ChartBaseActivator()); + SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); + String envpath= "//Applications//FineReport10_325//webapps//webroot//WEB-INF"; //工程路径 SimpleWork.checkIn(envpath); module.start(); - - // ���г����һЩ��Ҫ��ʼ�� + // 进行程序的一些必要初始化 try { - // δִ��ģ�幤���� + // 未执行模板工作薄 TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook( "Gettingstarted.cpt"); - // ����ֵΪChina�������������������rworkbook + // 参数值为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(), "����"); + parameterMap.put(parameters[i].getName(), "华东"); } - PageWorkBook rworkbook = (PageWorkBook) workbook.execute(parameterMap, new PageActor()); - rworkbook.setReportName(0, "����"); - // ���parametermap��������ֵ��Ϊ����,�������ResultReport + 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(), "����"); + parameterMap.put(parameters[i].getName(), "华北"); } - PageWorkBook rworkbook2 = (PageWorkBook) workbook.execute(parameterMap, new PageActor()); + 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")); + rworkbook.addReport("华北", rreport2); + // 将结果工作薄导出为Excel文件 + OutputStream outputStream = new FileOutputStream(new File("//Users//susie//Downloads//ExcelExport1.xls")); PageExcelExporter excelExport = new PageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook)); excelExport.export(outputStream, rworkbook); outputStream.close(); - ModuleContext.stopModules(); + module.stop(); } catch (Exception e) { e.printStackTrace(); - } finally { - SimpleWork.checkOut(); } } -} \ No newline at end of file +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/io/JavaPrint.java b/src/main/java/com/fr/io/JavaPrint.java similarity index 82% rename from plugin-report-doc-demo/src/com/fr/io/JavaPrint.java rename to src/main/java/com/fr/io/JavaPrint.java index 3c35be3..a2a8788 100644 --- a/plugin-report-doc-demo/src/com/fr/io/JavaPrint.java +++ b/src/main/java/com/fr/io/JavaPrint.java @@ -1,5 +1,4 @@ package com.fr.io; - import com.fr.base.Parameter; import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; @@ -12,21 +11,21 @@ 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; - 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); + String envpath;//工程路径 + envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF"; + SimpleWork.checkIn(envpath); module.start(); try { TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook("GettingStarted.cpt"); @@ -34,10 +33,9 @@ public class JavaPrint { 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) { + if (!a) { System.out.println("失败啦!返回" + a); } else { System.out.println("成功!返回" + a); @@ -45,7 +43,7 @@ public class JavaPrint { } catch (Exception e) { e.printStackTrace(); } finally { - SimpleWork.checkOut(); + module.stop(); } } } \ No newline at end of file diff --git a/src/main/java/com/fr/io/LocalEnv.java b/src/main/java/com/fr/io/LocalEnv.java new file mode 100644 index 0000000..ac3f63c --- /dev/null +++ b/src/main/java/com/fr/io/LocalEnv.java @@ -0,0 +1,6 @@ +package com.fr.io; + +public class LocalEnv { + public LocalEnv(String envpath) { + } +} diff --git a/src/main/java/com/fr/io/SaveReportToDatabase.java b/src/main/java/com/fr/io/SaveReportToDatabase.java new file mode 100644 index 0000000..8156218 --- /dev/null +++ b/src/main/java/com/fr/io/SaveReportToDatabase.java @@ -0,0 +1,66 @@ +package com.fr.io; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import com.fr.base.operator.common.CommonOperator; +import com.fr.chart.activator.ChartBaseActivator; +import com.fr.config.activator.BaseDBActivator; +import com.fr.config.activator.ConfigurationActivator; +import com.fr.data.impl.config.activator.RestrictionActivator; +import com.fr.env.operator.CommonOperatorImpl; +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.store.StateServerActivator; +import com.fr.workspace.simple.SimpleWork; + +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 StateServerActivator(), + new ReportBaseActivator(), + new RestrictionActivator(), + new ReportActivator(), + new ChartBaseActivator()); + SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); + String envpath= "//Applications//FineReport10_325//webapps//webroot//WEB-INF"; //工程路径 + SimpleWork.checkIn(envpath); + 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/plugin-report-doc-demo/src/com/fr/io/SetParameterWindow.java b/src/main/java/com/fr/io/SetParameterWindow.java similarity index 65% rename from plugin-report-doc-demo/src/com/fr/io/SetParameterWindow.java rename to src/main/java/com/fr/io/SetParameterWindow.java index 1b1af23..2781e5f 100644 --- a/plugin-report-doc-demo/src/com/fr/io/SetParameterWindow.java +++ b/src/main/java/com/fr/io/SetParameterWindow.java @@ -1,10 +1,12 @@ -// �����������API package com.fr.io; import com.fr.base.background.ColorBackground; +import com.fr.base.operator.common.CommonOperator; +import com.fr.chart.activator.ChartBaseActivator; import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.data.impl.config.activator.RestrictionActivator; +import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.Background; import com.fr.io.exporter.EmbeddedTableDataExporter; import com.fr.main.impl.WorkBook; @@ -29,35 +31,37 @@ public class SetParameterWindow { new StateServerActivator(), new ReportBaseActivator(), new RestrictionActivator(), - new ReportActivator()); - String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径 + new ReportActivator(), + new ChartBaseActivator()); + SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); + String envpath= "//Applications//FineReport10_325//webapps//webroot//WEB-INF"; //工程路径 SimpleWork.checkIn(envpath); module.start(); WorkBook workbook = (WorkBook) TemplateWorkBookIO .readTemplateWorkBook( - "\\doc\\Primary\\Parameter\\Parameter.cpt"); - // ��ȡWorkBook�������IJ�������ReportParameterAttr + "//doc//Primary//Parameter//Parameter.cpt"); + // 获取WorkBook工作薄的参数属性ReportParameterAttr  ReportParameterAttr paraAttr = workbook.getReportParameterAttr(); - /* ��������IJ��� - * 0 : ���� - * 1 ������ - * 2 �� ���� + /* 参数界面的布局 + * 0 : 靠左 + * 1 :居中 + * 2 : 靠右 */ paraAttr.setAlign(1); /* - * ���ò������汳�� - * ColorBackground ����ɫ���� - * GradientBackground ������ɫ���� - * ImageBackground ��ͼƬ���� - * PatternBackground ��ͼ������ - * TextureBackground �������� + * 设置参数界面背景 + * 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")); + "//Users//susie//Downloads//newParameter.cpt")); EmbeddedTableDataExporter templateExporter = new EmbeddedTableDataExporter(); templateExporter.export(outputStream, workbook); } catch (Exception e) { diff --git a/plugin-report-doc-demo/src/com/fr/io/SimpleDemo.java b/src/main/java/com/fr/io/SimpleDemo.java similarity index 68% rename from plugin-report-doc-demo/src/com/fr/io/SimpleDemo.java rename to src/main/java/com/fr/io/SimpleDemo.java index 23f04d7..7e29d3d 100644 --- a/plugin-report-doc-demo/src/com/fr/io/SimpleDemo.java +++ b/src/main/java/com/fr/io/SimpleDemo.java @@ -1,10 +1,12 @@ -//��ȡ�޸ı��� package com.fr.io; import com.fr.base.Style; +import com.fr.base.operator.common.CommonOperator; +import com.fr.chart.activator.ChartBaseActivator; import com.fr.config.activator.BaseDBActivator; import com.fr.config.activator.ConfigurationActivator; import com.fr.data.impl.config.activator.RestrictionActivator; +import com.fr.env.operator.CommonOperatorImpl; import com.fr.general.FRFont; import com.fr.main.impl.WorkBook; import com.fr.module.Module; @@ -22,36 +24,38 @@ import java.io.FileOutputStream; public class SimpleDemo { public static void main(String[] args) { + // 首先需要定义执行所在的环境,这样才能正确读取数据库信息 // 定义报表运行环境,用于执行报表 Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(), new ConfigurationActivator(), new StateServerActivator(), new ReportBaseActivator(), new RestrictionActivator(), - new ReportActivator()); - String envpath = "D:\\FineReport_10\\webapps\\webroot\\WEB-INF";//工程路径 + new ReportActivator(), + new ChartBaseActivator()); + SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); + String envpath= "//Applications//FineReport10_325//webapps//webroot//WEB-INF"; //工程路径 SimpleWork.checkIn(envpath); module.start(); try { - // ��ȡģ�� WorkBook workbook = (WorkBook) TemplateWorkBookIO .readTemplateWorkBook( - "\\doc\\Primary\\Parameter\\Parameter.cpt"); + "//doc//Primary//Parameter//Parameter.cpt"); - // ���WorkBook�е�WorkSheet�������޸�A1��Ԫ���ǰ��ɫΪ��ɫ + // 获得WorkBook中的WorkSheet,进而修改A1单元格的前景色为红色 TemplateElementCase report = (TemplateElementCase) workbook .getReport(0); - // getCellElement(int column, int - // row),column��row����0��ʼ�����A1��Ԫ����ǵ�0�е�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")); + "/Users//susie//Downloads//newParameter1.cpt")); ((WorkBook) workbook).export(outputStream); } catch (Exception e) { e.printStackTrace(); diff --git a/plugin-report-doc-demo/src/com/fr/log/LogApi.java b/src/main/java/com/fr/log/LogApi.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/log/LogApi.java rename to src/main/java/com/fr/log/LogApi.java diff --git a/src/main/java/com/fr/myexporter.java b/src/main/java/com/fr/myexporter.java new file mode 100644 index 0000000..b6bd0a2 --- /dev/null +++ b/src/main/java/com/fr/myexporter.java @@ -0,0 +1,451 @@ +package com.fr; + +import com.fr.base.DynamicUnitList; +import com.fr.base.FRContext; +import com.fr.base.ResultFormula; +import com.fr.general.ComparatorUtils; +import com.fr.general.DeclareRecordType; +import com.fr.general.ModuleContext; +import com.fr.io.TemplateWorkBookIO; +import com.fr.io.exporter.AppExporter; +import com.fr.io.exporter.PDFExporter; +import com.fr.io.exporter.WordExporter; +import com.fr.json.JSONArray; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.main.TemplateWorkBook; +import com.fr.main.workbook.ResultWorkBook; +import com.fr.page.PageSetProvider; +import com.fr.page.PaperSettingProvider; +import com.fr.report.cell.CellElement; +import com.fr.report.cell.DefaultTemplateCellElement; +import com.fr.report.cell.ResultCellElement; +import com.fr.report.cell.cellattr.PageExportCellElement; +import com.fr.report.core.ReportUtils; +import com.fr.report.core.block.PolyResultWorkSheet; +import com.fr.report.module.EngineModule; +import com.fr.report.worksheet.PageRWorkSheet; +import com.fr.stable.CodeUtils; +import com.fr.stable.ColumnRow; +import com.fr.stable.CommonCodeUtils; +import com.fr.stable.PageActor; +import com.fr.stable.unit.FU; +import com.fr.stable.unit.UNIT; +import com.fr.web.Browser; +import com.fr.web.core.ErrorHandlerHelper; +import com.fr.web.core.utils.ExportUtils; +import com.fr.web.utils.WebUtils; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class myexporter extends HttpServlet { + private static boolean offlineWriteAble = true; + private static final Pattern KEY_VALUE_PATTERN = Pattern.compile("[^{,}]*:[^{,}]*"); + private static final long serialVersionUID = 1L; + + public myexporter() { + } + + public static void dealResponse4Export(HttpServletResponse res) { + res.setHeader("Cache-Control", "public"); + res.setHeader("Cache-Control", "max-age=3"); + res.reset(); + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + this.doGet(request, response); + } + + public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { + try { + ModuleContext.startModule(EngineModule.class.getName()); + dealResponse4Export(res); + String fileName = WebUtils.getHTTPRequestParameter(req, "__filename__"); + String format = WebUtils.getHTTPRequestParameter(req, "format"); + Browser browser = Browser.resolve(req); + fileName = browser.getEncodedFileName4Download(fileName); + List paraMapList = new ArrayList(); + List reportPathList = new ArrayList(); + PaperSettingProvider paperSettingProvider = null; + if (WebUtils.getHTTPRequestParameter(req, "reportlets") != null) { + createReportsFromReportlets(WebUtils.getHTTPRequestParameter(req, "reportlets"), reportPathList, paraMapList); + ResultWorkBook[] resultWorkBook = new ResultWorkBook[reportPathList.size()]; + PolyResultWorkSheet allInOneSheet = new PageRWorkSheet(); + + for (int i = 0; i < reportPathList.size(); ++i) { + TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook(String.valueOf(reportPathList.get(i))); + Map paraMap = (Map) paraMapList.get(i); + resultWorkBook[i] = workbook.execute(paraMap, new PageActor()); + if (i == 0) { + paperSettingProvider = (PaperSettingProvider) ReportUtils.getPaperSettingListFromWorkBook(workbook).get(0); + } + } + + int length = resultWorkBook.length; + long[] lengthx = new long[length]; + long[] lengthy = (long[]) lengthx.clone(); + if (length > 0) { + lengthx[0] = lengthy[0] = 0L; + } + + for (int i = 1; i < length; ++i) { + long sumy = 0L; + + for (int county = resultWorkBook[i - 1].getElementCaseReport(0).getRowCount(); county-- > 0; sumy += resultWorkBook[i - 1].getElementCaseReport(0).getRowHeight(county).getLen()) { + ; + } + + lengthx[i] = 0L; + lengthy[i] = sumy + lengthy[i - 1]; + } + + ArrayList verticalList = new ArrayList(); + ArrayList horizontalList = new ArrayList(); + analyElementColumnRow(verticalList, horizontalList, resultWorkBook, lengthx, lengthy); + allInOneSheet = setNewColRowSize(verticalList, horizontalList, allInOneSheet); + allInOneSheet = fillBlankCell(verticalList.size(), horizontalList.size(), allInOneSheet); + int i = 0; + + for (int len = reportPathList.size(); i < len; ++i) { + allInOneSheet = addElemToSheet(verticalList, horizontalList, allInOneSheet, resultWorkBook[i], lengthx[i], lengthy[i]); + } + + if (paperSettingProvider == null) { + return; + } + + doExport(req, res, format, fileName, false, browser, allInOneSheet.generateReportPageSet(paperSettingProvider)); + } + } catch (Exception var24) { + var24.printStackTrace(); + } + + } + + private static void doExport(HttpServletRequest req, HttpServletResponse res, String format, String fileName, boolean isEmbbed, Browser browser, PageSetProvider page) throws Exception { + AppExporter[] exporters = new AppExporter[]{null}; + DeclareRecordType[] exportTypes = new DeclareRecordType[]{null}; + OutputStream outputStream = res.getOutputStream(); + getExporterAndTypeAndexport(req, res, format, fileName, isEmbbed, browser, exporters, exportTypes, outputStream, page); + DeclareRecordType exportType = exportTypes[0]; + if (exportType == null) { + ErrorHandlerHelper.getErrorHandler().error(req, res, "Cannot recognize the specifed export format:" + format + ",\nThe correct format can be PDF,Excel,Word,SVG,CSV,Text or Image."); + } else { + try { + outputStream.flush(); + outputStream.close(); + } catch (IOException var12) { + ; + } + + } + } + + private static void getExporterAndTypeAndexport(HttpServletRequest req, HttpServletResponse res, String format, String fileName, boolean isEmbbed, Browser browser, AppExporter[] exporters, DeclareRecordType[] exportTypes, OutputStream out, PageSetProvider page) throws Exception { + if (format.equalsIgnoreCase("PDF")) { + ExportUtils.setPDFContent(res, fileName, isEmbbed); + PDFExporter PDFExport = new PDFExporter(); + PDFExport.export(out, page); + } else if (format.equalsIgnoreCase("Word")) { + ExportUtils.setWordConetent(res, fileName); + WordExporter WordExport = new WordExporter(); + WordExport.export(out, page); + } + + } + + public static PolyResultWorkSheet fillBlankCell(int rowCount, int colCount, PolyResultWorkSheet allInOneSheet) { + for (int i = 0; i < rowCount; ++i) { + for (int j = 0; j < colCount; ++j) { + ResultCellElement ce = createDefaultCellElement(j, i); + allInOneSheet.addCellElement(ce); + } + } + + allInOneSheet.setRowMappingArray(new int[0]); + allInOneSheet.setColumnMappingArray(new int[0]); + return allInOneSheet; + } + + public static ResultCellElement createDefaultCellElement(int col, int row) { + return new PageExportCellElement(new DefaultTemplateCellElement(col, row)); + } + + public static PolyResultWorkSheet addElemToSheet(ArrayList verticalList, ArrayList horizontalList, PolyResultWorkSheet page_sheet, ResultWorkBook resultWorkBook, long lengthx, long lengthy) { + UNIT x = FU.getInstance(lengthx); + UNIT y = FU.getInstance(lengthy); + DynamicUnitList newRowList = page_sheet.getRowHeightList_DEC(); + DynamicUnitList newColList = page_sheet.getColumnWidthList_DEC(); + int rowCount = page_sheet.getRowCount(); + int colCount = page_sheet.getColumnCount(); + DynamicUnitList rowHeightList = resultWorkBook.getElementCaseReport(0).getRowHeightList_DEC(); + DynamicUnitList colWidthList = resultWorkBook.getElementCaseReport(0).getColumnWidthList_DEC(); + Iterator it = resultWorkBook.getElementCaseReport(0).cellIterator(); + HashMap columnRowMap = new HashMap(); + HashMap formulaMap = new HashMap(); + + while (it.hasNext()) { + CellElement ce = (CellElement) it.next(); + UNIT ceX = x.add(colWidthList.getRangeValueFromZero(ce.getColumn())); + UNIT ceWidth = colWidthList.getRangeValue(ce.getColumn(), ce.getColumn() + ce.getColumnSpan()); + UNIT ceY = y.add(rowHeightList.getRangeValueFromZero(ce.getRow())); + UNIT ceHeight = rowHeightList.getRangeValue(ce.getRow(), ce.getRow() + ce.getRowSpan()); + int newCeCol = horizontalList.indexOf(ceX) + 1; + int newCeColSpan = getNewSpan(newCeCol, newColList, ceWidth, colCount); + int newCeRow = verticalList.indexOf(ceY) + 1; + int newCeRowSpan = getNewSpan(newCeRow, newRowList, ceHeight, rowCount); + ColumnRow oriCR = ColumnRow.valueOf(ce.getColumn(), ce.getRow()); + ColumnRow newCR = ColumnRow.valueOf(newCeCol, newCeRow); + columnRowMap.put(oriCR.toString(), newCR.toString()); + ResultCellElement newCe = (ResultCellElement) ce.deriveCellElement(newCeCol, newCeRow, newCeColSpan, newCeRowSpan); + page_sheet.addCellElement(newCe); + if (ce.getValue() instanceof ResultFormula) { + formulaMap.put(newCe, (ResultFormula) ce.getValue()); + } + } + + modifyAllFormula(formulaMap, columnRowMap); + return page_sheet; + } + + public static int getNewSpan(int newCeColRow, DynamicUnitList newColRowList, UNIT ceWidthHeight, int count) { + for (int i = newCeColRow; i < count + 1; ++i) { + if (ComparatorUtils.equals(ceWidthHeight, newColRowList.getRangeValue(newCeColRow, i))) { + return i - newCeColRow; + } + } + + return 0; + } + + public static PolyResultWorkSheet setNewColRowSize(ArrayList verticalList, ArrayList horizontalList, PolyResultWorkSheet allInOneSheet) { + int i; + Object lastCoordinate; + FU colWidth; + for (i = 0; i < verticalList.size(); ++i) { + lastCoordinate = i == 0 ? UNIT.ZERO : (UNIT) verticalList.get(i - 1); + colWidth = ((UNIT) verticalList.get(i)).subtract((UNIT) lastCoordinate); + allInOneSheet.setRowHeight(i, colWidth); + } + + for (i = 0; i < horizontalList.size(); ++i) { + lastCoordinate = i == 0 ? UNIT.ZERO : (UNIT) horizontalList.get(i - 1); + colWidth = ((UNIT) horizontalList.get(i)).subtract((UNIT) lastCoordinate); + allInOneSheet.setColumnWidth(i, colWidth); + } + + return allInOneSheet; + } + + public static void analyElementColumnRow(ArrayList verticalList, ArrayList horizontalList, ResultWorkBook[] resultWorkBooks, long[] lengthx, long[] lengthy) { + int length = resultWorkBooks.length; + + for (int i = 0; i < length; ++i) { + ResultWorkBook resultWorkBook = resultWorkBooks[i]; + UNIT y = FU.getInstance(lengthy[i]); + int rowCount = resultWorkBook.getElementCaseReport(0).getRowCount(); + DynamicUnitList rowHeightList = resultWorkBook.getElementCaseReport(0).getRowHeightList_DEC(); + analyColumnRow(y, verticalList, rowHeightList, rowCount); + UNIT x = FU.getInstance(lengthx[i]); + int colCount = resultWorkBook.getElementCaseReport(0).getColumnCount(); + DynamicUnitList colWidthList = resultWorkBook.getElementCaseReport(0).getColumnWidthList_DEC(); + analyColumnRow(x, horizontalList, colWidthList, colCount); + } + + sort(verticalList, horizontalList); + } + + public static void analyColumnRow(UNIT startPoint, ArrayList verticalSet, DynamicUnitList rowHeightList, int count) { + verticalSet.add(startPoint); + + for (int i = 0; i < count; ++i) { + UNIT rowHeight = rowHeightList.getRangeValueFromZero(i + 1); + UNIT rowY = rowHeight.add(startPoint); + verticalSet.add(rowY); + } + + } + + public static void sort(ArrayList verticalList, ArrayList horizontalList) { + Comparator compare = new Comparator() { + public int compare(UNIT o1, UNIT o2) { + if (o1.subtract(o2).equal_zero()) { + return 0; + } + return o1.subtract(o2).more_than_zero() ? 1 : -1; + } + }; + Collections.sort(verticalList, compare); + Collections.sort(horizontalList, compare); + } + + private static void modifyAllFormula(HashMap formulaMap, HashMap columnRowMap) { + Iterator formulaIt = formulaMap.entrySet().iterator(); + + while (formulaIt.hasNext()) { + Entry entry = (Entry) formulaIt.next(); + CellElement ce = (CellElement) entry.getKey(); + ResultFormula formula = (ResultFormula) entry.getValue(); + String content = formula.getTransferContent(); + Iterator crIt = columnRowMap.entrySet().iterator(); + + while (crIt.hasNext()) { + Entry crEntry = (Entry) crIt.next(); + String oriCR = (String) crEntry.getKey(); + String newCR = (String) crEntry.getValue(); + if (content.indexOf(oriCR) != -1) { + content = getNewFormula(content, oriCR, newCR); + formula.setTransferContent(content); + ce.setValue(formula); + } + } + } + + } + + public static String getNewFormula(String formulaContent, String oriCR, String newCR) { + String[] array = formulaContent.toUpperCase().split(oriCR); + StringBuffer sb = new StringBuffer(); + int i = 0; + + for (int len = array.length; i < len; ++i) { + sb.append(array[i]); + if (formulaContent.endsWith(oriCR) || i != len - 1) { + String nodeCR = getNewColumnRow(array[i], i + 1, array, oriCR, newCR); + sb.append(nodeCR); + } + } + + return sb.toString(); + } + + private static String getNewColumnRow(String formulaPart, int nextIdx, String[] array, String oriCR, String newCR) { + if (formulaPart.endsWith("$")) { + return oriCR; + } else { + return nextIdx < array.length && startsWithDigit(array[nextIdx]) ? oriCR : newCR; + } + } + + private static boolean startsWithDigit(String s) { + return Pattern.compile("^[0-9]").matcher(s.trim()).find(); + } + + public static String transferReportletsInfo(String reportletsInfo) { + try { + reportletsInfo = CodeUtils.cjkDecode(reportletsInfo.trim()); + } catch (Exception var2) { + ; + } + + String jsonString = null; + if (reportletsInfo.length() > 0 && reportletsInfo.charAt(0) == '(') { + jsonString = transferToJSONString(reportletsInfo); + } else { + jsonString = reportletsInfo; + } + + return jsonString; + } + + public static String transferToJSONString(String reportletsInfo) { + if (reportletsInfo == null) { + return null; + } else { + reportletsInfo = reportletsInfo.trim(); + if (reportletsInfo.length() <= 0) { + return null; + } else { + reportletsInfo = reportletsInfo.substring(1, reportletsInfo.length() - 1); + StringBuffer rpSB = new StringBuffer("["); + Matcher matcher = KEY_VALUE_PATTERN.matcher(reportletsInfo); + int start = 0; + boolean var4 = false; + + while (matcher.find()) { + int end = matcher.start(); + String tmpText = reportletsInfo.substring(start, end); + if (tmpText != null && tmpText.length() > 0) { + rpSB.append(tmpText); + } + + start = matcher.end(); + String tmpStr = matcher.group(); + String[] tmpStrs = tmpStr.split(":"); + if (tmpStrs.length != 2) { + rpSB.append(tmpStr); + } else { + rpSB.append(tmpStrs[0]).append(':').append(quote(tmpStrs[1])); + } + } + + rpSB.append(reportletsInfo.substring(start, reportletsInfo.length())); + rpSB.append(']'); + return rpSB.toString(); + } + } + } + + private static String quote(String v) { + return "\"" + CommonCodeUtils.javascriptEncode(v) + "\""; + } + + public static void createReportsFromReportlets(String reportletsInfo, List reportPathList, List paraMapList) { + reportPathList.clear(); + paraMapList.clear(); + if (reportletsInfo != null) { + String jsonString = transferReportletsInfo(reportletsInfo); + FRContext.getLogger().info("reportletsInfo:" + jsonString); + if (jsonString != null) { + createFromReportlets(jsonString, reportPathList, paraMapList); + } + } + } + + private static void createFromReportlets(String jsonString, List reportPathList, List paraMapList) { + try { + JSONArray reportlets = new JSONArray(jsonString); + + for (int i = 0; i < reportlets.length(); ++i) { + Map paraMap = new HashMap(); + JSONObject jsonObject = reportlets.getJSONObject(i); + Iterator keys = jsonObject.keys(); + + while (keys.hasNext()) { + String key = (String) keys.next(); + Object value = jsonObject.get(key); + value = value instanceof String ? CodeUtils.decodeText(String.valueOf(value)) : value; + paraMap.put(key, value); + } + + String reportletPath = (String) paraMap.get("reportlet"); + if (reportletPath != null) { + try { + reportPathList.add(reportletPath); + paraMapList.add(paraMap); + } catch (Exception var11) { + FRContext.getLogger().error(var11.getMessage(), var11); + } + } + } + } catch (JSONException var12) { + FRContext.getLogger().error(var12.getMessage(), var12); + } + + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/myfilter.java b/src/main/java/com/fr/myfilter.java new file mode 100644 index 0000000..335a123 --- /dev/null +++ b/src/main/java/com/fr/myfilter.java @@ -0,0 +1,140 @@ +package com.fr; + +import com.fr.decision.webservice.v10.login.LoginService; +import com.fr.json.JSONException; +import net.sf.json.JSONObject; +import com.fr.stable.StringUtils; +import com.fr.web.utils.WebUtils; +import java.io.IOException; +import java.util.Set; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.NameValuePair; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.oltu.oauth2.client.response.OAuthAuthzResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +public class myfilter implements Filter { + public myfilter() { + } + + public void init(FilterConfig filterConfig) throws ServletException { + } + + public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { + HttpServletRequest req = (HttpServletRequest)request; + HttpServletResponse res = (HttpServletResponse)response; + OAuthAuthzResponse oAuthResponse = null; + HttpSession session = req.getSession(true); + String tokenLocation = "https:/www.example.com/oauth/token"; + String redirectURI = "http://localhost:8075/webroot/decision"; + String clientId = "dzs.hotelbi.local"; + String clientSecret = "da3e9b941b6dc724847c8426a323ddc8"; + String code = WebUtils.getHTTPRequestParameter(req, "code"); + System.out.println("code:" + code); + String Token = ""; + + try { + if (!StringUtils.isEmpty(code)) { + oAuthResponse = OAuthAuthzResponse.oauthCodeAuthzResponse(req); + System.out.println("oAuthResponse.getCode()=" + oAuthResponse.getCode()); + + + JSONObject jsonParams = new JSONObject(); + jsonParams.put("client_id", clientId); + jsonParams.put("client_secret", clientSecret); + jsonParams.put("redirect_uri", redirectURI); + jsonParams.put("code", oAuthResponse.getCode()); + jsonParams.put("grant_type", "authorization_code"); + // 通过接收到的授权码到SSO站点申请令牌 + String returnParams = postByJsonParameters(tokenLocation, jsonParams); + + JSONObject jsonResponse = new JSONObject(); + jsonResponse = jsonResponse.fromObject(returnParams); + String accessToken = jsonResponse.getString("access_token"); + + System.out.println("Token" + accessToken); + + JSONObject jsonParams1 = new JSONObject(); + jsonParams1.put("access_token", accessToken); + String result = postByJsonParameters("https://oauth.shu.edu.cn/rest/user/getLoggedInUser", jsonParams1); + System.out.println("result = " + result); + String username = ""; + if (!StringUtils.isEmpty(result)) { + JSONObject json = new JSONObject(); + json = json.fromObject(result); + username = json.getString("username"); + System.out.println("username" + username); + } + + if (StringUtils.isNotEmpty(username)) { + String token = LoginService.getInstance().login(req, res, username); + req.setAttribute("fine_auth_token", token); + } + res.addCookie(new Cookie("access_token", Token)); + filterChain.doFilter(req, res); + } else { + System.out.println("code is empty!"); + } + } catch (OAuthProblemException var20) { + var20.printStackTrace(); + } catch (OAuthSystemException var21) { + var21.printStackTrace(); + } catch (JSONException var22) { + var22.printStackTrace(); + } catch (Exception var23) { + var23.printStackTrace(); + } + + } + /** + * 模拟post请求方法,请求参数为json + * + * @param url + * @param params + * @return + */ + public static String postByJsonParameters(String url, JSONObject params) { + HttpClient httpClient = new HttpClient(); + PostMethod postMethod = new PostMethod(url); + Set keySet = params.keySet(); + try { + NameValuePair[] postData = new NameValuePair[keySet.size()]; + int postDataIndex = 0; + for (String key : keySet) { + postData[postDataIndex++] = new NameValuePair(key, params.getString(key)); + } + postMethod.getParams().setContentCharset("UTF-8"); + postMethod.addParameters(postData); + + httpClient.executeMethod(postMethod); + if (postMethod.getStatusCode() == HttpStatus.SC_OK) { + String response = new String(postMethod.getResponseBodyAsString()); + return response; + } else { + return null; + } + } catch (HttpException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + postMethod.releaseConnection(); + } + return null; + } + public void destroy() { + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/output/FTPUpload.java b/src/main/java/com/fr/output/FTPUpload.java new file mode 100644 index 0000000..fe007b7 --- /dev/null +++ b/src/main/java/com/fr/output/FTPUpload.java @@ -0,0 +1,51 @@ +package com.fr.output; + +import com.fr.schedule.base.bean.output.OutputClass; +import com.fr.schedule.base.bean.output.OutputFtp; +import com.fr.schedule.base.constant.ScheduleConstants; +import com.fr.schedule.feature.output.FTPHandler; +import com.fr.schedule.feature.output.OutputActionHandler; +import com.fr.stable.Filter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class FTPUpload extends OutputActionHandler { + + private FTPHandler handler = new FTPHandler(); + + @Override + public void doAction(OutputClass action, Map map) throws Exception { + OutputFtp ftp = new OutputFtp(); + ftp.setServerAddress("192.168.1.45"); + ftp.setPort(String.valueOf(21)); + ftp.setSavePath("test"); + ftp.setUsername("admin"); + ftp.setPassword("123456"); + + action(ftp, map, new Filter() { + @Override + public boolean accept(String s) { + // TODO: 2018/8/23 过滤 + return true; + } + }); + } + + + private void action(OutputFtp ftp, Map map, Filter filter) throws Exception { + + String[] files = (String[]) map.get(ScheduleConstants.OUTPUT_FILES); + List fileList = new ArrayList(); + for (String file : files) { + if (filter.accept(file)) { + fileList.add(file); + } + } + map.put(ScheduleConstants.OUTPUT_FILES, fileList.toArray(new String[0])); + + handler.doAction(ftp, map); + } + +} \ No newline at end of file diff --git a/src/main/java/com/fr/output/OutputExcel.java b/src/main/java/com/fr/output/OutputExcel.java new file mode 100644 index 0000000..f7c87a6 --- /dev/null +++ b/src/main/java/com/fr/output/OutputExcel.java @@ -0,0 +1,61 @@ +package com.fr.output; + +import com.fr.io.utils.ResourceIOUtils; +import com.fr.schedule.base.bean.output.OutputClass; +import com.fr.schedule.base.constant.ScheduleConstants; +import com.fr.schedule.feature.output.OutputActionHandler; +import com.fr.stable.ArrayUtils; + +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; +import java.util.Map; + +/** + * Created by Zed on 2018/9/11. + */ +public class OutputExcel extends OutputActionHandler { + + @Override + public void doAction(OutputClass action, Map map) throws Exception { + String[] files = (String[]) map.get(ScheduleConstants.OUTPUT_FILES); + if (ArrayUtils.isNotEmpty(files)) { + for (String path : files) { + output(path); + } + } + } + + private void output(String path) { + + String realPath = ResourceIOUtils.getRealPath(path); + File file = new File(realPath); + String newPath = "C:/test/" + file.getName(); + BufferedInputStream in = null; + OutputStream out = null; + try { + out = new BufferedOutputStream(new FileOutputStream(new File(newPath))); + in = new BufferedInputStream(new FileInputStream(realPath)); + byte[] ba = new byte[in.available()]; + in.read(ba); + out.write(ba); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (in != null) { + in.close(); + } + if (out != null) { + out.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff --git a/plugin-report-doc-demo/src/com/fr/output/session.java b/src/main/java/com/fr/output/session.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/output/session.java rename to src/main/java/com/fr/output/session.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartProviderImpl.java b/src/main/java/com/fr/plugin/chart/IndependentChartProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartProviderImpl.java rename to src/main/java/com/fr/plugin/chart/IndependentChartProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartUIProviderImpl.java b/src/main/java/com/fr/plugin/chart/IndependentChartUIProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/chart/IndependentChartUIProviderImpl.java rename to src/main/java/com/fr/plugin/chart/IndependentChartUIProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/ActionCMDImpl.java b/src/main/java/com/fr/plugin/core/ActionCMDImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/ActionCMDImpl.java rename to src/main/java/com/fr/plugin/core/ActionCMDImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/AttachmentDownloaderImpl.java b/src/main/java/com/fr/plugin/core/AttachmentDownloaderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/AttachmentDownloaderImpl.java rename to src/main/java/com/fr/plugin/core/AttachmentDownloaderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/CellValueProcessorImpl.java b/src/main/java/com/fr/plugin/core/CellValueProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/CellValueProcessorImpl.java rename to src/main/java/com/fr/plugin/core/CellValueProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/CssFileHandlerImpl.java b/src/main/java/com/fr/plugin/core/CssFileHandlerImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/CssFileHandlerImpl.java rename to src/main/java/com/fr/plugin/core/CssFileHandlerImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/DebugLogProviderImpl.java b/src/main/java/com/fr/plugin/core/DebugLogProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/DebugLogProviderImpl.java rename to src/main/java/com/fr/plugin/core/DebugLogProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/DialectCreatorImpl.java b/src/main/java/com/fr/plugin/core/DialectCreatorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/DialectCreatorImpl.java rename to src/main/java/com/fr/plugin/core/DialectCreatorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/EmailProcessorImpl.java b/src/main/java/com/fr/plugin/core/EmailProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/EmailProcessorImpl.java rename to src/main/java/com/fr/plugin/core/EmailProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java b/src/main/java/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java rename to src/main/java/com/fr/plugin/core/ExcelExportCellValueProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportProcessorImpl.java b/src/main/java/com/fr/plugin/core/ExcelExportProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/ExcelExportProcessorImpl.java rename to src/main/java/com/fr/plugin/core/ExcelExportProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/FunctionDefineProviderImpl.java b/src/main/java/com/fr/plugin/core/FunctionDefineProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/FunctionDefineProviderImpl.java rename to src/main/java/com/fr/plugin/core/FunctionDefineProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/GraphDrawProcessorImpl.java b/src/main/java/com/fr/plugin/core/GraphDrawProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/GraphDrawProcessorImpl.java rename to src/main/java/com/fr/plugin/core/GraphDrawProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/HttpAuthProcessorImpl.java b/src/main/java/com/fr/plugin/core/HttpAuthProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/HttpAuthProcessorImpl.java rename to src/main/java/com/fr/plugin/core/HttpAuthProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/JavaScriptFileHandlerImpl.java b/src/main/java/com/fr/plugin/core/JavaScriptFileHandlerImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/JavaScriptFileHandlerImpl.java rename to src/main/java/com/fr/plugin/core/JavaScriptFileHandlerImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/LogDBRecordProcessorImpl.java b/src/main/java/com/fr/plugin/core/LogDBRecordProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/LogDBRecordProcessorImpl.java rename to src/main/java/com/fr/plugin/core/LogDBRecordProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/LogProviderImpl.java b/src/main/java/com/fr/plugin/core/LogProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/LogProviderImpl.java rename to src/main/java/com/fr/plugin/core/LogProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/PrintCellValueProviderImpl.java b/src/main/java/com/fr/plugin/core/PrintCellValueProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/PrintCellValueProviderImpl.java rename to src/main/java/com/fr/plugin/core/PrintCellValueProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterCollectorImpl.java b/src/main/java/com/fr/plugin/core/RequestParameterCollectorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterCollectorImpl.java rename to src/main/java/com/fr/plugin/core/RequestParameterCollectorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterHandlerImpl.java b/src/main/java/com/fr/plugin/core/RequestParameterHandlerImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/RequestParameterHandlerImpl.java rename to src/main/java/com/fr/plugin/core/RequestParameterHandlerImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/ServiceImpl.java b/src/main/java/com/fr/plugin/core/ServiceImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/ServiceImpl.java rename to src/main/java/com/fr/plugin/core/ServiceImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/SpecialCharProcessorImpl.java b/src/main/java/com/fr/plugin/core/SpecialCharProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/SpecialCharProcessorImpl.java rename to src/main/java/com/fr/plugin/core/SpecialCharProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/TableDataProviderImpl.java b/src/main/java/com/fr/plugin/core/TableDataProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/TableDataProviderImpl.java rename to src/main/java/com/fr/plugin/core/TableDataProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/WidgetSwitcherImpl.java b/src/main/java/com/fr/plugin/core/WidgetSwitcherImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/WidgetSwitcherImpl.java rename to src/main/java/com/fr/plugin/core/WidgetSwitcherImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/core/XMLFileManagerProviderImpl.java b/src/main/java/com/fr/plugin/core/XMLFileManagerProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/core/XMLFileManagerProviderImpl.java rename to src/main/java/com/fr/plugin/core/XMLFileManagerProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/CellAttributeProviderImpl.java b/src/main/java/com/fr/plugin/design/CellAttributeProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/CellAttributeProviderImpl.java rename to src/main/java/com/fr/plugin/design/CellAttributeProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/CellWidgetOptionProviderImpl.java b/src/main/java/com/fr/plugin/design/CellWidgetOptionProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/CellWidgetOptionProviderImpl.java rename to src/main/java/com/fr/plugin/design/CellWidgetOptionProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/ConnectionProviderImpl.java b/src/main/java/com/fr/plugin/design/ConnectionProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/ConnectionProviderImpl.java rename to src/main/java/com/fr/plugin/design/ConnectionProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/FormWidgetOptionProviderImpl.java b/src/main/java/com/fr/plugin/design/FormWidgetOptionProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/FormWidgetOptionProviderImpl.java rename to src/main/java/com/fr/plugin/design/FormWidgetOptionProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/GlobalListenerProviderImpl.java b/src/main/java/com/fr/plugin/design/GlobalListenerProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/GlobalListenerProviderImpl.java rename to src/main/java/com/fr/plugin/design/GlobalListenerProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/HighlightProviderImpl.java b/src/main/java/com/fr/plugin/design/HighlightProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/HighlightProviderImpl.java rename to src/main/java/com/fr/plugin/design/HighlightProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/IndentationUnitProcessorImpl.java b/src/main/java/com/fr/plugin/design/IndentationUnitProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/IndentationUnitProcessorImpl.java rename to src/main/java/com/fr/plugin/design/IndentationUnitProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/JavaScriptActionProviderImpl.java b/src/main/java/com/fr/plugin/design/JavaScriptActionProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/JavaScriptActionProviderImpl.java rename to src/main/java/com/fr/plugin/design/JavaScriptActionProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/ParameterWidgetOptionProviderImpl.java b/src/main/java/com/fr/plugin/design/ParameterWidgetOptionProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/ParameterWidgetOptionProviderImpl.java rename to src/main/java/com/fr/plugin/design/ParameterWidgetOptionProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/PreviewProviderImpl.java b/src/main/java/com/fr/plugin/design/PreviewProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/PreviewProviderImpl.java rename to src/main/java/com/fr/plugin/design/PreviewProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/ShortCutImpl.java b/src/main/java/com/fr/plugin/design/ShortCutImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/ShortCutImpl.java rename to src/main/java/com/fr/plugin/design/ShortCutImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/SubmitProviderImpl.java b/src/main/java/com/fr/plugin/design/SubmitProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/SubmitProviderImpl.java rename to src/main/java/com/fr/plugin/design/SubmitProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/TableDataDefineProviderImpl.java b/src/main/java/com/fr/plugin/design/TableDataDefineProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/TableDataDefineProviderImpl.java rename to src/main/java/com/fr/plugin/design/TableDataDefineProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/TitlePlaceProcessorImpl.java b/src/main/java/com/fr/plugin/design/TitlePlaceProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/TitlePlaceProcessorImpl.java rename to src/main/java/com/fr/plugin/design/TitlePlaceProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/UIFormulaProcessorImpl.java b/src/main/java/com/fr/plugin/design/UIFormulaProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/UIFormulaProcessorImpl.java rename to src/main/java/com/fr/plugin/design/UIFormulaProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/design/WidgetDesignHandlerImpl.java b/src/main/java/com/fr/plugin/design/WidgetDesignHandlerImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/design/WidgetDesignHandlerImpl.java rename to src/main/java/com/fr/plugin/design/WidgetDesignHandlerImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ActorProviderImpl.java b/src/main/java/com/fr/plugin/report/ActorProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/report/ActorProviderImpl.java rename to src/main/java/com/fr/plugin/report/ActorProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/CellTooltipProcessorImpl.java b/src/main/java/com/fr/plugin/report/CellTooltipProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/report/CellTooltipProcessorImpl.java rename to src/main/java/com/fr/plugin/report/CellTooltipProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ExcelExportAppProviderImpl.java b/src/main/java/com/fr/plugin/report/ExcelExportAppProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/report/ExcelExportAppProviderImpl.java rename to src/main/java/com/fr/plugin/report/ExcelExportAppProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ExcelImportProcessor.java b/src/main/java/com/fr/plugin/report/ExcelImportProcessor.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/report/ExcelImportProcessor.java rename to src/main/java/com/fr/plugin/report/ExcelImportProcessor.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ExportEncodeProviderImpl.java b/src/main/java/com/fr/plugin/report/ExportEncodeProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/report/ExportEncodeProviderImpl.java rename to src/main/java/com/fr/plugin/report/ExportEncodeProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ExportExtensionProcessorImpl.java b/src/main/java/com/fr/plugin/report/ExportExtensionProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/report/ExportExtensionProcessorImpl.java rename to src/main/java/com/fr/plugin/report/ExportExtensionProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ExportOperateProviderImpl.java b/src/main/java/com/fr/plugin/report/ExportOperateProviderImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/report/ExportOperateProviderImpl.java rename to src/main/java/com/fr/plugin/report/ExportOperateProviderImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/FromExportProcessorImpl.java b/src/main/java/com/fr/plugin/report/FromExportProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/report/FromExportProcessorImpl.java rename to src/main/java/com/fr/plugin/report/FromExportProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/PageCalObjectProcessorImpl.java b/src/main/java/com/fr/plugin/report/PageCalObjectProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/report/PageCalObjectProcessorImpl.java rename to src/main/java/com/fr/plugin/report/PageCalObjectProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/plugin/report/ReportPretreatmentProcessorImpl.java b/src/main/java/com/fr/plugin/report/ReportPretreatmentProcessorImpl.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/plugin/report/ReportPretreatmentProcessorImpl.java rename to src/main/java/com/fr/plugin/report/ReportPretreatmentProcessorImpl.java diff --git a/plugin-report-doc-demo/src/com/fr/privilege/RSAUtil.java b/src/main/java/com/fr/privilege/RSAUtil.java similarity index 94% rename from plugin-report-doc-demo/src/com/fr/privilege/RSAUtil.java rename to src/main/java/com/fr/privilege/RSAUtil.java index d9d98e8..5a5d848 100644 --- a/plugin-report-doc-demo/src/com/fr/privilege/RSAUtil.java +++ b/src/main/java/com/fr/privilege/RSAUtil.java @@ -1,6 +1,5 @@ package com.fr.privilege; -import javax.crypto.Cipher; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -20,9 +19,12 @@ import java.security.spec.InvalidKeySpecException; import java.security.spec.RSAPrivateKeySpec; import java.security.spec.RSAPublicKeySpec; +import javax.crypto.Cipher; + /** * RSA 工具类。提供加密,解密,生成密钥对等方法。 * 需要到http://www.bouncycastle.org下载bcprov-jdk14-123.jar。 + * */ public class RSAUtil { /** @@ -46,7 +48,7 @@ public class RSAUtil { } public static KeyPair getKeyPair() throws Exception { - FileInputStream fis = new FileInputStream("C:/RSAKey.txt"); + FileInputStream fis = new FileInputStream("/Users/susie/Downloads/RSAKey.txt"); ObjectInputStream oos = new ObjectInputStream(fis); KeyPair kp = (KeyPair) oos.readObject(); oos.close(); @@ -56,7 +58,7 @@ public class RSAUtil { public static void saveKeyPair(KeyPair kp) throws Exception { - FileOutputStream fos = new FileOutputStream("C:/RSAKey.txt"); + FileOutputStream fos = new FileOutputStream("/Users/susie/Downloads/RSAKey.txt"); ObjectOutputStream oos = new ObjectOutputStream(fos); // 生成密钥 oos.writeObject(kp); @@ -67,7 +69,7 @@ public class RSAUtil { /** * * 生成公钥 * * - * @param modulus * + * @param modulus * * @param publicExponent * * @return RSAPublicKey * * @throws Exception @@ -94,7 +96,7 @@ public class RSAUtil { /** * * 生成私钥 * * - * @param modulus * + * @param modulus * * @param privateExponent * * @return RSAPrivateKey * * @throws Exception @@ -121,8 +123,10 @@ public class RSAUtil { /** * * 加密 * * - * @param key 加密的密钥 * - * @param data 待加密的明文数据 * + * @param key + * 加密的密钥 * + * @param data + * 待加密的明文数据 * * @return 加密后的数据 * * @throws Exception */ @@ -163,8 +167,10 @@ public class RSAUtil { /** * * 解密 * * - * @param key 解密的密钥 * - * @param raw 已经加密的数据 * + * @param key + * 解密的密钥 * + * @param raw + * 已经加密的数据 * * @return 解密后的明文 * * @throws Exception */ diff --git a/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidator.java b/src/main/java/com/fr/privilege/TestPasswordValidator.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidator.java rename to src/main/java/com/fr/privilege/TestPasswordValidator.java diff --git a/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorRSA.java b/src/main/java/com/fr/privilege/TestPasswordValidatorRSA.java similarity index 85% rename from plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorRSA.java rename to src/main/java/com/fr/privilege/TestPasswordValidatorRSA.java index 0e4c229..18b8ba5 100644 --- a/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorRSA.java +++ b/src/main/java/com/fr/privilege/TestPasswordValidatorRSA.java @@ -1,21 +1,20 @@ package com.fr.privilege; import com.fr.privilege.providers.dao.AbstractPasswordValidator; - -public class TestPasswordValidatorRSA extends AbstractPasswordValidator { +public class TestPasswordValidatorRSA extends AbstractPasswordValidator{ //@Override - public String encodePassword(String clinetPassword) { + 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[] en_test = RSAUtil.encrypt(RSAUtil.getKeyPair().getPublic(),bb.getBytes()); //进行解密,如果数据库里面保存的是加密码,则此处不需要进行解密 - byte[] de_test = RSAUtil.decrypt(RSAUtil.getKeyPair().getPrivate(), en_test); + byte[] de_test = RSAUtil.decrypt(RSAUtil.getKeyPair().getPrivate(),en_test); //返回加密密码 - clinetPassword = new String(de_test); + clinetPassword=new String(de_test); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -30,4 +29,4 @@ public class TestPasswordValidatorRSA extends AbstractPasswordValidator { } -} \ No newline at end of file +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorUser.java b/src/main/java/com/fr/privilege/TestPasswordValidatorUser.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/privilege/TestPasswordValidatorUser.java rename to src/main/java/com/fr/privilege/TestPasswordValidatorUser.java diff --git a/src/main/java/com/fr/schedule/ExecuteClass.java b/src/main/java/com/fr/schedule/ExecuteClass.java new file mode 100644 index 0000000..a2c84c2 --- /dev/null +++ b/src/main/java/com/fr/schedule/ExecuteClass.java @@ -0,0 +1,12 @@ +package com.fr.schedule; + +import java.util.Calendar; +import com.fr.schedule.base.provider.ExecuteCondition; + +public class ExecuteClass implements ExecuteCondition { + public boolean execute() { + Calendar cal = Calendar.getInstance(); + int dow = cal.get(Calendar.DAY_OF_WEEK);//星期二的dow等于3 + return (dow) == 3; + } +} \ No newline at end of file diff --git a/plugin-report-doc-demo/src/com/fr/test/gauthority.java b/src/main/java/com/fr/test/gauthority.java similarity index 100% rename from plugin-report-doc-demo/src/com/fr/test/gauthority.java rename to src/main/java/com/fr/test/gauthority.java diff --git a/plugin-report-doc-demo/src/mobile/MobileCodeWSCallbackHandler.java b/src/main/java/mobile/MobileCodeWSCallbackHandler.java similarity index 100% rename from plugin-report-doc-demo/src/mobile/MobileCodeWSCallbackHandler.java rename to src/main/java/mobile/MobileCodeWSCallbackHandler.java diff --git a/plugin-report-doc-demo/src/mobile/MobileCodeWSStub.java b/src/main/java/mobile/MobileCodeWSStub.java similarity index 100% rename from plugin-report-doc-demo/src/mobile/MobileCodeWSStub.java rename to src/main/java/mobile/MobileCodeWSStub.java diff --git a/src/main/java/service/MyService.class b/src/main/java/service/MyService.class new file mode 100644 index 0000000..5378a83 Binary files /dev/null and b/src/main/java/service/MyService.class differ diff --git a/src/main/java/service/MyService.java b/src/main/java/service/MyService.java new file mode 100644 index 0000000..bcb8d4b --- /dev/null +++ b/src/main/java/service/MyService.java @@ -0,0 +1,13 @@ +package service; + +public class MyService +{ + public String getGreeting(String name) + { + return "您好 " + name; + } + public void update(String data) + { + System.out.println("<" + data + ">已经更新"); + } +} \ No newline at end of file diff --git a/src/com/fr/StartFRDesigner.java b/src/main/java/startFRDesign.java similarity index 67% rename from src/com/fr/StartFRDesigner.java rename to src/main/java/startFRDesign.java index e1abc07..d9c6c11 100644 --- a/src/com/fr/StartFRDesigner.java +++ b/src/main/java/startFRDesign.java @@ -1,9 +1,8 @@ package com.fr; - import com.fr.start.Designer; -public class StartFRDesigner { - public StartFRDesigner() { +public class startFRDesign { + public startFRDesign() { } public static void main(String[] args) { diff --git a/src/mobile/MobileCodeWSCallbackHandler.java b/src/mobile/MobileCodeWSCallbackHandler.java deleted file mode 100644 index f7a3e59..0000000 --- a/src/mobile/MobileCodeWSCallbackHandler.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * 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/src/mobile/MobileCodeWSStub.java b/src/mobile/MobileCodeWSStub.java deleted file mode 100644 index 8f6199b..0000000 --- a/src/mobile/MobileCodeWSStub.java +++ /dev/null @@ -1,3780 +0,0 @@ -/** - * 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; - } - } -}