@Test public void getSafeHtml_Condition() { ConditionCol52 originalColumn = new ConditionCol52(); originalColumn.setBinding("bind1"); originalColumn.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL); originalColumn.setFactField("field1"); originalColumn.setFieldType("FieldType1"); originalColumn.setOperator("=="); originalColumn.setValueList("a,b,c"); originalColumn.setHeader("condition1"); originalColumn.setHideColumn(false); originalColumn.setDefaultValue(new DTCellValue52("def1")); ConditionCol52 newColumn = new ConditionCol52(); newColumn.setBinding("bind2"); newColumn.setConstraintValueType(BaseSingleFieldConstraint.TYPE_PREDICATE); newColumn.setFactField("field2"); newColumn.setFieldType("FieldType2"); newColumn.setOperator("!="); newColumn.setValueList("x,y,z"); newColumn.setHeader("condition2"); newColumn.setHideColumn(true); newColumn.setDefaultValue(new DTCellValue52("def2")); Pattern52 originalPattern = new Pattern52(); originalPattern.setBoundName("patBind1"); originalPattern.setFactType("FactType1"); originalPattern.setEntryPointName("ep1"); Pattern52 newPattern = new Pattern52(); newPattern.setBoundName("patBind2"); newPattern.setFactType("FactType2"); newPattern.setEntryPointName("ep2"); List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn); diffs.addAll(originalPattern.diff(newPattern)); SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs)); assertEquals(getConditionHeaderRepre(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 );  }