KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dspace > app > statistics > Report


1 /*
2  * Report.java
3  *
4  * Version: $Revision: 1.2 $
5  *
6  * Date: $Date: 2005/04/20 14:22:42 $
7  *
8  * Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
9  * Institute of Technology. All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are
13  * met:
14  *
15  * - Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  *
18  * - Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution.
21  *
22  * - Neither the name of the Hewlett-Packard Company nor the name of the
23  * Massachusetts Institute of Technology nor the names of their
24  * contributors may be used to endorse or promote products derived from
25  * this software without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
34  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
38  * DAMAGE.
39  */

40
41 package org.dspace.app.statistics;
42
43 import org.dspace.app.statistics.Stat;
44 import org.dspace.app.statistics.Statistics;
45
46 import java.util.ArrayList JavaDoc;
47 import java.util.Date JavaDoc;
48 import java.util.List JavaDoc;
49
50 /**
51  * Abstract class to define an interface to a generic report generating
52  * class, and to provide the polymorphism necessary to allow the report
53  * generator to generate any number of different formats of report
54  *
55  * @author Richard Jones
56  */

57 abstract class Report
58 {
59     
60     /** a list of the statistics blocks being managed by this class */
61     private List JavaDoc blocks = new ArrayList JavaDoc();
62     
63     /** the title for the page */
64     private String JavaDoc pageTitle = null;
65     
66     /** the main title for the page */
67     private String JavaDoc mainTitle = null;
68     
69     /** start date for report */
70     private Date JavaDoc start = null;
71     
72     /** end date for report */
73     private Date JavaDoc end = null;
74     
75     /**
76      * output any top headers that this page needs
77      *
78      * @return a string containing the header for the report
79      */

80     abstract public String JavaDoc header();
81     
82     /**
83      * output any top headers that this page needs
84      *
85      * @param title the title of the report, useful for email subjects or
86      * HTML headers
87      *
88      * @return a string containing the header for the report
89      */

90     abstract public String JavaDoc header(String JavaDoc title);
91     
92     /**
93      * output the title in the relevant format. This requires that the title
94      * has been set with setMainTitle()
95      *
96      * @return a string containing the title of the report
97      */

98     abstract public String JavaDoc mainTitle();
99     
100     /**
101      * output the date range in the relevant format. This requires that the
102      * date ranges have been set using setStartDate() and setEndDate()
103      *
104      * @return a string containing date range information
105      */

106     abstract public String JavaDoc dateRange();
107     
108     /**
109      * output the section header in the relevant format
110      *
111      * @param title the title of the current section header
112      *
113      * @return a string containing the formatted section header
114      */

115     abstract public String JavaDoc sectionHeader(String JavaDoc title);
116     
117     /**
118      * output the report block based on the passed statistics object array
119      *
120      * @param content a statistics object to form the basis of the displayed
121      * stat block
122      *
123      * @return a string containing the formatted statistics block
124      */

125     abstract public String JavaDoc statBlock(Statistics content);
126     
127     /**
128      * output the floor information in the relevant format
129      *
130      * @param floor the floor value for the statistics block
131      *
132      * @return a string containing the formatted floor information
133      */

134     abstract public String JavaDoc floorInfo(int floor);
135     
136     /**
137      * output the explanation of the stat block in the relevant format
138      *
139      * @param explanation the explanatory or clarification text for the stats
140      *
141      * @return a string contianing the formatted explanation
142      */

143     abstract public String JavaDoc blockExplanation(String JavaDoc explanation);
144     
145     /**
146      * output the final footers for this file
147      *
148      * @return a string containing the report footer
149      */

150     abstract public String JavaDoc footer();
151     
152     /**
153      * set the main title for the report
154      *
155      * @param name the name of the service
156      * @param serverName the name of the server
157      */

158     abstract public void setMainTitle (String JavaDoc name, String JavaDoc serverName);
159     
160     /**
161      * add a statistics block to the report to the class register
162      *
163      * @param stat the statistics object to be added to the report
164      */

165     abstract public void addBlock(Statistics stat);
166     
167     /**
168      * render the report
169      *
170      * @return a string containing the full content of the report
171      */

172     abstract public String JavaDoc render();
173     
174     /**
175      * set the starting date for the report
176      *
177      * @param start the start date for the report
178      */

179     abstract public void setStartDate(Date JavaDoc start);
180     
181     /**
182      * set the end date for the report
183      *
184      * @param end the end date for the report
185      */

186     abstract public void setEndDate(Date JavaDoc end);
187 }
188
Popular Tags