}
deleteColumn( origColumnIndex,
true );
//Log change to column definition
model.getAuditLog().add( new UpdateColumnAuditLogEntry( identity.getName(),
origColumn,
editColumn ) );
} else {
boolean isHideUpdated = false;
boolean isOperatorUpdated = false;
boolean isFieldTypeUpdated = false;
boolean isFactFieldUpdated = false;
boolean isFactTypeUpdated = false;
boolean isConstraintValueTypeUpdated = false;
boolean isValueListUpdated = false;
List<BaseColumnFieldDiff> diffs = origColumn.diff( editColumn );
if ( diffs != null && !diffs.isEmpty() ) {
bUpdateColumnDefinition = true;
isHideUpdated = BaseColumnFieldDiffImpl.hasChanged( ConditionCol52.FIELD_HIDE_COLUMN, diffs );
isOperatorUpdated = BaseColumnFieldDiffImpl.hasChanged( ConditionCol52.FIELD_OPERATOR, diffs );
isFieldTypeUpdated = BaseColumnFieldDiffImpl.hasChanged( ConditionCol52.FIELD_FIELD_TYPE, diffs );
isFactFieldUpdated = BaseColumnFieldDiffImpl.hasChanged( ConditionCol52.FIELD_FACT_FIELD, diffs );
isFactTypeUpdated = BaseColumnFieldDiffImpl.hasChanged( Pattern52.FIELD_FACT_TYPE, diffs );
isConstraintValueTypeUpdated = BaseColumnFieldDiffImpl.hasChanged( ConditionCol52.FIELD_VALUE_LIST, diffs );
isValueListUpdated = BaseColumnFieldDiffImpl.hasChanged( ConditionCol52.FIELD_VALUE_LIST, diffs );
}
if (patternDiff != null && !patternDiff.isEmpty()) {
if (diffs == null) diffs = new ArrayList<BaseColumnFieldDiff>(patternDiff.size());
diffs.addAll(patternDiff);
bUpdateColumnDefinition = true; // Force firing the audit log change event.
}
// Update column's visibility
if ( isHideUpdated ) {
setColumnVisibility( origColumn,
!editColumn.isHideColumn() );
}
//Clear otherwise if column cannot accept them
if ( isOperatorUpdated && !canAcceptOtherwiseValues( editColumn ) ) {
removeOtherwiseStates( origColumn );
bUpdateColumnData = true;
}
//Clear comma-separated values if column cannot accept them
if ( isOperatorUpdated && !canAcceptCommaSeparatedValues( editColumn ) ) {
cellUtils.removeCommaSeparatedValue( editColumn.getDefaultValue() );
removeCommaSeparatedValues( origColumn );
bUpdateColumnData = true;
}
// Update column's Cell type. Other than the obvious change in data-type if the
// Operator changes to or from "not set" (possible for literal columns and formulae)
// the column needs to be changed to or from Text.
if ( isFactTypeUpdated || isFactFieldUpdated || isFieldTypeUpdated || isOperatorUpdated || isConstraintValueTypeUpdated ) {
bUpdateColumnData = true;
}
// Update column's cell content if the Optional Value list has changed
if ( isValueListUpdated ) {
bUpdateColumnData = updateCellsForOptionValueList( editColumn,
origColumn );
}
if ( origColumn.isBound() && editColumn.isBound() && !origColumn.getBinding().equals( editColumn.getBinding() ) ) {
bUpdateColumnDefinition = true;
}
//Log change to column definition
if ( bUpdateColumnDefinition ) {
model.getAuditLog().add( new UpdateColumnAuditLogEntry( identity.getName(),
origColumn,
editColumn, diffs ) );
}
// Copy new values into original column definition