Search in sources :

Example 1 with DbContentImportHelper

use of ai.elimu.util.db.DbContentImportHelper in project webapp by elimu-ai.

the class CustomDispatcherServlet method initWebApplicationContext.

@Override
protected WebApplicationContext initWebApplicationContext() {
    logger.info("initWebApplicationContext");
    WebApplicationContext webApplicationContext = super.initWebApplicationContext();
    // Database migration
    logger.info("Performing database migration...");
    new DbMigrationHelper().performDatabaseMigration(webApplicationContext);
    if (EnvironmentContextLoaderListener.env == Environment.DEV) {
        // To ease development, pre-populate database with educational content extracted from the test server
        // Lookup the language of the educational content from the config file
        Language language = Language.valueOf(ConfigHelper.getProperty("content.language"));
        logger.info("language: " + language);
        // Import the educational content
        logger.info("Performing database content import...");
        new DbContentImportHelper().performDatabaseContentImport(Environment.TEST, language, webApplicationContext);
        createJpaSchemaExport();
    }
    return webApplicationContext;
}
Also used : DbContentImportHelper(ai.elimu.util.db.DbContentImportHelper) DbMigrationHelper(ai.elimu.util.db.DbMigrationHelper) Language(ai.elimu.model.v2.enums.Language) WebApplicationContext(org.springframework.web.context.WebApplicationContext)

Aggregations

Language (ai.elimu.model.v2.enums.Language)1 DbContentImportHelper (ai.elimu.util.db.DbContentImportHelper)1 DbMigrationHelper (ai.elimu.util.db.DbMigrationHelper)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1