+ * 这是一个按参数来解析不同地址XML文件的demo + *
+ * AbstractParameterTableData 包装了有参数数据集的基本实现
+ */
+public class XMLDemoTableData extends AbstractParameterTableData {
+
+ // 构造函数
+ public XMLDemoTableData() {
+ // 定义需要的参数,这里定义一个参数,参数名为filename,给其一个默认值"Northwind.xml"
+ this.parameters = new XmlColConf
+ * DataModel是获取数据的接口
+ *
+ * 这里通过init方法一次性取数后,构造一个二维表对象来实现DataModel的各个取数方法
+ */
+public class XMLParseDemoDataModel extends AbstractDataModel {
+ // 数据类型标识
+ public static final int COLUMN_TYPE_STRING = 0;
+ public static final int COLUMN_TYPE_INTEGER = 1;
+ public static final int COLUMN_TYPE_BOOLEAN = 2;
+
+ // 缓存取出来的数据
+ protected List row_list = null;
+
+ // 数据对应的节点路径
+ private String[] xPath;
+ // 节点路径下包含的需要取数的节点
+ private XMLColumnNameType4Demo[] columns;
+
+ private String filePath;
+
+ public XMLParseDemoDataModel(String filename, String[] xPath,
+ XMLColumnNameType4Demo[] columns) {
+ this.filePath = filename;
+ this.xPath = xPath;
+ this.columns = columns;
+ }
+
+ /**
+ * 取出列的数量
+ */
+ public int getColumnCount() throws TableDataException {
+ return columns.length;
+ }
+
+ /**
+ * 取出相应的列的名称
+ */
+ public String getColumnName(int columnIndex) throws TableDataException {
+ if (columnIndex < 0 || columnIndex >= columns.length)
+ return null;
+ String columnName = columns[columnIndex] == null ? null
+ : columns[columnIndex].getName();
+
+ return columnName;
+ }
+
+ /**
+ * 取出得到的结果集的总的行数
+ */
+ public int getRowCount() throws TableDataException {
+ this.init();
+ return row_list.size();
+ }
+
+ /**
+ * 取出相应位置的值
+ */
+ public Object getValueAt(int rowIndex, int columnIndex)
+ throws TableDataException {
+ this.init();
+ if (rowIndex < 0 || rowIndex >= row_list.size() || columnIndex < 0
+ || columnIndex >= columns.length)
+ return null;
+ return ((Object[]) row_list.get(rowIndex))[columnIndex];
+ }
+
+ /**
+ * 释放一些资源,取数结束后,调用此方法来释放资源
+ */
+ public void release() throws Exception {
+ if (this.row_list != null) {
+ this.row_list.clear();
+ this.row_list = null;
+ }
+ }
+
+ /** ************************************************** */
+ /** ***********以上是实现DataModel的方法*************** */
+ /** ************************************************** */
+
+ /** ************************************************** */
+ /** ************以下为解析XML文件的方法**************** */
+ /**
+ * *************************************************
+ */
+
+ // 一次性将数据取出来
+ protected void init() throws TableDataException {
+ if (this.row_list != null)
+ return;
+
+ this.row_list = new ArrayList();
+ try {
+ // 使用SAX解析XML文件, 使用方法请参见JAVA SAX解析
+ SAXParserFactory f = SAXParserFactory.newInstance();
+ SAXParser parser = f.newSAXParser();
+
+ parser.parse(new File(XMLParseDemoDataModel.this.filePath),
+ new DemoHandler());
+ } catch (Exception e) {
+ e.printStackTrace();
+ FRContext.getLogger().error(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * 基本原理就是解析器在遍历文件时 发现节点开始标记时,调用startElement方法 读取节点内部内容时,调用characters方法
+ * 发现节点结束标记时,调用endElement
+ */
+ private class DemoHandler extends DefaultHandler {
+ private List levelList = new ArrayList(); // 记录当前节点的路径
+ private Object[] values; // 缓存一条记录
+ private int recordIndex = -1; // 当前记录所对应的列的序号,-1表示不需要记录
+
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) throws SAXException {
+ // 记录下
+ levelList.add(qName);
+
+ if (isRecordWrapTag()) {
+ // 开始一条新数据的记录
+ values = new Object[XMLParseDemoDataModel.this.columns.length];
+ } else if (needReadRecord()) {
+ // 看看其对应的列序号,下面的characters之后执行时,根据这个列序号来设置值存放的位置。
+ recordIndex = getColumnIndex(qName);
+ }
+ }
+
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ if (recordIndex > -1) {
+ // 读取值
+ String text = new String(ch, start, length);
+ XMLColumnNameType4Demo type = XMLParseDemoDataModel.this.columns[recordIndex];
+ Object value = null;
+ if (type.getType() == COLUMN_TYPE_STRING) {
+ value = text;
+ }
+ if (type.getType() == COLUMN_TYPE_INTEGER) {
+ value = new Integer(text);
+ } else if (type.getType() == COLUMN_TYPE_BOOLEAN) {
+ value = new Boolean(text);
+ }
+
+ values[recordIndex] = value;
+ }
+ }
+
+ public void endElement(String uri, String localName, String qName)
+ throws SAXException {
+ try {
+ if (isRecordWrapTag()) {
+ // 一条记录结束,就add进list中
+ XMLParseDemoDataModel.this.row_list.add(values);
+ values = null;
+ } else if (needReadRecord()) {
+ recordIndex = -1;
+ }
+ } finally {
+ levelList.remove(levelList.size() - 1);
+ }
+ }
+
+ // 正好匹配路径,确定是记录外部的Tag
+ private boolean isRecordWrapTag() {
+ if (levelList.size() == XMLParseDemoDataModel.this.xPath.length
+ && compareXPath()) {
+ return true;
+ }
+
+ return false;
+ }
+
+ // 需要记录一条记录
+ private boolean needReadRecord() {
+ if (levelList.size() == (XMLParseDemoDataModel.this.xPath.length + 1)
+ && compareXPath()) {
+ return true;
+ }
+
+ return false;
+ }
+
+ // 是否匹配设定的XPath路径
+ private boolean compareXPath() {
+ String[] xPath = XMLParseDemoDataModel.this.xPath;
+ for (int i = 0; i < xPath.length; i++) {
+ if (!ComparatorUtils.equals(xPath[i], levelList.get(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // 获取该字段的序号
+ private int getColumnIndex(String columnName) {
+ XMLColumnNameType4Demo[] nts = XMLParseDemoDataModel.this.columns;
+ for (int i = 0; i < nts.length; i++) {
+ if (ComparatorUtils.equals(nts[i].getName(), columnName)) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugin-report-doc-demo/src/com/fr/data/XMLRead.java b/plugin-report-doc-demo/src/com/fr/data/XMLRead.java
new file mode 100644
index 0000000..ef3bc4d
--- /dev/null
+++ b/plugin-report-doc-demo/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/plugin-report-doc-demo/src/com/fr/data/impl/Commit1.java b/plugin-report-doc-demo/src/com/fr/data/impl/Commit1.java
new file mode 100644
index 0000000..49bdac1
--- /dev/null
+++ b/plugin-report-doc-demo/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/plugin-report-doc-demo/src/com/fr/data/impl/Commit3.java b/plugin-report-doc-demo/src/com/fr/data/impl/Commit3.java
new file mode 100644
index 0000000..4697f6f
--- /dev/null
+++ b/plugin-report-doc-demo/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/plugin-report-doc-demo/src/com/fr/demo/ChangeRowAndCol.java b/plugin-report-doc-demo/src/com/fr/demo/ChangeRowAndCol.java
new file mode 100644
index 0000000..61afa9b
--- /dev/null
+++ b/plugin-report-doc-demo/src/com/fr/demo/ChangeRowAndCol.java
@@ -0,0 +1,79 @@
+//遍历单元格
+package com.fr.demo;
+
+import com.fr.io.TemplateWorkBookIO;
+import com.fr.main.TemplateWorkBook;
+import com.fr.report.cell.TemplateCellElement;
+import com.fr.report.elementcase.TemplateElementCase;
+import com.fr.report.worksheet.WorkSheet;
+import com.fr.web.core.Reportlet;
+import com.fr.web.request.ReportletRequest;
+import com.fr.workspace.simple.SimpleWork;
+
+import java.util.Map;
+
+
+public class ChangeRowAndCol extends Reportlet {
+ public TemplateWorkBook createReport(ReportletRequest reportletrequest) {
+ // 定义最终需要返回的WorkBook对象
+ TemplateWorkBook workbook = null;
+ String envPath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
+ SimpleWork.checkIn(envPath);
+ WorkSheet newworksheet = new WorkSheet();
+ String change = "0";
+ try {
+ // 读取模板保存为WorkBook对象
+ workbook = TemplateWorkBookIO.readTemplateWorkBook(
+ "\\doc\\Primary\\GroupReport\\Group.cpt");
+ // 读取请求中的参数判断是否需要切换行列显示,0表示不切换,1表示切换
+ if (reportletrequest.getParameter("change") != null) {
+ change = reportletrequest.getParameter("change").toString();
+ }
+ if (change.equals("1")) {
+ // 获得单元格需要首先获得单元格所在的报表
+ TemplateElementCase report = (TemplateElementCase) workbook
+ .getTemplateReport(0);
+ // 遍历单元格
+ int col = 0, row = 0;
+ byte direction = 0;
+ java.util.Iterator it = report.cellIterator();
+ while (it.hasNext()) {
+ TemplateCellElement cell = (TemplateCellElement) it.next();
+ // 获取单元格的行号与列号并互换
+ col = cell.getColumn();
+ row = cell.getRow();
+ cell.setColumn(row);
+ cell.setRow(col);
+ // 获取原单元格的扩展方向,0表示纵向扩展,1表示横向扩展
+ direction = cell.getCellExpandAttr().getDirection();
+ if (direction == 0) {
+ cell.getCellExpandAttr().setDirection((byte) 1);
+ } else if (direction == 1) {
+ cell.getCellExpandAttr().setDirection((byte) 0);
+ }
+ // 将改变后的单元格添加进新的WorkSheet中
+ newworksheet.addCellElement(cell);
+ }
+ // 替换原sheet
+ workbook.setReport(0, newworksheet);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ SimpleWork.checkOut();
+ }
+ return workbook;
+ }
+
+ @Override
+ public void setParameterMap(Map arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setTplPath(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+}
\ No newline at end of file
diff --git a/plugin-report-doc-demo/src/com/fr/demo/CreateReportletDemo.java b/plugin-report-doc-demo/src/com/fr/demo/CreateReportletDemo.java
new file mode 100644
index 0000000..54f08e4
--- /dev/null
+++ b/plugin-report-doc-demo/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/plugin-report-doc-demo/src/com/fr/demo/NewDateDemo.java b/plugin-report-doc-demo/src/com/fr/demo/NewDateDemo.java
new file mode 100644
index 0000000..b38d639
--- /dev/null
+++ b/plugin-report-doc-demo/src/com/fr/demo/NewDateDemo.java
@@ -0,0 +1,40 @@
+//��̬������
+package com.fr.demo;
+
+import com.fr.data.ArrayTableDataDemo;
+import com.fr.general.ModuleContext;
+import com.fr.io.TemplateWorkBookIO;
+import com.fr.main.TemplateWorkBook;
+import com.fr.report.module.EngineModule;
+import com.fr.web.core.Reportlet;
+import com.fr.web.request.ReportletRequest;
+
+import java.util.Map;
+
+public class NewDateDemo extends Reportlet {
+ public TemplateWorkBook createReport(ReportletRequest reportletrequest) {
+ TemplateWorkBook workbook = null;
+ ModuleContext.startModule(EngineModule.class.getName());
+ try {
+ // ����workbook����ģ�屣��Ϊworkbook������
+ workbook = TemplateWorkBookIO.readTemplateWorkBook("1.cpt");
+ ArrayTableDataDemo a = new ArrayTableDataDemo(); // ���ö���ij������ݼ�����
+ workbook.putTableData("ds2", a); // ��ģ�帳�µ����ݼ�
+ } catch (Exception e) {
+ e.getStackTrace();
+ }
+ return workbook;
+ }
+
+ @Override
+ public void setParameterMap(Map arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setTplPath(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+}
\ No newline at end of file
diff --git a/plugin-report-doc-demo/src/com/fr/demo/ReadFromDatabase.java b/plugin-report-doc-demo/src/com/fr/demo/ReadFromDatabase.java
new file mode 100644
index 0000000..be146dc
--- /dev/null
+++ b/plugin-report-doc-demo/src/com/fr/demo/ReadFromDatabase.java
@@ -0,0 +1,65 @@
+package com.fr.demo;
+
+import com.fr.base.FRContext;
+import com.fr.main.TemplateWorkBook;
+import com.fr.main.impl.WorkBook;
+import com.fr.web.core.Reportlet;
+import com.fr.web.request.ReportletRequest;
+import com.fr.workspace.simple.SimpleWork;
+
+import java.io.InputStream;
+import java.sql.Blob;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.Map;
+
+
+public class ReadFromDatabase extends Reportlet {
+ public TemplateWorkBook createReport(ReportletRequest reportletRequest) {
+ // 定义报表运行环境,才能执行报表
+ String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
+ SimpleWork.checkIn(envpath);
+
+ WorkBook workbook = new WorkBook();
+ String name = reportletRequest.getParameter("cptname").toString();
+ try {
+ // 定义数据连接
+ String driver = "com.mysql.jdbc.Driver";
+ String url = "jdbc:mysql://112.124.109.239:3306/yourdatebase";
+ String user = "yourusername";
+ String pass = "yourpassword";
+ Class.forName(driver);
+ Connection conn = DriverManager.getConnection(url, user, pass);
+ // 从数据库中读模板
+ String sql = "select cpt from report where cptname = '" + name
+ + "'";
+ Statement smt = conn.createStatement();
+ ResultSet rs = smt.executeQuery(sql);
+ while (rs.next()) {
+ Blob blob = rs.getBlob(1); // 取第一列的值,即cpt列
+ FRContext.getLogger().info(blob.toString());
+ InputStream ins = blob.getBinaryStream();
+ workbook.readStream(ins);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ SimpleWork.checkOut();
+ }
+ return workbook;
+ }
+
+ @Override
+ public void setParameterMap(Map arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setTplPath(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+}
\ No newline at end of file
diff --git a/plugin-report-doc-demo/src/com/fr/demo/SaveReportToDatabase.java b/plugin-report-doc-demo/src/com/fr/demo/SaveReportToDatabase.java
new file mode 100644
index 0000000..0f04f30
--- /dev/null
+++ b/plugin-report-doc-demo/src/com/fr/demo/SaveReportToDatabase.java
@@ -0,0 +1,50 @@
+package com.fr.demo;
+
+import com.fr.workspace.simple.SimpleWork;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+
+public class SaveReportToDatabase {
+ public static void main(String[] args) {
+ SaveReport();
+ }
+
+ private static void SaveReport() {
+ try {
+ // 定义报表运行环境,才能执行报表
+ String envpath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
+ SimpleWork.checkIn(envpath);
+ // 连接数据库
+ String driver = "com.mysql.jdbc.Driver";
+ String url = "jdbc:mysql://112.124.109.239:3306/yourdatabase";
+ String user = "yourusername";
+ String pass = "yourpassword";
+ Class.forName(driver);
+ Connection conn = DriverManager.getConnection(url, user, pass); //注意表名是否区分大小写
+ conn.setAutoCommit(false);
+ PreparedStatement presmt = conn
+ .prepareStatement("INSERT INTO report VALUES(?,?)");
+ // 读进需要保存入库的模板文件
+ File cptfile = new File(envpath
+ + "\\reportlets\\GettingStarted.cpt");
+ int lens = (int) cptfile.length();
+ InputStream ins = new FileInputStream(cptfile);
+ // 将模板保存入库
+ presmt.setString(1, "GettingStarted.cpt"); // 第一个字段存放模板相对路径
+ presmt.setBinaryStream(2, ins, lens); // 第二个字段存放模板文件的二进制流
+ presmt.execute();
+ conn.commit();
+ presmt.close();
+ conn.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ SimpleWork.checkOut();
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugin-report-doc-demo/src/com/fr/demo/SetCellElementStyle.java b/plugin-report-doc-demo/src/com/fr/demo/SetCellElementStyle.java
new file mode 100644
index 0000000..3b19637
--- /dev/null
+++ b/plugin-report-doc-demo/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/plugin-report-doc-demo/src/com/fr/demo/SimpleReportletDemo.java b/plugin-report-doc-demo/src/com/fr/demo/SimpleReportletDemo.java
new file mode 100644
index 0000000..b051b1a
--- /dev/null
+++ b/plugin-report-doc-demo/src/com/fr/demo/SimpleReportletDemo.java
@@ -0,0 +1,42 @@
+//程序网络报表
+package com.fr.demo;
+
+import com.fr.io.TemplateWorkBookIO;
+import com.fr.main.TemplateWorkBook;
+import com.fr.web.core.Reportlet;
+import com.fr.web.request.ReportletRequest;
+import com.fr.workspace.simple.SimpleWork;
+
+import java.util.Map;
+
+
+public class SimpleReportletDemo extends Reportlet {
+ public TemplateWorkBook createReport(ReportletRequest reportletrequest) {
+ String envPath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
+ SimpleWork.checkIn(envPath);
+ // 新建一个WorkBook对象,用于保存最终返回的报表
+ TemplateWorkBook WorkBook = null;
+ try {
+ // 读取模板,将模板保存为workbook对象并返回
+ WorkBook = TemplateWorkBookIO.readTemplateWorkBook(
+ "\\doc\\Primary\\Parameter\\Parameter.cpt");
+ } catch (Exception e) {
+ e.getStackTrace();
+ } finally {
+ SimpleWork.checkOut();
+ }
+ return WorkBook;
+ }
+
+ @Override
+ public void setParameterMap(Map arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setTplPath(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+}
\ No newline at end of file
diff --git a/plugin-report-doc-demo/src/com/fr/demo/TotalVerifyJobDemo.java b/plugin-report-doc-demo/src/com/fr/demo/TotalVerifyJobDemo.java
new file mode 100644
index 0000000..7a0247c
--- /dev/null
+++ b/plugin-report-doc-demo/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/plugin-report-doc-demo/src/com/fr/demo/URLParameterDemo.java b/plugin-report-doc-demo/src/com/fr/demo/URLParameterDemo.java
new file mode 100644
index 0000000..c4dac4f
--- /dev/null
+++ b/plugin-report-doc-demo/src/com/fr/demo/URLParameterDemo.java
@@ -0,0 +1,53 @@
+// 程序网络报表中获取request中的值
+package com.fr.demo;
+
+import com.fr.base.Parameter;
+import com.fr.general.ModuleContext;
+import com.fr.io.TemplateWorkBookIO;
+import com.fr.main.TemplateWorkBook;
+import com.fr.report.module.EngineModule;
+import com.fr.web.core.Reportlet;
+import com.fr.web.request.ReportletRequest;
+import com.fr.workspace.simple.SimpleWork;
+
+import java.util.Map;
+
+
+public class URLParameterDemo extends Reportlet {
+ public TemplateWorkBook createReport(ReportletRequest reportletRequest) {
+
+ String envPath = "D:\\FineReport_8.0\\WebReport\\WEB-INF";
+ SimpleWork.checkIn(envPath);
+ ModuleContext.startModule(EngineModule.class.getName());
+ // 获取外部传来的参数
+ TemplateWorkBook wbTpl = null;
+ String countryValue = reportletRequest.getParameter("地区").toString();
+ try {
+ wbTpl = TemplateWorkBookIO.readTemplateWorkBook("\\doc\\Primary\\Parameter\\Parameter.cpt");
+ // 提取报表参数组,由于原模板只有country一个参数,因此直接取index为0的参数,并将外部传入的值赋给该参数
+ Parameter[] ps = wbTpl.getParameters();
+ ps[0].setValue(countryValue);
+ // 原模板定义有参数界面,参数已经从外部获得,去掉参数页面
+ // 若您想保留参数界面,则将模板设置为不延迟报表展示,再传入参数后直接根据参数值显示结果,否则还需要再次点击查询按钮
+ wbTpl.getReportParameterAttr().setParameterUI(null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ SimpleWork.checkOut();
+ }
+ return wbTpl;
+ }
+
+ @Override
+ public void setParameterMap(Map arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setTplPath(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
\ No newline at end of file
diff --git a/plugin-report-doc-demo/src/com/fr/demo/VerifyJobDemo.java b/plugin-report-doc-demo/src/com/fr/demo/VerifyJobDemo.java
new file mode 100644
index 0000000..77b0e40
--- /dev/null
+++ b/plugin-report-doc-demo/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/plugin-report-doc-demo/src/com/fr/function/BinaryImage.java b/plugin-report-doc-demo/src/com/fr/function/BinaryImage.java
new file mode 100644
index 0000000..65ac6eb
--- /dev/null
+++ b/plugin-report-doc-demo/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/plugin-report-doc-demo/src/com/fr/function/CellSum.java b/plugin-report-doc-demo/src/com/fr/function/CellSum.java
new file mode 100644
index 0000000..008009b
--- /dev/null
+++ b/plugin-report-doc-demo/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/plugin-report-doc-demo/src/com/fr/function/ConnectSAPServer.java b/plugin-report-doc-demo/src/com/fr/function/ConnectSAPServer.java
new file mode 100644
index 0000000..e97c7b7
--- /dev/null
+++ b/plugin-report-doc-demo/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/plugin-report-doc-demo/src/com/fr/function/FlagHtmlColor.java b/plugin-report-doc-demo/src/com/fr/function/FlagHtmlColor.java
new file mode 100644
index 0000000..76da40b
--- /dev/null
+++ b/plugin-report-doc-demo/src/com/fr/function/FlagHtmlColor.java
@@ -0,0 +1,67 @@
+package com.fr.function;
+import com.fr.script.AbstractFunction;
+import com.fr.stable.Primitive;
+public class FlagHtmlColor extends AbstractFunction {
+ public Object run(Object[] args) {
+ String txt="";
+ String color="";
+ String flag="";
+ if(null==args||args.length==0){
+ return Primitive.ERROR_NAME;
+ }else if(args.length==1){
+ txt=args[0].toString();
+ color="red";
+ flag="N";
+ }else if(args.length==2){
+ txt=args[0].toString();
+ color=args[1].toString();
+ flag="N";
+ }else{
+ txt=args[0].toString();
+ color=args[1].toString();
+ flag=args[2].toString();
+ }
+ String result=getHtmlStr(txt, color, flag);
+ return result;
+ }
+ public String getHtmlStr(String txt,String color,String flag){
+ String starthtml="";
+ String endhtml="";
+ StringBuffer sb=new StringBuffer();
+ int len=txt.length();
+ if("N".equalsIgnoreCase(flag)){//数字
+ for(int i=0;i
+ * 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/plugin-report-doc-demo/src/mobile/MobileCodeWSStub.java b/plugin-report-doc-demo/src/mobile/MobileCodeWSStub.java
new file mode 100644
index 0000000..8f6199b
--- /dev/null
+++ b/plugin-report-doc-demo/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;
+ }
+ }
+}