KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > transactions > OrdersReport


1 package transactions;
2
3 import dinamica.MasterDetailReader;
4 import dinamica.Recordset;
5
6 /**
7  * Retrieves data for a master/detail report in one shot,
8  * storing every detail recordset in the master recordset,
9  * using the method setChildrenRecordset(). Then overrides
10  * getDetail() to return the detail recordset using the method
11  * getChildrenRecordset() of the master recordset. Interesting
12  * too is the way this class reuses the superclass implementations
13  * of service() and getDetail() to minimize the code required
14  * to accomplish its task.
15  * <br><br>
16  * (c) 2004 Martin Cordova<br>
17  * This code is released under the LGPL license<br>
18  * Dinamica Framework - http://www.martincordova.com
19  * @author Martin Cordova (dinamica@martincordova.com)
20  * */

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

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

35     public int service(Recordset inputParams) throws Throwable JavaDoc
36     {
37         super.service(inputParams);
38         
39         Recordset rs = this.getRecordset("master");
40         while (rs.next())
41         {
42             Recordset detail = super.getDetail(rs);
43             rs.setChildrenRecordset(detail);
44         }
45         
46         return 0;
47     }
48
49 }
50
Popular Tags