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, "");
}
}
}
}
}
}
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;
}
}
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;
}
Aggregations