ImmutableSchema(ImmutableDbms parent, Map<String, Object> schema) { super(parent, schema); final Schema prototype = new SchemaImpl(parent, schema); this.enabled = prototype.isEnabled(); this.id = prototype.getId(); this.name = prototype.getName(); this.alias = prototype.getAlias(); this.defaultSchema = prototype.isDefaultSchema(); this.tables = unmodifiableList(super.children(TABLES, ImmutableTable::new).collect(toList())); }
/** * Debug method used to track type mappers of a project. May be of future use if one perhaps would venture to * investigate why we get several copies of the dbms from the database */ private void printTypeMappers(String heading, Project p) { System.out.println(heading); p.dbmses().map(d -> (Dbms) d).forEach(dbms -> { dbms.schemas().map(s -> (Schema) s).forEach(schema -> { schema.tables().map(t -> (Table) t).forEach(table -> { table.columns().map(c -> (Column) c).filter(c -> c.getTypeMapper().isPresent()).forEach(column -> { String mapperName = column.getTypeMapper().get(); if (mapperName.endsWith("PrimitiveTypeMapper")) { mapperName = "Primitive"; } System.out.println(" - " + dbms.getName() + ":" + schema.getName() + "/" + table.getName() + "." + column.getName() + " mapped by " + mapperName); }); }); }); }); }
/** * Returns the full name used in the database for the specified * {@link Table}. This is typically constructed by combining the schema and * the table name with a separator, but that might be different in different * implementations. * * @param table the table to retrieve the name of * @return the full name */ default String fullNameOf(Table table) { final Schema schema = table.getParentOrThrow(); return fullNameOf(schema.getName(), table.getName()); }
/** * Returns the full name used in the database for the specified * {@link Column}. This is typically constructed by combining the table and * the column name with a separator, but that might be different in * different implementations. * * @param column the column to retrieve the name of * @return the full name */ default String fullNameOf(Column column) { final Table table = column.getParentOrThrow(); final Schema schema = table.getParentOrThrow(); return fullNameOf(schema.getName(), table.getName(), column.getName()); }
LOGGER.info("dbms: " + dbms.getName()); dbms.schemas().forEach(schema -> { LOGGER.info("schema: " + schema.getName()); if (schema.getData().containsKey("tables")) { LOGGER.info("Removing " + schema.tables().count());
final String schemaName = ancestor(col, Schema.class).get().getName(); final String tableName = col.getParentOrThrow().getName(); final String columnName = col.getName();
/** * Returns the full name used in the database for the specified * {@link Table}. This is typically constructed by combining the schema and * the table name with a separator, but that might be different in different * implementations. * * @param table the table to retrieve the name of * @return the full name */ default String fullNameOf(Table table) { final Schema schema = table.getParentOrThrow(); return fullNameOf(schema.getName(), table.getName()); }
/** * Returns the full name used in the database for the specified * {@link Column}. This is typically constructed by combining the table and * the column name with a separator, but that might be different in * different implementations. * * @param column the column to retrieve the name of * @return the full name */ default String fullNameOf(Column column) { final Table table = column.getParentOrThrow(); final Schema schema = table.getParentOrThrow(); return fullNameOf(schema.getName(), table.getName(), column.getName()); }