private void insertAction ( final Element subTree , final QName attName , final Action action ) { if ( subTree == null || action == null ) { return ; } final LinkedList < Element > queue = new LinkedList <> ( ) ; // Skip the sub-tree root because it has been added already. NodeList children = subTree . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { if ( children . item ( i ) . getNodeType ( ) == Node . ELEMENT_NODE ) { queue . offer ( ( Element ) children . item ( i ) ) ; } } while ( ! queue . isEmpty ( ) ) { final Element node = queue . poll ( ) ; children = node . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { if ( children . item ( i ) . getNodeType ( ) == Node . ELEMENT_NODE ) { queue . offer ( ( Element ) children . item ( i ) ) ; } } if ( SUBJECTSCHEME_SUBJECTDEF . matches ( node ) ) { final String key = node . getAttribute ( ATTRIBUTE_NAME_KEYS ) ; if ( key != null && ! key . trim ( ) . isEmpty ( ) ) { final FilterKey k = new FilterKey ( attName , key ) ; if ( ! filterMap . containsKey ( k ) ) { filterMap . put ( k , action ) ; } } } } }
Insert subject scheme based action into filetermap if key not present in the map