Search in sources :

Example 6 with GuidedDecisionTableSourceBuilder

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

the class GuidedDecisionTableGeneratorListener method assertValueBuildersRowData.

private void assertValueBuildersRowData() {
    // new row is created the GuidedDecisionTableSourceBuilders contain sufficient row data
    if (_sourceBuilders != null) {
        final int rowCount = getRowCount();
        final int columnCount = _sourceBuilders.size();
        for (GuidedDecisionTableSourceBuilder sb : _sourceBuilders) {
            if (sb instanceof GuidedDecisionTableSourceBuilderDirect) {
                final GuidedDecisionTableSourceBuilderDirect sbd = (GuidedDecisionTableSourceBuilderDirect) sb;
                if (sbd.getRowCount() < rowCount) {
                    sbd.addCellValue(rowCount, columnCount, "");
                }
            } else if (sb instanceof GuidedDecisionTableSourceBuilderIndirect) {
                final GuidedDecisionTableSourceBuilderIndirect sbi = (GuidedDecisionTableSourceBuilderIndirect) sb;
                for (ParameterizedValueBuilder pvb : sbi.getValueBuilders().values()) {
                    if (pvb.getColumnData().size() < rowCount) {
                        pvb.addCellValue(rowCount, columnCount, "");
                    }
                }
            }
        }
    }
}
Also used : ParameterizedValueBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.ParameterizedValueBuilder) GuidedDecisionTableSourceBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableSourceBuilder) GuidedDecisionTableSourceBuilderDirect(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableSourceBuilderDirect) GuidedDecisionTableSourceBuilderIndirect(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableSourceBuilderIndirect)

Example 7 with GuidedDecisionTableSourceBuilder

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

the class GuidedDecisionTableGeneratorListener method doActionTypeCell.

private void doActionTypeCell(final int row, final int column, final String trimVal) {
    _ruleEndColumn = column;
    ActionType.addNewActionType(this._actions, trimVal, column, row);
    final ActionType actionType = getActionForColumn(row, column);
    GuidedDecisionTableSourceBuilder sb = null;
    switch(actionType.getCode()) {
        case CONDITION:
        case ACTION:
            // SourceBuilders for ACTIONs are set when processing the Object row
            break;
        case NAME:
            sb = new GuidedDecisionTableNameBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case DESCRIPTION:
            // Remove default Description Column builder and add that provided
            this._sourceBuilders.remove(DEFAULT_DESCRIPTION_BUILDER);
            sb = new GuidedDecisionTableDescriptionBuilder(row - 1, column, this._conversionResult);
            // Description column must always be at position 1
            this._sourceBuilders.add(DESCRIPTION_COLUMN_INDEX, sb);
            actionType.setSourceBuilder(sb);
            break;
        case SALIENCE:
            sb = new GuidedDecisionTableSalienceBuilder(row - 1, column, this._currentSequentialFlag, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case DURATION:
            sb = new GuidedDecisionTableDurationBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case TIMER:
            sb = new GuidedDecisionTableTimerBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case CALENDARS:
            sb = new GuidedDecisionTableCalendarsBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case NOLOOP:
            sb = new GuidedDecisionTableNoLoopBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case LOCKONACTIVE:
            sb = new GuidedDecisionTableLockonActiveBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case AUTOFOCUS:
            sb = new GuidedDecisionTableAutoFocusBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case ACTIVATIONGROUP:
            sb = new GuidedDecisionTableActivationGroupBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case AGENDAGROUP:
            sb = new GuidedDecisionTableAgendaGroupBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case RULEFLOWGROUP:
            sb = new GuidedDecisionTableRuleflowGroupBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case DATEEFFECTIVE:
            sb = new GuidedDecisionTableDateEffectiveBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case DATEEXPIRES:
            sb = new GuidedDecisionTableDateExpiresBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
        case METADATA:
            sb = new GuidedDecisionTableMetadataBuilder(row - 1, column, this._conversionResult);
            actionType.setSourceBuilder(sb);
            this._sourceBuilders.add(sb);
            break;
    }
}
Also used : GuidedDecisionTableAgendaGroupBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableAgendaGroupBuilder) ActionType(org.drools.decisiontable.parser.ActionType) GuidedDecisionTableCalendarsBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableCalendarsBuilder) GuidedDecisionTableActivationGroupBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableActivationGroupBuilder) GuidedDecisionTableDateEffectiveBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableDateEffectiveBuilder) GuidedDecisionTableTimerBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableTimerBuilder) GuidedDecisionTableAutoFocusBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableAutoFocusBuilder) GuidedDecisionTableNameBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableNameBuilder) GuidedDecisionTableMetadataBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableMetadataBuilder) GuidedDecisionTableSourceBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableSourceBuilder) GuidedDecisionTableRuleflowGroupBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableRuleflowGroupBuilder) GuidedDecisionTableDateExpiresBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableDateExpiresBuilder) GuidedDecisionTableSalienceBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableSalienceBuilder) GuidedDecisionTableDescriptionBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableDescriptionBuilder) GuidedDecisionTableNoLoopBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableNoLoopBuilder) GuidedDecisionTableDurationBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableDurationBuilder) GuidedDecisionTableLockonActiveBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableLockonActiveBuilder)

Example 8 with GuidedDecisionTableSourceBuilder

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

the class GuidedDecisionTablePopulater method getOrderedValueBuilders.

private List<ParameterizedValueBuilder> getOrderedValueBuilders() {
    // Get ordered list of ParameterizedValueBuilder for all GuidedDecisionTableSourceBuilderIndirect instances
    // An ordered list of ParameterizedValueBuilder guarantees they are checked in the same order as columns
    // were added to the Guided Decision Table.
    final List<ParameterizedValueBuilder> valueBuilders = new ArrayList<>();
    for (GuidedDecisionTableSourceBuilder sb : sourceBuilders) {
        if (sb instanceof GuidedDecisionTableSourceBuilderIndirect) {
            final GuidedDecisionTableSourceBuilderIndirect isb = (GuidedDecisionTableSourceBuilderIndirect) sb;
            final Set<Integer> sortedIndexes = new TreeSet<>(isb.getValueBuilders().keySet());
            for (Integer index : sortedIndexes) {
                final ParameterizedValueBuilder vb = isb.getValueBuilders().get(index);
                valueBuilders.add(vb);
            }
        }
    }
    return valueBuilders;
}
Also used : ParameterizedValueBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.ParameterizedValueBuilder) GuidedDecisionTableSourceBuilder(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableSourceBuilder) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) GuidedDecisionTableSourceBuilderIndirect(org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableSourceBuilderIndirect)

Aggregations

GuidedDecisionTableSourceBuilder (org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableSourceBuilder)8 ActionType (org.drools.decisiontable.parser.ActionType)4 GuidedDecisionTableRHSBuilder (org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableRHSBuilder)4 ArrayList (java.util.ArrayList)3 GuidedDecisionTableLHSBuilder (org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableLHSBuilder)3 GuidedDecisionTableSourceBuilderIndirect (org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.GuidedDecisionTableSourceBuilderIndirect)3 ParameterizedValueBuilder (org.drools.workbench.screens.dtablexls.backend.server.conversion.builders.ParameterizedValueBuilder)3 BRLVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLVariableColumn)2 HashMap (java.util.HashMap)1 List (java.util.List)1 TreeSet (java.util.TreeSet)1 ActionRetractFact (org.drools.workbench.models.datamodel.rule.ActionRetractFact)1 IAction (org.drools.workbench.models.datamodel.rule.IAction)1 IPattern (org.drools.workbench.models.datamodel.rule.IPattern)1 InterpolationVariable (org.drools.workbench.models.datamodel.rule.InterpolationVariable)1 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)1 RuleModelVisitor (org.drools.workbench.models.datamodel.rule.visitors.RuleModelVisitor)1 BRLActionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn)1 BRLActionVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionVariableColumn)1 BRLConditionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn)1