use of org.codice.ddf.admin.query.dev.system.fields.FeatureField in project admin-console-beta by connexta.
the class CreateFeatureDependencyGraph method createFeatureDependenciesGraph.
private DirectedGraph<Field, DependencyEdge> createFeatureDependenciesGraph(List<FeatureField> features) {
DirectedGraph<Field, DependencyEdge> graph = new DirectedPseudograph<>(DependencyEdge.class);
FEATURE_BUNDLE_VERTEX_PROV.getAttributes().forEach(attri -> exporter.registerAttribute(attri.getAttriName(), attri.getCategory(), attri.getType()));
features.forEach(graph::addVertex);
Map<String, FeatureField> featuresById = features.stream().collect(Collectors.toMap(FeatureField::id, f -> f));
for (FeatureField feature : features) {
for (String featId : feature.featDeps()) {
try {
Feature feat = featureUtils.getFeature(featId);
if (feat != null && featuresById.containsKey(feat.getId())) {
graph.addEdge(feature, featuresById.get(feat.getId()), DependencyEdge.create(null));
} else {
LOGGER.error("Failed to find feature {} while creating feature dependency graph.", featId);
}
} catch (Exception e) {
LOGGER.error("Failed to find feature {} while creating feature dependency graph.", featId, e);
}
}
feature.bundleDeps().forEach(dep -> {
graph.addVertex(dep);
graph.addEdge(feature, dep, DependencyEdge.create(null));
});
}
return graph;
}
use of org.codice.ddf.admin.query.dev.system.fields.FeatureField in project admin-console-beta by connexta.
the class FeatureUtils method featureToField.
private FeatureField featureToField(Feature feat, Map<String, BundleField> bundlesByLocation) {
List<String> featDeps = feat.getDependencies().stream().map(Dependency::getName).collect(Collectors.toList());
List<BundleField> bundleDepLocations = feat.getBundles().stream().map(BundleInfo::getLocation).map(loc -> createBundleFromLocation(loc, bundlesByLocation)).collect(Collectors.toList());
return new FeatureField().name(feat.getName()).featDescription(feat.getDescription()).state(feat.getInstall()).id(feat.getId()).repoUrl(feat.getRepositoryUrl()).addFeatureDeps(featDeps).addBundleDeps(bundleDepLocations);
}
Aggregations