private void handleCollectorItems ( List < Component > components ) { for ( Component component : components ) { Map < CollectorType , List < CollectorItem > > itemMap = component . getCollectorItems ( ) ; for ( CollectorType type : itemMap . keySet ( ) ) { List < CollectorItem > items = itemMap . get ( type ) ; for ( CollectorItem i : items ) { if ( CollectionUtils . isEmpty ( customRepositoryQuery . findComponents ( i . getCollectorId ( ) , type , i ) ) ) { i . setEnabled ( false ) ; collectorItemRepository . save ( i ) ; } } } } }
For the dashboard get all the components and get all the collector items for the components . If a collector item is NOT associated with any Component disable it .