use of alien4cloud.topology.task.NodeFiltersTask in project alien4cloud by alien4cloud.
the class NodeFilterValidationService method validateRequirementFilters.
/**
* Performs validation of the node filters to check that relationships targets the filter requirements.
*/
private List<NodeFiltersTask> validateRequirementFilters(Topology topology, boolean skipInputs) {
List<NodeFiltersTask> toReturnTaskList = Lists.newArrayList();
Map<String, NodeTemplate> nodeTemplates = topology.getNodeTemplates();
Map<String, NodeType> nodeTypes = topologyServiceCore.getIndexedNodeTypesFromTopology(topology, false, true, true);
Map<String, CapabilityType> capabilityTypes = topologyServiceCore.getIndexedCapabilityTypesFromTopology(topology);
for (Map.Entry<String, NodeTemplate> nodeTempEntry : nodeTemplates.entrySet()) {
Map<String, RelationshipTemplate> relationshipsMap = nodeTempEntry.getValue().getRelationships();
if (relationshipsMap == null || relationshipsMap.isEmpty()) {
continue;
}
NodeType sourceNodeType = toscaTypeSearchService.getRequiredElementInDependencies(NodeType.class, nodeTempEntry.getValue().getType(), topology.getDependencies());
if (sourceNodeType.isAbstract()) {
continue;
}
NodeFiltersTask task = new NodeFiltersTask();
task.setNodeTemplateName(nodeTempEntry.getKey());
task.setCode(TaskCode.NODE_FILTER_INVALID);
task.setComponent(sourceNodeType);
task.setNodeFiltersToSatisfy(Lists.<NodeFilterToSatisfy>newArrayList());
validateFiltersForNode(sourceNodeType, relationshipsMap, topology, nodeTypes, capabilityTypes, task, skipInputs);
if (!task.getNodeFiltersToSatisfy().isEmpty()) {
toReturnTaskList.add(task);
}
}
return toReturnTaskList.isEmpty() ? null : toReturnTaskList;
}
Aggregations