class DASpecification {

    public static Map<TRelationshipTemplate, TNodeTemplate> getNodesWithSuitableConcreteDAAndTheDirectlyConnectedNode
    (TNodeTemplate nodeTemplate, TDeploymentArtifact deploymentArtifact, TTopologyTemplate topologyTemplate) {

        // key is the node template the nodeTemplate is directly connected to this is the indicator from which connection the concrete DA is coming from
        // value is the node template which has a concrete DA attached to substiute the abstract DA of the nodeTemplate
        Map<TRelationshipTemplate, TNodeTemplate> nodeTemplateWithConcreteDAAndDirectlyConnectedNode = new HashMap<>();
        List<TRelationshipTemplate> outgoingRelationshipTemplates = ModelUtilities.getOutgoingRelationshipTemplates(topologyTemplate, nodeTemplate);

        //concrete DAs could be find in the hostedOn stack or the connected stacks, but just in directly connected stacks
        for (TRelationshipTemplate outgoingRelationship : outgoingRelationshipTemplates) {
            TNodeTemplate targetNodeTemplate = ModelUtilities.getTargetNodeTemplateOfRelationshipTemplate(topologyTemplate, outgoingRelationship);
            //In each directly connected stack a node with matching concrete DA is looked up
            TNodeTemplate nodesWithSuitableDA = getNodesWithSuitableConcreteDAs(targetNodeTemplate, deploymentArtifact, topologyTemplate);
            if (nodesWithSuitableDA != null) {
                nodeTemplateWithConcreteDAAndDirectlyConnectedNode.put(outgoingRelationship, nodesWithSuitableDA);
            }
        }
        return nodeTemplateWithConcreteDAAndDirectlyConnectedNode;
    }

}