View Javadoc
1   /**
2    * Copyright 2005-2015 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 data objects to a supported export format.
26   *
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public interface Exporter {
30  
31      /**
32       * Exports the List of BusinessObjects to the specified ExportFormat.
33       *
34       * <p>The resulting output of the export operation should be written to the given
35       * OutputStream</p>
36       *
37       * @param dataObjectClass the type of DataObjects being exported
38       * @param dataObjects a List of DataObjects to export
39       * @param exportFormat the export format in which to export the DataObjects
40       * @param outputStream the OutputStream to write the exported data to
41       * @throws IOException if the process encounters an I/O issue
42       * @throws ExportNotSupportedException if the given ExportFormat is not supported
43       */
44      void export(Class<?> dataObjectClass, List<? extends Object> dataObjects, String exportFormat,
45              OutputStream outputStream) throws IOException, ExportNotSupportedException;
46  
47      /**
48       * Returns a List of ExportFormats supported by this Exporter for the given DataOject class.
49       *
50       * @param dataObjectClass the class of the DataObjects being exported
51       * @return a List of supported ExportFormats
52       */
53      List<String> getSupportedFormats(Class<?> dataObjectClass);
54  
55  }