ModelNode toModelNode ( ) { ModelNode result = null ; if ( map != null ) { result = new ModelNode ( ) ; for ( Map . Entry < PathAddress , ResourceData > entry : map . entrySet ( ) ) { ModelNode item = new ModelNode ( ) ; PathAddress pa = entry . getKey ( ) ; item . get ( ABSOLUTE_ADDRESS ) . set ( pa . toModelNode ( ) ) ; ResourceData rd = entry . getValue ( ) ; item . get ( RELATIVE_ADDRESS ) . set ( pa . subAddress ( baseAddressLength ) . toModelNode ( ) ) ; ModelNode attrs = new ModelNode ( ) . setEmptyList ( ) ; if ( rd . attributes != null ) { for ( String attr : rd . attributes ) { attrs . add ( attr ) ; } } if ( attrs . asInt ( ) > 0 ) { item . get ( FILTERED_ATTRIBUTES ) . set ( attrs ) ; } ModelNode children = new ModelNode ( ) . setEmptyList ( ) ; if ( rd . children != null ) { for ( PathElement pe : rd . children ) { children . add ( new Property ( pe . getKey ( ) , new ModelNode ( pe . getValue ( ) ) ) ) ; } } if ( children . asInt ( ) > 0 ) { item . get ( UNREADABLE_CHILDREN ) . set ( children ) ; } ModelNode childTypes = new ModelNode ( ) . setEmptyList ( ) ; if ( rd . childTypes != null ) { Set < String > added = new HashSet < String > ( ) ; for ( PathElement pe : rd . childTypes ) { if ( added . add ( pe . getKey ( ) ) ) { childTypes . add ( pe . getKey ( ) ) ; } } } if ( childTypes . asInt ( ) > 0 ) { item . get ( FILTERED_CHILDREN_TYPES ) . set ( childTypes ) ; } result . add ( item ) ; } } return result ; }
Report on the filtered data in DMR .