use of alien4cloud.topology.task.NodeFilterToSatisfy in project alien4cloud by alien4cloud.
the class NodeFilterValidationService method validateFiltersForNode.
private void validateFiltersForNode(NodeType sourceNodeType, Map<String, RelationshipTemplate> relationshipsMap, Topology topology, Map<String, NodeType> nodeTypes, Map<String, CapabilityType> capabilityTypes, NodeFiltersTask task, boolean skipInputs) {
Map<String, RequirementDefinition> requirementDefinitionMap = getRequirementsAsMap(sourceNodeType);
for (Map.Entry<String, RelationshipTemplate> relationshipEntry : relationshipsMap.entrySet()) {
RequirementDefinition requirementDefinition = requirementDefinitionMap.get(relationshipEntry.getValue().getRequirementName());
NodeFilter nodeFilter = requirementDefinition.getNodeFilter();
if (nodeFilter != null) {
NodeTemplate targetNode = topology.getNodeTemplates().get(relationshipEntry.getValue().getTarget());
NodeType targetType = nodeTypes.get(relationshipEntry.getValue().getTarget());
NodeFilterToSatisfy nodeFilterToSatisfy = new NodeFilterToSatisfy();
nodeFilterToSatisfy.setRelationshipName(relationshipEntry.getKey());
nodeFilterToSatisfy.setTargetName(targetNode.getName());
nodeFilterToSatisfy.setMissingCapabilities(Lists.<String>newArrayList());
nodeFilterToSatisfy.setViolations(Lists.<Violations>newArrayList());
validateNodeFilter(nodeFilter, targetNode, targetType, capabilityTypes, nodeFilterToSatisfy, skipInputs);
if (!nodeFilterToSatisfy.getViolations().isEmpty() || !nodeFilterToSatisfy.getMissingCapabilities().isEmpty()) {
task.getNodeFiltersToSatisfy().add(nodeFilterToSatisfy);
}
}
}
}
Aggregations