KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hessian > demo > client > OrdersReport


1 package hessian.demo.client;
2
3 import dinamica.*;
4 import hessian.demo.*;
5 import com.caucho.hessian.client.*;
6
7 /**
8  * Retrieves data for a master/detail report in one shot
9  * using a Hessian web service that returns a Recordset
10  * containing children recordsets. Then overrides
11  * getDetail() to return the detail recordset using the method
12  * getChildrenRecordset() of the master recordset.
13  * <br><br>
14  * (c) 2004 Martin Cordova<br>
15  * This code is released under the LGPL license<br>
16  * Dinamica Framework - http://www.martincordova.com<br>
17  * @author Martin Cordova (dinamica@martincordova.com)
18  * */

19 public class OrdersReport extends MasterDetailReader
20 {
21
22     /* (non-Javadoc)
23      * @see dinamica.MasterDetailReader#getDetail(dinamica.Recordset)
24      */

25     public Recordset getDetail(Recordset master) throws Throwable JavaDoc
26     {
27         return master.getChildrenRecordset();
28     }
29
30     /* (non-Javadoc)
31      * @see dinamica.GenericTransaction#service(dinamica.Recordset)
32      */

33     public int service(Recordset inputParams) throws Throwable JavaDoc
34     {
35
36         //service end-point
37
String JavaDoc url = "http://localhost/sdk/hessian/customer";
38         
39         //get proxy
40
HessianProxyFactory factory = new HessianProxyFactory();
41         ICustomer c = (ICustomer) factory.create(ICustomer.class, url);
42         
43         //call service
44
Recordset rs = c.getCustomer(inputParams.getString("id"));
45         
46         //the customer basic info
47
//formerly created in config.xml with a <recordset.../> element
48
publish("query.sql", rs);
49         
50         //the orders
51
//the master recordset
52
publish("master", rs.getChildrenRecordset());
53                 
54         return 0;
55     }
56
57 }
58
Popular Tags