@Test public void getSafeHtml_ActionInsert() { ActionInsertFactCol52 originalColumn = new ActionInsertFactCol52(); originalColumn.setFactField("field1"); originalColumn.setInsertLogical(false); originalColumn.setValueList("q,w,e"); originalColumn.setHeader("action1"); originalColumn.setHideColumn(false); originalColumn.setDefaultValue(new DTCellValue52("def1")); ActionInsertFactCol52 newColumn = new ActionInsertFactCol52(); newColumn.setFactField("field2"); newColumn.setInsertLogical(true); newColumn.setValueList("a,s,d"); newColumn.setHeader("action2"); newColumn.setHideColumn(true); newColumn.setDefaultValue(new DTCellValue52("def2")); List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn); SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs)); assertEquals(getActionHeaderRepre(newColumn.getHeader()) + getDiffRepre(diffs), result.asString()); }
public SafeHtml getSafeHtml( final AuditLogEntry event ) { if ( event instanceof UpdateColumnAuditLogEntry ) { return getSafeHtml( (UpdateColumnAuditLogEntry) event ); } else if ( event instanceof InsertColumnAuditLogEntry ) { return getSafeHtml( (InsertColumnAuditLogEntry) event ); } else if ( event instanceof DeleteColumnAuditLogEntry ) { return getSafeHtml( (DeleteColumnAuditLogEntry) event ); } else if ( event instanceof InsertRowAuditLogEntry ) { return getSafeHtml( (InsertRowAuditLogEntry) event ); } else if ( event instanceof DeleteRowAuditLogEntry ) { return getSafeHtml( (DeleteRowAuditLogEntry) event ); } throw new IllegalArgumentException( "Unrecognised AuditLogEntry type." ); }
AuditLogEntryCellHelper { public SafeHtml getSafeHtml( final AuditLogEntry event ) { if ( event instanceof UpdateColumnAuditLogEntry ) { return getSafeHtml( (UpdateColumnAuditLogEntry) event ); } else if ( event instanceof InsertColumnAuditLogEntry ) { return getSafeHtml( (InsertColumnAuditLogEntry) event ); } else if ( event instanceof DeleteColumnAuditLogEntry ) { return getSafeHtml( (DeleteColumnAuditLogEntry) event ); } else if ( event instanceof InsertRowAuditLogEntry ) { return getSafeHtml( (InsertRowAuditLogEntry) event ); } else if ( event instanceof DeleteRowAuditLogEntry ) { return getSafeHtml( (DeleteRowAuditLogEntry) event ); } throw new IllegalArgumentException( "Unrecognised AuditLogEntry type." ); } }
AuditLogEntryCellHelper { public SafeHtml getSafeHtml( final AuditLogEntry event ) { if ( event instanceof UpdateColumnAuditLogEntry ) { return getSafeHtml( (UpdateColumnAuditLogEntry) event ); } else if ( event instanceof InsertColumnAuditLogEntry ) { return getSafeHtml( (InsertColumnAuditLogEntry) event ); } else if ( event instanceof DeleteColumnAuditLogEntry ) { return getSafeHtml( (DeleteColumnAuditLogEntry) event ); } else if ( event instanceof InsertRowAuditLogEntry ) { return getSafeHtml( (InsertRowAuditLogEntry) event ); } else if ( event instanceof DeleteRowAuditLogEntry ) { return getSafeHtml( (DeleteRowAuditLogEntry) event ); } throw new IllegalArgumentException( "Unrecognised AuditLogEntry type." ); } AuditLogEntryCellHelper( final DateTimeFormat format );  AuditLogEntryCellHelper( final DateTimeFormat format,
                                    final String labelClass,
                                    final String valueClass ); }
AuditLogEntryCellHelper { public SafeHtml getSafeHtml( final AuditLogEntry event ) { if ( event instanceof UpdateColumnAuditLogEntry ) { return getSafeHtml( (UpdateColumnAuditLogEntry) event ); } else if ( event instanceof InsertColumnAuditLogEntry ) { return getSafeHtml( (InsertColumnAuditLogEntry) event ); } else if ( event instanceof DeleteColumnAuditLogEntry ) { return getSafeHtml( (DeleteColumnAuditLogEntry) event ); } else if ( event instanceof InsertRowAuditLogEntry ) { return getSafeHtml( (InsertRowAuditLogEntry) event ); } else if ( event instanceof DeleteRowAuditLogEntry ) { return getSafeHtml( (DeleteRowAuditLogEntry) event ); } throw new IllegalArgumentException( "Unrecognised AuditLogEntry type." ); } AuditLogEntryCellHelper( final DateTimeFormat format );  AuditLogEntryCellHelper( final DateTimeFormat format,
                                    final String labelClass,
                                    final String valueClass ); static String getEventTypeDisplayText( final String eventType ); SafeHtml getSafeHtml( final AuditLogEntry event ); }
AuditLogEntryCellHelper { public SafeHtml getSafeHtml( final AuditLogEntry event ) { if ( event instanceof UpdateColumnAuditLogEntry ) { return getSafeHtml( (UpdateColumnAuditLogEntry) event ); } else if ( event instanceof InsertColumnAuditLogEntry ) { return getSafeHtml( (InsertColumnAuditLogEntry) event ); } else if ( event instanceof DeleteColumnAuditLogEntry ) { return getSafeHtml( (DeleteColumnAuditLogEntry) event ); } else if ( event instanceof InsertRowAuditLogEntry ) { return getSafeHtml( (InsertRowAuditLogEntry) event ); } else if ( event instanceof DeleteRowAuditLogEntry ) { return getSafeHtml( (DeleteRowAuditLogEntry) event ); } throw new IllegalArgumentException( "Unrecognised AuditLogEntry type." ); } AuditLogEntryCellHelper( final DateTimeFormat format );  AuditLogEntryCellHelper( final DateTimeFormat format,
                                    final String labelClass,
                                    final String valueClass ); static String getEventTypeDisplayText( final String eventType ); SafeHtml getSafeHtml( final AuditLogEntry event );  }