protected void cleanUpMenuTree ( WebMenuItem root , String menuName ) { List < WebMenuItem > subMenu = root . getSubMenu ( ) ; List < WebMenuItem > rootBreadcrumbs = root . getBreadcrumbs ( ) ; if ( subMenu != null && subMenu . size ( ) > 0 ) { Collections . sort ( subMenu ) ; for ( int i = 0 ; i < subMenu . size ( ) ; i ++ ) { WebMenuItem item = subMenu . get ( i ) ; if ( item instanceof MenuItemExt ) { MenuItemExt itemExt = ( MenuItemExt ) item ; item = itemExt . toWebMenuItem ( ) ; subMenu . set ( i , item ) ; menuItemPaths . get ( menuName ) . put ( itemExt . path , item ) ; } item . breadcrumbs = new ArrayList < WebMenuItem > ( ) ; if ( rootBreadcrumbs != null ) { item . breadcrumbs . addAll ( rootBreadcrumbs ) ; } item . breadcrumbs . add ( item ) ; cleanUpMenuTree ( item , menuName ) ; } } }
Convert MenuItemExt to WebMenuItem and clean up all data