Col_prop.java
package yjava.ws.ie.reportdef;
import java.sql.SQLException; import java.util.Hashtable; import java.util.Vector; import java.sql.ResultSet; import java.sql.ResultSetMetaData;
import org.arrah.framework.rdbms.Rdbms_conn; import org.arrah.framework.rdbms.QueryBuilder; import org.arrah.framework.util.KeyValueParser; import org.arrah.framework.ndtable.ResultsetToRTM; import org.arrah.framework.ndtable.ReportTableModel;
//Adding Company resource import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement;
import yjava.ws.util.CompanyResource; import yjava.ws.util.representations.RootCompanyElement;
@XmlRootElement public class Col_prop { @XmlElement public String label; @XmlElement public String sortable ="true"; }
Column.java
@XmlRootElement public class Column extends RootCompanyElement { private Hashtable<String, String> _fileParse; // private String table; private String dbparam; /* public Column(String _table) { table = _table; } */ public Column() { } public Column(String dbstr) { dbparam = dbstr; }
@SuppressWarnings("unused") @GET @XmlElement public Vector<String> getColname() throws SQLException {
/* _fileParse = KeyValueParser.parseFile("/home/y/conf/yjava_tomcat/configFile.txt"); */ _fileParse = new Hashtable<String,String>(); _fileParse.put("Database_Type","MYSQL"); _fileParse.put("Database_Driver","com.mysql.jdbc.Driver"); _fileParse.put("Database_Protocol","jdbc:mysql"); _fileParse.put("Database_DSN",""); _fileParse.put("Database_User",""); _fileParse.put("Database_Passwd",""); _fileParse.put("Database_Catalog",""); _fileParse.put("Database_SchemaPattern",""); _fileParse.put("Database_TablePattern",""); _fileParse.put("Database_ColumnPattern",""); _fileParse.put("Database_TableType","TABLE");
String para = dbparam.split(":"); _fileParse.put("Database_DSN","//"+para+"/"+para); _fileParse.put("Database_User",para); _fileParse.put("Database_Passwd",para);
String s = (String) _fileParse.get("Database_SchemaPattern"); String s1 = (String) _fileParse.get("Database_TablePattern"); String s2 = (String) _fileParse.get("Database_TableType"); String s3 = (String) _fileParse.get("Database_Catalog"); Rdbms_conn.init(_fileParse); s3 = ""; Rdbms_conn.populateTable(s3.compareTo("") != 0 ? s3 : (s3 = null), s .compareTo("") != 0 ? s : (s = null), s1.compareTo("") != 0 ? s1 : (s1 = null), s2.split(",")); Vector<String> table_v = Rdbms_conn.getTable(); Vector<String> tableDesc_v = Rdbms_conn.getTableDesc(); int tableCount = table_v.size(); Rdbms_conn.closeConn(); return table_v;
}
ColumnProfiler.java
import org.arrah.framework.rdbms.Rdbms_conn; import org.arrah.framework.rdbms.QueryBuilder; import org.arrah.framework.util.KeyValueParser; import org.arrah.framework.profile.FirstInformation;
@XmlRootElement public class ColumnProfile extends RootCompanyElement { private Hashtable<String, String> _fileParse; private String table; private String column; private String dbstr;
@XmlElement double Total = 0.0D; @XmlElement double Unique = 0.0D; @XmlElement double Repeat = 0.0D; @XmlElement double Pattern = 0.0D; @XmlElement double Null = 0.0D;
public ColumnProfile (String _table, String _column, String _dbstr) { table = _table; column = _column; dbstr = _dbstr; } public ColumnProfile () { }
@XmlAttribute public String getTableName() { return table; } @XmlAttribute public String getColumnName() { return column; }
public double getProfile ( ) throws SQLException { /* _fileParse = KeyValueParser.parseFile("/home/y/conf/yjava_tomcat/configFile.txt"); */ _fileParse = new Hashtable<String,String>(); _fileParse.put("Database_Type","MYSQL"); _fileParse.put("Database_Driver","com.mysql.jdbc.Driver"); _fileParse.put("Database_Protocol","jdbc:mysql"); _fileParse.put("Database_DSN",""); _fileParse.put("Database_User",""); _fileParse.put("Database_Passwd",""); _fileParse.put("Database_Catalog",""); _fileParse.put("Database_SchemaPattern",""); _fileParse.put("Database_TablePattern",""); _fileParse.put("Database_ColumnPattern",""); _fileParse.put("Database_TableType","TABLE");
String para = dbstr.split(":"); _fileParse.put("Database_DSN","//"+para+"/"+para); _fileParse.put("Database_User",para); _fileParse.put("Database_Passwd",para);
Rdbms_conn.init(_fileParse); String s = (String) _fileParse.get("Database_DSN"); QueryBuilder colProfile_qb = new QueryBuilder(s, table,column, Rdbms_conn.getDBType()); Rdbms_conn.openConn(); double ad = FirstInformation.getProfileValues(colProfile_qb); Total = ad; Unique = ad; Repeat = ad; Pattern = ad; Null = ad;
Rdbms_conn.closeConn();
double Profile_a = new double {Total,Unique,Repeat,Pattern,Null}; return Profile_a;
ColumnResource.java ( Webserver calls this resource) package yjava.ws.ie.reportdef;
//Adding Company resource import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement;
@Path("/rpt") public class ColumnResource extends CompanyResource { private Hashtable<String, String> _fileParse;
@SuppressWarnings("unused") @GET public Column getCol(@QueryParam("dbstr") String dbstr) throws SQLException { return complete(new Column(dbstr) ); }
@GET @Path("{table}/data") public Table_data getTableData(@PathParam("table") String table,@QueryParam("dbstr") String dbstr ) throws SQLException { Table clm = new Table(table,dbstr); // clm.fillBody(); Table_data table_data = new Table_data(); table_data.setTable_data (clm); return complete(table_data) ; }
@GET @Path("{table}/{column}/data") public ColumnProfile getColumnData(@PathParam("table") String table, @PathParam("column") String column,@QueryParam("dbstr") String dbstr ) throws SQLException { ColumnProfile clm = new ColumnProfile (table,column,dbstr); clm.getProfile(); return complete(clm) ; }
Package-info.java @XmlSchema ( namespace="http://reportdef.os.corp.Company.com/v1/schema.rng", elementFormDefault=javax.xml.bind.annotation.XmlNsForm.QUALIFIED, xmlns={ @XmlNs(prefix="Company", namespaceURI="http://www.Companyapis.com/v1/base.rng"), @XmlNs(prefix="", namespaceURI="http://reportdef.os.corp.Company.com/v1/schema.rng") } ) package yjava.ws.ie.reportdef;
import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlSchema;
Row.java
@XmlRootElement public class Row { @XmlElement public String data; }
Table.java package yjava.ws.ie.reportdef;
import java.sql.SQLException; import java.util.Hashtable; import java.util.Vector; import java.util.Hashtable; import java.sql.ResultSet; import java.sql.ResultSetMetaData;
//Adding Company resource import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
@XmlRootElement @XmlType(propOrder={"title", "use_caption", "add_select", "header", "body"})
public class Table {
private Hashtable<String, String> _fileParse; private String rowCount = "0"; private String title; private String dbstr; private String use_caption ="true"; private String add_select ="no"; private Vector<String> header; private Vector<Row> body;
public Table (String _table, String _dbstr) throws SQLException { title = _table; dbstr = _dbstr; fillBody(); }
public Table () { }
@XmlElement public String getTitle() { return title; } @XmlElement public String getUse_caption() { return "true"; } @XmlElement public String getAdd_select() { return "no"; } @XmlElement public Vector<String> getHeader() { return header; } @XmlElement public Vector<Row> getBody() { return body; }
private void fillBody( ) throws SQLException { /* _fileParse = KeyValueParser.parseFile("/home/y/conf/yjava_tomcat/configFile.txt"); */ _fileParse = new Hashtable<String,String>(); _fileParse.put("Database_Type","MYSQL"); _fileParse.put("Database_Driver","com.mysql.jdbc.Driver"); _fileParse.put("Database_Protocol","jdbc:mysql"); _fileParse.put("Database_DSN",""); _fileParse.put("Database_User",""); _fileParse.put("Database_Passwd",""); _fileParse.put("Database_Catalog",""); _fileParse.put("Database_SchemaPattern",""); _fileParse.put("Database_TablePattern",""); _fileParse.put("Database_ColumnPattern",""); _fileParse.put("Database_TableType","TABLE");
Rdbms_conn.init(_fileParse); String s = (String) _fileParse.get("Database_DSN"); QueryBuilder table_qb = new QueryBuilder(s, title, Rdbms_conn.getDBType()); String s1 = table_qb.get_tableAll_query(); Rdbms_conn.openConn(); ResultSet resultset = Rdbms_conn.runQuery(s1, 20); // get 20 rows ReportTableModel _rtm = ResultsetToRTM.getSQLValue(resultset, true); resultset.close();
String s2 = table_qb.get_tableCount_query(); for (ResultSet resultset1 = Rdbms_conn.runQuery(s2); resultset1 .next(); ) rowCount = resultset1.getString("row_count");
int rowc = _rtm.getModel().getRowCount(); int colc = _rtm.getModel().getColumnCount(); header = new Vector<String> (); for (int i=0; i < colc; i++) { Col_prop colp = new Col_prop(); colp.label = _rtm.getModel().getColumnName(i); header.add(colp.label); }
body = new Vector<Row> ();
for (int i=0; i < rowc ; i++){ Row row = new Row(); row.data= new String; for (int j = 0; j < colc; j++) { row.data = _rtm.getModel().getValueAt(i,j).toString(); } body.add(i,row); }
} Table_data.java package yjava.ws.ie.reportdef;
@XmlRootElement public class Table_data extends RootCompanyElement { private Table table_data;
public Table_data () {};
@XmlElement public Table getTable_data() { return table_data; } public void setTable_data(Table _table_data) { table_data = _table_data; } }
Log in to post a comment.
Col_prop.java
package yjava.ws.ie.reportdef;
import java.sql.SQLException;
import java.util.Hashtable;
import java.util.Vector;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import org.arrah.framework.rdbms.Rdbms_conn;
import org.arrah.framework.rdbms.QueryBuilder;
import org.arrah.framework.util.KeyValueParser;
import org.arrah.framework.ndtable.ResultsetToRTM;
import org.arrah.framework.ndtable.ReportTableModel;
//Adding Company resource
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import yjava.ws.util.CompanyResource;
import yjava.ws.util.representations.RootCompanyElement;
@XmlRootElement
public class Col_prop {
@XmlElement
public String label;
@XmlElement
public String sortable ="true";
}
Column.java
package yjava.ws.ie.reportdef;
import java.sql.SQLException;
import java.util.Hashtable;
import java.util.Vector;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import org.arrah.framework.rdbms.Rdbms_conn;
import org.arrah.framework.rdbms.QueryBuilder;
import org.arrah.framework.util.KeyValueParser;
import org.arrah.framework.ndtable.ResultsetToRTM;
import org.arrah.framework.ndtable.ReportTableModel;
//Adding Company resource
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import yjava.ws.util.CompanyResource;
import yjava.ws.util.representations.RootCompanyElement;
@XmlRootElement
public class Column extends RootCompanyElement {
private Hashtable<String, String> _fileParse;
// private String table;
private String dbparam;
/*
public Column(String _table) {
table = _table;
}
*/
public Column() {
}
public Column(String dbstr) {
dbparam = dbstr;
}
@SuppressWarnings("unused")
@GET
@XmlElement
public Vector<String> getColname() throws SQLException {
/*
_fileParse = KeyValueParser.parseFile("/home/y/conf/yjava_tomcat/configFile.txt");
*/
_fileParse = new Hashtable<String,String>();
_fileParse.put("Database_Type","MYSQL");
_fileParse.put("Database_Driver","com.mysql.jdbc.Driver");
_fileParse.put("Database_Protocol","jdbc:mysql");
_fileParse.put("Database_DSN","");
_fileParse.put("Database_User","");
_fileParse.put("Database_Passwd","");
_fileParse.put("Database_Catalog","");
_fileParse.put("Database_SchemaPattern","");
_fileParse.put("Database_TablePattern","");
_fileParse.put("Database_ColumnPattern","");
_fileParse.put("Database_TableType","TABLE");
String para = dbparam.split(":");
_fileParse.put("Database_DSN","//"+para+"/"+para);
_fileParse.put("Database_User",para);
_fileParse.put("Database_Passwd",para);
String s = (String) _fileParse.get("Database_SchemaPattern");
String s1 = (String) _fileParse.get("Database_TablePattern");
String s2 = (String) _fileParse.get("Database_TableType");
String s3 = (String) _fileParse.get("Database_Catalog");
Rdbms_conn.init(_fileParse);
s3 = "";
Rdbms_conn.populateTable(s3.compareTo("") != 0 ? s3 : (s3 = null), s
.compareTo("") != 0 ? s : (s = null),
s1.compareTo("") != 0 ? s1 : (s1 = null), s2.split(","));
Vector<String> table_v = Rdbms_conn.getTable();
Vector<String> tableDesc_v = Rdbms_conn.getTableDesc();
int tableCount = table_v.size();
Rdbms_conn.closeConn();
return table_v;
}
}
ColumnProfiler.java
package yjava.ws.ie.reportdef;
import java.sql.SQLException;
import java.util.Hashtable;
import java.util.Vector;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import org.arrah.framework.rdbms.Rdbms_conn;
import org.arrah.framework.rdbms.QueryBuilder;
import org.arrah.framework.util.KeyValueParser;
import org.arrah.framework.profile.FirstInformation;
//Adding Company resource
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import yjava.ws.util.CompanyResource;
import yjava.ws.util.representations.RootCompanyElement;
@XmlRootElement
public class ColumnProfile extends RootCompanyElement {
private Hashtable<String, String> _fileParse;
private String table;
private String column;
private String dbstr;
@XmlElement
double Total = 0.0D;
@XmlElement
double Unique = 0.0D;
@XmlElement
double Repeat = 0.0D;
@XmlElement
double Pattern = 0.0D;
@XmlElement
double Null = 0.0D;
public ColumnProfile (String _table, String _column, String _dbstr) {
table = _table;
column = _column;
dbstr = _dbstr;
}
public ColumnProfile () {
}
@XmlAttribute
public String getTableName() {
return table;
}
@XmlAttribute
public String getColumnName() {
return column;
}
public double getProfile ( ) throws SQLException
{
/*
_fileParse = KeyValueParser.parseFile("/home/y/conf/yjava_tomcat/configFile.txt");
*/
_fileParse = new Hashtable<String,String>();
_fileParse.put("Database_Type","MYSQL");
_fileParse.put("Database_Driver","com.mysql.jdbc.Driver");
_fileParse.put("Database_Protocol","jdbc:mysql");
_fileParse.put("Database_DSN","");
_fileParse.put("Database_User","");
_fileParse.put("Database_Passwd","");
_fileParse.put("Database_Catalog","");
_fileParse.put("Database_SchemaPattern","");
_fileParse.put("Database_TablePattern","");
_fileParse.put("Database_ColumnPattern","");
_fileParse.put("Database_TableType","TABLE");
String para = dbstr.split(":");
_fileParse.put("Database_DSN","//"+para+"/"+para);
_fileParse.put("Database_User",para);
_fileParse.put("Database_Passwd",para);
Rdbms_conn.init(_fileParse);
String s = (String) _fileParse.get("Database_DSN");
QueryBuilder colProfile_qb = new QueryBuilder(s, table,column, Rdbms_conn.getDBType());
Rdbms_conn.openConn();
double ad = FirstInformation.getProfileValues(colProfile_qb);
Total = ad;
Unique = ad;
Repeat = ad;
Pattern = ad;
Null = ad;
Rdbms_conn.closeConn();
double Profile_a = new double {Total,Unique,Repeat,Pattern,Null};
return Profile_a;
}
}
ColumnResource.java ( Webserver calls this resource)
package yjava.ws.ie.reportdef;
import java.sql.SQLException;
import java.util.Hashtable;
import java.util.Vector;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import org.arrah.framework.rdbms.Rdbms_conn;
import org.arrah.framework.rdbms.QueryBuilder;
import org.arrah.framework.util.KeyValueParser;
import org.arrah.framework.ndtable.ResultsetToRTM;
import org.arrah.framework.ndtable.ReportTableModel;
//Adding Company resource
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import yjava.ws.util.CompanyResource;
import yjava.ws.util.representations.RootCompanyElement;
@Path("/rpt")
public class ColumnResource extends CompanyResource {
private Hashtable<String, String> _fileParse;
@SuppressWarnings("unused")
@GET
public Column getCol(@QueryParam("dbstr") String dbstr) throws SQLException {
return complete(new Column(dbstr) );
}
@GET
@Path("{table}/data")
public Table_data getTableData(@PathParam("table") String table,@QueryParam("dbstr") String dbstr ) throws SQLException
{
Table clm = new Table(table,dbstr);
// clm.fillBody();
Table_data table_data = new Table_data();
table_data.setTable_data (clm);
return complete(table_data) ;
}
@GET
@Path("{table}/{column}/data")
public ColumnProfile getColumnData(@PathParam("table") String table, @PathParam("column") String column,@QueryParam("dbstr") String dbstr ) throws SQLException
{
ColumnProfile clm = new ColumnProfile (table,column,dbstr);
clm.getProfile();
return complete(clm) ;
}
}
Package-info.java
@XmlSchema (
namespace="http://reportdef.os.corp.Company.com/v1/schema.rng",
elementFormDefault=javax.xml.bind.annotation.XmlNsForm.QUALIFIED,
xmlns={
@XmlNs(prefix="Company", namespaceURI="http://www.Companyapis.com/v1/base.rng"),
@XmlNs(prefix="", namespaceURI="http://reportdef.os.corp.Company.com/v1/schema.rng")
}
)
package yjava.ws.ie.reportdef;
import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlSchema;
Row.java
package yjava.ws.ie.reportdef;
import java.sql.SQLException;
import java.util.Hashtable;
import java.util.Vector;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import org.arrah.framework.rdbms.Rdbms_conn;
import org.arrah.framework.rdbms.QueryBuilder;
import org.arrah.framework.util.KeyValueParser;
import org.arrah.framework.ndtable.ResultsetToRTM;
import org.arrah.framework.ndtable.ReportTableModel;
//Adding Company resource
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import yjava.ws.util.CompanyResource;
import yjava.ws.util.representations.RootCompanyElement;
@XmlRootElement
public class Row {
@XmlElement
public String data;
}
Table.java
package yjava.ws.ie.reportdef;
import java.sql.SQLException;
import java.util.Hashtable;
import java.util.Vector;
import java.util.Hashtable;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import org.arrah.framework.rdbms.Rdbms_conn;
import org.arrah.framework.rdbms.QueryBuilder;
import org.arrah.framework.util.KeyValueParser;
import org.arrah.framework.ndtable.ResultsetToRTM;
import org.arrah.framework.ndtable.ReportTableModel;
//Adding Company resource
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
import yjava.ws.util.CompanyResource;
import yjava.ws.util.representations.RootCompanyElement;
@XmlRootElement
@XmlType(propOrder={"title", "use_caption", "add_select", "header", "body"})
public class Table {
private Hashtable<String, String> _fileParse;
private String rowCount = "0";
private String title;
private String dbstr;
private String use_caption ="true";
private String add_select ="no";
private Vector<String> header;
private Vector<Row> body;
public Table (String _table, String _dbstr) throws SQLException {
title = _table;
dbstr = _dbstr;
fillBody();
}
public Table () {
}
@XmlElement
public String getTitle() {
return title;
}
@XmlElement
public String getUse_caption() {
return "true";
}
@XmlElement
public String getAdd_select() {
return "no";
}
@XmlElement
public Vector<String> getHeader() {
return header;
}
@XmlElement
public Vector<Row> getBody() {
return body;
}
private void fillBody( ) throws SQLException
{
/*
_fileParse = KeyValueParser.parseFile("/home/y/conf/yjava_tomcat/configFile.txt");
*/
_fileParse = new Hashtable<String,String>();
_fileParse.put("Database_Type","MYSQL");
_fileParse.put("Database_Driver","com.mysql.jdbc.Driver");
_fileParse.put("Database_Protocol","jdbc:mysql");
_fileParse.put("Database_DSN","");
_fileParse.put("Database_User","");
_fileParse.put("Database_Passwd","");
_fileParse.put("Database_Catalog","");
_fileParse.put("Database_SchemaPattern","");
_fileParse.put("Database_TablePattern","");
_fileParse.put("Database_ColumnPattern","");
_fileParse.put("Database_TableType","TABLE");
String para = dbstr.split(":");
_fileParse.put("Database_DSN","//"+para+"/"+para);
_fileParse.put("Database_User",para);
_fileParse.put("Database_Passwd",para);
Rdbms_conn.init(_fileParse);
String s = (String) _fileParse.get("Database_DSN");
QueryBuilder table_qb = new QueryBuilder(s, title, Rdbms_conn.getDBType());
String s1 = table_qb.get_tableAll_query();
Rdbms_conn.openConn();
ResultSet resultset = Rdbms_conn.runQuery(s1, 20); // get 20 rows
ReportTableModel _rtm = ResultsetToRTM.getSQLValue(resultset, true);
resultset.close();
String s2 = table_qb.get_tableCount_query();
for (ResultSet resultset1 = Rdbms_conn.runQuery(s2); resultset1
.next(); )
rowCount = resultset1.getString("row_count");
Rdbms_conn.closeConn();
int rowc = _rtm.getModel().getRowCount();
int colc = _rtm.getModel().getColumnCount();
header = new Vector<String> ();
for (int i=0; i < colc; i++) {
Col_prop colp = new Col_prop();
colp.label = _rtm.getModel().getColumnName(i);
header.add(colp.label);
}
body = new Vector<Row> ();
for (int i=0; i < rowc ; i++){
Row row = new Row();
row.data= new String;
for (int j = 0; j < colc; j++) {
row.data = _rtm.getModel().getValueAt(i,j).toString();
}
body.add(i,row);
}
}
}
Table_data.java
package yjava.ws.ie.reportdef;
import java.sql.SQLException;
import java.util.Hashtable;
import java.util.Vector;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import org.arrah.framework.rdbms.Rdbms_conn;
import org.arrah.framework.rdbms.QueryBuilder;
import org.arrah.framework.util.KeyValueParser;
import org.arrah.framework.ndtable.ResultsetToRTM;
import org.arrah.framework.ndtable.ReportTableModel;
//Adding Company resource
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import yjava.ws.util.CompanyResource;
import yjava.ws.util.representations.RootCompanyElement;
@XmlRootElement
public class Table_data extends RootCompanyElement {
private Table table_data;
public Table_data () {};
@XmlElement
public Table getTable_data() {
return table_data;
}
public void setTable_data(Table _table_data) {
table_data = _table_data;
}
}