com.capitalone.dashboard.util.DashboardUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Core package shared by API layer and Microservices
package com.capitalone.dashboard.util;
import com.capitalone.dashboard.model.Collector;
import com.capitalone.dashboard.model.CollectorItem;
import com.capitalone.dashboard.repository.ComponentRepository;
import org.bson.types.ObjectId;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public final class DashboardUtils {
/**
* Gets a unique set of collector item ids for a given collector from all components in the Hygieia instance.
* @param componentRepository component repo
* @param collector collector
* @return unique set of collector item ids
*/
public static Set getUniqueCollectorItemIDsFromAllComponents(ComponentRepository componentRepository, Collector collector) {
Set uniqueIDs = new HashSet<>();
for (com.capitalone.dashboard.model.Component comp : componentRepository.findAll()) {
if (comp.getCollectorItems() == null || comp.getCollectorItems().isEmpty()) continue;
List itemList = comp.getCollectorItems().get(collector.getCollectorType());
if (itemList == null) continue;
for (CollectorItem ci : itemList) {
if (ci != null && ci.getCollectorId().equals(collector.getId())) {
uniqueIDs.add(ci.getId());
}
}
}
return uniqueIDs;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy