Search in sources :

Example 1 with ConfiguredLanguageValidator

use of com.avaloq.tools.ddk.checkcfg.checkcfg.ConfiguredLanguageValidator in project dsl-devkit by dsldevkit.

the class CheckConfigurationPropertiesGenerator method generatePropertiesForCatalogsInConfigurableSection.

/**
 * Generate properties for languages or legacy catalogs.
 *
 * @param section
 *          the section
 * @param properties
 *          the properties
 */
private void generatePropertiesForCatalogsInConfigurableSection(final ConfigurableSection section, final Properties properties) {
    String language = null;
    EList<ConfiguredCatalog> configuredCatalogs = ECollections.emptyEList();
    if (section instanceof CheckConfiguration) {
        configuredCatalogs = ((CheckConfiguration) section).getLegacyCatalogConfigurations();
    } else if (section instanceof ConfiguredLanguageValidator) {
        language = ((ConfiguredLanguageValidator) section).getLanguage();
        configuredCatalogs = ((ConfiguredLanguageValidator) section).getCatalogConfigurations();
    }
    for (ConfiguredCatalog catalog : configuredCatalogs) {
        Set<Check> configuredChecks = Sets.newHashSet();
        for (ConfiguredCheck configuredCheck : catalog.getCheckConfigurations()) {
            generatePropertiesForConfiguredCheck(properties, language, configuredCheck);
            configuredChecks.add(configuredCheck.getCheck());
        }
        for (Check unconfiguredCheck : Sets.difference(Sets.newHashSet(catalog.getCatalog().getAllChecks()), configuredChecks)) {
            putInheritedProperties(properties, language, unconfiguredCheck, catalog, ECollections.emptyEList());
        }
    }
}
Also used : CheckConfiguration(com.avaloq.tools.ddk.checkcfg.checkcfg.CheckConfiguration) ConfiguredCatalog(com.avaloq.tools.ddk.checkcfg.checkcfg.ConfiguredCatalog) ConfiguredLanguageValidator(com.avaloq.tools.ddk.checkcfg.checkcfg.ConfiguredLanguageValidator) ConfiguredCheck(com.avaloq.tools.ddk.checkcfg.checkcfg.ConfiguredCheck) Check(com.avaloq.tools.ddk.check.check.Check) ConfiguredCheck(com.avaloq.tools.ddk.checkcfg.checkcfg.ConfiguredCheck)

Aggregations

Check (com.avaloq.tools.ddk.check.check.Check)1 CheckConfiguration (com.avaloq.tools.ddk.checkcfg.checkcfg.CheckConfiguration)1 ConfiguredCatalog (com.avaloq.tools.ddk.checkcfg.checkcfg.ConfiguredCatalog)1 ConfiguredCheck (com.avaloq.tools.ddk.checkcfg.checkcfg.ConfiguredCheck)1 ConfiguredLanguageValidator (com.avaloq.tools.ddk.checkcfg.checkcfg.ConfiguredLanguageValidator)1