DefaultReportOutputHandlerFactory implements ReportOutputHandlerFactory { public Set<Map.Entry<String, String>> getSupportedOutputTypes() { Messages m = Messages.getInstance(); LinkedHashMap<String, String> outputTypes = new LinkedHashMap<String, String>(); if ( isHtmlPageVisible() && isHtmlPageAvailable() ) { outputTypes.put( HtmlTableModule.TABLE_HTML_PAGE_EXPORT_TYPE, m.getString( "ReportPlugin.outputHTMLPaginated" ) ); } if ( isHtmlStreamVisible() && isHtmlStreamAvailable() ) { outputTypes.put( HtmlTableModule.TABLE_HTML_STREAM_EXPORT_TYPE, m.getString( "ReportPlugin.outputHTMLStream" ) ); } if ( isMailVisible() && isMailAvailable() ) { outputTypes.put( SimpleReportingAction.MIME_TYPE_EMAIL, m.getString( "ReportPlugin.outputEmail" ) ); } if ( isPdfVisible() && isPdfAvailable() ) { outputTypes.put( PdfPageableModule.PDF_EXPORT_TYPE, m.getString( "ReportPlugin.outputPDF" ) ); } if ( isXlsVisible() && isXlsAvailable() ) { outputTypes.put( ExcelTableModule.EXCEL_FLOW_EXPORT_TYPE, m.getString( "ReportPlugin.outputXLS" ) ); } if ( isXlsxVisible() && isXlsxAvailable() ) { outputTypes.put( ExcelTableModule.XLSX_FLOW_EXPORT_TYPE, m.getString( "ReportPlugin.outputXLSX" ) ); } if ( isCsvVisible() && isCsvAvailable() ) { outputTypes.put( CSVTableModule.TABLE_CSV_STREAM_EXPORT_TYPE, m.getString( "ReportPlugin.outputCSV" ) ); } if ( isRtfVisible() && isRtfAvailable() ) { outputTypes.put( RTFTableModule.TABLE_RTF_FLOW_EXPORT_TYPE, m.getString( "ReportPlugin.outputRTF" ) ); } if ( isTextVisible() && isTextAvailable() ) { outputTypes.put( PlainTextPageableModule.PLAINTEXT_EXPORT_TYPE, m.getString( "ReportPlugin.outputTXT" ) ); } return Collections.unmodifiableSet( outputTypes.entrySet() ); } DefaultReportOutputHandlerFactory(); boolean isHtmlStreamVisible(); void setHtmlStreamVisible( final boolean htmlStreamVisible ); boolean isHtmlPageVisible(); void setHtmlPageVisible( final boolean htmlPageVisible ); boolean isXlsVisible(); void setXlsVisible( final boolean xlsVisible ); boolean isXlsxVisible(); void setXlsxVisible( final boolean xlsxVisible ); boolean isCsvVisible(); void setCsvVisible( final boolean csvVisible ); boolean isRtfVisible(); void setRtfVisible( final boolean rtfVisible ); boolean isPdfVisible(); void setPdfVisible( final boolean pdfVisible ); boolean isTextVisible(); void setTextVisible( final boolean textVisible ); boolean isMailVisible(); void setMailVisible( final boolean mailVisible ); boolean isXmlTableVisible(); void setXmlTableVisible( final boolean xmlTableVisible ); boolean isXmlPageVisible(); void setXmlPageVisible( final boolean xmlPageVisible ); boolean isPngVisible(); void setPngVisible( final boolean pngVisible ); boolean isHtmlStreamAvailable(); void setHtmlStreamAvailable( final boolean htmlStreamAvailable ); boolean isHtmlPageAvailable(); void setHtmlPageAvailable( final boolean htmlPageAvailable ); boolean isXlsAvailable(); void setXlsAvailable( final boolean xlsAvailable ); boolean isXlsxAvailable(); void setXlsxAvailable( final boolean xlsxAvailable ); boolean isCsvAvailable(); void setCsvAvailable( final boolean csvAvailable ); boolean isRtfAvailable(); void setRtfAvailable( final boolean rtfAvailable ); boolean isPdfAvailable(); void setPdfAvailable( final boolean pdfAvailable ); boolean isTextAvailable(); void setTextAvailable( final boolean textAvailable ); boolean isMailAvailable(); void setMailAvailable( final boolean mailAvailable ); boolean isXmlTableAvailable(); void setXmlTableAvailable( final boolean xmlTableAvailable ); boolean isXmlPageAvailable(); void setXmlPageAvailable( final boolean xmlPageAvailable ); boolean isPngAvailable(); void setPngAvailable( final boolean pngAvailable ); String getMimeType( final ReportOutputHandlerSelector selector ); Set<Map.Entry<String, String>> getSupportedOutputTypes(); ReportOutputHandler createOutputHandlerForOutputType( final ReportOutputHandlerSelector selector );  }
@Test public void testGetSupportedOutputTypes() throws Exception { List<String> expectations = new ArrayList<String>(); expectations.add( "table/html;page-mode=page" ); expectations.add( "table/html;page-mode=stream" ); expectations.add( "pageable/pdf" ); expectations.add( "table/excel;page-mode=flow" ); expectations.add( "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;page-mode=flow" ); expectations.add( "table/csv;page-mode=stream" ); expectations.add( "table/rtf;page-mode=flow" ); expectations.add( "pageable/text" ); Set<Map.Entry<String, String>> outputTypes = roh.getSupportedOutputTypes(); List<Object> outputs = Arrays.asList( outputTypes.toArray() ); List<String> expectedOutputs = new ArrayList<String>(); for ( int i = 0; i < outputTypes.size(); i++ ) { expectedOutputs.add( ( (Map.Entry) outputs.get( i ) ).getKey().toString() ); } for ( String expectation : expectations ) { assertTrue( expectedOutputs.contains( expectation ) ); } }