use of com.avaloq.tools.ddk.checkcfg.checkcfg.ConfigurableSection in project dsl-devkit by dsldevkit.
the class CheckConfigurationPropertiesGenerator method putInheritedProperties.
/**
* Adds the inherited properties.
*
* @param properties
* the properties
* @param language
* the language
* @param check
* the check to configure
* @param parentCatalog
* the parent catalog configuration
* @param configuredProperties
* the properties already configured for this check
*/
private void putInheritedProperties(final Properties properties, final String language, final Check check, final ConfiguredCatalog parentCatalog, final EList<ConfiguredParameter> configuredProperties) {
// this check needs to inherit any parameters defined in one of its parent levels (ConfigurableSections).
// the values of the inferred parameters are taken from the innermost level.
// @Format-Off
Set<String> configuredPropertyNames = configuredProperties.stream().map(property -> property.getParameter()).filter(Objects::nonNull).map(formalParameter -> formalParameter.getName()).collect(Collectors.toSet());
// @Format-On
EObject parentSection = parentCatalog;
while (parentSection != null) {
if (parentSection instanceof ConfigurableSection) {
EList<ConfiguredParameter> sectionProperties = ((ConfigurableSection) parentSection).getParameterConfigurations();
for (ConfiguredParameter property : sectionProperties) {
if (!configuredPropertyNames.contains(property.getParameter().getName())) {
configuredPropertyNames.add(property.getParameter().getName());
putProperty(properties, language, check, property, evaluateParameterValue(property.getNewValue()));
}
}
}
parentSection = parentSection.eContainer();
}
}
Aggregations