@Test public void testToDMNModelRuleAnnotationClause() { mapper.toDMNModel(0, 3, Optional::empty); mapper.toDMNModel(1, 3, () -> Optional.of(new BaseGridCellValue<>("value"))); assertEquals("", dtable.getRule().get(0).getAnnotationEntry().get(0).getText().getValue()); assertEquals("value", dtable.getRule().get(1).getAnnotationEntry().get(0).getText().getValue()); }
@Override public void toDMNModel(final int rowIndex, final int columnIndex, final Supplier<Optional<GridCellValue<?>>> cell) { dmnModel.get().ifPresent(dtable -> { final DecisionRule rule = dtable.getRule().get(rowIndex); final DecisionTableSection section = DecisionTableUIModelMapperHelper.getSection(dtable, columnIndex); switch (section) { case ROW_INDEX: break; case INPUT_CLAUSES: final int iei = DecisionTableUIModelMapperHelper.getInputEntryIndex(dtable, columnIndex); rule.getInputEntry().get(iei).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; case OUTPUT_CLAUSES: final int oei = DecisionTableUIModelMapperHelper.getOutputEntryIndex(dtable, columnIndex); rule.getOutputEntry().get(oei).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; case ANNOTATION_CLAUSES: final int annotationIndex = DecisionTableUIModelMapperHelper.getAnnotationEntryIndex(dtable, columnIndex); rule.getAnnotationEntry().get(annotationIndex).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; } }); }
DecisionTableUIModelMapper extends BaseUIModelMapper<DecisionTable> { @Override public void toDMNModel(final int rowIndex, final int columnIndex, final Supplier<Optional<GridCellValue<?>>> cell) { dmnModel.get().ifPresent(dtable -> { final DecisionRule rule = dtable.getRule().get(rowIndex); final DecisionTableSection section = DecisionTableUIModelMapperHelper.getSection(dtable, columnIndex); switch (section) { case ROW_INDEX: break; case INPUT_CLAUSES: final int iei = DecisionTableUIModelMapperHelper.getInputEntryIndex(dtable, columnIndex); rule.getInputEntry().get(iei).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; case OUTPUT_CLAUSES: final int oei = DecisionTableUIModelMapperHelper.getOutputEntryIndex(dtable, columnIndex); rule.getOutputEntry().get(oei).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; case ANNOTATION_CLAUSES: final int annotationIndex = DecisionTableUIModelMapperHelper.getAnnotationEntryIndex(dtable, columnIndex); rule.getAnnotationEntry().get(annotationIndex).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; } }); } }
DecisionTableUIModelMapper extends BaseUIModelMapper<DecisionTable> { @Override public void toDMNModel(final int rowIndex, final int columnIndex, final Supplier<Optional<GridCellValue<?>>> cell) { dmnModel.get().ifPresent(dtable -> { final DecisionRule rule = dtable.getRule().get(rowIndex); final DecisionTableSection section = DecisionTableUIModelMapperHelper.getSection(dtable, columnIndex); switch (section) { case ROW_INDEX: break; case INPUT_CLAUSES: final int iei = DecisionTableUIModelMapperHelper.getInputEntryIndex(dtable, columnIndex); rule.getInputEntry().get(iei).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; case OUTPUT_CLAUSES: final int oei = DecisionTableUIModelMapperHelper.getOutputEntryIndex(dtable, columnIndex); rule.getOutputEntry().get(oei).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; case ANNOTATION_CLAUSES: final int annotationIndex = DecisionTableUIModelMapperHelper.getAnnotationEntryIndex(dtable, columnIndex); rule.getAnnotationEntry().get(annotationIndex).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; } }); } DecisionTableUIModelMapper(final Supplier<GridData> uiModel,
                                      final Supplier<Optional<DecisionTable>> dmnModel,
                                      final ListSelectorView.Presenter listSelector,
                                      final double lineHeight); }
DecisionTableUIModelMapper extends BaseUIModelMapper<DecisionTable> { @Override public void toDMNModel(final int rowIndex, final int columnIndex, final Supplier<Optional<GridCellValue<?>>> cell) { dmnModel.get().ifPresent(dtable -> { final DecisionRule rule = dtable.getRule().get(rowIndex); final DecisionTableSection section = DecisionTableUIModelMapperHelper.getSection(dtable, columnIndex); switch (section) { case ROW_INDEX: break; case INPUT_CLAUSES: final int iei = DecisionTableUIModelMapperHelper.getInputEntryIndex(dtable, columnIndex); rule.getInputEntry().get(iei).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; case OUTPUT_CLAUSES: final int oei = DecisionTableUIModelMapperHelper.getOutputEntryIndex(dtable, columnIndex); rule.getOutputEntry().get(oei).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; case ANNOTATION_CLAUSES: final int annotationIndex = DecisionTableUIModelMapperHelper.getAnnotationEntryIndex(dtable, columnIndex); rule.getAnnotationEntry().get(annotationIndex).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; } }); } DecisionTableUIModelMapper(final Supplier<GridData> uiModel,
                                      final Supplier<Optional<DecisionTable>> dmnModel,
                                      final ListSelectorView.Presenter listSelector,
                                      final double lineHeight); @Override void fromDMNModel(final int rowIndex,
                             final int columnIndex); @Override void toDMNModel(final int rowIndex,
                           final int columnIndex,
                           final Supplier<Optional<GridCellValue<?>>> cell); }
DecisionTableUIModelMapper extends BaseUIModelMapper<DecisionTable> { @Override public void toDMNModel(final int rowIndex, final int columnIndex, final Supplier<Optional<GridCellValue<?>>> cell) { dmnModel.get().ifPresent(dtable -> { final DecisionRule rule = dtable.getRule().get(rowIndex); final DecisionTableSection section = DecisionTableUIModelMapperHelper.getSection(dtable, columnIndex); switch (section) { case ROW_INDEX: break; case INPUT_CLAUSES: final int iei = DecisionTableUIModelMapperHelper.getInputEntryIndex(dtable, columnIndex); rule.getInputEntry().get(iei).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; case OUTPUT_CLAUSES: final int oei = DecisionTableUIModelMapperHelper.getOutputEntryIndex(dtable, columnIndex); rule.getOutputEntry().get(oei).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; case ANNOTATION_CLAUSES: final int annotationIndex = DecisionTableUIModelMapperHelper.getAnnotationEntryIndex(dtable, columnIndex); rule.getAnnotationEntry().get(annotationIndex).getText().setValue(cell.get().orElse(new BaseGridCellValue<>("")).getValue().toString()); break; } }); } DecisionTableUIModelMapper(final Supplier<GridData> uiModel,
                                      final Supplier<Optional<DecisionTable>> dmnModel,
                                      final ListSelectorView.Presenter listSelector,
                                      final double lineHeight); @Override void fromDMNModel(final int rowIndex,
                             final int columnIndex); @Override void toDMNModel(final int rowIndex,
                           final int columnIndex,
                           final Supplier<Optional<GridCellValue<?>>> cell);  }