001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.kfs.sys.service; 017 018 import java.io.ByteArrayOutputStream; 019 import java.util.Date; 020 import java.util.Map; 021 022 /** 023 * To provide utilities that can generate reports 024 */ 025 public interface ReportGenerationService { 026 027 /** 028 * generate a report as PDF file with the given file name 029 * 030 * @param reportData the data being written into the PDF report file 031 * @param template the report template full file name 032 * @param reportFileName the full name of the generated PDF file 033 */ 034 public void generateReportToPdfFile(Map<String, Object> reportData, String template, String reportFileName); 035 036 /** 037 * generate a report as PDF file with the given file name 038 * 039 * @param reportData the data being written into the PDF report file 040 * @param dataSource the data source being used for the PDF report 041 * @param template the report template full file name 042 * @param reportFileName the full name of the generated PDF file 043 */ 044 public void generateReportToPdfFile(Map<String, Object> reportData, Object dataSource, String template, String reportFileName); 045 046 /** 047 * generate a report as PDF file and outputs to stream 048 * 049 * @param reportData the data being written into the PDF report file 050 * @param dataSource the data source being used for the PDF report 051 * @param template the report template full file name 052 * @param reportFileName the output stream for sending back contents 053 */ 054 public void generateReportToOutputStream(Map<String, Object> reportData, Object dataSource, String template, ByteArrayOutputStream baos); 055 056 /** 057 * build a full file name with the given information. The format of the file name is <absolute path><filename>_<timestamp>.<extension> 058 * 059 * @param directory the directory where the file would be located 060 * @param fileName the given file name without file extension 061 * @param extension the given file extension 062 * @param runDate the run date which is used to generate a timestamp 063 * @return a full file name built from the given information. 064 */ 065 public String buildFullFileName(Date runDate, String directory, String fileName, String extension); 066 }