View Javadoc
1   /*
2    * Copyright 2008 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.io.ByteArrayOutputStream;
19  import java.util.Date;
20  import java.util.Map;
21  
22  /**
23   * To provide utilities that can generate reports
24   */
25  public interface ReportGenerationService {
26  
27      /**
28       * generate a report as PDF file with the given file name
29       * 
30       * @param reportData the data being written into the PDF report file
31       * @param template the report template full file name
32       * @param reportFileName the full name of the generated PDF file
33       */
34      public void generateReportToPdfFile(Map<String, Object> reportData, String template, String reportFileName);
35  
36      /**
37       * generate a report as PDF file with the given file name
38       * 
39       * @param reportData the data being written into the PDF report file
40       * @param dataSource the data source being used for the PDF report
41       * @param template the report template full file name
42       * @param reportFileName the full name of the generated PDF file
43       */
44      public void generateReportToPdfFile(Map<String, Object> reportData, Object dataSource, String template, String reportFileName);
45      
46      /**
47       * generate a report as PDF file and outputs to stream
48       * 
49       * @param reportData the data being written into the PDF report file
50       * @param dataSource the data source being used for the PDF report
51       * @param template the report template full file name
52       * @param reportFileName the output stream for sending back contents
53       */
54      public void generateReportToOutputStream(Map<String, Object> reportData, Object dataSource, String template, ByteArrayOutputStream baos);
55  
56      /**
57       * build a full file name with the given information. The format of the file name is <absolute path><filename>_<timestamp>.<extension> 
58       * 
59       * @param directory the directory where the file would be located
60       * @param fileName the given file name without file extension
61       * @param extension the given file extension
62       * @param runDate the run date which is used to generate a timestamp
63       * @return a full file name built from the given information.
64       */
65      public String buildFullFileName(Date runDate, String directory, String fileName, String extension);
66  }