private Format readOptionFormat(CliArguments arguments) { Format format = Format.AUTO; if (arguments.hasOption("format")) { format = Format.valueOf(arguments.option("format").toUpperCase()); } return format; }
public void loadDataset(String fileName, int maxCount) { // Clearing the database if (database == null) { database = new SequenceDatabase(); } else { database.clear(); } // Tries to guess the format if it is a predefined dataset try { Format datasetFormat = Format.valueOf(fileName); loadPredefinedDataset(datasetFormat, maxCount); } catch (IllegalArgumentException e) { loadCustomDataset(fileName, maxCount); } // Shuffling the database Collections.shuffle(database.getSequences()); }
private String saveReport(JasperPrint jasperPrint, String format, String destFileName) throws JRException, Exception { String reportName = null; switch (Format.valueOf(format)) { case pdf: JasperExportManager.exportReportToPdfFile(jasperPrint, destFileName); reportName = destFileName; break; case html: JasperExportManager.exportReportToHtmlFile(jasperPrint, destFileName); reportName = createZip(destFileName); break; case xml: JasperExportManager.exportReportToXmlFile(jasperPrint, destFileName, true); reportName = createZip(destFileName); break; case csv: JRCsvExporter exporter = new JRCsvExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFileName); exporter.exportReport(); reportName = destFileName; break; default: LogUtils.errorf(this, "Error Running Report: Unknown Format: %s", format); } return reportName; }