+ * 这是一个按参数来解析不同地址XML文件的demo + *
+ * AbstractParameterTableData 包装了有参数数据集的基本实现
+ */
+public class XMLDemoTableData extends AbstractParameterTableData {
+
+ // 构造函数
+ public XMLDemoTableData() {
+ // 定义需要的参数,这里定义一个参数,参数名为filename,给其一个默认值"Northwind.xml"
+ this.parameters = new Parameter[1];
+ this.parameters[0] = 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文件的格式是:
+ *
+ * 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/src/com/fr/data/XMLRead.java b/src/com/fr/data/XMLRead.java
new file mode 100644
index 0000000..ef3bc4d
--- /dev/null
+++ b/src/com/fr/data/XMLRead.java
@@ -0,0 +1,115 @@
+package com.fr.data;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.ArrayList;
+
+/**
+ * @author fanruan
+ */
+public class XMLRead extends AbstractTableData {
+ /**
+ * 列名数组,保存程序数据集所有列名
+ */
+ private String[] columnNames = {"id", "name", "MemoryFreeSize",
+ "MemoryTotalSize", "MemoryUsage"};
+ /**
+ * 保存表数据
+ */
+ private ArrayList valueList = null;
+
+ @Override
+ public int getColumnCount() {
+ return 5;
+ }
+
+ @Override
+ public String getColumnName(int columnIndex) {
+ return columnNames[columnIndex];
+ }
+
+ @Override
+ public int getRowCount() {
+ init();
+ return valueList.size();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ init();
+ return ((Object[]) valueList.get(rowIndex))[columnIndex];
+ }
+
+ private void init() {
+ // 确保只被执行一次
+ if (valueList != null) {
+ return;
+ }
+ valueList = new ArrayList();
+ String sql = "SELECT * FROM xmltest";
+ String[] name = {"MemoryFreeSize", "MemoryTotalSize", "MemoryUsage"};
+ Connection conn = this.getConnection();
+ try {
+ Statement stmt = conn.createStatement();
+ ResultSet rs = stmt.executeQuery(sql);
+ // 用对象保存数据
+ Object[] objArray;
+ while (rs.next()) {
+ objArray = new Object[5];
+ String[] xmlData;
+ objArray[0] = rs.getObject(1);
+ objArray[1] = rs.getObject(2);
+ InputStream in;
+ String str = "中文stream";
+ in = new ByteArrayInputStream(str.getBytes("UTF-8"));
+ GetXmlData getXMLData = new GetXmlData();
+ // 对xml流进行解析,返回的为name对应的value值数组
+ xmlData = getXMLData.readerXMLSource(in, name);
+ // 将解析后的值存于最终结果ArrayList中
+ objArray[2] = xmlData[0];
+ objArray[3] = xmlData[1];
+ objArray[4] = xmlData[2];
+ valueList.add(objArray);
+ }
+ // 释放数据源
+ rs.close();
+ stmt.close();
+ conn.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private Connection getConnection() {
+ String driverName = "oracle.jdbc.driver.OracleDriver";
+ String url = "jdbc:oracle:thin:@env.finedevelop.com:55702:fr";
+ String username = "system";
+ String password = "123";
+ Connection con;
+
+ try {
+ Class.forName(driverName);
+ con = DriverManager.getConnection(url, username, password);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ return con;
+
+ }
+
+ /**
+ * 释放一些资源,因为可能会有重复调用,所以需释放valueList,将上次查询的结果释放掉
+ *
+ * @throws Exception e
+ */
+ @Override
+ public void release() throws Exception {
+ super.release();
+ this.valueList = null;
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/data/impl/Commit1.java b/src/com/fr/data/impl/Commit1.java
new file mode 100644
index 0000000..49bdac1
--- /dev/null
+++ b/src/com/fr/data/impl/Commit1.java
@@ -0,0 +1,126 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.fr.data.impl;
+
+import com.fr.base.Formula;
+import com.fr.cache.Attachment;
+import com.fr.data.SubmitJob;
+import com.fr.general.FArray;
+import com.fr.script.Calculator;
+import com.fr.stable.UtilEvalError;
+import com.fr.stable.xml.XMLPrintWriter;
+import com.fr.stable.xml.XMLableReader;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Statement;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author fanruan
+ */
+public class Commit1 implements SubmitJob {
+ private Object attach;
+ private String filePath;
+
+ public Commit1() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ private Object getAttach(Calculator ca) {
+ if (this.attach != null && this.attach instanceof Formula) {
+ try {
+ return ca.eval(((Formula) this.attach).getContent());
+ } catch (UtilEvalError var3) {
+ var3.printStackTrace();
+ return "";
+ }
+ } else {
+ return ca.resolveVariable("attach");
+ }
+ }
+
+ @Override
+ public void doJob(Calculator ca) {
+ final Object attachO = this.getAttach(ca);
+ if (attachO instanceof FArray && ((FArray) attachO).length() != 0) {
+ (new Thread() {
+ @Override
+ public void run() {
+ FArray attachmentlist = (FArray) attachO;
+
+ for (int i = 0; i < attachmentlist.length(); ++i) {
+ Statement sm = null;
+ String command = null;
+ String result = null;
+ if (attachmentlist.elementAt(i) instanceof Attachment) {
+ String FilePath = Commit1.this.filePath;
+ String FileName = ((Attachment) attachmentlist.elementAt(i)).getFilename();
+ (new StringBuilder(String.valueOf(FilePath))).append("\\").append(FileName).toString();
+ File fileDir = new File(FilePath);
+ if (!fileDir.exists()) {
+ fileDir.mkdirs();
+ }
+
+ try {
+ Commit1.mkfile(FilePath, FileName, new ByteArrayInputStream(((Attachment) attachmentlist.elementAt(i)).getBytes()));
+ } catch (Exception var11) {
+ Logger.getLogger("FR").log(Level.WARNING, var11.getMessage() + "/nmkfileerror", var11);
+ }
+ }
+ }
+
+ }
+ }).start();
+ }
+
+ }
+
+ @Override
+ public void doFinish(Calculator calculator) {
+
+ }
+
+ private static void mkfile(String path, String FileName, InputStream source) throws FileNotFoundException, IOException {
+ File fileout = new File(path, FileName);
+ if (fileout.exists()) {
+ fileout.delete();
+ }
+
+ fileout.createNewFile();
+ FileOutputStream outputStream = new FileOutputStream(fileout);
+ byte[] bytes = new byte[1024];
+
+ for (int read = source.read(bytes); read != -1; read = source.read(bytes)) {
+ outputStream.write(bytes, 0, read);
+ outputStream.flush();
+ }
+
+ outputStream.close();
+ }
+
+ @Override
+ public void readXML(XMLableReader reader) {
+ }
+
+ @Override
+ public void writeXML(XMLPrintWriter writer) {
+ }
+
+ @Override
+ public String getJobType() {
+ return null;
+ }
+}
diff --git a/src/com/fr/data/impl/Commit3.java b/src/com/fr/data/impl/Commit3.java
new file mode 100644
index 0000000..4697f6f
--- /dev/null
+++ b/src/com/fr/data/impl/Commit3.java
@@ -0,0 +1,131 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.fr.data.impl;
+
+import com.fr.base.FRContext;
+import com.fr.base.Formula;
+import com.fr.cache.Attachment;
+import com.fr.data.JobValue;
+import com.fr.data.SubmitJob;
+import com.fr.general.FArray;
+import com.fr.script.Calculator;
+import com.fr.stable.UtilEvalError;
+import com.fr.stable.xml.XMLPrintWriter;
+import com.fr.stable.xml.XMLableReader;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author fanruan
+ */
+public class Commit3 implements SubmitJob {
+ private Object attach;
+ private JobValue filePath;
+
+ public Commit3() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ @Override
+ public void doJob(Calculator ca) throws Exception {
+ FRContext.getLogger().info("begin to upload file...");
+ final Object attachO = this.getAttach(ca);
+ if (attachO instanceof FArray && ((FArray) attachO).length() != 0) {
+ (new Thread() {
+ @Override
+ public void run() {
+ FArray attachmentlist = (FArray) attachO;
+
+ for (int i = 0; i < attachmentlist.length(); ++i) {
+ if (attachmentlist.elementAt(i) instanceof Attachment) {
+ FRContext.getLogger().info("filePath.value:" + Commit3.this.filePath.getValue().toString());
+ FRContext.getLogger().info("filePath.valueState:" + Commit3.this.filePath.getValueState() + "注:valueState 0,1,2,3 分别表示 默认值,插入行,值改变,删除行");
+ String FilePath = Commit3.this.filePath.getValue().toString();
+ String FileName = ((Attachment) attachmentlist.elementAt(i)).getFilename();
+ (new StringBuilder(String.valueOf(FilePath))).append("\\").append(FileName).toString();
+ File fileDir = new File(FilePath);
+ if (!fileDir.exists()) {
+ fileDir.mkdirs();
+ }
+
+ try {
+ Commit3.mkfile(FilePath, FileName, new ByteArrayInputStream(((Attachment) attachmentlist.elementAt(i)).getBytes()));
+ } catch (Exception var8) {
+ Logger.getLogger("FR").log(Level.WARNING, var8.getMessage() + "/nmkfileerror", var8);
+ }
+ }
+ }
+
+ }
+ }).start();
+ }
+
+ }
+
+ @Override
+ public void doFinish(Calculator calculator) throws Exception {
+
+ }
+
+ private Object getAttach(Calculator ca) {
+ if (this.attach != null && this.attach instanceof Formula) {
+ try {
+ return ca.eval(((Formula) this.attach).getContent());
+ } catch (UtilEvalError var3) {
+ var3.printStackTrace();
+ return "";
+ }
+ } else {
+ return ca.resolveVariable("attach");
+ }
+ }
+
+ private static void mkfile(String path, String FileName, InputStream source) throws FileNotFoundException, IOException {
+ File fileout = new File(path, FileName);
+ if (fileout.exists()) {
+ fileout.delete();
+ FRContext.getLogger().info("old file deleted");
+ }
+
+ if (fileout.createNewFile()) {
+ FRContext.getLogger().info(path + FileName + "created!!");
+ }
+
+ FileOutputStream outputStream = new FileOutputStream(fileout);
+ byte[] bytes = new byte[1024];
+
+ for (int read = source.read(bytes); read != -1; read = source.read(bytes)) {
+ outputStream.write(bytes, 0, read);
+ outputStream.flush();
+ }
+
+ outputStream.close();
+ }
+
+ @Override
+ public void readXML(XMLableReader reader) {
+ }
+
+ @Override
+ public void writeXML(XMLPrintWriter writer) {
+ }
+
+ @Override
+ public String getJobType() {
+ return null;
+ }
+}
diff --git a/src/com/fr/demo/ChangeRowAndCol.java b/src/com/fr/demo/ChangeRowAndCol.java
new file mode 100644
index 0000000..bdbbf8d
--- /dev/null
+++ b/src/com/fr/demo/ChangeRowAndCol.java
@@ -0,0 +1,77 @@
+//遍历单元格
+package com.fr.demo;
+
+import com.fr.base.Env;
+import com.fr.base.FRContext;
+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 java.util.Map;
+
+
+public class ChangeRowAndCol extends Reportlet {
+ public TemplateWorkBook createReport(ReportletRequest reportletrequest) {
+ // 定义最终需要返回的WorkBook对象
+ TemplateWorkBook workbook = null;
+ Env oldEnv = FRContext.getCurrentEnv();
+ WorkSheet newworksheet = new WorkSheet();
+ String change = "0";
+ try {
+ // 读取模板保存为WorkBook对象
+ workbook = TemplateWorkBookIO.readTemplateWorkBook(oldEnv,
+ "\\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();
+ }
+ 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
new file mode 100644
index 0000000..54f08e4
--- /dev/null
+++ b/src/com/fr/demo/CreateReportletDemo.java
@@ -0,0 +1,50 @@
+//创建程序报表
+package com.fr.demo;
+
+import com.fr.base.Style;
+import com.fr.general.FRFont;
+import com.fr.main.TemplateWorkBook;
+import com.fr.main.impl.WorkBook;
+import com.fr.report.cell.DefaultTemplateCellElement;
+import com.fr.report.cell.TemplateCellElement;
+import com.fr.report.worksheet.WorkSheet;
+import com.fr.stable.unit.OLDPIX;
+import com.fr.web.core.Reportlet;
+import com.fr.web.request.ReportletRequest;
+
+import java.awt.Color;
+import java.util.Map;
+
+public class CreateReportletDemo extends Reportlet {
+ public TemplateWorkBook createReport(ReportletRequest arg0) {
+ //创建一个WorkBook工作薄,在工作薄中插入一个WorkSheet
+ WorkBook workbook = new WorkBook();
+ WorkSheet sheet1 = new WorkSheet();
+
+ TemplateCellElement CellA1 = new DefaultTemplateCellElement(0, 0,
+ "FineReport");
+ Style style = Style.getInstance();
+
+ FRFont frfont = FRFont.getInstance("Arial", 1, 20.0F, Color.red);
+ style = style.deriveFRFont(frfont);
+ CellA1.setStyle(style);
+ sheet1.addCellElement(CellA1);
+
+ sheet1.setColumnWidth(0, new OLDPIX(150.0F));
+ sheet1.setRowHeight(1, new OLDPIX(35.0F));
+ workbook.addReport(sheet1);
+ return workbook;
+ }
+
+ @Override
+ public void setParameterMap(Map arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setTplPath(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/demo/NewDateDemo.java b/src/com/fr/demo/NewDateDemo.java
new file mode 100644
index 0000000..4fae5c3
--- /dev/null
+++ b/src/com/fr/demo/NewDateDemo.java
@@ -0,0 +1,43 @@
+//��̬������
+package com.fr.demo;
+
+import com.fr.base.Env;
+import com.fr.base.FRContext;
+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;
+ Env oldEnv = FRContext.getCurrentEnv();
+ ModuleContext.startModule(EngineModule.class.getName());
+ try {
+ // ����workbook����ģ�屣��Ϊworkbook������
+ workbook = TemplateWorkBookIO.readTemplateWorkBook(oldEnv, "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/src/com/fr/demo/ReadFromDatabase.java b/src/com/fr/demo/ReadFromDatabase.java
new file mode 100644
index 0000000..d983cad
--- /dev/null
+++ b/src/com/fr/demo/ReadFromDatabase.java
@@ -0,0 +1,63 @@
+package com.fr.demo;
+
+import com.fr.base.FRContext;
+import com.fr.dav.LocalEnv;
+import com.fr.main.TemplateWorkBook;
+import com.fr.main.impl.WorkBook;
+import com.fr.web.core.Reportlet;
+import com.fr.web.request.ReportletRequest;
+
+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";
+ FRContext.setCurrentEnv(new LocalEnv(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();
+ }
+ 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
new file mode 100644
index 0000000..2bbcd66
--- /dev/null
+++ b/src/com/fr/demo/SaveReportToDatabase.java
@@ -0,0 +1,49 @@
+package com.fr.demo;
+
+import com.fr.base.FRContext;
+import com.fr.dav.LocalEnv;
+
+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";
+ FRContext.setCurrentEnv(new LocalEnv(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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/demo/SetCellElementStyle.java b/src/com/fr/demo/SetCellElementStyle.java
new file mode 100644
index 0000000..3b19637
--- /dev/null
+++ b/src/com/fr/demo/SetCellElementStyle.java
@@ -0,0 +1,71 @@
+//单元格格式设置
+package com.fr.demo;
+
+import com.fr.base.Style;
+import com.fr.base.background.ColorBackground;
+import com.fr.general.FRFont;
+import com.fr.main.TemplateWorkBook;
+import com.fr.main.impl.WorkBook;
+import com.fr.report.cell.DefaultTemplateCellElement;
+import com.fr.report.cell.TemplateCellElement;
+import com.fr.report.worksheet.WorkSheet;
+import com.fr.stable.Constants;
+import com.fr.stable.unit.OLDPIX;
+import com.fr.web.core.Reportlet;
+import com.fr.web.request.ReportletRequest;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.util.Map;
+
+
+public class SetCellElementStyle extends Reportlet {
+ public TemplateWorkBook createReport(ReportletRequest arg0) {
+ // 新建报表
+ WorkBook workbook = new WorkBook();
+ WorkSheet worksheet = new WorkSheet();
+ // 新建一个单元格,位置为(1,1),列占2单元格,行占2单元格,文本值为 "FineReport"
+ TemplateCellElement cellElement = new DefaultTemplateCellElement(1, 1,
+ 2, 2, "FineReport");
+ // 设置列宽为300px,设置行高为30px
+ worksheet.setColumnWidth(1, new OLDPIX(300));
+ worksheet.setRowHeight(1, new OLDPIX(30));
+ // 得到CellElement的样式,如果没有新建默认样式
+ Style style = cellElement.getStyle();
+ if (style == null) {
+ style = Style.getInstance();
+ }
+ // 设置字体和前景的颜色
+ FRFont frFont = FRFont.getInstance("Dialog", Font.BOLD, 16);
+ frFont = frFont.applyForeground(new Color(21, 76, 160));
+ style = style.deriveFRFont(frFont);
+ // 设置背景
+ ColorBackground background = ColorBackground.getInstance(new Color(255,
+ 255, 177));
+ style = style.deriveBackground(background);
+ // 设置水平居中
+ style = style.deriveHorizontalAlignment(Constants.CENTER);
+ // 设置边框
+ style = style.deriveBorder(Constants.LINE_DASH, Color.red,
+ Constants.LINE_DOT, Color.gray, Constants.LINE_DASH_DOT,
+ Color.BLUE, Constants.LINE_DOUBLE, Color.CYAN);
+ // 改变单元格的样式
+ cellElement.setStyle(style);
+ // 将单元格添加到报表中
+ worksheet.addCellElement(cellElement);
+ workbook.addReport(worksheet);
+ return workbook;
+ }
+
+ @Override
+ public void setParameterMap(Map arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setTplPath(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/demo/SimpleReportletDemo.java b/src/com/fr/demo/SimpleReportletDemo.java
new file mode 100644
index 0000000..20df0fc
--- /dev/null
+++ b/src/com/fr/demo/SimpleReportletDemo.java
@@ -0,0 +1,40 @@
+//程序网络报表
+package com.fr.demo;
+
+import com.fr.base.Env;
+import com.fr.base.FRContext;
+import com.fr.io.TemplateWorkBookIO;
+import com.fr.main.TemplateWorkBook;
+import com.fr.web.core.Reportlet;
+import com.fr.web.request.ReportletRequest;
+
+import java.util.Map;
+
+
+public class SimpleReportletDemo extends Reportlet {
+ public TemplateWorkBook createReport(ReportletRequest reportletrequest) {
+ // 新建一个WorkBook对象,用于保存最终返回的报表
+ Env oldEnv = FRContext.getCurrentEnv();
+ TemplateWorkBook WorkBook = null;
+ try {
+ // 读取模板,将模板保存为workbook对象并返回
+ WorkBook = TemplateWorkBookIO.readTemplateWorkBook(oldEnv,
+ "\\doc\\Primary\\Parameter\\Parameter.cpt");
+ } 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/src/com/fr/demo/TotalVerifyJobDemo.java b/src/com/fr/demo/TotalVerifyJobDemo.java
new file mode 100644
index 0000000..7a0247c
--- /dev/null
+++ b/src/com/fr/demo/TotalVerifyJobDemo.java
@@ -0,0 +1,55 @@
+package com.fr.demo;
+
+import com.fr.base.Utils;
+import com.fr.data.JobValue;
+import com.fr.data.TotalVerifyJob;
+import com.fr.data.Verifier;
+import com.fr.script.Calculator;
+
+public class TotalVerifyJobDemo extends TotalVerifyJob {
+ /*
+ * type : 必须要定义此私有变量,变量名可改,表示校验状态
+ * 0 表示校验成功,默认校验状态位为0
+ * 1 表示校验失败
+ */
+ private int type = 0;
+
+ @Override
+ protected void doTotalJob(Data data, Calculator calculator)
+ throws Exception { // @param data 以二维表排列的所有提交数据
+ int sale, min;
+ JobValue salenum, minnum;
+
+ int row = data.getRowCount(); // 获取一共多少行数据
+ for (int i = 0; i < row; i++) { // 遍历每行,进行校验
+ salenum = (JobValue) data.getValueAt(i, 0);
+ sale = Integer.parseInt(Utils.objectToString(salenum.getValue()));
+
+ minnum = (JobValue) data.getValueAt(i, 1);
+ min = Integer.parseInt(Utils.objectToString(minnum.getValue()));
+
+ if (sale < min) { //校验判断
+ type = 1;
+ }
+ }
+
+ }
+
+ public String getMessage() {
+ // 根据校验状态是成功还是失败,设置对应的返回信息
+ if (type == 0) {
+ return "恭喜你,校验成功";
+ } else {
+ return "销量值不能小于最小基数";
+ }
+ }
+
+ public Verifier.Status getType() {
+ // 返回校验状态
+ return Verifier.Status.parse(type);
+ }
+
+ public String getJobType() {
+ return "totalVerifyJob";
+ }
+}
diff --git a/src/com/fr/demo/URLParameterDemo.java b/src/com/fr/demo/URLParameterDemo.java
new file mode 100644
index 0000000..5d71da2
--- /dev/null
+++ b/src/com/fr/demo/URLParameterDemo.java
@@ -0,0 +1,54 @@
+// 程序网络报表中获取request中的值
+package com.fr.demo;
+
+import com.fr.base.FRContext;
+import com.fr.base.Parameter;
+import com.fr.dav.LocalEnv;
+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 URLParameterDemo extends Reportlet {
+ public TemplateWorkBook createReport(ReportletRequest reportletRequest) {
+
+ String envPath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
+ FRContext.setCurrentEnv(new LocalEnv(envPath));
+ ModuleContext.startModule(EngineModule.class.getName());
+ // 获取外部传来的参数
+ TemplateWorkBook wbTpl = null;
+ String countryValue = reportletRequest.getParameter("地区").toString();
+ try {
+ wbTpl = TemplateWorkBookIO.readTemplateWorkBook(
+ FRContext.getCurrentEnv(), "\\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();
+ return null;
+ }
+ 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
new file mode 100644
index 0000000..77b0e40
--- /dev/null
+++ b/src/com/fr/demo/VerifyJobDemo.java
@@ -0,0 +1,68 @@
+package com.fr.demo;
+
+import com.fr.base.Utils;
+import com.fr.data.DefinedVerifyJob;
+import com.fr.data.JobValue;
+import com.fr.data.Verifier;
+import com.fr.script.Calculator;
+
+public class VerifyJobDemo extends DefinedVerifyJob {
+ /*
+ * 必须要定义此私有变量,变量名可改,表示校验状态
+ * 0 表示校验成功,默认校验状态位为0
+ * 1 表示校验失败
+ */
+ private int type = 0;
+
+ /**
+ * 当模板自定义事件增加的属性 名称与下面变量有对应时,则会自动赋值于此对应变量
+ */
+ private JobValue salenum; // JobValue对应单元格
+ private int minnum; // 非单元格,则对应具体类型值
+
+ public void doJob(Calculator calculator) throws Exception {
+ /*
+ * 如这边提供一个简单的判断来模拟执行过程
+ * 校验规则为销量需要大于等于最小基数:salenum >= minnum
+ * 校验不通过,提示“销量值不能小于最小基数”
+ */
+ if (salenum != null) {
+ int sale = 0;
+ if (salenum.getValue() instanceof Integer) { //将单元格值转为整型以便用于比较
+ sale = (Integer) salenum.getValue();
+
+
+ } else {
+ sale = Integer.parseInt(Utils.objectToString(salenum.getValue()));
+ }
+
+ if (sale < minnum) { //校验判断
+ type = 1;
+ }
+ } else {
+ type = 1;
+ }
+
+ }
+
+ public String getMessage() {
+ // 根据校验状态是成功还是失败,设置对应的返回信息
+ if (type == 0) {
+ return "恭喜你,校验成功";
+ } else {
+ return "销量值不能小于最小基数";
+ }
+
+ }
+
+ public Verifier.Status getType() {
+ // 返回校验状态
+ return Verifier.Status.parse(type);
+ }
+
+ public void doFinish(Calculator arg0) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/com/fr/function/BinaryImage.java b/src/com/fr/function/BinaryImage.java
new file mode 100644
index 0000000..65ac6eb
--- /dev/null
+++ b/src/com/fr/function/BinaryImage.java
@@ -0,0 +1,91 @@
+package com.fr.function;
+
+import com.fr.data.core.db.BinaryObject;
+import com.fr.script.AbstractFunction;
+import com.sun.jna.Library;
+import com.sun.jna.Native;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+public class BinaryImage extends AbstractFunction {
+
+ //加载dll,"E:\\bmp\\WltRS"是dll的文件完整路径,但不带后缀名,生成WltRS.class
+ static WltRS wltrs = (WltRS) Native.loadLibrary("E:\\bmp\\WltRS", WltRS.class);
+
+ static int index = 0;
+
+ public Object run(Object[] args) {
+
+ int current = index;
+
+ //args[0] 是 BinaryObject对象,取为bo
+ BinaryObject bo = (BinaryObject) args[0];
+
+ //将bo转换为.wlt文件,并保存在位置E:\bmp\;本地方法GetBmp的第一个参数是wlt文件的路径
+ getFile(bo.getBytes(), "E:\\bmp\\", current + ".wlt");
+
+ //读取.wlt为文件
+ File file = new File("E:\\bmp\\" + current + ".wlt");
+
+ //调用本地方法,在相同路径下生产.bmp
+ wltrs.GetBmp("E:\\bmp\\" + current + ".wlt", 1);
+
+ //读取并返回图片
+ File imagefile = new File("E:\\bmp\\" + current + ".bmp");
+ BufferedImage buffer = null;
+ try {
+ buffer = ImageIO.read(imagefile);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ index = (++index) % 300;
+ return buffer;
+ }
+
+
+ // byte[]转换为file的方法
+ public static void getFile(byte[] bfile, String filePath, String fileName) {
+ BufferedOutputStream bos = null;
+ FileOutputStream fos = null;
+ File file = null;
+ try {
+ File dir = new File(filePath);
+ if (!dir.exists() && dir.isDirectory()) {//判断文件目录是否存在
+ dir.mkdirs();
+ }
+ file = new File(filePath + "\\" + fileName);
+ fos = new FileOutputStream(file);
+ bos = new BufferedOutputStream(fos);
+ bos.write(bfile);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (bos != null) {
+ try {
+ bos.close();
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
+ if (fos != null) {
+ try {
+ fos.close();
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+ }
+}
+
+//用jna调用本地方法的必须步骤,具体含义不明
+interface WltRS extends Library {
+ //定义要调用的本地方法
+ void GetBmp(String str, int i);
+}
\ No newline at end of file
diff --git a/src/com/fr/function/CellSum.java b/src/com/fr/function/CellSum.java
new file mode 100644
index 0000000..008009b
--- /dev/null
+++ b/src/com/fr/function/CellSum.java
@@ -0,0 +1,15 @@
+// 自定义函数中获取公式所在单元格
+package com.fr.function;
+
+import com.fr.base.Utils;
+import com.fr.script.AbstractFunction;
+
+public class CellSum extends AbstractFunction {
+ public Object run(Object[] args) {
+ String sum = Utils.objectToNumber(new SUM().run(args), false)
+ .toString(); // 直接调用FR内部的SUM方法
+ String result = "所在单元格为:" + this.getCalculator().getCurrentColumnRow()
+ + ";总和为:" + sum; // 获取当前单元格拼出最终结果
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/function/ConnectSAPServer.java b/src/com/fr/function/ConnectSAPServer.java
new file mode 100644
index 0000000..e97c7b7
--- /dev/null
+++ b/src/com/fr/function/ConnectSAPServer.java
@@ -0,0 +1,58 @@
+package com.fr.function;
+
+import com.sap.conn.jco.JCoDestination;
+import com.sap.conn.jco.JCoDestinationManager;
+import com.sap.conn.jco.JCoException;
+import com.sap.conn.jco.ext.DestinationDataProvider;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Properties;
+
+public class ConnectSAPServer {
+ static String ABAP_AS_POOLED = "ABAP_AS_WITH_POOL";
+
+ static {
+ Properties connectProperties = new Properties();
+ connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST,
+ "SAP服务器IP地址");
+ connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "系统编号");
+ connectProperties
+ .setProperty(DestinationDataProvider.JCO_CLIENT, "客户端编号(SAP中的,和客户端没关系)");
+ connectProperties.setProperty(DestinationDataProvider.JCO_USER,
+ "用户名");
+ connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD,
+ "密码");
+ connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "ZH");
+ connectProperties.setProperty(
+ DestinationDataProvider.JCO_POOL_CAPACITY, "10");
+ connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT,
+ "10");
+ createDataFile(ABAP_AS_POOLED, "jcoDestination", connectProperties);
+ }
+
+ static void createDataFile(String name, String suffix, Properties properties) {
+ File cfg = new File(name + "." + suffix);
+ if (!cfg.exists()) {
+ try {
+ FileOutputStream fos = new FileOutputStream(cfg, false);
+ properties.store(fos, "SAP连接配置文件");
+ fos.close();
+ } catch (Exception e) {
+ throw new RuntimeException(
+ "Unable to create the destination file "
+ + cfg.getName(), e);
+ }
+ }
+ }
+
+ public static JCoDestination Connect() {
+ JCoDestination destination = null;
+ try {
+ destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
+ } catch (JCoException e) {
+ e.getCause();
+ }
+ return destination;
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/function/JFreeToChart.java b/src/com/fr/function/JFreeToChart.java
new file mode 100644
index 0000000..6ee0a16
--- /dev/null
+++ b/src/com/fr/function/JFreeToChart.java
@@ -0,0 +1,86 @@
+// 引入JFreeChart图表
+package com.fr.function;
+
+import com.fr.script.AbstractFunction;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.DatasetRenderingOrder;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.LineAndShapeRenderer;
+import org.jfree.chart.title.TextTitle;
+import org.jfree.data.DataUtilities;
+import org.jfree.data.DefaultKeyedValues;
+import org.jfree.data.category.CategoryDataset;
+import org.jfree.data.general.DatasetUtilities;
+import org.jfree.util.SortOrder;
+
+import java.awt.Color;
+import java.awt.image.BufferedImage;
+import java.text.NumberFormat;
+
+public class JFreeToChart extends AbstractFunction {
+ private String x, y;
+
+ public Object run(Object[] args) {
+ this.x = args[0].toString();
+ this.y = args[1].toString();
+ BufferedImage image = createImage(600, 400);
+ return image;
+ }
+
+ private BufferedImage createImage(int width, int height) {
+ CategoryDataset acategorydataset[] = createDatasets();
+ JFreeChart jfreechart = createChart(acategorydataset);
+ return jfreechart.createBufferedImage(width, height);
+ }
+
+ private CategoryDataset[] createDatasets() {
+ DefaultKeyedValues defaultkeyedvalues = new DefaultKeyedValues();
+ String[] xValue = this.x.split(",");
+ String[] yValue = this.y.split(",");
+ for (int i = 0; i < xValue.length; i++) {
+ defaultkeyedvalues.addValue(xValue[i], Double.valueOf(yValue[i]));
+ }
+ defaultkeyedvalues.sortByValues(SortOrder.DESCENDING);
+ org.jfree.data.KeyedValues keyedvalues = DataUtilities
+ .getCumulativePercentages(defaultkeyedvalues);
+ CategoryDataset categorydataset = DatasetUtilities
+ .createCategoryDataset("Languages", defaultkeyedvalues);
+ CategoryDataset categorydataset1 = DatasetUtilities
+ .createCategoryDataset("Cumulative", keyedvalues);
+ return (new CategoryDataset[]{categorydataset, categorydataset1});
+
+ }
+
+ private JFreeChart createChart(CategoryDataset acategorydataset[]) {
+ JFreeChart jfreechart = ChartFactory.createBarChart(
+ "Freshmeat Software Projects", "Language", "Projects",
+ acategorydataset[0], PlotOrientation.VERTICAL, true, true,
+ false);
+ jfreechart.addSubtitle(new TextTitle("By Programming Language"));
+ jfreechart.addSubtitle(new TextTitle("As at 5 March 2003"));
+ jfreechart.setBackgroundPaint(Color.white);
+ CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
+ categoryplot.setBackgroundPaint(Color.lightGray);
+ categoryplot.setRangeGridlinePaint(Color.white);
+ CategoryAxis categoryaxis = categoryplot.getDomainAxis();
+ categoryaxis.setLowerMargin(0.02D);
+ categoryaxis.setUpperMargin(0.02D);
+ categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
+ numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
+ LineAndShapeRenderer lineandshaperenderer = new LineAndShapeRenderer();
+ NumberAxis numberaxis1 = new NumberAxis("Percent");
+ numberaxis1.setNumberFormatOverride(NumberFormat.getPercentInstance());
+ categoryplot.setRangeAxis(1, numberaxis1);
+ categoryplot.setDataset(1, acategorydataset[1]);
+ categoryplot.setRenderer(1, lineandshaperenderer);
+ categoryplot.mapDatasetToRangeAxis(1, 1);
+ categoryplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
+ return jfreechart;
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/function/Lunar.java b/src/com/fr/function/Lunar.java
new file mode 100644
index 0000000..8f003c2
--- /dev/null
+++ b/src/com/fr/function/Lunar.java
@@ -0,0 +1,15 @@
+//自定义函数把阳历转换成阴历
+package com.fr.function;
+
+import com.fr.script.AbstractFunction;
+
+public class Lunar extends AbstractFunction {
+ public Object run(Object[] args) {
+ String result = "";
+ int y = Integer.parseInt(args[0].toString());
+ int m = Integer.parseInt(args[1].toString());
+ int d = Integer.parseInt(args[2].toString());
+ result = SolarToLunar.today(y, m, d);
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/function/ParamSAPDataTest.java b/src/com/fr/function/ParamSAPDataTest.java
new file mode 100644
index 0000000..e98088d
--- /dev/null
+++ b/src/com/fr/function/ParamSAPDataTest.java
@@ -0,0 +1,40 @@
+package com.fr.function;
+
+import com.fr.data.AbstractTableData;
+import com.sap.conn.jco.JCoDestination;
+import com.sap.conn.jco.JCoException;
+
+public class ParamSAPDataTest extends AbstractTableData {
+ private String[] columnNames;
+ private int columnNum;
+ private String[][] rowData;
+ private static JCoDestination jCoDestination;
+
+ public ParamSAPDataTest() {
+ throw new Error("Unresolved compilation problems: \n\tThe declared package \"com.fr.data\" does not match the expected package \"com.fr.function\"\n\tThe import com.sap cannot be resolved\n\tThe import com.sap cannot be resolved\n\tThe import com.sap cannot be resolved\n\tThe import com.sap cannot be resolved\n\tAbstractTableData cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tparameters cannot be resolved or is not a field\n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n\tJCoException cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tThe method Connect() from the type ConnectSAPServer refers to the missing type JCoDestination\n\tJCoFunction cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tparameters cannot be resolved or is not a field\n\tparameters cannot be resolved or is not a field\n\tJCoDestination cannot be resolved to a type\n\tJCoTable cannot be resolved to a type\n\tAbstractTableData cannot be resolved to a type\n");
+ }
+
+ public int getColumnCount() {
+ throw new Error("Unresolved compilation problem: \n");
+ }
+
+ public String getColumnName(int columnIndex) {
+ throw new Error("Unresolved compilation problem: \n");
+ }
+
+ public int getRowCount() {
+ throw new Error("Unresolved compilation problems: \n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n");
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ throw new Error("Unresolved compilation problems: \n\tThe method init() from the type ParamSAPDataTest refers to the missing type JCoException\n\tJCoException cannot be resolved to a type\n");
+ }
+
+ public void init() throws JCoException {
+ throw new Error("Unresolved compilation problems: \n\tJCoException cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tThe method Connect() from the type ConnectSAPServer refers to the missing type JCoDestination\n\tJCoFunction cannot be resolved to a type\n\tJCoDestination cannot be resolved to a type\n\tparameters cannot be resolved or is not a field\n\tparameters cannot be resolved or is not a field\n\tJCoDestination cannot be resolved to a type\n\tJCoTable cannot be resolved to a type\n");
+ }
+
+ public void release() throws Exception {
+ throw new Error("Unresolved compilation problem: \n\tAbstractTableData cannot be resolved to a type\n");
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/function/ReportCheck.java b/src/com/fr/function/ReportCheck.java
new file mode 100644
index 0000000..ee0948b
--- /dev/null
+++ b/src/com/fr/function/ReportCheck.java
@@ -0,0 +1,108 @@
+// 自定义函数实现表间校验
+package com.fr.function;
+
+import com.fr.base.Env;
+import com.fr.base.FRContext;
+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;
+ // 定义报表运行环境,才能运行读取的报表
+ Env oldEnv = FRContext.getCurrentEnv();
+ try {
+ ResultWorkBook rworkbook = null;
+ // 读取模板
+ WorkBook workbook = (WorkBook) TemplateWorkBookIO
+ .readTemplateWorkBook(oldEnv, 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
new file mode 100644
index 0000000..c70a634
--- /dev/null
+++ b/src/com/fr/function/SolarToLunar.java
@@ -0,0 +1,381 @@
+//自定义函数把阳历转换成阴历
+package com.fr.function;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+public class SolarToLunar {
+ final private static long[] lunarInfo = new long[]{0x04bd8, 0x04ae0,
+ 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0,
+ 0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540,
+ 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, 0x04970, 0x0a4b0, 0x0b4b5,
+ 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970,
+ 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3,
+ 0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0,
+ 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0,
+ 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8,
+ 0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570,
+ 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5,
+ 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0,
+ 0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50,
+ 0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5, 0x04970, 0x064b0,
+ 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0,
+ 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7,
+ 0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50,
+ 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954,
+ 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260,
+ 0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0,
+ 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, 0x0b5a0, 0x056d0,
+ 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20,
+ 0x0ada0};
+
+ final private static int[] year20 = new int[]{1, 4, 1, 2, 1, 2, 1, 1, 2,
+ 1, 2, 1};
+
+ final private static int[] year19 = new int[]{0, 3, 0, 1, 0, 1, 0, 0, 1,
+ 0, 1, 0};
+
+ final private static int[] year2000 = new int[]{0, 3, 1, 2, 1, 2, 1, 1,
+ 2, 1, 2, 1};
+
+ public final static String[] nStr1 = new String[]{"", "正", "二", "三", "四",
+ "五", "六", "七", "八", "九", "十", "十一", "十二"};
+
+ private final static String[] Gan = new String[]{"甲", "乙", "丙", "丁", "戊",
+ "己", "庚", "辛", "壬", "癸"};
+
+ private final static String[] Zhi = new String[]{"子", "丑", "寅", "卯", "辰",
+ "巳", "午", "未", "申", "酉", "戌", "亥"};
+
+ private final static String[] Animals = new String[]{"鼠", "牛", "虎", "兔",
+ "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"};
+
+ private final static String[] solarTerm = new String[]{"小寒", "大寒", "立春",
+ "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑",
+ "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至"};
+
+ private final static String[] sFtv = new String[]{"0101*元旦", "0214 情人节",
+ "0308 妇女节", "0312 植树节", "0315 消费者权益日", "0401 愚人节", "0501 劳动节",
+ "0504 青年节", "0512 护士节", "0601 儿童节", "0701 建党节", "0801 建军节",
+ "0808 父亲节", "0909 毛泽东逝世纪念", "0910 教师节", "0928 孔子诞辰", "1001*国庆节",
+ "1006 老人节", "1024 联合国日", "1112 孙中山诞辰", "1220 澳门回归", "1225 圣诞节",
+ "1226 毛泽东诞辰"};
+
+ private final static String[] lFtv = new String[]{"0101*农历春节",
+ "0115 元宵节", "0505 端午节", "0707 七夕情人节", "0815 中秋节", "0909 重阳节",
+ "1208 腊八节", "1224 小年", "0100*除夕"};
+
+ /**
+ * 传回农历 y年的总天数
+ *
+ * @param y
+ * @return
+ */
+ final private static int lYearDays(int y) {
+ int i, sum = 348;
+ for (i = 0x8000; i > 0x8; i >>= 1) {
+ if ((lunarInfo[y - 1900] & i) != 0)
+ sum += 1;
+ }
+ return (sum + leapDays(y));
+ }
+
+ /**
+ * 传回农历 y年闰月的天数
+ *
+ * @param y
+ * @return
+ */
+ final private static int leapDays(int y) {
+ if (leapMonth(y) != 0) {
+ if ((lunarInfo[y - 1900] & 0x10000) != 0)
+ return 30;
+ else
+ return 29;
+ } else
+ return 0;
+ }
+
+ /**
+ * 传回农历 y年闰哪个月 1-12 , 没闰传回 0
+ *
+ * @param y
+ * @return
+ */
+ final private static int leapMonth(int y) {
+ return (int) (lunarInfo[y - 1900] & 0xf);
+ }
+
+ /**
+ * 传回农历 y年m月的总天数
+ *
+ * @param y
+ * @param m
+ * @return
+ */
+ final private static int monthDays(int y, int m) {
+ if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0)
+ return 29;
+ else
+ return 30;
+ }
+
+ /**
+ * 传回农历 y年的生肖
+ *
+ * @param y
+ * @return
+ */
+ final public static String AnimalsYear(int y) {
+ return Animals[(y - 4) % 12];
+ }
+
+ /**
+ * 传入 月日的offset 传回干支,0=甲子
+ *
+ * @param num
+ * @return
+ */
+ final private static String cyclicalm(int num) {
+ return (Gan[num % 10] + Zhi[num % 12]);
+ }
+
+ /**
+ * 传入 offset 传回干支, 0=甲子
+ *
+ * @param y
+ * @return
+ */
+ final public static String cyclical(int y) {
+ int num = y - 1900 + 36;
+ return (cyclicalm(num));
+ }
+
+ /**
+ * 传出农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6
+ *
+ * @param y
+ * @param m
+ * @return
+ */
+ final private long[] Lunar(int y, int m) {
+ long[] nongDate = new long[7];
+ int i = 0, temp = 0, leap = 0;
+ Date baseDate = new GregorianCalendar(1900 + 1900, 1, 31).getTime();
+ Date objDate = new GregorianCalendar(y + 1900, m, 1).getTime();
+ long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L;
+ if (y < 2000)
+ offset += year19[m - 1];
+ if (y > 2000)
+ offset += year20[m - 1];
+ if (y == 2000)
+ offset += year2000[m - 1];
+ nongDate[5] = offset + 40;
+ nongDate[4] = 14;
+
+ for (i = 1900; i < 2050 && offset > 0; i++) {
+ temp = lYearDays(i);
+ offset -= temp;
+ nongDate[4] += 12;
+ }
+ if (offset < 0) {
+ offset += temp;
+ i--;
+ nongDate[4] -= 12;
+ }
+ nongDate[0] = i;
+ nongDate[3] = i - 1864;
+ leap = leapMonth(i); // 闰哪个月
+ nongDate[6] = 0;
+
+ for (i = 1; i < 13 && offset > 0; i++) {
+ // 闰月
+ if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) {
+ --i;
+ nongDate[6] = 1;
+ temp = leapDays((int) nongDate[0]);
+ } else {
+ temp = monthDays((int) nongDate[0], i);
+ }
+
+ // 解除闰月
+ if (nongDate[6] == 1 && i == (leap + 1))
+ nongDate[6] = 0;
+ offset -= temp;
+ if (nongDate[6] == 0)
+ nongDate[4]++;
+ }
+
+ if (offset == 0 && leap > 0 && i == leap + 1) {
+ if (nongDate[6] == 1) {
+ nongDate[6] = 0;
+ } else {
+ nongDate[6] = 1;
+ --i;
+ --nongDate[4];
+ }
+ }
+ if (offset < 0) {
+ offset += temp;
+ --i;
+ --nongDate[4];
+ }
+ nongDate[1] = i;
+ nongDate[2] = offset + 1;
+ return nongDate;
+ }
+
+ /**
+ * 传出y年m月d日对应的农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6
+ *
+ * @param y
+ * @param m
+ * @param d
+ * @return
+ */
+ final public static long[] calElement(int y, int m, int d) {
+ long[] nongDate = new long[7];
+ int i = 0, temp = 0, leap = 0;
+ Date baseDate = new GregorianCalendar(0 + 1900, 0, 31).getTime();
+ Date objDate = new GregorianCalendar(y, m - 1, d).getTime();
+ long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L;
+ nongDate[5] = offset + 40;
+ nongDate[4] = 14;
+
+ for (i = 1900; i < 2050 && offset > 0; i++) {
+ temp = lYearDays(i);
+ offset -= temp;
+ nongDate[4] += 12;
+ }
+ if (offset < 0) {
+ offset += temp;
+ i--;
+ nongDate[4] -= 12;
+ }
+ nongDate[0] = i;
+ nongDate[3] = i - 1864;
+ leap = leapMonth(i); // 闰哪个月
+ nongDate[6] = 0;
+
+ for (i = 1; i < 13 && offset > 0; i++) {
+ // 闰月
+ if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) {
+ --i;
+ nongDate[6] = 1;
+ temp = leapDays((int) nongDate[0]);
+ } else {
+ temp = monthDays((int) nongDate[0], i);
+ }
+
+ // 解除闰月
+ if (nongDate[6] == 1 && i == (leap + 1))
+ nongDate[6] = 0;
+ offset -= temp;
+ if (nongDate[6] == 0)
+ nongDate[4]++;
+ }
+
+ if (offset == 0 && leap > 0 && i == leap + 1) {
+ if (nongDate[6] == 1) {
+ nongDate[6] = 0;
+ } else {
+ nongDate[6] = 1;
+ --i;
+ --nongDate[4];
+ }
+ }
+ if (offset < 0) {
+ offset += temp;
+ --i;
+ --nongDate[4];
+ }
+ nongDate[1] = i;
+ nongDate[2] = offset + 1;
+ return nongDate;
+ }
+
+ public final static String getChinaDate(int day) {
+ String a = "";
+ if (day == 10)
+ return "初十";
+ if (day == 20)
+ return "二十";
+ if (day == 30)
+ return "三十";
+ int two = (int) ((day) / 10);
+ if (two == 0)
+ a = "初";
+ if (two == 1)
+ a = "十";
+ if (two == 2)
+ a = "廿";
+ if (two == 3)
+ a = "三";
+ int one = (int) (day % 10);
+ switch (one) {
+ case 1:
+ a += "一";
+ break;
+ case 2:
+ a += "二";
+ break;
+ case 3:
+ a += "三";
+ break;
+ case 4:
+ a += "四";
+ break;
+ case 5:
+ a += "五";
+ break;
+ case 6:
+ a += "六";
+ break;
+ case 7:
+ a += "七";
+ break;
+ case 8:
+ a += "八";
+ break;
+ case 9:
+ a += "九";
+ break;
+ }
+ return a;
+ }
+
+ public static String today(int y, int m, int d) {
+ int year = y;
+ int month = m;
+ int date = d;
+ long[] l = calElement(year, month, date);
+ StringBuffer sToday = new StringBuffer();
+ try {
+
+ sToday.append(" 农历");
+ sToday.append(cyclical(year));
+ sToday.append('(');
+ sToday.append(AnimalsYear(year));
+ sToday.append(")年");
+ sToday.append(nStr1[(int) l[1]]);
+ sToday.append("月");
+ sToday.append(getChinaDate((int) (l[2])));
+ return sToday.toString();
+ } finally {
+ sToday = null;
+ }
+ }
+
+ private static SimpleDateFormat sdf = new SimpleDateFormat(
+ "yyyy年M月d日 EEEEE");
+
+ /**
+ * 农历日历工具使用演示
+ *
+ * @param args
+ */
+ public static void main(String[] args) {
+ System.out.println(today(1988, 10, 27));
+ }
+}
diff --git a/src/com/fr/function/StringCat.java b/src/com/fr/function/StringCat.java
new file mode 100644
index 0000000..8db60a7
--- /dev/null
+++ b/src/com/fr/function/StringCat.java
@@ -0,0 +1,19 @@
+package com.fr.function;
+
+import com.fr.script.AbstractFunction;
+
+public class StringCat extends AbstractFunction {
+ public StringCat() {
+ }
+
+ public Object run(Object[] args) {
+ StringBuilder result = new StringBuilder();
+
+ for (int i = 0; i < args.length; ++i) {
+ Object para = args[i];
+ result.append(para.toString());
+ }
+
+ return result.toString();
+ }
+}
diff --git a/src/com/fr/function/StringImage.java b/src/com/fr/function/StringImage.java
new file mode 100644
index 0000000..5b01967
--- /dev/null
+++ b/src/com/fr/function/StringImage.java
@@ -0,0 +1,73 @@
+//图片在下文字在上
+package com.fr.function;
+
+import com.fr.base.BaseUtils;
+import com.fr.base.GraphHelper;
+import com.fr.script.AbstractFunction;
+import com.fr.stable.CoreGraphHelper;
+
+import javax.imageio.ImageIO;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+
+public class StringImage extends AbstractFunction {
+ public Object run(Object[] args) {
+ Image result = null;
+ int p = 0;
+ Object[] ob = new Object[2];
+ for (int i = 0; (i < args.length && p <= 1); i++) {
+ if (args[i] == null) {
+ continue;
+ }
+ ob[p] = args[i];
+ p++;
+
+ }
+ try {
+ result = initStringImage(ob[0], ob[1]);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ public Image initStringImage(Object nameOb, Object imageOb)
+ throws IOException {
+ String name = (String) nameOb;
+ Image image = null;
+ if (imageOb instanceof Image)
+ image = (Image) imageOb;
+ else
+ ;
+ Image stringImage = null;
+ BufferedImage splashBuffedImage = CoreGraphHelper.toBufferedImage(image);
+ stringImage = splashBuffedImage;
+ Graphics2D splashG2d = splashBuffedImage.createGraphics();
+ double centerX = 25;
+ double centerY = 25;
+ GraphHelper.drawString(splashG2d, name, centerX, centerY);
+ //
+ String FilePath = "Test.png";
+ File f = new File(FilePath);
+ ImageIO.write(splashBuffedImage, "png", f);
+ //
+ return splashBuffedImage;
+ }
+
+ public static void main(String arg[]) throws IOException {
+ StringImage tt = new StringImage();
+ Image image = BaseUtils.readImage("D:\\1.jpg");
+ String name = "12314124";
+ Image aa = tt.initStringImage(name, image);
+ JFrame jf = new JFrame();
+ JPanel jp = new JPanel();
+
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/function/SubSection.java b/src/com/fr/function/SubSection.java
new file mode 100644
index 0000000..a502c9c
--- /dev/null
+++ b/src/com/fr/function/SubSection.java
@@ -0,0 +1,45 @@
+//SubSection函数-Oracle查询参数个数限制
+package com.fr.function;
+
+import com.fr.general.FArray;
+import com.fr.script.AbstractFunction;
+
+public class SubSection extends AbstractFunction {
+ public Object run(Object[] args) {
+ // 获取第一个对象,即取得传入的参数
+ Object para = args[0];
+ String parastr = para.toString();
+ // 由于是复选参数,因此要去掉前后的"("和")"
+ if (parastr.startsWith("(") && parastr.endsWith(")")) {
+ parastr = parastr.substring(1, parastr.length() - 1);
+ }
+ // 将字符串转为","分割的数组
+ String test[] = parastr.split(",");
+ int len = test.length;
+ int loopnum = len / 500;
+ if (len % 500 != 0) {
+ loopnum += 1;
+ }
+ ;
+ // 返回的值是数组,需要定义成我们内部的类型FArray
+ FArray result = new FArray();
+ String str = "";
+ int k = 1;
+ for (int i = 0; i < loopnum; i++) {
+ for (int j = 500 * i; j < 500 * (i + 1) && j < len; j++) {
+ if (k != 500 && j != (len - 1)) {
+ str += test[j] + ",";
+ } else {
+ str += test[j];
+ }
+ k++;
+ }
+ // 每500个形成一组并在每组外部加上"("和")"
+ str = "(" + str + ")";
+ result.add(str);
+ str = "";
+ k = 1;
+ }
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/function/Ubm.java b/src/com/fr/function/Ubm.java
new file mode 100644
index 0000000..3501fb7
--- /dev/null
+++ b/src/com/fr/function/Ubm.java
@@ -0,0 +1,25 @@
+// 自定义函数Unicode编码转化为中文
+package com.fr.function;
+
+import com.fr.script.AbstractFunction;
+
+public class Ubm extends AbstractFunction {
+ public Object run(Object[] args) {
+ String str = args[0].toString();
+ String st = "";
+ StringBuffer buffer = new StringBuffer();
+ while (str.length() > 0) {
+ if (str.startsWith("%u")) {
+ st = str.substring(2, 6);
+ char ch = (char) Integer.parseInt(String.valueOf(st), 16);
+ buffer.append(new Character(ch).toString());
+ str = str.substring(6);
+ } else {
+ st = str.substring(0, str.indexOf("%u"));
+ buffer.append(st);
+ str = str.substring(st.length());
+ }
+ }
+ return buffer.toString();
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/function/Upc.java b/src/com/fr/function/Upc.java
new file mode 100644
index 0000000..b922952
--- /dev/null
+++ b/src/com/fr/function/Upc.java
@@ -0,0 +1,35 @@
+// 自定义函数生成UPC条形码
+package com.fr.function;
+
+import com.fr.script.AbstractFunction;
+import org.krysalis.barcode4j.impl.upcean.UPCABean;
+import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider;
+import org.krysalis.barcode4j.tools.UnitConv;
+
+import java.awt.image.BufferedImage;
+
+public class Upc extends AbstractFunction {
+ public Object run(Object[] args) {
+ if (args == null || args.length < 1) {
+ return "参数不对,必须有一个参数";
+ }
+ try {
+ // 创建一个UPC编码生成器
+ UPCABean bean = new UPCABean();
+ // 设置条形码高度,BufferedImage.TYPE_BYTE_BINARY代表常量值12,可直接使用常量值
+ final int dpi = Integer.parseInt(args[1].toString());
+ bean.setModuleWidth(UnitConv.in2mm(1.0f / dpi));
+ bean.doQuietZone(false);
+ BitmapCanvasProvider canvas = new BitmapCanvasProvider(dpi,
+ BufferedImage.TYPE_BYTE_BINARY, false, 0);
+ // 创建条形码
+ bean.generateBarcode(canvas, String.valueOf(args[0]));
+ canvas.finish();
+ // 返回图片显示
+ return canvas.getBufferedImage();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return args[0];
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/function/Widget2Image.java b/src/com/fr/function/Widget2Image.java
new file mode 100644
index 0000000..b809ce6
--- /dev/null
+++ b/src/com/fr/function/Widget2Image.java
@@ -0,0 +1,105 @@
+// 导出打印单选按钮及复选框
+package com.fr.function;
+
+import com.fr.base.AbstractPainter;
+import com.fr.base.BaseUtils;
+import com.fr.base.GraphHelper;
+import com.fr.base.Style;
+import com.fr.general.FArray;
+import com.fr.general.FRFont;
+import com.fr.script.AbstractFunction;
+import com.fr.stable.Primitive;
+import com.fr.stable.StringUtils;
+
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+
+public class Widget2Image extends AbstractFunction {
+ public Object run(Object[] args) {
+ if (args.length < 3)
+ return Primitive.NULL;
+ // 第一个参数:控件类型,不区分大小写
+ String type = args[0].toString().toLowerCase();
+ if (!("checkbox".equals(type) || "radiobutton".equals(type)))
+ return Primitive.ERROR_VALUE;
+ // 第二个参数:控件按钮个数
+ int num = Integer.parseInt(args[1].toString());
+ // 第三个参数:按钮组的值,哪些被选中
+ String selection = args[2].toString();
+ // 第四个参数:可选参数,按钮组对应的显示值数组
+ FArray textArray = new FArray();
+ if (args.length == 4 && args[3] instanceof FArray) {
+ textArray = (FArray) args[3];
+ }
+ return new WidgetPaint(type, num, selection, textArray);
+ }
+
+ public static class WidgetPaint extends AbstractPainter {
+ public static String CHECK_ON = "/com/fr/web/images/checkon.gif";
+ public static String CHECK_OFF = "/com/fr/web/images/checkoff.gif";
+ public static String RADIO_ON = "/com/fr/web/images/radioon.gif";
+ public static String RADIO_OFF = "/com/fr/web/images/radiooff.gif";
+ public static FRFont DEFUALT_FONT = FRFont.getInstance();
+ public static FontMetrics FontMetrics = GraphHelper
+ .getFontMetrics(DEFUALT_FONT);
+ private String type;
+ private int num;
+ private String selection;
+ private FArray textArray;
+
+ {
+ DEFUALT_FONT = DEFUALT_FONT.applyForeground(Color.BLACK);
+ }
+
+ public WidgetPaint(String type, int num, String selection,
+ FArray textArray) {
+ this.type = type;
+ this.num = num;
+ this.selection = selection;
+ this.textArray = textArray;
+ }
+
+ private String resolveText(int i) {
+ if (i < this.textArray.length()) {
+ return this.textArray.elementAt(i).toString();
+ }
+ return StringUtils.EMPTY;
+ }
+
+ public void paint(Graphics g, int width, int height, int resolution,
+ Style style) {
+ String OFF = CHECK_OFF;
+ String ON = CHECK_ON;
+ if ("radiobutton".equals(type)) {
+ OFF = RADIO_OFF;
+ ON = RADIO_ON;
+ }
+ Image[] checkOFFON = {BaseUtils.readImage(OFF),
+ BaseUtils.readImage(ON)};
+ int[] imgWidths = {checkOFFON[0].getWidth(null),
+ checkOFFON[1].getWidth(null)};
+ int[] imgHeights = {checkOFFON[0].getHeight(null),
+ checkOFFON[1].getHeight(null)};
+ Graphics2D g2d = (Graphics2D) g;
+ g2d.setFont(FRFont.getInstance());
+ g2d.setPaint(Color.BLACK);
+ int x = 2;
+ int y = (height - imgHeights[0]) / 2;
+ String select = selection;
+ for (int i = 0; i < num; i++) {
+ int bit = Integer.parseInt(select.substring(i, i + 1));
+ g2d.drawImage(checkOFFON[bit], x, y, imgWidths[bit],
+ imgHeights[bit], null);
+ x += imgWidths[bit] + 2;
+ String text = resolveText(i);
+ g2d.setBackground(Color.BLACK);
+ g2d.drawString(text, (float) x, (float) (y + FontMetrics
+ .getAscent()));
+ x += FontMetrics.stringWidth(text) + 2;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/io/ExcelToCpt.java b/src/com/fr/io/ExcelToCpt.java
new file mode 100644
index 0000000..c8af6e1
--- /dev/null
+++ b/src/com/fr/io/ExcelToCpt.java
@@ -0,0 +1,25 @@
+package com.fr.io;
+
+import com.fr.general.ModuleContext;
+import com.fr.io.importer.ExcelReportImporter;
+import com.fr.main.TemplateWorkBook;
+import com.fr.main.impl.WorkBook;
+import com.fr.report.module.EngineModule;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+
+public class ExcelToCpt {
+ public static void main(String[] args) throws Exception {
+ File excelFile = new File("D:\\API.xls");
+ FileInputStream a = new FileInputStream(excelFile);
+ ModuleContext.startModule(EngineModule.class.getName());
+ TemplateWorkBook tpl = new ExcelReportImporter().generateWorkBookByStream(a);
+ OutputStream outputStream = new FileOutputStream(new File("D:\\abc.cpt"));
+ ((WorkBook) tpl).export(outputStream);
+ outputStream.close();
+ ModuleContext.stopModules();
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/io/ExcelToCptpage.java b/src/com/fr/io/ExcelToCptpage.java
new file mode 100644
index 0000000..eb3a391
--- /dev/null
+++ b/src/com/fr/io/ExcelToCptpage.java
@@ -0,0 +1,46 @@
+package com.fr.io;
+
+import com.fr.io.importer.ExcelReportImporter;
+import com.fr.main.TemplateWorkBook;
+import com.fr.main.impl.WorkBook;
+import com.fr.report.cell.CellElement;
+import com.fr.report.cell.cellattr.CellPageAttr;
+import com.fr.report.elementcase.AbstractElementCase;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.util.Iterator;
+
+public class ExcelToCptpage {
+ public static void main(String[] args) throws Exception {
+ File excelFile = new File("D:\\API.xls"); // 获取EXCEL文件
+ FileInputStream a = new FileInputStream(excelFile);
+ TemplateWorkBook tpl = new ExcelReportImporter().generateWorkBookByStream(a);
+ Iterator it = tpl.getReport(0).iteratorOfElementCase();
+
+ while (it.hasNext()) {
+ AbstractElementCase ec = (AbstractElementCase) it.next();
+ Iterator cellIt = ec.cellIterator();
+ while (cellIt.hasNext()) {
+ CellElement obj = (CellElement) cellIt.next();
+ if (matchCell(obj, Integer.parseInt("1"), Integer.parseInt("0"))) {
+ CellPageAttr cpa = new CellPageAttr();
+ cpa.setPageAfterRow(true);
+ obj.setCellPageAttr(cpa);
+ }
+
+ }
+ }
+ OutputStream outputStream = new FileOutputStream(new File("D:\\abc.cpt")); // 转换成cpt模板
+ ((WorkBook) tpl).export(outputStream);
+ }
+
+
+ private static boolean matchCell(CellElement cell, int row, int col) {
+ if (cell.getRow() == row && cell.getColumn() == col)
+ return true;
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/io/ExcuteDemo.java b/src/com/fr/io/ExcuteDemo.java
new file mode 100644
index 0000000..0d382dd
--- /dev/null
+++ b/src/com/fr/io/ExcuteDemo.java
@@ -0,0 +1,43 @@
+package com.fr.io;
+
+import com.fr.base.FRContext;
+import com.fr.dav.LocalEnv;
+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.report.module.EngineModule;
+import com.fr.stable.WriteActor;
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+
+public class ExcuteDemo {
+ public static void main(String[] args) {
+ try {
+ // 首先需要定义执行所在的环境,这样才能正确读取数据库信息
+ String envPath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
+ FRContext.setCurrentEnv(new LocalEnv(envPath));
+ ModuleContext.startModule(EngineModule.class.getName());
+ // 读取模板
+ TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook(FRContext.getCurrentEnv(), "\\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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/io/ExportApi.java b/src/com/fr/io/ExportApi.java
new file mode 100644
index 0000000..01f352f
--- /dev/null
+++ b/src/com/fr/io/ExportApi.java
@@ -0,0 +1,93 @@
+package com.fr.io;
+
+import com.fr.base.FRContext;
+import com.fr.base.Parameter;
+import com.fr.dav.LocalEnv;
+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.report.module.EngineModule;
+import com.fr.stable.WriteActor;
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+
+public class ExportApi {
+ public static void main(String[] args) {
+ // 定义报表运行环境,才能执行报表
+ String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
+ FRContext.setCurrentEnv(new LocalEnv(envpath));
+ ModuleContext.startModule(EngineModule.class.getName());
+ ResultWorkBook rworkbook = null;
+ try {
+ // 未执行模板工作薄
+ WorkBook workbook = (WorkBook) TemplateWorkBookIO
+ .readTemplateWorkBook(FRContext.getCurrentEnv(),
+ "\\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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/io/ExportBatch.java b/src/com/fr/io/ExportBatch.java
new file mode 100644
index 0000000..99f9dcc
--- /dev/null
+++ b/src/com/fr/io/ExportBatch.java
@@ -0,0 +1,70 @@
+package com.fr.io;
+
+import com.fr.base.FRContext;
+import com.fr.dav.LocalEnv;
+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.report.module.EngineModule;
+import com.fr.stable.StableUtils;
+import com.fr.stable.WriteActor;
+
+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 {
+ // ���屨�����л���,����ִ�б���
+ String envpath = "D:\\FineReport_7.1\\WebReport\\WEB-INF";
+ FRContext.setCurrentEnv(new LocalEnv(envpath));
+ ModuleContext.startModule(EngineModule.class.getName());
+ // ��ȡ�����µ�ģ���ļ�
+ TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook(FRContext.getCurrentEnv(),
+ "doc\\Primary\\DetailReport\\Details.cpt");
+ // ��ȡ���ڱ���IJ���ֵ��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
new file mode 100644
index 0000000..ffd8466
--- /dev/null
+++ b/src/com/fr/io/ExportExcel.java
@@ -0,0 +1,90 @@
+package com.fr.io;
+
+import com.fr.base.FRContext;
+import com.fr.base.Parameter;
+import com.fr.dav.LocalEnv;
+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 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";
+ FRContext.setCurrentEnv(new LocalEnv(envpath));
+ ModuleContext.startModule(EngineModule.class.getName());
+ ResultWorkBook rworkbook = null;
+ try {
+ // 未执行模板工作薄
+ WorkBook workbook = (WorkBook) TemplateWorkBookIO
+ .readTemplateWorkBook(FRContext.getCurrentEnv(),
+ "\\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
new file mode 100644
index 0000000..9e01ce9
--- /dev/null
+++ b/src/com/fr/io/ExportReports.java
@@ -0,0 +1,57 @@
+package com.fr.io;
+
+import com.fr.base.FRContext;
+import com.fr.base.Parameter;
+import com.fr.dav.LocalEnv;
+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 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";
+ FRContext.setCurrentEnv(new LocalEnv(envpath));
+ ModuleContext.startModule(EngineModule.class.getName());
+ // ���г����һЩ��Ҫ��ʼ��
+ try {
+ // δִ��ģ�幤����
+ TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook(FRContext.getCurrentEnv(),
+ "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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/io/JavaPrint.java b/src/com/fr/io/JavaPrint.java
new file mode 100644
index 0000000..f0ab95b
--- /dev/null
+++ b/src/com/fr/io/JavaPrint.java
@@ -0,0 +1,35 @@
+package com.fr.io;
+
+import com.fr.base.FRContext;
+import com.fr.base.Parameter;
+import com.fr.dav.LocalEnv;
+import com.fr.main.TemplateWorkBook;
+import com.fr.print.PrintUtils;
+
+import java.util.HashMap;
+
+
+public class JavaPrint {
+ public static void main(String[] args) {
+ // 定义报表运行环境,才能执行报表
+ String envPath = "D:\\FineReport\\develop\\code\\build\\package\\WebReport\\WEB-INF";
+ FRContext.setCurrentEnv(new LocalEnv(envPath));
+ try {
+ TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook(FRContext.getCurrentEnv(), "GettingStarted.cpt");
+ // 参数传值
+ Parameter[] parameters = workbook.getParameters();
+ HashMap
+ * 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
new file mode 100644
index 0000000..8f6199b
--- /dev/null
+++ b/src/mobile/MobileCodeWSStub.java
@@ -0,0 +1,3780 @@
+/**
+ * MobileCodeWSStub.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: 1.7.3 Built on : May 30, 2016 (04:08:57 BST)
+ */
+package mobile;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+
+/*
+ * MobileCodeWSStub java implementation
+ */
+public class MobileCodeWSStub extends org.apache.axis2.client.Stub {
+ private static int counter = 0;
+ protected org.apache.axis2.description.AxisOperation[] _operations;
+
+ //hashmaps to keep the fault mapping
+ private java.util.HashMap faultExceptionNameMap = new java.util.HashMap();
+ private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap();
+ private java.util.HashMap faultMessageMap = new java.util.HashMap();
+ private QName[] opNameArray = null;
+
+ /**
+ * Constructor that takes in a configContext
+ */
+ public MobileCodeWSStub(
+ org.apache.axis2.context.ConfigurationContext configurationContext,
+ java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
+ this(configurationContext, targetEndpoint, false);
+ }
+
+ /**
+ * Constructor that takes in a configContext and useseperate listner
+ */
+ public MobileCodeWSStub(
+ org.apache.axis2.context.ConfigurationContext configurationContext,
+ java.lang.String targetEndpoint, boolean useSeparateListener)
+ throws org.apache.axis2.AxisFault {
+ //To populate AxisService
+ populateAxisService();
+ populateFaults();
+
+ _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,
+ _service);
+
+ _serviceClient.getOptions()
+ .setTo(new org.apache.axis2.addressing.EndpointReference(
+ targetEndpoint));
+ _serviceClient.getOptions().setUseSeparateListener(useSeparateListener);
+
+ //Set the soap version
+ _serviceClient.getOptions()
+ .setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ }
+
+ /**
+ * Default Constructor
+ */
+ public MobileCodeWSStub(
+ org.apache.axis2.context.ConfigurationContext configurationContext)
+ throws org.apache.axis2.AxisFault {
+ this(configurationContext,
+ "http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx");
+ }
+
+ /**
+ * Default Constructor
+ */
+ public MobileCodeWSStub() throws org.apache.axis2.AxisFault {
+ this("http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx");
+ }
+
+ /**
+ * Constructor taking the target endpoint
+ */
+ public MobileCodeWSStub(java.lang.String targetEndpoint)
+ throws org.apache.axis2.AxisFault {
+ this(null, targetEndpoint);
+ }
+
+ private static synchronized java.lang.String getUniqueSuffix() {
+ // reset the counter if it is greater than 99999
+ if (counter > 99999) {
+ counter = 0;
+ }
+
+ counter = counter + 1;
+
+ return Long.toString(System.currentTimeMillis()) +
+ "_" + counter;
+ }
+
+ private void populateAxisService() throws org.apache.axis2.AxisFault {
+ //creating the Service with a unique name
+ _service = new org.apache.axis2.description.AxisService("MobileCodeWS" +
+ getUniqueSuffix());
+ addAnonymousOperations();
+
+ //creating the operations
+ org.apache.axis2.description.AxisOperation __operation;
+
+ _operations = new org.apache.axis2.description.AxisOperation[2];
+
+ __operation = new org.apache.axis2.description.OutInAxisOperation();
+
+ __operation.setName(new QName(
+ "http://WebXml.com.cn/", "getDatabaseInfo"));
+ _service.addOperation(__operation);
+
+ _operations[0] = __operation;
+
+ __operation = new org.apache.axis2.description.OutInAxisOperation();
+
+ __operation.setName(new QName(
+ "http://WebXml.com.cn/", "getMobileCodeInfo"));
+ _service.addOperation(__operation);
+
+ _operations[1] = __operation;
+ }
+
+ //populates the faults
+ private void populateFaults() {
+ }
+
+ /**
+ * Auto generated method signature
+ * <br /><h3>获得国内手机号码归属地数据库信息</h3><p>输入参数:无;返回数据:�?��字符串数组(省份 城市 记录数量)�?</p><br />
+ *
+ * @param getDatabaseInfo0
+ * @see mobile.MobileCodeWS#getDatabaseInfo
+ */
+ public GetDatabaseInfoResponse getDatabaseInfo(
+ GetDatabaseInfo getDatabaseInfo0)
+ throws java.rmi.RemoteException {
+ org.apache.axis2.context.MessageContext _messageContext = null;
+
+ try {
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
+ _operationClient.getOptions()
+ .setAction("http://WebXml.com.cn/getDatabaseInfo");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+ addPropertyToOperationClient(_operationClient,
+ org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+ "&");
+
+ // create a message context
+ _messageContext = new org.apache.axis2.context.MessageContext();
+
+ // create SOAP envelope with that payload
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+
+ env = toEnvelope(getFactory(_operationClient.getOptions()
+ .getSoapVersionURI()),
+ getDatabaseInfo0,
+ optimizeContent(
+ new QName("http://WebXml.com.cn/",
+ "getDatabaseInfo")),
+ new QName("http://WebXml.com.cn/",
+ "getDatabaseInfo"));
+
+ //adding SOAP soap_headers
+ _serviceClient.addHeadersToEnvelope(env);
+ // set the message context with that soap envelope
+ _messageContext.setEnvelope(env);
+
+ // add the message contxt to the operation client
+ _operationClient.addMessageContext(_messageContext);
+
+ //execute the operation client
+ _operationClient.execute(true);
+
+ org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
+
+ Object object = fromOM(_returnEnv.getBody()
+ .getFirstElement(),
+ GetDatabaseInfoResponse.class);
+
+ return (GetDatabaseInfoResponse) object;
+ } catch (org.apache.axis2.AxisFault f) {
+ org.apache.axiom.om.OMElement faultElt = f.getDetail();
+
+ if (faultElt != null) {
+ if (faultExceptionNameMap.containsKey(
+ new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(), "getDatabaseInfo"))) {
+ //make the fault by reflection
+ try {
+ java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(), "getDatabaseInfo"));
+ Class exceptionClass = Class.forName(exceptionClassName);
+ java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class});
+ Exception ex = (Exception) constructor.newInstance(new Object[]{f.getMessage()});
+
+ //message class
+ java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(), "getDatabaseInfo"));
+ Class messageClass = Class.forName(messageClassName);
+ Object messageObject = fromOM(faultElt,
+ messageClass);
+ java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
+ new Class[]{messageClass});
+ m.invoke(ex, new Object[]{messageObject});
+
+ throw new java.rmi.RemoteException(ex.getMessage(), ex);
+ } catch (ClassCastException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (ClassNotFoundException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (NoSuchMethodException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (IllegalAccessException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (InstantiationException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ } finally {
+ if (_messageContext.getTransportOut() != null) {
+ _messageContext.getTransportOut().getSender()
+ .cleanup(_messageContext);
+ }
+ }
+ }
+
+ /**
+ * Auto generated method signature for Asynchronous Invocations
+ * <br /><h3>获得国内手机号码归属地数据库信息</h3><p>输入参数:无;返回数据:�?��字符串数组(省份 城市 记录数量)�?</p><br />
+ *
+ * @param getDatabaseInfo0
+ * @see mobile.MobileCodeWS#startgetDatabaseInfo
+ */
+ public void startgetDatabaseInfo(
+ GetDatabaseInfo getDatabaseInfo0,
+ final MobileCodeWSCallbackHandler callback)
+ throws java.rmi.RemoteException {
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
+ _operationClient.getOptions()
+ .setAction("http://WebXml.com.cn/getDatabaseInfo");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+ addPropertyToOperationClient(_operationClient,
+ org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+ "&");
+
+ // create SOAP envelope with that payload
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+ final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
+
+ //Style is Doc.
+ env = toEnvelope(getFactory(_operationClient.getOptions()
+ .getSoapVersionURI()),
+ getDatabaseInfo0,
+ optimizeContent(
+ new QName("http://WebXml.com.cn/",
+ "getDatabaseInfo")),
+ new QName("http://WebXml.com.cn/",
+ "getDatabaseInfo"));
+
+ // adding SOAP soap_headers
+ _serviceClient.addHeadersToEnvelope(env);
+ // create message context with that soap envelope
+ _messageContext.setEnvelope(env);
+
+ // add the message context to the operation client
+ _operationClient.addMessageContext(_messageContext);
+
+ _operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() {
+ public void onMessage(
+ org.apache.axis2.context.MessageContext resultContext) {
+ try {
+ org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();
+
+ Object object = fromOM(resultEnv.getBody()
+ .getFirstElement(),
+ GetDatabaseInfoResponse.class);
+ callback.receiveResultgetDatabaseInfo((GetDatabaseInfoResponse) object);
+ } catch (org.apache.axis2.AxisFault e) {
+ callback.receiveErrorgetDatabaseInfo(e);
+ }
+ }
+
+ public void onError(Exception error) {
+ if (error instanceof org.apache.axis2.AxisFault) {
+ org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
+ org.apache.axiom.om.OMElement faultElt = f.getDetail();
+
+ if (faultElt != null) {
+ if (faultExceptionNameMap.containsKey(
+ new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(),
+ "getDatabaseInfo"))) {
+ //make the fault by reflection
+ try {
+ java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(),
+ "getDatabaseInfo"));
+ Class exceptionClass = Class.forName(exceptionClassName);
+ java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class});
+ Exception ex = (Exception) constructor.newInstance(new Object[]{f.getMessage()});
+
+ //message class
+ java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(),
+ "getDatabaseInfo"));
+ Class messageClass = Class.forName(messageClassName);
+ Object messageObject = fromOM(faultElt,
+ messageClass);
+ java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
+ new Class[]{messageClass});
+ m.invoke(ex,
+ new Object[]{messageObject});
+
+ callback.receiveErrorgetDatabaseInfo(new java.rmi.RemoteException(
+ ex.getMessage(), ex));
+ } catch (ClassCastException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetDatabaseInfo(f);
+ } catch (ClassNotFoundException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetDatabaseInfo(f);
+ } catch (NoSuchMethodException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetDatabaseInfo(f);
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetDatabaseInfo(f);
+ } catch (IllegalAccessException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetDatabaseInfo(f);
+ } catch (InstantiationException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetDatabaseInfo(f);
+ } catch (org.apache.axis2.AxisFault e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetDatabaseInfo(f);
+ }
+ } else {
+ callback.receiveErrorgetDatabaseInfo(f);
+ }
+ } else {
+ callback.receiveErrorgetDatabaseInfo(f);
+ }
+ } else {
+ callback.receiveErrorgetDatabaseInfo(error);
+ }
+ }
+
+ public void onFault(
+ org.apache.axis2.context.MessageContext faultContext) {
+ org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
+ onError(fault);
+ }
+
+ public void onComplete() {
+ try {
+ _messageContext.getTransportOut().getSender()
+ .cleanup(_messageContext);
+ } catch (org.apache.axis2.AxisFault axisFault) {
+ callback.receiveErrorgetDatabaseInfo(axisFault);
+ }
+ }
+ });
+
+ org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;
+
+ if ((_operations[0].getMessageReceiver() == null) &&
+ _operationClient.getOptions().isUseSeparateListener()) {
+ _callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
+ _operations[0].setMessageReceiver(_callbackReceiver);
+ }
+
+ //execute the operation client
+ _operationClient.execute(false);
+ }
+
+ /**
+ * Auto generated method signature
+ * <br /><h3>获得国内手机号码归属地省份�?地区和手机卡类型信息</h3><p>输入参数:mobileCode = 字符串(手机号码,最少前7位数字),userID = 字符串(商业用户ID�?免费用户为空字符串;返回数据:字符串(手机号码:省份 城市 手机卡类型)�?lt;/p><br />
+ *
+ * @param getMobileCodeInfo2
+ * @see mobile.MobileCodeWS#getMobileCodeInfo
+ */
+ public GetMobileCodeInfoResponse getMobileCodeInfo(
+ GetMobileCodeInfo getMobileCodeInfo2)
+ throws java.rmi.RemoteException {
+ org.apache.axis2.context.MessageContext _messageContext = null;
+
+ try {
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());
+ _operationClient.getOptions()
+ .setAction("http://WebXml.com.cn/getMobileCodeInfo");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+ addPropertyToOperationClient(_operationClient,
+ org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+ "&");
+
+ // create a message context
+ _messageContext = new org.apache.axis2.context.MessageContext();
+
+ // create SOAP envelope with that payload
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+
+ env = toEnvelope(getFactory(_operationClient.getOptions()
+ .getSoapVersionURI()),
+ getMobileCodeInfo2,
+ optimizeContent(
+ new QName("http://WebXml.com.cn/",
+ "getMobileCodeInfo")),
+ new QName("http://WebXml.com.cn/",
+ "getMobileCodeInfo"));
+
+ //adding SOAP soap_headers
+ _serviceClient.addHeadersToEnvelope(env);
+ // set the message context with that soap envelope
+ _messageContext.setEnvelope(env);
+
+ // add the message contxt to the operation client
+ _operationClient.addMessageContext(_messageContext);
+
+ //execute the operation client
+ _operationClient.execute(true);
+
+ org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
+
+ Object object = fromOM(_returnEnv.getBody()
+ .getFirstElement(),
+ GetMobileCodeInfoResponse.class);
+
+ return (GetMobileCodeInfoResponse) object;
+ } catch (org.apache.axis2.AxisFault f) {
+ org.apache.axiom.om.OMElement faultElt = f.getDetail();
+
+ if (faultElt != null) {
+ if (faultExceptionNameMap.containsKey(
+ new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(), "getMobileCodeInfo"))) {
+ //make the fault by reflection
+ try {
+ java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(), "getMobileCodeInfo"));
+ Class exceptionClass = Class.forName(exceptionClassName);
+ java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class});
+ Exception ex = (Exception) constructor.newInstance(new Object[]{new Object[]{f.getMessage()}});
+
+ //message class
+ java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(), "getMobileCodeInfo"));
+ Class messageClass = Class.forName(messageClassName);
+ Object messageObject = fromOM(faultElt,
+ messageClass);
+ java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
+ new Class[]{messageClass});
+ m.invoke(ex, new Object[]{messageObject});
+
+ throw new java.rmi.RemoteException(ex.getMessage(), ex);
+ } catch (ClassCastException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (ClassNotFoundException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (NoSuchMethodException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (IllegalAccessException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (InstantiationException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ } finally {
+ if (_messageContext.getTransportOut() != null) {
+ _messageContext.getTransportOut().getSender()
+ .cleanup(_messageContext);
+ }
+ }
+ }
+
+ /**
+ * Auto generated method signature for Asynchronous Invocations
+ * <br /><h3>获得国内手机号码归属地省份�?地区和手机卡类型信息</h3><p>输入参数:mobileCode = 字符串(手机号码,最少前7位数字),userID = 字符串(商业用户ID�?免费用户为空字符串;返回数据:字符串(手机号码:省份 城市 手机卡类型)�?lt;/p><br />
+ *
+ * @param getMobileCodeInfo2
+ * @see mobile.MobileCodeWS#startgetMobileCodeInfo
+ */
+ public void startgetMobileCodeInfo(
+ GetMobileCodeInfo getMobileCodeInfo2,
+ final MobileCodeWSCallbackHandler callback)
+ throws java.rmi.RemoteException {
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());
+ _operationClient.getOptions()
+ .setAction("http://WebXml.com.cn/getMobileCodeInfo");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+ addPropertyToOperationClient(_operationClient,
+ org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+ "&");
+
+ // create SOAP envelope with that payload
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+ final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
+
+ //Style is Doc.
+ env = toEnvelope(getFactory(_operationClient.getOptions()
+ .getSoapVersionURI()),
+ getMobileCodeInfo2,
+ optimizeContent(
+ new QName("http://WebXml.com.cn/",
+ "getMobileCodeInfo")),
+ new QName("http://WebXml.com.cn/",
+ "getMobileCodeInfo"));
+
+ // adding SOAP soap_headers
+ _serviceClient.addHeadersToEnvelope(env);
+ // create message context with that soap envelope
+ _messageContext.setEnvelope(env);
+
+ // add the message context to the operation client
+ _operationClient.addMessageContext(_messageContext);
+
+ _operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() {
+ public void onMessage(
+ org.apache.axis2.context.MessageContext resultContext) {
+ try {
+ org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();
+
+ Object object = fromOM(resultEnv.getBody()
+ .getFirstElement(),
+ GetMobileCodeInfoResponse.class);
+ callback.receiveResultgetMobileCodeInfo((GetMobileCodeInfoResponse) object);
+ } catch (org.apache.axis2.AxisFault e) {
+ callback.receiveErrorgetMobileCodeInfo(e);
+ }
+ }
+
+ public void onError(Exception error) {
+ if (error instanceof org.apache.axis2.AxisFault) {
+ org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
+ org.apache.axiom.om.OMElement faultElt = f.getDetail();
+
+ if (faultElt != null) {
+ if (faultExceptionNameMap.containsKey(
+ new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(),
+ "getMobileCodeInfo"))) {
+ //make the fault by reflection
+ try {
+ java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(),
+ "getMobileCodeInfo"));
+ Class exceptionClass = Class.forName(exceptionClassName);
+ java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class});
+ Exception ex = (Exception) constructor.newInstance(new Object[]{f.getMessage()});
+
+ //message class
+ java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
+ faultElt.getQName(),
+ "getMobileCodeInfo"));
+ Class messageClass = Class.forName(messageClassName);
+ Object messageObject = fromOM(faultElt,
+ messageClass);
+ java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
+ new Class[]{messageClass});
+ m.invoke(ex,
+ new Object[]{messageObject});
+
+ callback.receiveErrorgetMobileCodeInfo(new java.rmi.RemoteException(
+ ex.getMessage(), ex));
+ } catch (ClassCastException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetMobileCodeInfo(f);
+ } catch (ClassNotFoundException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetMobileCodeInfo(f);
+ } catch (NoSuchMethodException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetMobileCodeInfo(f);
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetMobileCodeInfo(f);
+ } catch (IllegalAccessException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetMobileCodeInfo(f);
+ } catch (InstantiationException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetMobileCodeInfo(f);
+ } catch (org.apache.axis2.AxisFault e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ callback.receiveErrorgetMobileCodeInfo(f);
+ }
+ } else {
+ callback.receiveErrorgetMobileCodeInfo(f);
+ }
+ } else {
+ callback.receiveErrorgetMobileCodeInfo(f);
+ }
+ } else {
+ callback.receiveErrorgetMobileCodeInfo(error);
+ }
+ }
+
+ public void onFault(
+ org.apache.axis2.context.MessageContext faultContext) {
+ org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
+ onError(fault);
+ }
+
+ public void onComplete() {
+ try {
+ _messageContext.getTransportOut().getSender()
+ .cleanup(_messageContext);
+ } catch (org.apache.axis2.AxisFault axisFault) {
+ callback.receiveErrorgetMobileCodeInfo(axisFault);
+ }
+ }
+ });
+
+ org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;
+
+ if ((_operations[1].getMessageReceiver() == null) &&
+ _operationClient.getOptions().isUseSeparateListener()) {
+ _callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
+ _operations[1].setMessageReceiver(_callbackReceiver);
+ }
+
+ //execute the operation client
+ _operationClient.execute(false);
+ }
+
+ private boolean optimizeContent(QName opName) {
+ if (opNameArray == null) {
+ return false;
+ }
+
+ for (int i = 0; i < opNameArray.length; i++) {
+ if (opName.equals(opNameArray[i])) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ GetDatabaseInfo param, boolean optimizeContent)
+ throws org.apache.axis2.AxisFault {
+ try {
+ return param.getOMElement(GetDatabaseInfo.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ GetDatabaseInfoResponse param,
+ boolean optimizeContent) throws org.apache.axis2.AxisFault {
+ try {
+ return param.getOMElement(GetDatabaseInfoResponse.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ GetMobileCodeInfo param, boolean optimizeContent)
+ throws org.apache.axis2.AxisFault {
+ try {
+ return param.getOMElement(GetMobileCodeInfo.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ GetMobileCodeInfoResponse param,
+ boolean optimizeContent) throws org.apache.axis2.AxisFault {
+ try {
+ return param.getOMElement(GetMobileCodeInfoResponse.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory,
+ GetDatabaseInfo param, boolean optimizeContent,
+ QName elementQName)
+ throws org.apache.axis2.AxisFault {
+ try {
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ emptyEnvelope.getBody()
+ .addChild(param.getOMElement(
+ GetDatabaseInfo.MY_QNAME, factory));
+
+ return emptyEnvelope;
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ /* methods to provide back word compatibility */
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory,
+ GetMobileCodeInfo param,
+ boolean optimizeContent, QName elementQName)
+ throws org.apache.axis2.AxisFault {
+ try {
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ emptyEnvelope.getBody()
+ .addChild(param.getOMElement(
+ GetMobileCodeInfo.MY_QNAME, factory));
+
+ return emptyEnvelope;
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ /* methods to provide back word compatibility */
+
+ /**
+ * get the default envelope
+ */
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory) {
+ return factory.getDefaultEnvelope();
+ }
+
+ private Object fromOM(org.apache.axiom.om.OMElement param,
+ Class type) throws org.apache.axis2.AxisFault {
+ try {
+ if (GetDatabaseInfo.class.equals(type)) {
+ return GetDatabaseInfo.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+
+ if (GetDatabaseInfoResponse.class.equals(
+ type)) {
+ return GetDatabaseInfoResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+
+ if (GetMobileCodeInfo.class.equals(type)) {
+ return GetMobileCodeInfo.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+
+ if (GetMobileCodeInfoResponse.class.equals(
+ type)) {
+ return GetMobileCodeInfoResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+ } catch (Exception e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+
+ return null;
+ }
+
+ //http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx
+ public static class ArrayOfStringE implements org.apache.axis2.databinding.ADBBean {
+ public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
+ "ArrayOfString", "ns1");
+
+ /**
+ * field for ArrayOfString
+ */
+ protected ArrayOfString localArrayOfString;
+
+ /**
+ * Auto generated getter method
+ *
+ * @return ArrayOfString
+ */
+ public ArrayOfString getArrayOfString() {
+ return localArrayOfString;
+ }
+
+ /**
+ * Auto generated setter method
+ *
+ * @param param ArrayOfString
+ */
+ public void setArrayOfString(ArrayOfString param) {
+ this.localArrayOfString = param;
+ }
+
+ /**
+ * @param parentQName
+ * @param factory
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getOMElement(
+ final QName parentQName,
+ final org.apache.axiom.om.OMFactory factory)
+ throws org.apache.axis2.databinding.ADBException {
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
+ this, MY_QNAME), parentQName);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ serialize(parentQName, xmlWriter, false);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ //We can safely assume an element has only one type associated with it
+ if (localArrayOfString == null) {
+ java.lang.String namespace = "http://WebXml.com.cn/";
+ writeStartElement(null, namespace, "ArrayOfString", xmlWriter);
+
+ // write the nil attribute
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "nil", "1",
+ xmlWriter);
+ xmlWriter.writeEndElement();
+ } else {
+ localArrayOfString.serialize(MY_QNAME, xmlWriter);
+ }
+ }
+
+ private static java.lang.String generatePrefix(
+ java.lang.String namespace) {
+ if (namespace.equals("http://WebXml.com.cn/")) {
+ return "ns1";
+ }
+
+ return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ /**
+ * Utility method to write an element start tag.
+ */
+ private void writeStartElement(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String localPart,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
+ } else {
+ if (namespace.length() == 0) {
+ prefix = "";
+ } else if (prefix == null) {
+ prefix = generatePrefix(namespace);
+ }
+
+ xmlWriter.writeStartElement(prefix, localPart, namespace);
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+ }
+
+ /**
+ * Util method to write an attribute with the ns prefix
+ */
+ private void writeAttribute(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String attName,
+ java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeAttribute(writerPrefix, namespace, attName,
+ attValue);
+ } else {
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeAttribute(java.lang.String namespace,
+ java.lang.String attName, java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attValue);
+ } else {
+ xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
+ namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeQNameAttribute(java.lang.String namespace,
+ java.lang.String attName, QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String attributeNamespace = qname.getNamespaceURI();
+ java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
+
+ if (attributePrefix == null) {
+ attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
+ }
+
+ java.lang.String attributeValue;
+
+ if (attributePrefix.trim().length() > 0) {
+ attributeValue = attributePrefix + ":" + qname.getLocalPart();
+ } else {
+ attributeValue = qname.getLocalPart();
+ }
+
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attributeValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(attributePrefix, namespace, attName,
+ attributeValue);
+ }
+ }
+
+ /**
+ * method to handle Qnames
+ */
+ private void writeQName(QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String namespaceURI = qname.getNamespaceURI();
+
+ if (namespaceURI != null) {
+ java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ xmlWriter.writeCharacters(prefix + ":" +
+ org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ } else {
+ // i.e this is the default namespace
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ } else {
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ }
+
+ private void writeQNames(QName[] qnames,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (qnames != null) {
+ // we have to store this data until last moment since it is not possible to write any
+ // namespace data after writing the charactor data
+ StringBuffer stringToWrite = new StringBuffer();
+ java.lang.String namespaceURI = null;
+ java.lang.String prefix = null;
+
+ for (int i = 0; i < qnames.length; i++) {
+ if (i > 0) {
+ stringToWrite.append(" ");
+ }
+
+ namespaceURI = qnames[i].getNamespaceURI();
+
+ if (namespaceURI != null) {
+ prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if ((prefix == null) || (prefix.length() == 0)) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ stringToWrite.append(prefix).append(":")
+ .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ }
+
+ xmlWriter.writeCharacters(stringToWrite.toString());
+ }
+ }
+
+ /**
+ * Register a namespace prefix
+ */
+ private java.lang.String registerPrefix(
+ javax.xml.stream.XMLStreamWriter xmlWriter,
+ java.lang.String namespace)
+ throws XMLStreamException {
+ java.lang.String prefix = xmlWriter.getPrefix(namespace);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+
+ javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
+
+ while (true) {
+ java.lang.String uri = nsContext.getNamespaceURI(prefix);
+
+ if ((uri == null) || (uri.length() == 0)) {
+ break;
+ }
+
+ prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Factory class that keeps the parse method
+ */
+ public static class Factory {
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
+
+ /**
+ * static method to create the object
+ * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
+ * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
+ * Postcondition: If this object is an element, the reader is positioned at its end element
+ * If this object is a complex type, the reader is positioned at the end element of its outer element
+ */
+ public static ArrayOfStringE parse(
+ XMLStreamReader reader)
+ throws Exception {
+ ArrayOfStringE object = new ArrayOfStringE();
+
+ int event;
+ QName currentQName = null;
+ java.lang.String nillableValue = null;
+ java.lang.String prefix = "";
+ java.lang.String namespaceuri = "";
+
+ try {
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ currentQName = reader.getName();
+
+ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "nil");
+
+ if ("true".equals(nillableValue) ||
+ "1".equals(nillableValue)) {
+ // Skip the element and report the null value. It cannot have subelements.
+ while (!reader.isEndElement())
+ reader.next();
+
+ return object;
+ }
+
+ // Note all attributes that were handled. Used to differ normal attributes
+ // from anyAttributes.
+ java.util.Vector handledAttributes = new java.util.Vector();
+
+ while (!reader.isEndElement()) {
+ if (reader.isStartElement()) {
+ if ((reader.isStartElement() &&
+ new QName(
+ "http://WebXml.com.cn/", "ArrayOfString").equals(
+ reader.getName())) ||
+ new QName("",
+ "ArrayOfString").equals(
+ reader.getName())) {
+ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "nil");
+
+ if ("true".equals(nillableValue) ||
+ "1".equals(nillableValue)) {
+ object.setArrayOfString(null);
+ reader.next();
+ } else {
+ object.setArrayOfString(ArrayOfString.Factory.parse(
+ reader));
+ }
+ } // End of if for expected property start element
+
+ else {
+ // 3 - A start element we are not expecting indicates an invalid parameter was passed
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unexpected subelement " +
+ reader.getName());
+ }
+ } else {
+ reader.next();
+ }
+ } // end of while loop
+ } catch (XMLStreamException e) {
+ throw new Exception(e);
+ }
+
+ return object;
+ }
+ } //end of factory class
+
+ public XMLStreamReader getPullParser(QName arg0)
+ throws XMLStreamException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+ public static class GetDatabaseInfo implements org.apache.axis2.databinding.ADBBean {
+ public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
+ "getDatabaseInfo", "ns1");
+
+ /**
+ * @param parentQName
+ * @param factory
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getOMElement(
+ final QName parentQName,
+ final org.apache.axiom.om.OMFactory factory)
+ throws org.apache.axis2.databinding.ADBException {
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
+ this, MY_QNAME), parentQName);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ serialize(parentQName, xmlWriter, false);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ java.lang.String prefix = null;
+ java.lang.String namespace = null;
+
+ prefix = parentQName.getPrefix();
+ namespace = parentQName.getNamespaceURI();
+ writeStartElement(prefix, namespace, parentQName.getLocalPart(),
+ xmlWriter);
+
+ if (serializeType) {
+ java.lang.String namespacePrefix = registerPrefix(xmlWriter,
+ "http://WebXml.com.cn/");
+
+ if ((namespacePrefix != null) &&
+ (namespacePrefix.trim().length() > 0)) {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ namespacePrefix + ":getDatabaseInfo", xmlWriter);
+ } else {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ "getDatabaseInfo", xmlWriter);
+ }
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ private static java.lang.String generatePrefix(
+ java.lang.String namespace) {
+ if (namespace.equals("http://WebXml.com.cn/")) {
+ return "ns1";
+ }
+
+ return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ /**
+ * Utility method to write an element start tag.
+ */
+ private void writeStartElement(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String localPart,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
+ } else {
+ if (namespace.length() == 0) {
+ prefix = "";
+ } else if (prefix == null) {
+ prefix = generatePrefix(namespace);
+ }
+
+ xmlWriter.writeStartElement(prefix, localPart, namespace);
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+ }
+
+ /**
+ * Util method to write an attribute with the ns prefix
+ */
+ private void writeAttribute(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String attName,
+ java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeAttribute(writerPrefix, namespace, attName,
+ attValue);
+ } else {
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeAttribute(java.lang.String namespace,
+ java.lang.String attName, java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attValue);
+ } else {
+ xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
+ namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeQNameAttribute(java.lang.String namespace,
+ java.lang.String attName, QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String attributeNamespace = qname.getNamespaceURI();
+ java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
+
+ if (attributePrefix == null) {
+ attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
+ }
+
+ java.lang.String attributeValue;
+
+ if (attributePrefix.trim().length() > 0) {
+ attributeValue = attributePrefix + ":" + qname.getLocalPart();
+ } else {
+ attributeValue = qname.getLocalPart();
+ }
+
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attributeValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(attributePrefix, namespace, attName,
+ attributeValue);
+ }
+ }
+
+ /**
+ * method to handle Qnames
+ */
+ private void writeQName(QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String namespaceURI = qname.getNamespaceURI();
+
+ if (namespaceURI != null) {
+ java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ xmlWriter.writeCharacters(prefix + ":" +
+ org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ } else {
+ // i.e this is the default namespace
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ } else {
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ }
+
+ private void writeQNames(QName[] qnames,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (qnames != null) {
+ // we have to store this data until last moment since it is not possible to write any
+ // namespace data after writing the charactor data
+ StringBuffer stringToWrite = new StringBuffer();
+ java.lang.String namespaceURI = null;
+ java.lang.String prefix = null;
+
+ for (int i = 0; i < qnames.length; i++) {
+ if (i > 0) {
+ stringToWrite.append(" ");
+ }
+
+ namespaceURI = qnames[i].getNamespaceURI();
+
+ if (namespaceURI != null) {
+ prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if ((prefix == null) || (prefix.length() == 0)) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ stringToWrite.append(prefix).append(":")
+ .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ }
+
+ xmlWriter.writeCharacters(stringToWrite.toString());
+ }
+ }
+
+ /**
+ * Register a namespace prefix
+ */
+ private java.lang.String registerPrefix(
+ javax.xml.stream.XMLStreamWriter xmlWriter,
+ java.lang.String namespace)
+ throws XMLStreamException {
+ java.lang.String prefix = xmlWriter.getPrefix(namespace);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+
+ javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
+
+ while (true) {
+ java.lang.String uri = nsContext.getNamespaceURI(prefix);
+
+ if ((uri == null) || (uri.length() == 0)) {
+ break;
+ }
+
+ prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Factory class that keeps the parse method
+ */
+ public static class Factory {
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
+
+ /**
+ * static method to create the object
+ * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
+ * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
+ * Postcondition: If this object is an element, the reader is positioned at its end element
+ * If this object is a complex type, the reader is positioned at the end element of its outer element
+ */
+ public static GetDatabaseInfo parse(
+ XMLStreamReader reader)
+ throws Exception {
+ GetDatabaseInfo object = new GetDatabaseInfo();
+
+ int event;
+ QName currentQName = null;
+ java.lang.String nillableValue = null;
+ java.lang.String prefix = "";
+ java.lang.String namespaceuri = "";
+
+ try {
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ currentQName = reader.getName();
+
+ if (reader.getAttributeValue(
+ "http://www.w3.org/2001/XMLSchema-instance",
+ "type") != null) {
+ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "type");
+
+ if (fullTypeName != null) {
+ java.lang.String nsPrefix = null;
+
+ if (fullTypeName.indexOf(":") > -1) {
+ nsPrefix = fullTypeName.substring(0,
+ fullTypeName.indexOf(":"));
+ }
+
+ nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
+
+ java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(
+ ":") + 1);
+
+ if (!"getDatabaseInfo".equals(type)) {
+ //find namespace for the prefix
+ java.lang.String nsUri = reader.getNamespaceContext()
+ .getNamespaceURI(nsPrefix);
+
+ return (GetDatabaseInfo) ExtensionMapper.getTypeObject(nsUri,
+ type, reader);
+ }
+ }
+ }
+
+ // Note all attributes that were handled. Used to differ normal attributes
+ // from anyAttributes.
+ java.util.Vector handledAttributes = new java.util.Vector();
+
+ reader.next();
+ } catch (XMLStreamException e) {
+ throw new Exception(e);
+ }
+
+ return object;
+ }
+ } //end of factory class
+
+ public XMLStreamReader getPullParser(QName arg0)
+ throws XMLStreamException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+ public static class String implements org.apache.axis2.databinding.ADBBean {
+ public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
+ "string", "ns1");
+
+ /**
+ * field for String
+ */
+ protected java.lang.String localString;
+
+ /**
+ * Auto generated getter method
+ *
+ * @return java.lang.String
+ */
+ public java.lang.String getString() {
+ return localString;
+ }
+
+ /**
+ * Auto generated setter method
+ *
+ * @param param String
+ */
+ public void setString(java.lang.String param) {
+ this.localString = param;
+ }
+
+ /**
+ * @param parentQName
+ * @param factory
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getOMElement(
+ final QName parentQName,
+ final org.apache.axiom.om.OMFactory factory)
+ throws org.apache.axis2.databinding.ADBException {
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
+ this, MY_QNAME), parentQName);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ serialize(parentQName, xmlWriter, false);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ //We can safely assume an element has only one type associated with it
+ java.lang.String namespace = "http://WebXml.com.cn/";
+ java.lang.String _localName = "string";
+
+ writeStartElement(null, namespace, _localName, xmlWriter);
+
+ // add the type details if this is used in a simple type
+ if (serializeType) {
+ java.lang.String namespacePrefix = registerPrefix(xmlWriter,
+ "http://WebXml.com.cn/");
+
+ if ((namespacePrefix != null) &&
+ (namespacePrefix.trim().length() > 0)) {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ namespacePrefix + ":string", xmlWriter);
+ } else {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ "string", xmlWriter);
+ }
+ }
+
+ if (localString == null) {
+ // write the nil attribute
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "nil", "1",
+ xmlWriter);
+ } else {
+ xmlWriter.writeCharacters(localString);
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ private static java.lang.String generatePrefix(
+ java.lang.String namespace) {
+ if (namespace.equals("http://WebXml.com.cn/")) {
+ return "ns1";
+ }
+
+ return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ /**
+ * Utility method to write an element start tag.
+ */
+ private void writeStartElement(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String localPart,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
+ } else {
+ if (namespace.length() == 0) {
+ prefix = "";
+ } else if (prefix == null) {
+ prefix = generatePrefix(namespace);
+ }
+
+ xmlWriter.writeStartElement(prefix, localPart, namespace);
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+ }
+
+ /**
+ * Util method to write an attribute with the ns prefix
+ */
+ private void writeAttribute(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String attName,
+ java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeAttribute(writerPrefix, namespace, attName,
+ attValue);
+ } else {
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeAttribute(java.lang.String namespace,
+ java.lang.String attName, java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attValue);
+ } else {
+ xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
+ namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeQNameAttribute(java.lang.String namespace,
+ java.lang.String attName, QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String attributeNamespace = qname.getNamespaceURI();
+ java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
+
+ if (attributePrefix == null) {
+ attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
+ }
+
+ java.lang.String attributeValue;
+
+ if (attributePrefix.trim().length() > 0) {
+ attributeValue = attributePrefix + ":" + qname.getLocalPart();
+ } else {
+ attributeValue = qname.getLocalPart();
+ }
+
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attributeValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(attributePrefix, namespace, attName,
+ attributeValue);
+ }
+ }
+
+ /**
+ * method to handle Qnames
+ */
+ private void writeQName(QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String namespaceURI = qname.getNamespaceURI();
+
+ if (namespaceURI != null) {
+ java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ xmlWriter.writeCharacters(prefix + ":" +
+ org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ } else {
+ // i.e this is the default namespace
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ } else {
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ }
+
+ private void writeQNames(QName[] qnames,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (qnames != null) {
+ // we have to store this data until last moment since it is not possible to write any
+ // namespace data after writing the charactor data
+ StringBuffer stringToWrite = new StringBuffer();
+ java.lang.String namespaceURI = null;
+ java.lang.String prefix = null;
+
+ for (int i = 0; i < qnames.length; i++) {
+ if (i > 0) {
+ stringToWrite.append(" ");
+ }
+
+ namespaceURI = qnames[i].getNamespaceURI();
+
+ if (namespaceURI != null) {
+ prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if ((prefix == null) || (prefix.length() == 0)) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ stringToWrite.append(prefix).append(":")
+ .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ }
+
+ xmlWriter.writeCharacters(stringToWrite.toString());
+ }
+ }
+
+ /**
+ * Register a namespace prefix
+ */
+ private java.lang.String registerPrefix(
+ javax.xml.stream.XMLStreamWriter xmlWriter,
+ java.lang.String namespace)
+ throws XMLStreamException {
+ java.lang.String prefix = xmlWriter.getPrefix(namespace);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+
+ javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
+
+ while (true) {
+ java.lang.String uri = nsContext.getNamespaceURI(prefix);
+
+ if ((uri == null) || (uri.length() == 0)) {
+ break;
+ }
+
+ prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Factory class that keeps the parse method
+ */
+ public static class Factory {
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
+
+ /**
+ * static method to create the object
+ * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
+ * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
+ * Postcondition: If this object is an element, the reader is positioned at its end element
+ * If this object is a complex type, the reader is positioned at the end element of its outer element
+ */
+ public static String parse(XMLStreamReader reader)
+ throws Exception {
+ String object = new String();
+
+ int event;
+ QName currentQName = null;
+ java.lang.String nillableValue = null;
+ java.lang.String prefix = "";
+ java.lang.String namespaceuri = "";
+
+ try {
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ currentQName = reader.getName();
+
+ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "nil");
+
+ if ("true".equals(nillableValue) ||
+ "1".equals(nillableValue)) {
+ // Skip the element and report the null value. It cannot have subelements.
+ while (!reader.isEndElement())
+ reader.next();
+
+ return object;
+ }
+
+ // Note all attributes that were handled. Used to differ normal attributes
+ // from anyAttributes.
+ java.util.Vector handledAttributes = new java.util.Vector();
+
+ while (!reader.isEndElement()) {
+ if (reader.isStartElement()) {
+ if ((reader.isStartElement() &&
+ new QName(
+ "http://WebXml.com.cn/", "string").equals(
+ reader.getName())) ||
+ new QName("", "string").equals(
+ reader.getName())) {
+ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "nil");
+
+ if (!"true".equals(nillableValue) &&
+ !"1".equals(nillableValue)) {
+ java.lang.String content = reader.getElementText();
+
+ object.setString(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ content));
+ } else {
+ reader.getElementText(); // throw away text nodes if any.
+ }
+ } // End of if for expected property start element
+
+ else {
+ // 3 - A start element we are not expecting indicates an invalid parameter was passed
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unexpected subelement " +
+ reader.getName());
+ }
+ } else {
+ reader.next();
+ }
+ } // end of while loop
+ } catch (XMLStreamException e) {
+ throw new Exception(e);
+ }
+
+ return object;
+ }
+ } //end of factory class
+
+ public XMLStreamReader getPullParser(QName arg0)
+ throws XMLStreamException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+ public static class ExtensionMapper {
+ public static Object getTypeObject(
+ java.lang.String namespaceURI, java.lang.String typeName,
+ XMLStreamReader reader) throws Exception {
+ if ("http://WebXml.com.cn/".equals(namespaceURI) &&
+ "ArrayOfString".equals(typeName)) {
+ return ArrayOfString.Factory.parse(reader);
+ }
+
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unsupported type " + namespaceURI + " " + typeName);
+ }
+ }
+
+ public static class GetDatabaseInfoResponse implements org.apache.axis2.databinding.ADBBean {
+ public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
+ "getDatabaseInfoResponse", "ns1");
+
+ /**
+ * field for GetDatabaseInfoResult
+ */
+ protected ArrayOfString localGetDatabaseInfoResult;
+
+ /* This tracker boolean wil be used to detect whether the user called the set method
+ * for this attribute. It will be used to determine whether to include this field
+ * in the serialized XML
+ */
+ protected boolean localGetDatabaseInfoResultTracker = false;
+
+ public boolean isGetDatabaseInfoResultSpecified() {
+ return localGetDatabaseInfoResultTracker;
+ }
+
+ /**
+ * Auto generated getter method
+ *
+ * @return ArrayOfString
+ */
+ public ArrayOfString getGetDatabaseInfoResult() {
+ return localGetDatabaseInfoResult;
+ }
+
+ /**
+ * Auto generated setter method
+ *
+ * @param param GetDatabaseInfoResult
+ */
+ public void setGetDatabaseInfoResult(ArrayOfString param) {
+ localGetDatabaseInfoResultTracker = param != null;
+
+ this.localGetDatabaseInfoResult = param;
+ }
+
+ /**
+ * @param parentQName
+ * @param factory
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getOMElement(
+ final QName parentQName,
+ final org.apache.axiom.om.OMFactory factory)
+ throws org.apache.axis2.databinding.ADBException {
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
+ this, MY_QNAME), parentQName);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ serialize(parentQName, xmlWriter, false);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ java.lang.String prefix = null;
+ java.lang.String namespace = null;
+
+ prefix = parentQName.getPrefix();
+ namespace = parentQName.getNamespaceURI();
+ writeStartElement(prefix, namespace, parentQName.getLocalPart(),
+ xmlWriter);
+
+ if (serializeType) {
+ java.lang.String namespacePrefix = registerPrefix(xmlWriter,
+ "http://WebXml.com.cn/");
+
+ if ((namespacePrefix != null) &&
+ (namespacePrefix.trim().length() > 0)) {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ namespacePrefix + ":getDatabaseInfoResponse", xmlWriter);
+ } else {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ "getDatabaseInfoResponse", xmlWriter);
+ }
+ }
+
+ if (localGetDatabaseInfoResultTracker) {
+ if (localGetDatabaseInfoResult == null) {
+ throw new org.apache.axis2.databinding.ADBException(
+ "getDatabaseInfoResult cannot be null!!");
+ }
+
+ localGetDatabaseInfoResult.serialize(new QName(
+ "http://WebXml.com.cn/", "getDatabaseInfoResult"),
+ xmlWriter);
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ private static java.lang.String generatePrefix(
+ java.lang.String namespace) {
+ if (namespace.equals("http://WebXml.com.cn/")) {
+ return "ns1";
+ }
+
+ return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ /**
+ * Utility method to write an element start tag.
+ */
+ private void writeStartElement(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String localPart,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
+ } else {
+ if (namespace.length() == 0) {
+ prefix = "";
+ } else if (prefix == null) {
+ prefix = generatePrefix(namespace);
+ }
+
+ xmlWriter.writeStartElement(prefix, localPart, namespace);
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+ }
+
+ /**
+ * Util method to write an attribute with the ns prefix
+ */
+ private void writeAttribute(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String attName,
+ java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeAttribute(writerPrefix, namespace, attName,
+ attValue);
+ } else {
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeAttribute(java.lang.String namespace,
+ java.lang.String attName, java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attValue);
+ } else {
+ xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
+ namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeQNameAttribute(java.lang.String namespace,
+ java.lang.String attName, QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String attributeNamespace = qname.getNamespaceURI();
+ java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
+
+ if (attributePrefix == null) {
+ attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
+ }
+
+ java.lang.String attributeValue;
+
+ if (attributePrefix.trim().length() > 0) {
+ attributeValue = attributePrefix + ":" + qname.getLocalPart();
+ } else {
+ attributeValue = qname.getLocalPart();
+ }
+
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attributeValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(attributePrefix, namespace, attName,
+ attributeValue);
+ }
+ }
+
+ /**
+ * method to handle Qnames
+ */
+ private void writeQName(QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String namespaceURI = qname.getNamespaceURI();
+
+ if (namespaceURI != null) {
+ java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ xmlWriter.writeCharacters(prefix + ":" +
+ org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ } else {
+ // i.e this is the default namespace
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ } else {
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ }
+
+ private void writeQNames(QName[] qnames,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (qnames != null) {
+ // we have to store this data until last moment since it is not possible to write any
+ // namespace data after writing the charactor data
+ StringBuffer stringToWrite = new StringBuffer();
+ java.lang.String namespaceURI = null;
+ java.lang.String prefix = null;
+
+ for (int i = 0; i < qnames.length; i++) {
+ if (i > 0) {
+ stringToWrite.append(" ");
+ }
+
+ namespaceURI = qnames[i].getNamespaceURI();
+
+ if (namespaceURI != null) {
+ prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if ((prefix == null) || (prefix.length() == 0)) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ stringToWrite.append(prefix).append(":")
+ .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ }
+
+ xmlWriter.writeCharacters(stringToWrite.toString());
+ }
+ }
+
+ /**
+ * Register a namespace prefix
+ */
+ private java.lang.String registerPrefix(
+ javax.xml.stream.XMLStreamWriter xmlWriter,
+ java.lang.String namespace)
+ throws XMLStreamException {
+ java.lang.String prefix = xmlWriter.getPrefix(namespace);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+
+ javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
+
+ while (true) {
+ java.lang.String uri = nsContext.getNamespaceURI(prefix);
+
+ if ((uri == null) || (uri.length() == 0)) {
+ break;
+ }
+
+ prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Factory class that keeps the parse method
+ */
+ public static class Factory {
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
+
+ /**
+ * static method to create the object
+ * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
+ * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
+ * Postcondition: If this object is an element, the reader is positioned at its end element
+ * If this object is a complex type, the reader is positioned at the end element of its outer element
+ */
+ public static GetDatabaseInfoResponse parse(
+ XMLStreamReader reader)
+ throws Exception {
+ GetDatabaseInfoResponse object = new GetDatabaseInfoResponse();
+
+ int event;
+ QName currentQName = null;
+ java.lang.String nillableValue = null;
+ java.lang.String prefix = "";
+ java.lang.String namespaceuri = "";
+
+ try {
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ currentQName = reader.getName();
+
+ if (reader.getAttributeValue(
+ "http://www.w3.org/2001/XMLSchema-instance",
+ "type") != null) {
+ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "type");
+
+ if (fullTypeName != null) {
+ java.lang.String nsPrefix = null;
+
+ if (fullTypeName.indexOf(":") > -1) {
+ nsPrefix = fullTypeName.substring(0,
+ fullTypeName.indexOf(":"));
+ }
+
+ nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
+
+ java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(
+ ":") + 1);
+
+ if (!"getDatabaseInfoResponse".equals(type)) {
+ //find namespace for the prefix
+ java.lang.String nsUri = reader.getNamespaceContext()
+ .getNamespaceURI(nsPrefix);
+
+ return (GetDatabaseInfoResponse) ExtensionMapper.getTypeObject(nsUri,
+ type, reader);
+ }
+ }
+ }
+
+ // Note all attributes that were handled. Used to differ normal attributes
+ // from anyAttributes.
+ java.util.Vector handledAttributes = new java.util.Vector();
+
+ reader.next();
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if ((reader.isStartElement() &&
+ new QName(
+ "http://WebXml.com.cn/", "getDatabaseInfoResult").equals(
+ reader.getName())) ||
+ new QName("",
+ "getDatabaseInfoResult").equals(
+ reader.getName())) {
+ object.setGetDatabaseInfoResult(ArrayOfString.Factory.parse(
+ reader));
+
+ reader.next();
+ } // End of if for expected property start element
+
+ else {
+ }
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if (reader.isStartElement()) {
+ // 2 - A start element we are not expecting indicates a trailing invalid property
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unexpected subelement " + reader.getName());
+ }
+ } catch (XMLStreamException e) {
+ throw new Exception(e);
+ }
+
+ return object;
+ }
+ } //end of factory class
+
+ public XMLStreamReader getPullParser(QName arg0)
+ throws XMLStreamException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+ public static class ArrayOfString implements org.apache.axis2.databinding.ADBBean {
+ /* This type was generated from the piece of schema that had
+ name = ArrayOfString
+ Namespace URI = http://WebXml.com.cn/
+ Namespace Prefix = ns1
+ */
+
+ /**
+ * field for String
+ * This was an Array!
+ */
+ protected java.lang.String[] localString;
+
+ /* This tracker boolean wil be used to detect whether the user called the set method
+ * for this attribute. It will be used to determine whether to include this field
+ * in the serialized XML
+ */
+ protected boolean localStringTracker = false;
+
+ public boolean isStringSpecified() {
+ return localStringTracker;
+ }
+
+ /**
+ * Auto generated getter method
+ *
+ * @return java.lang.String[]
+ */
+ public java.lang.String[] getString() {
+ return localString;
+ }
+
+ /**
+ * validate the array for String
+ */
+ protected void validateString(java.lang.String[] param) {
+ }
+
+ /**
+ * Auto generated setter method
+ *
+ * @param param String
+ */
+ public void setString(java.lang.String[] param) {
+ validateString(param);
+
+ localStringTracker = true;
+
+ this.localString = param;
+ }
+
+ /**
+ * Auto generated add method for the array for convenience
+ *
+ * @param param java.lang.String
+ */
+ public void addString(java.lang.String param) {
+ if (localString == null) {
+ localString = new java.lang.String[]{};
+ }
+
+ //update the setting tracker
+ localStringTracker = true;
+
+ java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil.toList(localString);
+ list.add(param);
+ this.localString = (java.lang.String[]) list.toArray(new java.lang.String[list.size()]);
+ }
+
+ /**
+ * @param parentQName
+ * @param factory
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getOMElement(
+ final QName parentQName,
+ final org.apache.axiom.om.OMFactory factory)
+ throws org.apache.axis2.databinding.ADBException {
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
+ this, parentQName), parentQName);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ serialize(parentQName, xmlWriter, false);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ java.lang.String prefix = null;
+ java.lang.String namespace = null;
+
+ prefix = parentQName.getPrefix();
+ namespace = parentQName.getNamespaceURI();
+ writeStartElement(prefix, namespace, parentQName.getLocalPart(),
+ xmlWriter);
+
+ if (serializeType) {
+ java.lang.String namespacePrefix = registerPrefix(xmlWriter,
+ "http://WebXml.com.cn/");
+
+ if ((namespacePrefix != null) &&
+ (namespacePrefix.trim().length() > 0)) {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ namespacePrefix + ":ArrayOfString", xmlWriter);
+ } else {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ "ArrayOfString", xmlWriter);
+ }
+ }
+
+ if (localStringTracker) {
+ if (localString != null) {
+ namespace = "http://WebXml.com.cn/";
+
+ for (int i = 0; i < localString.length; i++) {
+ if (localString[i] != null) {
+ writeStartElement(null, namespace, "string",
+ xmlWriter);
+
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ localString[i]));
+
+ xmlWriter.writeEndElement();
+ } else {
+ // write null attribute
+ namespace = "http://WebXml.com.cn/";
+ writeStartElement(null, namespace, "string",
+ xmlWriter);
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance",
+ "nil", "1", xmlWriter);
+ xmlWriter.writeEndElement();
+ }
+ }
+ } else {
+ // write the null attribute
+ // write null attribute
+ writeStartElement(null, "http://WebXml.com.cn/", "string",
+ xmlWriter);
+
+ // write the nil attribute
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "nil",
+ "1", xmlWriter);
+ xmlWriter.writeEndElement();
+ }
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ private static java.lang.String generatePrefix(
+ java.lang.String namespace) {
+ if (namespace.equals("http://WebXml.com.cn/")) {
+ return "ns1";
+ }
+
+ return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ /**
+ * Utility method to write an element start tag.
+ */
+ private void writeStartElement(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String localPart,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
+ } else {
+ if (namespace.length() == 0) {
+ prefix = "";
+ } else if (prefix == null) {
+ prefix = generatePrefix(namespace);
+ }
+
+ xmlWriter.writeStartElement(prefix, localPart, namespace);
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+ }
+
+ /**
+ * Util method to write an attribute with the ns prefix
+ */
+ private void writeAttribute(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String attName,
+ java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeAttribute(writerPrefix, namespace, attName,
+ attValue);
+ } else {
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeAttribute(java.lang.String namespace,
+ java.lang.String attName, java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attValue);
+ } else {
+ xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
+ namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeQNameAttribute(java.lang.String namespace,
+ java.lang.String attName, QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String attributeNamespace = qname.getNamespaceURI();
+ java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
+
+ if (attributePrefix == null) {
+ attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
+ }
+
+ java.lang.String attributeValue;
+
+ if (attributePrefix.trim().length() > 0) {
+ attributeValue = attributePrefix + ":" + qname.getLocalPart();
+ } else {
+ attributeValue = qname.getLocalPart();
+ }
+
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attributeValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(attributePrefix, namespace, attName,
+ attributeValue);
+ }
+ }
+
+ /**
+ * method to handle Qnames
+ */
+ private void writeQName(QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String namespaceURI = qname.getNamespaceURI();
+
+ if (namespaceURI != null) {
+ java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ xmlWriter.writeCharacters(prefix + ":" +
+ org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ } else {
+ // i.e this is the default namespace
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ } else {
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ }
+
+ private void writeQNames(QName[] qnames,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (qnames != null) {
+ // we have to store this data until last moment since it is not possible to write any
+ // namespace data after writing the charactor data
+ StringBuffer stringToWrite = new StringBuffer();
+ java.lang.String namespaceURI = null;
+ java.lang.String prefix = null;
+
+ for (int i = 0; i < qnames.length; i++) {
+ if (i > 0) {
+ stringToWrite.append(" ");
+ }
+
+ namespaceURI = qnames[i].getNamespaceURI();
+
+ if (namespaceURI != null) {
+ prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if ((prefix == null) || (prefix.length() == 0)) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ stringToWrite.append(prefix).append(":")
+ .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ }
+
+ xmlWriter.writeCharacters(stringToWrite.toString());
+ }
+ }
+
+ /**
+ * Register a namespace prefix
+ */
+ private java.lang.String registerPrefix(
+ javax.xml.stream.XMLStreamWriter xmlWriter,
+ java.lang.String namespace)
+ throws XMLStreamException {
+ java.lang.String prefix = xmlWriter.getPrefix(namespace);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+
+ javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
+
+ while (true) {
+ java.lang.String uri = nsContext.getNamespaceURI(prefix);
+
+ if ((uri == null) || (uri.length() == 0)) {
+ break;
+ }
+
+ prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Factory class that keeps the parse method
+ */
+ public static class Factory {
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
+
+ /**
+ * static method to create the object
+ * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
+ * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
+ * Postcondition: If this object is an element, the reader is positioned at its end element
+ * If this object is a complex type, the reader is positioned at the end element of its outer element
+ */
+ public static ArrayOfString parse(
+ XMLStreamReader reader)
+ throws Exception {
+ ArrayOfString object = new ArrayOfString();
+
+ int event;
+ QName currentQName = null;
+ java.lang.String nillableValue = null;
+ java.lang.String prefix = "";
+ java.lang.String namespaceuri = "";
+
+ try {
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ currentQName = reader.getName();
+
+ if (reader.getAttributeValue(
+ "http://www.w3.org/2001/XMLSchema-instance",
+ "type") != null) {
+ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "type");
+
+ if (fullTypeName != null) {
+ java.lang.String nsPrefix = null;
+
+ if (fullTypeName.indexOf(":") > -1) {
+ nsPrefix = fullTypeName.substring(0,
+ fullTypeName.indexOf(":"));
+ }
+
+ nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
+
+ java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(
+ ":") + 1);
+
+ if (!"ArrayOfString".equals(type)) {
+ //find namespace for the prefix
+ java.lang.String nsUri = reader.getNamespaceContext()
+ .getNamespaceURI(nsPrefix);
+
+ return (ArrayOfString) ExtensionMapper.getTypeObject(nsUri,
+ type, reader);
+ }
+ }
+ }
+
+ // Note all attributes that were handled. Used to differ normal attributes
+ // from anyAttributes.
+ java.util.Vector handledAttributes = new java.util.Vector();
+
+ reader.next();
+
+ java.util.ArrayList list1 = new java.util.ArrayList();
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if ((reader.isStartElement() &&
+ new QName(
+ "http://WebXml.com.cn/", "string").equals(
+ reader.getName())) ||
+ new QName("", "string").equals(
+ reader.getName())) {
+ // Process the array and step past its final element's end.
+ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "nil");
+
+ if ("true".equals(nillableValue) ||
+ "1".equals(nillableValue)) {
+ list1.add(null);
+
+ reader.next();
+ } else {
+ list1.add(reader.getElementText());
+ }
+
+ //loop until we find a start element that is not part of this array
+ boolean loopDone1 = false;
+
+ while (!loopDone1) {
+ // Ensure we are at the EndElement
+ while (!reader.isEndElement()) {
+ reader.next();
+ }
+
+ // Step out of this element
+ reader.next();
+
+ // Step to next element event.
+ while (!reader.isStartElement() &&
+ !reader.isEndElement())
+ reader.next();
+
+ if (reader.isEndElement()) {
+ //two continuous end elements means we are exiting the xml structure
+ loopDone1 = true;
+ } else {
+ if (new QName(
+ "http://WebXml.com.cn/", "string").equals(
+ reader.getName())) {
+ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "nil");
+
+ if ("true".equals(nillableValue) ||
+ "1".equals(nillableValue)) {
+ list1.add(null);
+
+ reader.next();
+ } else {
+ list1.add(reader.getElementText());
+ }
+ } else {
+ loopDone1 = true;
+ }
+ }
+ }
+
+ // call the converter utility to convert and set the array
+ object.setString((java.lang.String[]) list1.toArray(
+ new java.lang.String[list1.size()]));
+ } // End of if for expected property start element
+
+ else {
+ }
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if (reader.isStartElement()) {
+ // 2 - A start element we are not expecting indicates a trailing invalid property
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unexpected subelement " + reader.getName());
+ }
+ } catch (XMLStreamException e) {
+ throw new Exception(e);
+ }
+
+ return object;
+ }
+ } //end of factory class
+
+ public XMLStreamReader getPullParser(QName arg0)
+ throws XMLStreamException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+ public static class GetMobileCodeInfoResponse implements org.apache.axis2.databinding.ADBBean {
+ public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
+ "getMobileCodeInfoResponse", "ns1");
+
+ /**
+ * field for GetMobileCodeInfoResult
+ */
+ protected java.lang.String localGetMobileCodeInfoResult;
+
+ /* This tracker boolean wil be used to detect whether the user called the set method
+ * for this attribute. It will be used to determine whether to include this field
+ * in the serialized XML
+ */
+ protected boolean localGetMobileCodeInfoResultTracker = false;
+
+ public boolean isGetMobileCodeInfoResultSpecified() {
+ return localGetMobileCodeInfoResultTracker;
+ }
+
+ /**
+ * Auto generated getter method
+ *
+ * @return java.lang.String
+ */
+ public java.lang.String getGetMobileCodeInfoResult() {
+ return localGetMobileCodeInfoResult;
+ }
+
+ /**
+ * Auto generated setter method
+ *
+ * @param param GetMobileCodeInfoResult
+ */
+ public void setGetMobileCodeInfoResult(java.lang.String param) {
+ localGetMobileCodeInfoResultTracker = param != null;
+
+ this.localGetMobileCodeInfoResult = param;
+ }
+
+ /**
+ * @param parentQName
+ * @param factory
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getOMElement(
+ final QName parentQName,
+ final org.apache.axiom.om.OMFactory factory)
+ throws org.apache.axis2.databinding.ADBException {
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
+ this, MY_QNAME), parentQName);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ serialize(parentQName, xmlWriter, false);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ java.lang.String prefix = null;
+ java.lang.String namespace = null;
+
+ prefix = parentQName.getPrefix();
+ namespace = parentQName.getNamespaceURI();
+ writeStartElement(prefix, namespace, parentQName.getLocalPart(),
+ xmlWriter);
+
+ if (serializeType) {
+ java.lang.String namespacePrefix = registerPrefix(xmlWriter,
+ "http://WebXml.com.cn/");
+
+ if ((namespacePrefix != null) &&
+ (namespacePrefix.trim().length() > 0)) {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ namespacePrefix + ":getMobileCodeInfoResponse",
+ xmlWriter);
+ } else {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ "getMobileCodeInfoResponse", xmlWriter);
+ }
+ }
+
+ if (localGetMobileCodeInfoResultTracker) {
+ namespace = "http://WebXml.com.cn/";
+ writeStartElement(null, namespace, "getMobileCodeInfoResult",
+ xmlWriter);
+
+ if (localGetMobileCodeInfoResult == null) {
+ // write the nil attribute
+ throw new org.apache.axis2.databinding.ADBException(
+ "getMobileCodeInfoResult cannot be null!!");
+ } else {
+ xmlWriter.writeCharacters(localGetMobileCodeInfoResult);
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ private static java.lang.String generatePrefix(
+ java.lang.String namespace) {
+ if (namespace.equals("http://WebXml.com.cn/")) {
+ return "ns1";
+ }
+
+ return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ /**
+ * Utility method to write an element start tag.
+ */
+ private void writeStartElement(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String localPart,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
+ } else {
+ if (namespace.length() == 0) {
+ prefix = "";
+ } else if (prefix == null) {
+ prefix = generatePrefix(namespace);
+ }
+
+ xmlWriter.writeStartElement(prefix, localPart, namespace);
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+ }
+
+ /**
+ * Util method to write an attribute with the ns prefix
+ */
+ private void writeAttribute(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String attName,
+ java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeAttribute(writerPrefix, namespace, attName,
+ attValue);
+ } else {
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeAttribute(java.lang.String namespace,
+ java.lang.String attName, java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attValue);
+ } else {
+ xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
+ namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeQNameAttribute(java.lang.String namespace,
+ java.lang.String attName, QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String attributeNamespace = qname.getNamespaceURI();
+ java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
+
+ if (attributePrefix == null) {
+ attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
+ }
+
+ java.lang.String attributeValue;
+
+ if (attributePrefix.trim().length() > 0) {
+ attributeValue = attributePrefix + ":" + qname.getLocalPart();
+ } else {
+ attributeValue = qname.getLocalPart();
+ }
+
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attributeValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(attributePrefix, namespace, attName,
+ attributeValue);
+ }
+ }
+
+ /**
+ * method to handle Qnames
+ */
+ private void writeQName(QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String namespaceURI = qname.getNamespaceURI();
+
+ if (namespaceURI != null) {
+ java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ xmlWriter.writeCharacters(prefix + ":" +
+ org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ } else {
+ // i.e this is the default namespace
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ } else {
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ }
+
+ private void writeQNames(QName[] qnames,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (qnames != null) {
+ // we have to store this data until last moment since it is not possible to write any
+ // namespace data after writing the charactor data
+ StringBuffer stringToWrite = new StringBuffer();
+ java.lang.String namespaceURI = null;
+ java.lang.String prefix = null;
+
+ for (int i = 0; i < qnames.length; i++) {
+ if (i > 0) {
+ stringToWrite.append(" ");
+ }
+
+ namespaceURI = qnames[i].getNamespaceURI();
+
+ if (namespaceURI != null) {
+ prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if ((prefix == null) || (prefix.length() == 0)) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ stringToWrite.append(prefix).append(":")
+ .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ }
+
+ xmlWriter.writeCharacters(stringToWrite.toString());
+ }
+ }
+
+ /**
+ * Register a namespace prefix
+ */
+ private java.lang.String registerPrefix(
+ javax.xml.stream.XMLStreamWriter xmlWriter,
+ java.lang.String namespace)
+ throws XMLStreamException {
+ java.lang.String prefix = xmlWriter.getPrefix(namespace);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+
+ javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
+
+ while (true) {
+ java.lang.String uri = nsContext.getNamespaceURI(prefix);
+
+ if ((uri == null) || (uri.length() == 0)) {
+ break;
+ }
+
+ prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Factory class that keeps the parse method
+ */
+ public static class Factory {
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
+
+ /**
+ * static method to create the object
+ * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
+ * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
+ * Postcondition: If this object is an element, the reader is positioned at its end element
+ * If this object is a complex type, the reader is positioned at the end element of its outer element
+ */
+ public static GetMobileCodeInfoResponse parse(
+ XMLStreamReader reader)
+ throws Exception {
+ GetMobileCodeInfoResponse object = new GetMobileCodeInfoResponse();
+
+ int event;
+ QName currentQName = null;
+ java.lang.String nillableValue = null;
+ java.lang.String prefix = "";
+ java.lang.String namespaceuri = "";
+
+ try {
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ currentQName = reader.getName();
+
+ if (reader.getAttributeValue(
+ "http://www.w3.org/2001/XMLSchema-instance",
+ "type") != null) {
+ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "type");
+
+ if (fullTypeName != null) {
+ java.lang.String nsPrefix = null;
+
+ if (fullTypeName.indexOf(":") > -1) {
+ nsPrefix = fullTypeName.substring(0,
+ fullTypeName.indexOf(":"));
+ }
+
+ nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
+
+ java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(
+ ":") + 1);
+
+ if (!"getMobileCodeInfoResponse".equals(type)) {
+ //find namespace for the prefix
+ java.lang.String nsUri = reader.getNamespaceContext()
+ .getNamespaceURI(nsPrefix);
+
+ return (GetMobileCodeInfoResponse) ExtensionMapper.getTypeObject(nsUri,
+ type, reader);
+ }
+ }
+ }
+
+ // Note all attributes that were handled. Used to differ normal attributes
+ // from anyAttributes.
+ java.util.Vector handledAttributes = new java.util.Vector();
+
+ reader.next();
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if ((reader.isStartElement() &&
+ new QName(
+ "http://WebXml.com.cn/",
+ "getMobileCodeInfoResult").equals(
+ reader.getName())) ||
+ new QName("",
+ "getMobileCodeInfoResult").equals(
+ reader.getName())) {
+ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "nil");
+
+ if ("true".equals(nillableValue) ||
+ "1".equals(nillableValue)) {
+ throw new org.apache.axis2.databinding.ADBException(
+ "The element: " + "getMobileCodeInfoResult" +
+ " cannot be null");
+ }
+
+ java.lang.String content = reader.getElementText();
+
+ object.setGetMobileCodeInfoResult(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ content));
+
+ reader.next();
+ } // End of if for expected property start element
+
+ else {
+ }
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if (reader.isStartElement()) {
+ // 2 - A start element we are not expecting indicates a trailing invalid property
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unexpected subelement " + reader.getName());
+ }
+ } catch (XMLStreamException e) {
+ throw new Exception(e);
+ }
+
+ return object;
+ }
+ } //end of factory class
+
+ public XMLStreamReader getPullParser(QName arg0)
+ throws XMLStreamException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+ public static class GetMobileCodeInfo implements org.apache.axis2.databinding.ADBBean {
+ public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
+ "getMobileCodeInfo", "ns1");
+
+ /**
+ * field for MobileCode
+ */
+ protected java.lang.String localMobileCode;
+
+ /* This tracker boolean wil be used to detect whether the user called the set method
+ * for this attribute. It will be used to determine whether to include this field
+ * in the serialized XML
+ */
+ protected boolean localMobileCodeTracker = false;
+
+ /**
+ * field for UserID
+ */
+ protected java.lang.String localUserID;
+
+ /* This tracker boolean wil be used to detect whether the user called the set method
+ * for this attribute. It will be used to determine whether to include this field
+ * in the serialized XML
+ */
+ protected boolean localUserIDTracker = false;
+
+ public boolean isMobileCodeSpecified() {
+ return localMobileCodeTracker;
+ }
+
+ /**
+ * Auto generated getter method
+ *
+ * @return java.lang.String
+ */
+ public java.lang.String getMobileCode() {
+ return localMobileCode;
+ }
+
+ /**
+ * Auto generated setter method
+ *
+ * @param param MobileCode
+ */
+ public void setMobileCode(java.lang.String param) {
+ localMobileCodeTracker = param != null;
+
+ this.localMobileCode = param;
+ }
+
+ public boolean isUserIDSpecified() {
+ return localUserIDTracker;
+ }
+
+ /**
+ * Auto generated getter method
+ *
+ * @return java.lang.String
+ */
+ public java.lang.String getUserID() {
+ return localUserID;
+ }
+
+ /**
+ * Auto generated setter method
+ *
+ * @param param UserID
+ */
+ public void setUserID(java.lang.String param) {
+ localUserIDTracker = param != null;
+
+ this.localUserID = param;
+ }
+
+ /**
+ * @param parentQName
+ * @param factory
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getOMElement(
+ final QName parentQName,
+ final org.apache.axiom.om.OMFactory factory)
+ throws org.apache.axis2.databinding.ADBException {
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
+ this, MY_QNAME), parentQName);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ serialize(parentQName, xmlWriter, false);
+ }
+
+ public void serialize(final QName parentQName,
+ javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
+ throws XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ java.lang.String prefix = null;
+ java.lang.String namespace = null;
+
+ prefix = parentQName.getPrefix();
+ namespace = parentQName.getNamespaceURI();
+ writeStartElement(prefix, namespace, parentQName.getLocalPart(),
+ xmlWriter);
+
+ if (serializeType) {
+ java.lang.String namespacePrefix = registerPrefix(xmlWriter,
+ "http://WebXml.com.cn/");
+
+ if ((namespacePrefix != null) &&
+ (namespacePrefix.trim().length() > 0)) {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ namespacePrefix + ":getMobileCodeInfo", xmlWriter);
+ } else {
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "type",
+ "getMobileCodeInfo", xmlWriter);
+ }
+ }
+
+ if (localMobileCodeTracker) {
+ namespace = "http://WebXml.com.cn/";
+ writeStartElement(null, namespace, "mobileCode", xmlWriter);
+
+ if (localMobileCode == null) {
+ // write the nil attribute
+ throw new org.apache.axis2.databinding.ADBException(
+ "mobileCode cannot be null!!");
+ } else {
+ xmlWriter.writeCharacters(localMobileCode);
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ if (localUserIDTracker) {
+ namespace = "http://WebXml.com.cn/";
+ writeStartElement(null, namespace, "userID", xmlWriter);
+
+ if (localUserID == null) {
+ // write the nil attribute
+ throw new org.apache.axis2.databinding.ADBException(
+ "userID cannot be null!!");
+ } else {
+ xmlWriter.writeCharacters(localUserID);
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ private static java.lang.String generatePrefix(
+ java.lang.String namespace) {
+ if (namespace.equals("http://WebXml.com.cn/")) {
+ return "ns1";
+ }
+
+ return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ /**
+ * Utility method to write an element start tag.
+ */
+ private void writeStartElement(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String localPart,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
+ } else {
+ if (namespace.length() == 0) {
+ prefix = "";
+ } else if (prefix == null) {
+ prefix = generatePrefix(namespace);
+ }
+
+ xmlWriter.writeStartElement(prefix, localPart, namespace);
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+ }
+
+ /**
+ * Util method to write an attribute with the ns prefix
+ */
+ private void writeAttribute(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String attName,
+ java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeAttribute(writerPrefix, namespace, attName,
+ attValue);
+ } else {
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeAttribute(java.lang.String namespace,
+ java.lang.String attName, java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attValue);
+ } else {
+ xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
+ namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeQNameAttribute(java.lang.String namespace,
+ java.lang.String attName, QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String attributeNamespace = qname.getNamespaceURI();
+ java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
+
+ if (attributePrefix == null) {
+ attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
+ }
+
+ java.lang.String attributeValue;
+
+ if (attributePrefix.trim().length() > 0) {
+ attributeValue = attributePrefix + ":" + qname.getLocalPart();
+ } else {
+ attributeValue = qname.getLocalPart();
+ }
+
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attributeValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(attributePrefix, namespace, attName,
+ attributeValue);
+ }
+ }
+
+ /**
+ * method to handle Qnames
+ */
+ private void writeQName(QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ java.lang.String namespaceURI = qname.getNamespaceURI();
+
+ if (namespaceURI != null) {
+ java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ xmlWriter.writeCharacters(prefix + ":" +
+ org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ } else {
+ // i.e this is the default namespace
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ } else {
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ }
+
+ private void writeQNames(QName[] qnames,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws XMLStreamException {
+ if (qnames != null) {
+ // we have to store this data until last moment since it is not possible to write any
+ // namespace data after writing the charactor data
+ StringBuffer stringToWrite = new StringBuffer();
+ java.lang.String namespaceURI = null;
+ java.lang.String prefix = null;
+
+ for (int i = 0; i < qnames.length; i++) {
+ if (i > 0) {
+ stringToWrite.append(" ");
+ }
+
+ namespaceURI = qnames[i].getNamespaceURI();
+
+ if (namespaceURI != null) {
+ prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if ((prefix == null) || (prefix.length() == 0)) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ stringToWrite.append(prefix).append(":")
+ .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ }
+
+ xmlWriter.writeCharacters(stringToWrite.toString());
+ }
+ }
+
+ /**
+ * Register a namespace prefix
+ */
+ private java.lang.String registerPrefix(
+ javax.xml.stream.XMLStreamWriter xmlWriter,
+ java.lang.String namespace)
+ throws XMLStreamException {
+ java.lang.String prefix = xmlWriter.getPrefix(namespace);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+
+ javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
+
+ while (true) {
+ java.lang.String uri = nsContext.getNamespaceURI(prefix);
+
+ if ((uri == null) || (uri.length() == 0)) {
+ break;
+ }
+
+ prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Factory class that keeps the parse method
+ */
+ public static class Factory {
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
+
+ /**
+ * static method to create the object
+ * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
+ * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
+ * Postcondition: If this object is an element, the reader is positioned at its end element
+ * If this object is a complex type, the reader is positioned at the end element of its outer element
+ */
+ public static GetMobileCodeInfo parse(
+ XMLStreamReader reader)
+ throws Exception {
+ GetMobileCodeInfo object = new GetMobileCodeInfo();
+
+ int event;
+ QName currentQName = null;
+ java.lang.String nillableValue = null;
+ java.lang.String prefix = "";
+ java.lang.String namespaceuri = "";
+
+ try {
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ currentQName = reader.getName();
+
+ if (reader.getAttributeValue(
+ "http://www.w3.org/2001/XMLSchema-instance",
+ "type") != null) {
+ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "type");
+
+ if (fullTypeName != null) {
+ java.lang.String nsPrefix = null;
+
+ if (fullTypeName.indexOf(":") > -1) {
+ nsPrefix = fullTypeName.substring(0,
+ fullTypeName.indexOf(":"));
+ }
+
+ nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
+
+ java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(
+ ":") + 1);
+
+ if (!"getMobileCodeInfo".equals(type)) {
+ //find namespace for the prefix
+ java.lang.String nsUri = reader.getNamespaceContext()
+ .getNamespaceURI(nsPrefix);
+
+ return (GetMobileCodeInfo) ExtensionMapper.getTypeObject(nsUri,
+ type, reader);
+ }
+ }
+ }
+
+ // Note all attributes that were handled. Used to differ normal attributes
+ // from anyAttributes.
+ java.util.Vector handledAttributes = new java.util.Vector();
+
+ reader.next();
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if ((reader.isStartElement() &&
+ new QName(
+ "http://WebXml.com.cn/", "mobileCode").equals(
+ reader.getName())) ||
+ new QName("", "mobileCode").equals(
+ reader.getName())) {
+ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "nil");
+
+ if ("true".equals(nillableValue) ||
+ "1".equals(nillableValue)) {
+ throw new org.apache.axis2.databinding.ADBException(
+ "The element: " + "mobileCode" +
+ " cannot be null");
+ }
+
+ java.lang.String content = reader.getElementText();
+
+ object.setMobileCode(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ content));
+
+ reader.next();
+ } // End of if for expected property start element
+
+ else {
+ }
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if ((reader.isStartElement() &&
+ new QName(
+ "http://WebXml.com.cn/", "userID").equals(
+ reader.getName())) ||
+ new QName("", "userID").equals(
+ reader.getName())) {
+ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+ "nil");
+
+ if ("true".equals(nillableValue) ||
+ "1".equals(nillableValue)) {
+ throw new org.apache.axis2.databinding.ADBException(
+ "The element: " + "userID" +
+ " cannot be null");
+ }
+
+ java.lang.String content = reader.getElementText();
+
+ object.setUserID(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ content));
+
+ reader.next();
+ } // End of if for expected property start element
+
+ else {
+ }
+
+ while (!reader.isStartElement() && !reader.isEndElement())
+ reader.next();
+
+ if (reader.isStartElement()) {
+ // 2 - A start element we are not expecting indicates a trailing invalid property
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unexpected subelement " + reader.getName());
+ }
+ } catch (XMLStreamException e) {
+ throw new Exception(e);
+ }
+
+ return object;
+ }
+ } //end of factory class
+
+ public XMLStreamReader getPullParser(QName arg0)
+ throws XMLStreamException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+}
From 0251597f7bd420f15f375f93d55a6590e5e5a1ba Mon Sep 17 00:00:00 2001
From: "yaoh.wu"