Search in sources :

Example 1 with PluginAggregator

use of org.mybatis.generator.internal.PluginAggregator in project generator by mybatis.

the class Context method generateFiles.

/**
     * Generate files.
     *
     * @param callback
     *            the callback
     * @param generatedJavaFiles
     *            the generated java files
     * @param generatedXmlFiles
     *            the generated xml files
     * @param warnings
     *            the warnings
     * @throws InterruptedException
     *             the interrupted exception
     */
public void generateFiles(ProgressCallback callback, List<GeneratedJavaFile> generatedJavaFiles, List<GeneratedXmlFile> generatedXmlFiles, List<String> warnings) throws InterruptedException {
    pluginAggregator = new PluginAggregator();
    for (PluginConfiguration pluginConfiguration : pluginConfigurations) {
        Plugin plugin = ObjectFactory.createPlugin(this, pluginConfiguration);
        if (plugin.validate(warnings)) {
            pluginAggregator.addPlugin(plugin);
        } else {
            warnings.add(getString(//$NON-NLS-1$
            "Warning.24", pluginConfiguration.getConfigurationType(), id));
        }
    }
    if (introspectedTables != null) {
        for (IntrospectedTable introspectedTable : introspectedTables) {
            callback.checkCancel();
            introspectedTable.initialize();
            introspectedTable.calculateGenerators(warnings, callback);
            generatedJavaFiles.addAll(introspectedTable.getGeneratedJavaFiles());
            generatedXmlFiles.addAll(introspectedTable.getGeneratedXmlFiles());
            generatedJavaFiles.addAll(pluginAggregator.contextGenerateAdditionalJavaFiles(introspectedTable));
            generatedXmlFiles.addAll(pluginAggregator.contextGenerateAdditionalXmlFiles(introspectedTable));
        }
    }
    generatedJavaFiles.addAll(pluginAggregator.contextGenerateAdditionalJavaFiles());
    generatedXmlFiles.addAll(pluginAggregator.contextGenerateAdditionalXmlFiles());
}
Also used : PluginAggregator(org.mybatis.generator.internal.PluginAggregator) IntrospectedTable(org.mybatis.generator.api.IntrospectedTable) Plugin(org.mybatis.generator.api.Plugin)

Example 2 with PluginAggregator

use of org.mybatis.generator.internal.PluginAggregator in project generator by mybatis.

the class Context method generateFiles.

public void generateFiles(ProgressCallback callback, List<GeneratedJavaFile> generatedJavaFiles, List<GeneratedXmlFile> generatedXmlFiles, List<GeneratedKotlinFile> generatedKotlinFiles, List<String> warnings) throws InterruptedException {
    pluginAggregator = new PluginAggregator();
    for (PluginConfiguration pluginConfiguration : pluginConfigurations) {
        Plugin plugin = ObjectFactory.createPlugin(this, pluginConfiguration);
        if (plugin.validate(warnings)) {
            pluginAggregator.addPlugin(plugin);
        } else {
            warnings.add(getString(// $NON-NLS-1$
            "Warning.24", pluginConfiguration.getConfigurationType(), id));
        }
    }
    // items in the configuration.
    for (IntrospectedTable introspectedTable : introspectedTables) {
        callback.checkCancel();
        introspectedTable.initialize();
        introspectedTable.calculateGenerators(warnings, callback);
    }
    for (IntrospectedTable introspectedTable : introspectedTables) {
        callback.checkCancel();
        generatedJavaFiles.addAll(introspectedTable.getGeneratedJavaFiles());
        generatedXmlFiles.addAll(introspectedTable.getGeneratedXmlFiles());
        generatedKotlinFiles.addAll(introspectedTable.getGeneratedKotlinFiles());
        generatedJavaFiles.addAll(pluginAggregator.contextGenerateAdditionalJavaFiles(introspectedTable));
        generatedXmlFiles.addAll(pluginAggregator.contextGenerateAdditionalXmlFiles(introspectedTable));
        generatedKotlinFiles.addAll(pluginAggregator.contextGenerateAdditionalKotlinFiles(introspectedTable));
    }
    generatedJavaFiles.addAll(pluginAggregator.contextGenerateAdditionalJavaFiles());
    generatedXmlFiles.addAll(pluginAggregator.contextGenerateAdditionalXmlFiles());
    generatedKotlinFiles.addAll(pluginAggregator.contextGenerateAdditionalKotlinFiles());
}
Also used : PluginAggregator(org.mybatis.generator.internal.PluginAggregator) IntrospectedTable(org.mybatis.generator.api.IntrospectedTable) Plugin(org.mybatis.generator.api.Plugin)

Aggregations

IntrospectedTable (org.mybatis.generator.api.IntrospectedTable)2 Plugin (org.mybatis.generator.api.Plugin)2 PluginAggregator (org.mybatis.generator.internal.PluginAggregator)2