Search in sources :

Example 1 with NonNull

use of org.eclipse.jgit.annotations.NonNull in project winery by eclipse.

the class ConsistencyChecker method checkServiceTemplate.

public static void checkServiceTemplate(ConsistencyErrorLogger errorLogger, ConsistencyCheckerConfiguration configuration, ServiceTemplateId id) {
    final TServiceTemplate serviceTemplate = configuration.getRepository().getElement(id);
    if (serviceTemplate.getTopologyTemplate() == null) {
        return;
    }
    @NonNull final List<TNodeTemplate> nodeTemplates = serviceTemplate.getTopologyTemplate().getNodeTemplates();
    for (TNodeTemplate nodeTemplate : nodeTemplates) {
        final TNodeType nodeType = configuration.getRepository().getElement(new NodeTypeId(nodeTemplate.getType()));
        final WinerysPropertiesDefinition winerysPropertiesDefinition = nodeType.getWinerysPropertiesDefinition();
        if (winerysPropertiesDefinition != null) {
            PropertyDefinitionKVList list = winerysPropertiesDefinition.getPropertyDefinitionKVList();
            if (list != null) {
                // iterate on all defined properties
                for (PropertyDefinitionKV propdef : list) {
                    String key = propdef.getKey();
                    if (key == null) {
                        printAndAddError(errorLogger, configuration.getVerbosity(), id, "key is null");
                        continue;
                    }
                    // assign value, but change "null" to "" if no property is defined
                    final Map<String, String> propertiesKV = ModelUtilities.getPropertiesKV(nodeTemplate);
                    if (propertiesKV == null) {
                        printAndAddError(errorLogger, configuration.getVerbosity(), id, "propertiesKV of node template " + nodeTemplate.getId() + " is null");
                    }
                }
            }
        }
    }
}
Also used : PropertyDefinitionKV(org.eclipse.winery.model.tosca.kvproperties.PropertyDefinitionKV) NonNull(org.eclipse.jgit.annotations.NonNull) WinerysPropertiesDefinition(org.eclipse.winery.model.tosca.kvproperties.WinerysPropertiesDefinition) PropertyDefinitionKVList(org.eclipse.winery.model.tosca.kvproperties.PropertyDefinitionKVList)

Aggregations

NonNull (org.eclipse.jgit.annotations.NonNull)1 PropertyDefinitionKV (org.eclipse.winery.model.tosca.kvproperties.PropertyDefinitionKV)1 PropertyDefinitionKVList (org.eclipse.winery.model.tosca.kvproperties.PropertyDefinitionKVList)1 WinerysPropertiesDefinition (org.eclipse.winery.model.tosca.kvproperties.WinerysPropertiesDefinition)1