View Javadoc
1   /*
2    * Copyright 2007-2009 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.sys.service;
17  
18  import java.util.List;
19  
20  import org.kuali.ole.sys.Message;
21  import org.kuali.rice.krad.bo.BusinessObject;
22  
23  /**
24   * Service interface defines methods that are relevant to writing a report
25   */
26  public interface ReportWriterService {
27      /**
28       * Writes a centered message. The purpose of this is primarily to write custom subtitles necessary in some reports
29       * @param message to be written centered
30       */
31      public void writeSubTitle(String message);
32      
33      /**
34       * Writes an error message for the passed in business object. If the business object is the first or different then the
35       * previous one a table header is printed per definition in the implementation of this service
36       * @param businessObject controlling the table header and values to be printed
37       * @param message associated with the businessObject
38       */
39      public void writeError(BusinessObject businessObject, Message message);
40      
41      /**
42       * Same as writeError except that it provides for multiple messages for the BO. BO values are only printed once and then messages each
43       * row below that.
44       * @param businessObject controlling the table header and values to be printed
45       * @param messages associated with the businessObject
46       */
47      public void writeError(BusinessObject businessObject, List<Message> messages);
48      
49      /**
50       * Writes statistics usually placed at the end of the report. If this is the first time this method is called then a statistics header
51       * is written. All messages are indented per STATISTICS_LEFT_PADDING. If multiple lines are needed, call this method multiple times to
52       * assure pagination works properly
53       * @param message to write
54       * @param args for the message per standard String.format
55       */
56      public void writeStatisticLine(String message, Object ... args);
57      
58      /**
59       * Writes parameter usually placed at the end of the report. If this is the first time this method is called then a parameter header
60       * is written. All messages are indented per PARAMETERS_LEFT_PADDING. If multiple lines are needed, call this method multiple times to
61       * assure pagination works properly
62       * @param message to write
63       * @param args for the message per standard String.format
64       */
65      public abstract void writeParameterLine(String message, Object ... args);
66      
67      /**
68       * Writes "lines" number of newlines to the report
69       * @param lines number of newlines to write to the report
70       */
71      public void writeNewLines(int lines);
72      
73      /**
74       * Pass through to PrintStream.printf except that it also handles pagination. If multiple lines are needed, call this method multiple
75       * times to assure pagination works properly
76       * @param format
77       */
78      public void writeFormattedMessageLine(String format);
79      
80      /**
81       * Pass through to PrintStream.printf except that it also handles pagination. If multiple lines are needed, call this method multiple
82       * times to assure pagination works properly
83       * @param format
84       * @param args
85       */
86      public void writeFormattedMessageLine(String format, Object ... args);
87  
88      public void writeMultipleFormattedMessageLines(String format, Object... args);
89      
90      /**
91       * Write table header into a report for the given business object
92       * @param businessObject the given business object
93       */
94      public void writeTableHeader(BusinessObject businessObject);
95      
96      /**
97       * Write table header into a report for business objects of the given class
98       * @param businessObjectClass the given class of a business object
99       */
100     public abstract void writeTableHeader(Class<? extends BusinessObject> businessObjectClass);
101     
102     /**
103      * Write table row into a report for the given business object
104      * @param businessObject the given business object
105      */
106     public void writeTableRow(BusinessObject businessObject);
107     
108     /**
109      * Write table into a report for the given list of business objects
110      * @param businessObjects the given business objects
111      * @param isHeaderRepeatedInNewPage instruct if the header row needs to be repeated in a new page
112      * @param isRowBreakAcrossPageAllowed determine whether a row can be broken across pages
113      */
114     public void writeTable(List<? extends BusinessObject> businessObjects, boolean isHeaderRepeatedInNewPage, boolean isRowBreakAcrossPageAllowed);
115 
116     /**
117      * Breaking the page and write a new header
118      */
119     public void pageBreak();
120 
121     /**
122      * Write table row into a report for the given business object and also take the colspan in account
123      * @param businessObject the given business object
124      */
125     public void writeTableRowWithColspan(BusinessObject businessObject);
126 
127     /**
128      * write a separation line in a table
129      * @param businessObject the given business object
130      */
131     public void writeTableRowSeparationLine(BusinessObject businessObject);
132 }