public void updateChangeLog ( final Principal user , final Verb verb , final PropertyKey key , final Object previousValue , final Object newValue ) { if ( ( Settings . ChangelogEnabled . getValue ( ) || Settings . UserChangelogEnabled . getValue ( ) ) && key != null ) { final String name = key . jsonName ( ) ; if ( ! hiddenPropertiesInAuditLog . contains ( name ) && ! ( key . isUnvalidated ( ) || key . isReadOnly ( ) ) ) { final JsonObject obj = new JsonObject ( ) ; obj . add ( "time" , toElement ( System . currentTimeMillis ( ) ) ) ; obj . add ( "userId" , toElement ( user . getUuid ( ) ) ) ; obj . add ( "userName" , toElement ( user . getName ( ) ) ) ; obj . add ( "verb" , toElement ( verb ) ) ; obj . add ( "key" , toElement ( key . jsonName ( ) ) ) ; obj . add ( "prev" , toElement ( previousValue ) ) ; obj . add ( "val" , toElement ( newValue ) ) ; if ( Settings . ChangelogEnabled . getValue ( ) ) { changeLog . append ( obj . toString ( ) ) ; changeLog . append ( "\n" ) ; } if ( Settings . UserChangelogEnabled . getValue ( ) ) { // remove user for user-centric logging to reduce redundancy obj . remove ( "userId" ) ; obj . remove ( "userName" ) ; // add target to identify change event obj . add ( "target" , toElement ( getUuid ( ) ) ) ; appendUserChangelog ( user . getUuid ( ) , obj . toString ( ) ) ; } } } }
Update changelog for Verb . change