static void applyAndUpdateDeleteSet ( Document plf , Document ilf , IntegrationResult result ) { Element dSet = null ; try { dSet = getDeleteSet ( plf , null , false ) ; } catch ( Exception e ) { LOG . error ( "Exception occurred while getting user's DLM delete-set." , e ) ; } if ( dSet == null ) return ; NodeList deletes = dSet . getChildNodes ( ) ; for ( int i = deletes . getLength ( ) - 1 ; i >= 0 ; i -- ) { if ( applyDelete ( ( Element ) deletes . item ( i ) , ilf ) == false ) { dSet . removeChild ( deletes . item ( i ) ) ; result . setChangedPLF ( true ) ; } else { result . setChangedILF ( true ) ; } } if ( dSet . getChildNodes ( ) . getLength ( ) == 0 ) { plf . getDocumentElement ( ) . removeChild ( dSet ) ; result . setChangedPLF ( true ) ; } }
Get the delete set if any from the plf and process each delete command removing any that fail from the delete set so that the delete set is self cleaning .