use of liquibase.database.structure.Table in project collect by openforis.
the class IdmDatabaseSnapshotBuilder method createCodeListTables.
// private void createDataTable(EntityDefinition defn) throws DatabaseException {
// Set<Table> tables = snapshot.getTables();
//
// // Tail recursion so that leaf tables are created first; required for relations
// List<NodeDefinition> childDefns = ((EntityDefinition) defn).getChildDefinitions();
// for (NodeDefinition child : childDefns) {
// if ( child instanceof EntityDefinition ) {
// createDataTable((EntityDefinition) child);
// }
// }
//
// IdmDataTableBuilder dtb = new IdmDataTableBuilder(defn);
// dtb.setTablePrefix(tablePrefix);
// dtb.setTableSuffix(dataTableSuffix);
// Table table = dtb.toTable();
//
// if ( tables.contains(table) ) {
// throw new DatabaseException("Duplicate table name '"+table.getName()+"' for "+defn.getPath());
// }
//
// tables.add(table);
// }
// TODO hierarchical code lists as multiple tables
private void createCodeListTables() throws DatabaseException {
List<CodeList> lists = survey.getCodeLists();
for (CodeList list : lists) {
IdmCodeListTableBuilder tb = new IdmCodeListTableBuilder();
tb.setList(list);
tb.setTablePrefix(tablePrefix);
tb.setTableSuffix(codeTableSuffix);
Table table = tb.toTable();
if (tables.contains(table)) {
throw new DatabaseException("Duplicate table name '" + table.getName() + "' for list " + list.getName());
}
tables.add(table);
}
}
Aggregations