| 1 |
//---PACKAGE DECLARATION--- |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
//---IMPORTS--- |
| 6 |
|
| 7 |
import java.sql.*; |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
/** |
| 12 |
|
| 13 |
* This is a report template. |
| 14 |
|
| 15 |
* |
| 16 |
|
| 17 |
* @author $Author: pjm2 $ |
| 18 |
|
| 19 |
* @version $Id: Template__Report.java,v 1.10 2001/01/07 21:09:31 pjm2 Exp $ |
| 20 |
|
| 21 |
*/ |
| 22 |
|
| 23 |
public class Template__Report extends Report { |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
//---FINAL ATTRIBUTES--- |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
/** |
| 32 |
|
| 33 |
* The current CVS revision of this class |
| 34 |
|
| 35 |
*/ |
| 36 |
|
| 37 |
public final String REVISION = "$ Revision: $"; |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
//---STATIC METHODS--- |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
//---CONSTRUCTORS--- |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
//---PUBLIC METHODS--- |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
/** |
| 58 |
|
| 59 |
* This method overrides the superclass' method. It should be used to |
| 60 |
|
| 61 |
* provide special functionality for the report. |
| 62 |
|
| 63 |
*/ |
| 64 |
|
| 65 |
public String createReport(String directory, Statement stmt, String machine_name, long startDate, long endDate, int type){ |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
// Use this key value from the parameter table for the report data. |
| 70 |
|
| 71 |
_reportField = "packet.template.name"; |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
_friendlyName = "Friendly name for this type of report"; |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
// Use this select query. |
| 80 |
|
| 81 |
_sql = "SELECT receipt_date, value FROM "+DBParameters.PACKET_TABLE+" pkt, "+DBParameters.PARAMETER_TABLE+" param WHERE pkt.id=param.packet_id AND pkt.machine_name='"+ machine_name+"' AND pkt.receipt_date >= "+startDate+" AND pkt.receipt_date <= "+endDate+" AND param.name='"+_reportField+"' ORDER BY pkt.receipt_date;"; |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
// Perform special custom functions here. |
| 86 |
|
| 87 |
// ..... |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
// Return own string or carry on with the normal method for creating reports. |
| 92 |
|
| 93 |
return super.createReport(directory, stmt, machine_name, startDate, endDate, type); |
| 94 |
|
| 95 |
} |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
/** |
| 102 |
|
| 103 |
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
| 104 |
|
| 105 |
* method to provide clean logging (every class should have this). |
| 106 |
|
| 107 |
* |
| 108 |
|
| 109 |
* @return the name of this class and its CVS revision |
| 110 |
|
| 111 |
*/ |
| 112 |
|
| 113 |
public String toString() { |
| 114 |
|
| 115 |
return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
| 116 |
|
| 117 |
} |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
//---PRIVATE METHODS--- |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
//---ACCESSOR/MUTATOR METHODS--- |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
//---ATTRIBUTES--- |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
//---STATIC ATTRIBUTES--- |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
} |