| 1 |
|
import java.sql.*; |
| 2 |
|
import java.util.*; |
| 3 |
+ |
import java.io.*; |
| 4 |
|
|
| 5 |
|
// DBReporter class - establishes the database connection and is |
| 6 |
|
// used to run all of the reports. |
| 58 |
|
String machine = (String)machineIt.next(); |
| 59 |
|
rm.produce(reports, machine); |
| 60 |
|
} |
| 61 |
+ |
|
| 62 |
+ |
|
| 63 |
+ |
|
| 64 |
+ |
// Now output the files for PHP searching. |
| 65 |
+ |
// - print report list stuff out to reports.inc |
| 66 |
+ |
System.out.println("Writing reports.inc"); |
| 67 |
+ |
File reportInc = new File(new File(webDir), "reports.inc"); |
| 68 |
+ |
try { |
| 69 |
+ |
BufferedWriter bw = new BufferedWriter(new FileWriter(reportInc)); |
| 70 |
+ |
Iterator reportIt = reports.iterator(); |
| 71 |
+ |
while (reportIt.hasNext()) { |
| 72 |
+ |
Report report = (Report)reportIt.next(); |
| 73 |
+ |
bw.write("<option value=\"" + report.getReportField() + "\">" + report.getFriendlyName() + "</option>"); |
| 74 |
+ |
} |
| 75 |
+ |
bw.flush(); |
| 76 |
+ |
bw.close(); |
| 77 |
+ |
} |
| 78 |
+ |
catch (IOException e) { |
| 79 |
+ |
System.out.println("Unable to create" + reportInc); |
| 80 |
+ |
} |
| 81 |
+ |
|
| 82 |
+ |
|
| 83 |
+ |
// - print machine list stuff out to machine_name.inc |
| 84 |
+ |
System.out.println("Writing machine_name.inc"); |
| 85 |
+ |
File machineInc = new File(new File(webDir), "machine_name.inc"); |
| 86 |
+ |
try { |
| 87 |
+ |
BufferedWriter bw = new BufferedWriter(new FileWriter(machineInc)); |
| 88 |
+ |
machineIt = machines.iterator(); |
| 89 |
+ |
while (machineIt.hasNext()) { |
| 90 |
+ |
String machine = (String)machineIt.next(); |
| 91 |
+ |
bw.write("<option value=\"" + machine + "\">" + machine + "</option>"); |
| 92 |
+ |
} |
| 93 |
+ |
bw.flush(); |
| 94 |
+ |
bw.close(); |
| 95 |
+ |
} |
| 96 |
+ |
catch (IOException e) { |
| 97 |
+ |
System.out.println("Unable to create" + machineInc); |
| 98 |
+ |
} |
| 99 |
+ |
|
| 100 |
+ |
|
| 101 |
+ |
// - print current day out to day.inc |
| 102 |
+ |
System.out.println("Writing day.inc"); |
| 103 |
+ |
File dayInc = new File(new File(webDir), "day.inc"); |
| 104 |
+ |
try { |
| 105 |
+ |
BufferedWriter bw = new BufferedWriter(new FileWriter(dayInc)); |
| 106 |
+ |
bw.write("<? $day = \"" + DateUtils.shortDateString(_startTime) + "\"; ?>"); |
| 107 |
+ |
bw.flush(); |
| 108 |
+ |
bw.close(); |
| 109 |
+ |
} |
| 110 |
+ |
catch (IOException e) { |
| 111 |
+ |
System.out.println("Unable to create" + dayInc); |
| 112 |
+ |
} |
| 113 |
+ |
|
| 114 |
|
|
| 115 |
|
} |
| 116 |
|
|