Search in sources :

Example 1 with LiteralValueBuilder

use of org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.LiteralValueBuilder in project drools-wb by kiegroup.

the class GuidedDecisionTablePopulater method assertDecisionTableData.

private void assertDecisionTableData(final String varName, final String varDataType, final List<ParameterizedValueBuilder> valueBuilders, final int maxRowCount) {
    if (varName.equals("")) {
        for (ParameterizedValueBuilder pvb : valueBuilders) {
            if (pvb instanceof LiteralValueBuilder) {
                for (int iRowIndex = 0; iRowIndex < maxRowCount; iRowIndex++) {
                    final int _rowIndex = ruleRowStartIndex + iRowIndex + 1;
                    final int _columnIndex = ruleColumnStartIndex + valueBuilders.indexOf(pvb) + 1;
                    final List<DTCellValue52> fragmentRow = pvb.getColumnData().get(iRowIndex);
                    final List<DTCellValue52> dtableRow = dtable.getData().get(iRowIndex);
                    final DTCellValue52 fragmentCell = fragmentRow.get(0);
                    assertDTCellValue(varDataType, fragmentCell, (final String value, final DataType.DataTypes dataType) -> addConversionMessage(value, dataType, _rowIndex, _columnIndex));
                    dtableRow.add(fragmentCell);
                }
                break;
            }
        }
    } else {
        for (ParameterizedValueBuilder pvb : valueBuilders) {
            final int varNameIndex = pvb.getParameters().indexOf(varName);
            if (varNameIndex > -1) {
                for (int iRowIndex = 0; iRowIndex < maxRowCount; iRowIndex++) {
                    final int _rowIndex = ruleRowStartIndex + iRowIndex + 1;
                    final int _columnIndex = ruleColumnStartIndex + valueBuilders.indexOf(pvb) + 1;
                    final List<DTCellValue52> fragmentRow = pvb.getColumnData().get(iRowIndex);
                    final List<DTCellValue52> dtableRow = dtable.getData().get(iRowIndex);
                    final DTCellValue52 fragmentCell = fragmentRow.get(varNameIndex);
                    assertDTCellValue(varDataType, fragmentCell, (final String value, final DataType.DataTypes dataType) -> addConversionMessage(value, dataType, _rowIndex, _columnIndex));
                    dtableRow.add(fragmentCell);
                }
                break;
            }
        }
    }
}
Also used : ParameterizedValueBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.ParameterizedValueBuilder) LiteralValueBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.LiteralValueBuilder) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Aggregations

DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)1 LiteralValueBuilder (org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.LiteralValueBuilder)1 ParameterizedValueBuilder (org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.ParameterizedValueBuilder)1