View Javadoc

1   /**
2    * Copyright 2005-2012 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.rice.krad.bo;
17  
18  import org.kuali.rice.krad.exception.ExportNotSupportedException;
19  
20  import java.io.IOException;
21  import java.io.OutputStream;
22  import java.util.List;
23  
24  /**
25   * An Exporter provides the ability to export a List of BusinessObjects to a
26   * supported ExportFormat.
27   * 
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   */
30  public interface Exporter {
31  
32  	/**
33  	 * Exports the List of BusinessObjects to the specified ExportFormat. The
34  	 * resulting output of the export operation should be written to the given
35  	 * OutputStream.
36  	 * 
37  	 * @param dataObjectClass
38  	 *            the type of DataObjects being exported
39  	 * @param data
40  	 *            a List of DataObjects to export
41  	 * @param exportFormat
42  	 *            the export format in which to export the DataObjects
43  	 * @param outputStream
44  	 *            the OutputStream to write the exported data to
45  	 * 
46  	 * @throws IOException
47  	 *             if the process encounters an I/O issue
48  	 * @throws ExportNotSupportedException
49  	 *             if the given ExportFormat is not supported
50  	 */
51  	public void export(Class<?> dataObjectClass,
52  			List<? extends Object> dataObjects, String exportFormat,
53  			OutputStream outputStream) throws IOException, ExportNotSupportedException;
54  
55  	/**
56  	 * Returns a List of ExportFormats supported by this Exporter for the given
57  	 * DataOject class.
58  	 * 
59  	 * @param dataObjectClass
60  	 *            the class of the DataObjects being exported
61  	 * @return a List of supported ExportFormats
62  	 */
63  	public List<String> getSupportedFormats(Class<?> dataObjectClass);
64  
65  }