ActionInsertFactColumnSynchronizer extends ActionColumnSynchronizer { @Override public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException { if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) { return Collections.emptyList(); } final ActionInsertFactCol52 originalColumn = (ActionInsertFactCol52) originalMetaData.getColumn(); final ActionInsertFactCol52 editedColumn = (ActionInsertFactCol52) editedMetaData.getColumn(); final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn); update(originalColumn, editedColumn); final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionInsertFactCol52.FIELD_HIDE_COLUMN, diffs); final boolean isHeaderUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionInsertFactCol52.FIELD_HEADER, diffs); final boolean isBoundNameUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionInsertFactCol52.FIELD_BOUND_NAME, diffs); final boolean isFactTypeUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionInsertFactCol52.FIELD_FACT_TYPE, diffs); final boolean isFactFieldUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionInsertFactCol52.FIELD_FACT_FIELD, diffs); if (isBoundNameUpdated || isFactTypeUpdated || isFactFieldUpdated) { clearColumnData(originalColumn); } else { cleanColumnData(originalColumn, editedColumn, diffs); } synchroniseUpdateColumn(originalColumn); if (isHideUpdated) { setColumnVisibility(originalColumn, originalColumn.isHideColumn()); } if (isHeaderUpdated) { setColumnHeader(originalColumn, originalColumn.getHeader()); } return diffs; }  @Override int priority(); @Override boolean handlesAppend(final MetaData metaData); @Override void append(final ColumnMetaData metaData); @Override boolean handlesUpdate(final MetaData metaData); @Override List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData,
                                            final ColumnMetaData editedMetaData); @Override boolean handlesMoveColumnsTo(final List<? extends MetaData> metaData);  }
@Test public void testUpdate() throws VetoException { final ActionInsertFactCol52 column = spy(new ActionInsertFactCol52()); column.setHeader("col1"); column.setBoundName("$a"); column.setFactType("Applicant"); column.setFactField("age"); modelSynchronizer.appendColumn(column); final ActionInsertFactCol52 edited = new ActionInsertFactCol52(); edited.setWidth(column.getWidth()); edited.setBoundName("$a"); edited.setFactType("Applicant"); edited.setFactField("name"); edited.setHideColumn(true); edited.setHeader("updated"); List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited); assertEquals(3, diffs.size()); verify(column).diff(edited); assertEquals(1, model.getActionCols().size()); assertEquals(4, uiModel.getColumns().size()); assertTrue(uiModel.getColumns().get(3) instanceof StringUiColumn); assertEquals("updated", uiModel.getColumns().get(3).getHeaderMetaData().get(1).getTitle()); assertEquals(false, uiModel.getColumns().get(3).isVisible()); }