ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/DBReporter2/DBReporter.java
(Generate patch)

Comparing projects/cms/source/reports/DBReporter2/DBReporter.java (file contents):
Revision 1.2 by pjm2, Sat Feb 3 17:26:07 2001 UTC vs.
Revision 1.4 by pjm2, Sat Feb 3 21:41:11 2001 UTC

# Line 1 | Line 1
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.
# Line 12 | Line 13 | public class DBReporter {
13      }
14  
15      // Runs all of the reports for each distinct machine name.    
16 <    public void runReports(ReportList reports) throws SQLException, Exception {
16 >    public void runReports(ReportList reports, String webDir) throws SQLException, Exception {
17          
18          System.out.println("Preparing reports ...");
19  
# Line 51 | Line 52 | public class DBReporter {
52          System.out.println("Readying reports for " + machines.size() + " machines.");
53          
54          // Produce all of the reports for each machine.
55 <        ReportMaker rm = new ReportMaker(_stmt, DateUtils.shortDateString(_startTime), _startTime, _endTime);
55 >        ReportMaker rm = new ReportMaker(_stmt, webDir, DateUtils.shortDateString(_startTime), _startTime, _endTime);
56          Iterator machineIt = machines.iterator();
57          while (machineIt.hasNext()) {
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      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines