@Test public void testConvert() { List<Future<File>> futures = testConvertDocumentService.convert( mockInputFile, mockOutputDir, DocumentType.HTML, DocumentType.PDF, DocumentType.TEXT); for (Future<File> future : futures) { try { assertTrue(FilenameUtils.getExtension(future.get().getName()).matches("(html|pdf|txt)")); } catch (Exception e) { fail(e.getMessage()); } } }
public List<Future<File>> convert(File inputFile, File outputDir, DocumentType... documentTypes) { logger.debug("convert begin"); List<Future<File>> futures = new ArrayList<>(); for (DocumentType type : documentTypes) { if (type == DocumentType.HTML) { futures.add(convert2HTML(inputFile, outputDir)); } else if (type == DocumentType.TEXT) { futures.add(convert2Text(inputFile, outputDir)); } else if (type == DocumentType.PDF) { futures.add(convert2PDF(inputFile, outputDir)); } } return futures; }
ConvertDocumentService implements IConvertDocumentService { public List<Future<File>> convert(File inputFile, File outputDir, DocumentType... documentTypes) { logger.debug("convert begin"); List<Future<File>> futures = new ArrayList<>(); for (DocumentType type : documentTypes) { if (type == DocumentType.HTML) { futures.add(convert2HTML(inputFile, outputDir)); } else if (type == DocumentType.TEXT) { futures.add(convert2Text(inputFile, outputDir)); } else if (type == DocumentType.PDF) { futures.add(convert2PDF(inputFile, outputDir)); } } return futures; } }
ConvertDocumentService implements IConvertDocumentService { public List<Future<File>> convert(File inputFile, File outputDir, DocumentType... documentTypes) { logger.debug("convert begin"); List<Future<File>> futures = new ArrayList<>(); for (DocumentType type : documentTypes) { if (type == DocumentType.HTML) { futures.add(convert2HTML(inputFile, outputDir)); } else if (type == DocumentType.TEXT) { futures.add(convert2Text(inputFile, outputDir)); } else if (type == DocumentType.PDF) { futures.add(convert2PDF(inputFile, outputDir)); } } return futures; } @Autowired  ConvertDocumentService(ConvertDocumentConfiguration config); }
ConvertDocumentService implements IConvertDocumentService { public List<Future<File>> convert(File inputFile, File outputDir, DocumentType... documentTypes) { logger.debug("convert begin"); List<Future<File>> futures = new ArrayList<>(); for (DocumentType type : documentTypes) { if (type == DocumentType.HTML) { futures.add(convert2HTML(inputFile, outputDir)); } else if (type == DocumentType.TEXT) { futures.add(convert2Text(inputFile, outputDir)); } else if (type == DocumentType.PDF) { futures.add(convert2PDF(inputFile, outputDir)); } } return futures; } @Autowired  ConvertDocumentService(ConvertDocumentConfiguration config); @Autowired void setResourceLoader(ResourceLoader resourceLoader); Future<File> convertCDA2HTML(String eventId, String cda, File outputDir); Future<File> convert2HTML(File inputFile, File outputDir); Future<File> convert2PDF(File inputFile, File outputDir); Future<File> convert2Text(File inputFile, File outputDir); List<Future<File>> convert(File inputFile, File outputDir, DocumentType... documentTypes); }
ConvertDocumentService implements IConvertDocumentService { public List<Future<File>> convert(File inputFile, File outputDir, DocumentType... documentTypes) { logger.debug("convert begin"); List<Future<File>> futures = new ArrayList<>(); for (DocumentType type : documentTypes) { if (type == DocumentType.HTML) { futures.add(convert2HTML(inputFile, outputDir)); } else if (type == DocumentType.TEXT) { futures.add(convert2Text(inputFile, outputDir)); } else if (type == DocumentType.PDF) { futures.add(convert2PDF(inputFile, outputDir)); } } return futures; } @Autowired  ConvertDocumentService(ConvertDocumentConfiguration config); @Autowired void setResourceLoader(ResourceLoader resourceLoader); Future<File> convertCDA2HTML(String eventId, String cda, File outputDir); Future<File> convert2HTML(File inputFile, File outputDir); Future<File> convert2PDF(File inputFile, File outputDir); Future<File> convert2Text(File inputFile, File outputDir); List<Future<File>> convert(File inputFile, File outputDir, DocumentType... documentTypes);  }