public void updateProperties ( final WatchedUpdateResult result , final Configuration config , final boolean ignoreDeletesFromSource ) { if ( result == null || ! result . hasChanges ( ) ) { return ; } logger . debug ( "incremental result? [{}]" , result . isIncremental ( ) ) ; logger . debug ( "ignored deletes from source? [{}]" , ignoreDeletesFromSource ) ; if ( ! result . isIncremental ( ) ) { Map < String , Object > props = result . getComplete ( ) ; if ( props == null ) { return ; } for ( Entry < String , Object > entry : props . entrySet ( ) ) { addOrChangeProperty ( entry . getKey ( ) , entry . getValue ( ) , config ) ; } Set < String > existingKeys = new HashSet < String > ( ) ; for ( Iterator < String > i = config . getKeys ( ) ; i . hasNext ( ) ; ) { existingKeys . add ( i . next ( ) ) ; } if ( ! ignoreDeletesFromSource ) { for ( String key : existingKeys ) { if ( ! props . containsKey ( key ) ) { deleteProperty ( key , config ) ; } } } } else { Map < String , Object > props = result . getAdded ( ) ; if ( props != null ) { for ( Entry < String , Object > entry : props . entrySet ( ) ) { addOrChangeProperty ( entry . getKey ( ) , entry . getValue ( ) , config ) ; } } props = result . getChanged ( ) ; if ( props != null ) { for ( Entry < String , Object > entry : props . entrySet ( ) ) { addOrChangeProperty ( entry . getKey ( ) , entry . getValue ( ) , config ) ; } } if ( ! ignoreDeletesFromSource ) { props = result . getDeleted ( ) ; if ( props != null ) { for ( String name : props . keySet ( ) ) { deleteProperty ( name , config ) ; } } } } }
Updates the properties in the config param given the contents of the result param .