use of org.openforis.collect.relational.model.RelationalSchemaGenerator in project collect by openforis.
the class Mondrian4SchemaGenerator method init.
private void init() {
RelationalSchemaGenerator schemaGenerator = new RelationalSchemaGenerator(rdbConfig);
rdbSchema = schemaGenerator.generateSchema(survey, survey.getName());
}
use of org.openforis.collect.relational.model.RelationalSchemaGenerator in project collect by openforis.
the class RelationalDataConverterTest method testGenerator.
@Test
public void testGenerator() throws Exception {
RelationalSchemaGenerator rsg = new RelationalSchemaGenerator();
RelationalSchema rs = rsg.generateSchema(survey, "archenland1");
List<Table<?>> tables = rs.getTables();
CollectRecord record = createTestRecord(survey, "123_456");
Dataset data = rs.createDataset(record);
data.print(System.out);
// TODO proper integration test
}
use of org.openforis.collect.relational.model.RelationalSchemaGenerator in project collect by openforis.
the class RelationalSchemaGeneratorTest method testGenerator.
@Test
public void testGenerator() throws Exception {
RelationalSchemaGenerator rsg = new RelationalSchemaGenerator();
RelationalSchema rs = rsg.generateSchema(survey, "archenland1");
List<Table<?>> tables = rs.getTables();
// Debug
for (Table<?> table : tables) {
DataTable t = (DataTable) table;
t.print(System.out);
}
// TODO proper integration test
}
use of org.openforis.collect.relational.model.RelationalSchemaGenerator in project collect by openforis.
the class CollectRDBPublisher method export.
public void export(String surveyName, String rootEntityName, Step step, String targetSchemaName, Connection targetConn, RelationalSchemaConfig config, ProgressListener progressListener) throws CollectRdbException {
try {
targetConn.setAutoCommit(false);
} catch (SQLException e) {
}
try {
CollectSurvey survey = surveyManager.get(surveyName);
// Generate relational model
RelationalSchemaGenerator schemaGenerator = new RelationalSchemaGenerator(config);
RelationalSchema relationalSchema = schemaGenerator.generateSchema(survey, targetSchemaName);
RelationalSchemaCreator relationalSchemaCreator = createRelationalSchemaCreator();
relationalSchemaCreator.createRelationalSchema(relationalSchema, targetConn);
relationalSchemaCreator.addConstraints(relationalSchema, targetConn);
relationalSchemaCreator.addIndexes(relationalSchema, targetConn);
insertData(survey, rootEntityName, step, targetConn, relationalSchema, progressListener);
targetConn.commit();
if (LOG.isInfoEnabled()) {
LOG.info("RDB generation completed");
}
} catch (Exception e) {
try {
targetConn.rollback();
} catch (SQLException e1) {
}
throw new RuntimeException(e);
}
}
use of org.openforis.collect.relational.model.RelationalSchemaGenerator in project collect by openforis.
the class NewMondrianSchemaGenerator method generateRdbSchema.
private RelationalSchema generateRdbSchema() {
RelationalSchemaGenerator generator = new RelationalSchemaGenerator(rdbConfig);
RelationalSchema rdbSchema = generator.generateSchema(survey, dbSchemaName);
return rdbSchema;
}
Aggregations