src/main/java/com/capitalone/dashboard/event/DashboardEventListener.java
/**
     * Creates a collector item for new team dashboards
     * @param event
     */
Creates a collector item for new team dashboards
@param event
Creates a collector item for new team dashboards @param event
@Override
    public void onAfterSave(AfterSaveEvent<Dashboard> event) {
        Dashboard dashboard = event.getSource();
        if (DashboardType.Product.equals(dashboard.getType())) {
            return;
        }
        Collector productCollector = getProductCollector();
        CollectorItem item = getDashboardCollectorItem(dashboard.getId().toString(), productCollector.getId());
        if (item == null) {
            item = new CollectorItem();
            item.setCollectorId(productCollector.getId());
            item.setDescription(dashboard.getTitle());
            item.getOptions().put("dashboardId", dashboard.getId().toString());
        } else {
            item.setDescription(dashboard.getTitle());
        }
        collectorItemRepository.save(item);
    }
@ Override public void onAfterSave ( AfterSaveEvent < Dashboard > event ) { Dashboard dashboard = event . getSource ( ) ; if ( DashboardType . Product . equals ( dashboard . getType ( ) ) ) { return ; } Collector productCollector = getProductCollector ( ) ; CollectorItem item = getDashboardCollectorItem ( dashboard . getId ( ) . toString ( ) , productCollector . getId ( ) ) ; if ( item == null ) { item = new CollectorItem ( ) ; item . setCollectorId ( productCollector . getId ( ) ) ; item . setDescription ( dashboard . getTitle ( ) ) ; item . getOptions ( ) . put ( "dashboardId" , dashboard . getId ( ) . toString ( ) ) ; } else { item . setDescription ( dashboard . getTitle ( ) ) ; } collectorItemRepository . save ( item ) ; }
Creates a collector item for new team dashboards
 @param event
Creates a collector item for new team dashboards @param event
// Ignore product dashboards // Create a new Collector Item // Update the title of the existing Collector Item in case it changed