Search in sources :

Example 1 with JooqRelationalSchemaCreator

use of org.openforis.collect.relational.jooq.JooqRelationalSchemaCreator in project collect by openforis.

the class RDBReportingRepositories method createRepository.

@Override
public void createRepository(final String surveyName, final RecordStep recordStep, final String preferredLanguage, final ProgressListener progressListener) {
    localRDBStorageManager.deleteRDBFile(surveyName, recordStep);
    updateMondrianSchemaFile(surveyName, preferredLanguage);
    if (saikuDatasourceStorageManager.isSaikuAvailable()) {
        writeSaikuDatasource(surveyName, recordStep);
    }
    final RelationalSchema relationalSchema = getOrInitializeRelationalSchemaDefinition(surveyName);
    withConnection(surveyName, recordStep, new Callback() {

        public void execute(Connection connection) {
            RelationalSchemaCreator relationalSchemaCreator = new JooqRelationalSchemaCreator();
            relationalSchemaCreator.createRelationalSchema(relationalSchema, connection);
            insertRecords(surveyName, recordStep, relationalSchema, connection, progressListener);
            relationalSchemaCreator.addConstraints(relationalSchema, connection);
            relationalSchemaCreator.addIndexes(relationalSchema, connection);
        }
    });
}
Also used : JooqRelationalSchemaCreator(org.openforis.collect.relational.jooq.JooqRelationalSchemaCreator) Connection(java.sql.Connection) JooqRelationalSchemaCreator(org.openforis.collect.relational.jooq.JooqRelationalSchemaCreator) RelationalSchema(org.openforis.collect.relational.model.RelationalSchema)

Aggregations

Connection (java.sql.Connection)1 JooqRelationalSchemaCreator (org.openforis.collect.relational.jooq.JooqRelationalSchemaCreator)1 RelationalSchema (org.openforis.collect.relational.model.RelationalSchema)1