use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class ConditionColumnSynchronizerTest method testUpdate6.
@Test
public void testUpdate6() throws VetoException {
// Single Pattern, single Condition
final Pattern52 pattern = spy(boundApplicantPattern("$a"));
final ConditionCol52 condition = spy(ageEqualsCondition());
modelSynchronizer.appendColumn(pattern, condition);
final Pattern52 editedPattern = boundApplicantPattern("$a");
final ConditionCol52 editedCondition = ageEqualsCondition();
editedCondition.setWidth(condition.getWidth());
editedCondition.setOperator("!=");
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(pattern, condition, editedPattern, editedCondition);
assertEquals(1, diffs.size());
verify(pattern).diff(editedPattern);
verify(condition).diff(editedCondition);
assertEquals(4, model.getExpandedColumns().size());
assertEquals(1, model.getConditions().size());
assertEquals(1, model.getConditionPattern("$a").getChildColumns().size());
assertEquals(4, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(3) instanceof IntegerUiColumn);
assertEquals(editedPattern.getBoundName() + " : " + editedPattern.getFactType(), uiModel.getColumns().get(3).getHeaderMetaData().get(0).getTitle());
assertEquals(editedCondition.getHeader(), uiModel.getColumns().get(3).getHeaderMetaData().get(1).getTitle());
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class ConditionColumnSynchronizerTest method testUpdate4.
@Test
public void testUpdate4() throws VetoException {
// Multiple Patterns, multiple Conditions
final Pattern52 pattern1 = spy(boundApplicantPattern("$a"));
final ConditionCol52 condition1 = spy(ageEqualsCondition());
modelSynchronizer.appendColumn(pattern1, condition1);
final Pattern52 editedPattern = boundAddressPattern("$d");
final ConditionCol52 editedCondition = new ConditionCol52();
editedCondition.setWidth(condition1.getWidth());
editedCondition.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
editedCondition.setHeader("col1");
editedCondition.setFactField("country");
editedCondition.setOperator("==");
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(pattern1, condition1, editedPattern, editedCondition);
assertEquals(3, diffs.size());
verify(pattern1).diff(editedPattern);
verify(condition1).diff(editedCondition);
assertEquals(4, model.getExpandedColumns().size());
assertEquals(1, model.getConditions().size());
assertNull(model.getConditionPattern("$a"));
assertEquals(1, model.getConditionPattern("$d").getChildColumns().size());
assertEquals(4, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(3) instanceof StringUiColumn);
assertEquals(editedPattern.getBoundName() + " : " + editedPattern.getFactType(), uiModel.getColumns().get(3).getHeaderMetaData().get(0).getTitle());
assertEquals(editedCondition.getHeader(), uiModel.getColumns().get(3).getHeaderMetaData().get(1).getTitle());
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class AuditLogEntryCellHelper method buildColumnDetailsUpdate.
private void buildColumnDetailsUpdate(final LimitedEntryActionSetFieldColumnDetails details, final LimitedEntryActionSetFieldColumnDetails originalDetails, final List<BaseColumnFieldDiff> diffs, final SafeHtmlBuilder sb) {
sb.append(TEMPLATE.commentHeader(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogUpdateAction(details.getColumnHeader())));
SafeHtmlBuilder sbFields = null;
// Show changed fields too.
if (diffs != null && !diffs.isEmpty()) {
sbFields = new SafeHtmlBuilder();
for (BaseColumnFieldDiff diff : diffs) {
String changedFieldName = diff.getFieldName();
// if (changedFieldName.equals(ActionInsertFactCol52.FIELD_TYPE)) buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.Binding(), diff.getOldValue(), diff.getValue(), sb);
if (changedFieldName.equals(DTColumnConfig52.FIELD_HEADER)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.ColumnHeader(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(LimitedEntryActionSetFieldCol52.FIELD_VALUE)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.Value(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(ActionInsertFactCol52.FIELD_BOUND_NAME)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.Binding(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(ActionInsertFactCol52.FIELD_FACT_FIELD)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.Field(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(ActionInsertFactCol52.FIELD_IS_INSERT_LOGICAL)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.LogicallyInsert(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(ActionInsertFactCol52.FIELD_VALUE_LIST)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.ValueList(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(DTColumnConfig52.FIELD_DEFAULT_VALUE)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.DefaultValue(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(DTColumnConfig52.FIELD_HIDE_COLUMN)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.HideThisColumn(), diff.getOldValue(), diff.getValue(), sbFields);
}
}
}
if (sbFields != null) {
sb.append(TEMPLATE.updatedFields(sbFields.toSafeHtml(), labelClass));
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class AuditLogEntryCellHelper method buildColumnDetailsUpdate.
private void buildColumnDetailsUpdate(final MetadataColumnDetails details, final MetadataColumnDetails originalDetails, final List<BaseColumnFieldDiff> diffs, final SafeHtmlBuilder sb) {
sb.append(TEMPLATE.commentHeader(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogUpdateColumn(details.getColumnHeader())));
SafeHtmlBuilder sbFields = null;
// Show changed fields too.
if (diffs != null && !diffs.isEmpty()) {
sbFields = new SafeHtmlBuilder();
for (BaseColumnFieldDiff diff : diffs) {
String changedFieldName = diff.getFieldName();
if (changedFieldName.equals(DTColumnConfig52.FIELD_DEFAULT_VALUE)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.DefaultValue(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(MetadataCol52.FIELD_METADATA)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.Metadata1(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(DTColumnConfig52.FIELD_HEADER)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.ColumnHeader(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(DTColumnConfig52.FIELD_HIDE_COLUMN)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.HideThisColumn(), diff.getOldValue(), diff.getValue(), sbFields);
}
}
}
if (sbFields != null) {
sb.append(TEMPLATE.updatedFields(sbFields.toSafeHtml(), labelClass));
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class AuditLogEntryCellHelper method buildColumnDetailsUpdate.
private void buildColumnDetailsUpdate(final ActionSetFieldColumnDetails details, final ActionSetFieldColumnDetails originalDetails, final List<BaseColumnFieldDiff> diffs, final SafeHtmlBuilder sb) {
sb.append(TEMPLATE.commentHeader(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogUpdateAction(details.getColumnHeader())));
SafeHtmlBuilder sbFields = null;
// Show changed fields too.
if (diffs != null && !diffs.isEmpty()) {
sbFields = new SafeHtmlBuilder();
for (BaseColumnFieldDiff diff : diffs) {
String changedFieldName = diff.getFieldName();
// if (changedFieldName.equals(ActionInsertFactCol52.FIELD_TYPE)) buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.Binding(), diff.getOldValue(), diff.getValue(), sb);
if (changedFieldName.equals(DTColumnConfig52.FIELD_HEADER)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.ColumnHeader(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(ActionSetFieldCol52.FIELD_BOUND_NAME)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.Binding(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(ActionSetFieldCol52.FIELD_FACT_FIELD)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.Field(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(ActionInsertFactCol52.FIELD_IS_INSERT_LOGICAL)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.LogicallyInsert(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(ActionSetFieldCol52.FIELD_VALUE_LIST)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.ValueList(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(DTColumnConfig52.FIELD_DEFAULT_VALUE)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.DefaultValue(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(DTColumnConfig52.FIELD_HIDE_COLUMN)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.HideThisColumn(), diff.getOldValue(), diff.getValue(), sbFields);
} else if (changedFieldName.equals(ActionSetFieldCol52.FIELD_UPDATE)) {
buildColumnUpdateFields(GuidedDecisionTableConstants.INSTANCE.UpdateEngineWithChanges(), diff.getOldValue(), diff.getValue(), sbFields);
}
}
}
if (sbFields != null) {
sb.append(TEMPLATE.updatedFields(sbFields.toSafeHtml(), labelClass));
}
}
Aggregations