@Test public void convertEmptyTable() throws IOException { final Path path = PathFactory.newPath("file.gdst", "file: final GuidedDecisionTable52 table52 = new GuidedDecisionTable52(); doReturn(mock(PackageDataModelOracle.class)).when(dataModelService).getDataModel(any()); doReturn(table52).when(guidedDecisionTableEditorService).load(path); doReturn("id").when(sessionInfo).getId(); final XLSConversionResult convert = converter.convert(path); assertNotNull(convert); verify(decisionTableXLSService).create(any(), any(ByteArrayInputStream.class), eq("id"), eq("Converted from file.gdst")); }
public XLSConversionResult convert(final Path originPath) throws IOException { final PackageDataModelOracle dmo = dataModelService.getDataModel(originPath); final GuidedDecisionTable52 dtable = guidedDecisionTableEditorService.load(originPath); final XLSBuilder.BuildResult buildResult = new XLSBuilder(dtable, dmo).build(); if (buildResult.getConversionResult().isConverted()) { final Workbook workbook = buildResult.getWorkbook(); final ByteArrayOutputStream fileOut = new ByteArrayOutputStream(); workbook.write(fileOut); final ByteArrayInputStream inStream = new ByteArrayInputStream(fileOut.toByteArray()); decisionTableXLSService.create(getDestinationFilePath(originPath), inStream, sessionInfo.getId(), "Converted from " + originPath.getFileName()); fileOut.close(); workbook.close(); inStream.close(); } return buildResult.getConversionResult(); }
DecisionTableGuidedToDecisionTableXLSConverter { public XLSConversionResult convert(final Path originPath) throws IOException { final PackageDataModelOracle dmo = dataModelService.getDataModel(originPath); final GuidedDecisionTable52 dtable = guidedDecisionTableEditorService.load(originPath); final XLSBuilder.BuildResult buildResult = new XLSBuilder(dtable, dmo).build(); if (buildResult.getConversionResult().isConverted()) { final Workbook workbook = buildResult.getWorkbook(); final ByteArrayOutputStream fileOut = new ByteArrayOutputStream(); workbook.write(fileOut); final ByteArrayInputStream inStream = new ByteArrayInputStream(fileOut.toByteArray()); decisionTableXLSService.create(getDestinationFilePath(originPath), inStream, sessionInfo.getId(), "Converted from " + originPath.getFileName()); fileOut.close(); workbook.close(); inStream.close(); } return buildResult.getConversionResult(); } }
DecisionTableGuidedToDecisionTableXLSConverter { public XLSConversionResult convert(final Path originPath) throws IOException { final PackageDataModelOracle dmo = dataModelService.getDataModel(originPath); final GuidedDecisionTable52 dtable = guidedDecisionTableEditorService.load(originPath); final XLSBuilder.BuildResult buildResult = new XLSBuilder(dtable, dmo).build(); if (buildResult.getConversionResult().isConverted()) { final Workbook workbook = buildResult.getWorkbook(); final ByteArrayOutputStream fileOut = new ByteArrayOutputStream(); workbook.write(fileOut); final ByteArrayInputStream inStream = new ByteArrayInputStream(fileOut.toByteArray()); decisionTableXLSService.create(getDestinationFilePath(originPath), inStream, sessionInfo.getId(), "Converted from " + originPath.getFileName()); fileOut.close(); workbook.close(); inStream.close(); } return buildResult.getConversionResult(); }  }
DecisionTableGuidedToDecisionTableXLSConverter { public XLSConversionResult convert(final Path originPath) throws IOException { final PackageDataModelOracle dmo = dataModelService.getDataModel(originPath); final GuidedDecisionTable52 dtable = guidedDecisionTableEditorService.load(originPath); final XLSBuilder.BuildResult buildResult = new XLSBuilder(dtable, dmo).build(); if (buildResult.getConversionResult().isConverted()) { final Workbook workbook = buildResult.getWorkbook(); final ByteArrayOutputStream fileOut = new ByteArrayOutputStream(); workbook.write(fileOut); final ByteArrayInputStream inStream = new ByteArrayInputStream(fileOut.toByteArray()); decisionTableXLSService.create(getDestinationFilePath(originPath), inStream, sessionInfo.getId(), "Converted from " + originPath.getFileName()); fileOut.close(); workbook.close(); inStream.close(); } return buildResult.getConversionResult(); }  XLSConversionResult convert(final Path originPath); }
DecisionTableGuidedToDecisionTableXLSConverter { public XLSConversionResult convert(final Path originPath) throws IOException { final PackageDataModelOracle dmo = dataModelService.getDataModel(originPath); final GuidedDecisionTable52 dtable = guidedDecisionTableEditorService.load(originPath); final XLSBuilder.BuildResult buildResult = new XLSBuilder(dtable, dmo).build(); if (buildResult.getConversionResult().isConverted()) { final Workbook workbook = buildResult.getWorkbook(); final ByteArrayOutputStream fileOut = new ByteArrayOutputStream(); workbook.write(fileOut); final ByteArrayInputStream inStream = new ByteArrayInputStream(fileOut.toByteArray()); decisionTableXLSService.create(getDestinationFilePath(originPath), inStream, sessionInfo.getId(), "Converted from " + originPath.getFileName()); fileOut.close(); workbook.close(); inStream.close(); } return buildResult.getConversionResult(); }  XLSConversionResult convert(final Path originPath);  }