use of org.openforis.collect.relational.model.Table 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.Table 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.Table in project collect by openforis.
the class DDLCreator method write.
public void write(Writer output) {
Database db = new Database();
db.setName(schema.getName());
for (Table<?> table : schema.getTables()) {
org.apache.ddlutils.model.Table ddlTable = new org.apache.ddlutils.model.Table();
ddlTable.setName(table.getName());
ddlTable.setSchema(schema.getName());
for (Column<?> column : table.getColumns()) {
org.apache.ddlutils.model.Column ddlColumn = new org.apache.ddlutils.model.Column();
ddlColumn.setName(column.getName());
ddlColumn.setType(column.getType().getName());
ddlColumn.setTypeCode(column.getType().getCode());
ddlColumn.setSizeAndScale(column.getLength() == null ? 0 : column.getLength(), 0);
ddlTable.addColumn(ddlColumn);
}
db.addTable(ddlTable);
}
new DatabaseIO().write(db, output);
}
Aggregations