@Test public void getSafeHtml_ActionWorkItemExecute_Complex() { ActionWorkItemCol52 originalColumn = new ActionWorkItemCol52(); originalColumn.setHeader("action1"); originalColumn.setHideColumn(false); ActionWorkItemCol52 newColumn = new ActionWorkItemCol52(); newColumn.setHeader("action2"); newColumn.setHideColumn(true); PortableStringParameterDefinition param1 = new PortableStringParameterDefinition(); param1.setName("param1"); param1.setValue("value1"); PortableStringParameterDefinition param2 = new PortableStringParameterDefinition(); param2.setName("param2"); param2.setValue("value2"); PortableWorkDefinition def1 = new PortableWorkDefinition(); def1.setName("def1name"); def1.addParameter(param1); def1.addParameter(param2); PortableStringParameterDefinition param3 = new PortableStringParameterDefinition(); param3.setName("param3"); param3.setValue("value3"); PortableStringParameterDefinition param4 = new PortableStringParameterDefinition(); param4.setName("param1"); param4.setValue("value1"); PortableStringParameterDefinition param5 = new PortableStringParameterDefinition(); param5.setName("param5"); param5.setBinding("binding5"); PortableStringParameterDefinition param6 = new PortableStringParameterDefinition(); param6.setName("param2"); param6.setValue("value6"); PortableWorkDefinition def2 = new PortableWorkDefinition(); def2.setName("def2name"); def2.addParameter(param3); def2.addParameter(param4); def2.addParameter(param5); def2.addParameter(param6); originalColumn.setWorkItemDefinition(def1); newColumn.setWorkItemDefinition(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 );  }