use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class ModelSynchronizerImpl method updateColumn.
@Override
@SuppressWarnings("unchecked")
public List<BaseColumnFieldDiff> updateColumn(final BaseColumn originalColumn, final BaseColumn editedColumn) throws VetoException {
final MetaData originalMetaData = new BaseColumnSynchronizer.ColumnMetaDataImpl(originalColumn);
final MetaData editedMetaData = new BaseColumnSynchronizer.ColumnMetaDataImpl(editedColumn);
for (Synchronizer synchronizer : synchronizers) {
if (synchronizer.handlesUpdate(originalMetaData)) {
final List<BaseColumnFieldDiff> diffs = synchronizer.update(originalMetaData, editedMetaData);
final boolean isSalienceUseRowNumberUpdated = BaseColumnFieldDiffImpl.hasChanged(AttributeCol52.FIELD_USE_ROW_NUMBER, diffs);
final boolean isSalienceUseReverseOrderUpdated = BaseColumnFieldDiffImpl.hasChanged(AttributeCol52.FIELD_REVERSE_ORDER, diffs);
if (isSalienceUseRowNumberUpdated || isSalienceUseReverseOrderUpdated) {
systemControlledColumnValuesSynchronizer.updateSystemControlledColumnValues();
}
return diffs;
}
}
return Collections.emptyList();
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldColumnSynchronizer method update.
@Override
public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException {
// Check operation is supported
if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) {
return Collections.emptyList();
}
// Get differences between original and edited column
final ActionWorkItemSetFieldCol52 originalColumn = (ActionWorkItemSetFieldCol52) originalMetaData.getColumn();
final ActionWorkItemSetFieldCol52 editedColumn = (ActionWorkItemSetFieldCol52) editedMetaData.getColumn();
final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn);
update(originalColumn, editedColumn);
// ActionWorkItem columns are always represented with a BooleanUiColumn
final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HIDE_COLUMN, diffs);
final boolean isHeaderUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HEADER, diffs);
if (isHideUpdated) {
setColumnVisibility(originalColumn, originalColumn.isHideColumn());
}
if (isHeaderUpdated) {
setColumnHeader(originalColumn, originalColumn.getHeader());
}
return diffs;
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class ConditionColumnSynchronizer method update.
@Override
public List<BaseColumnFieldDiff> update(final PatternConditionMetaData originalMetaData, final PatternConditionMetaData editedMetaData) throws VetoException {
// Check operation is supported
if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) {
return Collections.emptyList();
}
// Get differences between original and edited column
final Pattern52 originalPattern = originalMetaData.getPattern();
final Pattern52 editedPattern = editedMetaData.getPattern();
final ConditionCol52 originalColumn = (ConditionCol52) originalMetaData.getColumn();
final ConditionCol52 editedColumn = (ConditionCol52) editedMetaData.getColumn();
final List<BaseColumnFieldDiff> patternDiffs = originalPattern.diff(editedPattern);
final List<BaseColumnFieldDiff> columnDiffs = originalColumn.diff(editedColumn);
final List<BaseColumnFieldDiff> diffs = new ArrayList<BaseColumnFieldDiff>();
if (patternDiffs != null) {
diffs.addAll(patternDiffs);
}
if (columnDiffs != null) {
diffs.addAll(columnDiffs);
}
// Changes to the Pattern create the new column and remove the old column
final boolean isNewPattern = isNewPattern(editedPattern);
final boolean isBoundNameUpdated = BaseColumnFieldDiffImpl.hasChanged(Pattern52.FIELD_BOUND_NAME, diffs);
final boolean isEntryPointNameUpdated = BaseColumnFieldDiffImpl.hasChanged(Pattern52.FIELD_ENTRY_POINT_NAME, diffs);
final boolean isUpdatedCondition = BaseColumnFieldDiffImpl.hasChanged(ConditionCol52.FIELD_BINDING, diffs);
// Check if pattern change can be applied to model
if (isUpdatedCondition) {
if (!isPotentialConditionDeletionSafe(originalColumn)) {
throw new VetoUpdatePatternInUseException();
}
}
if (isBoundNameUpdated) {
if (!isPotentialPatternDeletionSafe(originalPattern)) {
throw new VetoUpdatePatternInUseException();
}
}
// Perform update
if (isNewPattern || isBoundNameUpdated) {
append(editedMetaData);
copyColumnData(originalColumn, editedColumn, diffs);
delete(originalMetaData);
return diffs;
}
if (isEntryPointNameUpdated) {
originalPattern.setEntryPointName(editedPattern.getEntryPointName());
}
// Changes to the Condition, but Pattern remains unchanged
update(originalColumn, editedColumn);
final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(ConditionCol52.FIELD_HIDE_COLUMN, diffs);
final boolean isHeaderUpdated = BaseColumnFieldDiffImpl.hasChanged(ConditionCol52.FIELD_HEADER, diffs);
final boolean isFactTypeUpdated = BaseColumnFieldDiffImpl.hasChanged(Pattern52.FIELD_FACT_TYPE, diffs);
final boolean isFactFieldUpdated = BaseColumnFieldDiffImpl.hasChanged(ConditionCol52.FIELD_FACT_FIELD, diffs);
final boolean isFieldTypeUpdated = BaseColumnFieldDiffImpl.hasChanged(ConditionCol52.FIELD_FIELD_TYPE, diffs);
final boolean isConstraintValueTypeUpdated = BaseColumnFieldDiffImpl.hasChanged(ConditionCol52.FIELD_CONSTRAINT_VALUE_TYPE, diffs);
if (isFactTypeUpdated || isFactFieldUpdated || isFieldTypeUpdated || isConstraintValueTypeUpdated) {
clearColumnData(originalColumn);
} else {
cleanColumnData(originalColumn, editedColumn, diffs);
}
synchroniseUpdateColumn(originalColumn);
if (isHideUpdated) {
setColumnVisibility(originalColumn, originalColumn.isHideColumn());
}
if (isHeaderUpdated) {
setColumnHeader(originalColumn, originalColumn.getHeader());
}
return diffs;
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class LimitedEntryBRLConditionColumnSynchronizer method update.
@Override
public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException {
// Check operation is supported
if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) {
return Collections.emptyList();
}
// Get differences between original and edited column
final LimitedEntryBRLConditionColumn originalColumn = (LimitedEntryBRLConditionColumn) originalMetaData.getColumn();
final LimitedEntryBRLConditionColumn editedColumn = (LimitedEntryBRLConditionColumn) editedMetaData.getColumn();
final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn);
update(originalColumn, editedColumn);
// LimitedEntry columns are always represented with a BooleanUiColumn
final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(ConditionCol52.FIELD_HIDE_COLUMN, diffs);
final boolean isHeaderUpdated = BaseColumnFieldDiffImpl.hasChanged(ConditionCol52.FIELD_HIDE_COLUMN, diffs);
if (isHideUpdated) {
setColumnVisibility(originalColumn, originalColumn.isHideColumn());
}
if (isHeaderUpdated) {
setColumnHeader(originalColumn, originalColumn.getHeader());
}
return diffs;
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class LimitedEntryBRLActionColumnSynchronizer method update.
@Override
public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException {
// Check operation is supported
if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) {
return Collections.emptyList();
}
// Get differences between original and edited column
final LimitedEntryBRLActionColumn originalColumn = (LimitedEntryBRLActionColumn) originalMetaData.getColumn();
final LimitedEntryBRLActionColumn editedColumn = (LimitedEntryBRLActionColumn) editedMetaData.getColumn();
final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn);
update(originalColumn, editedColumn);
// LimitedEntry columns are always represented with a BooleanUiColumn
final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(ConditionCol52.FIELD_HIDE_COLUMN, diffs);
final boolean isHeaderUpdated = BaseColumnFieldDiffImpl.hasChanged(ConditionCol52.FIELD_HIDE_COLUMN, diffs);
if (isHideUpdated) {
setColumnVisibility(originalColumn, originalColumn.isHideColumn());
}
if (isHeaderUpdated) {
setColumnHeader(originalColumn, originalColumn.getHeader());
}
return diffs;
}
Aggregations