/** * Returns the catalog lookup name used when calling * connection.getMetaData().getXxxx(catalogLookupName, ...) methods. * * @param schema to use * @return the catalog lookup name used when calling * connection.getMetaData().getXxxx(catalogLookupName, ...) methods */ protected String jdbcCatalogLookupName(Schema schema) { return schema.getId(); }
public static Optional<? extends Schema> referencedSchemaIfPresent(Project project, String dbmsId, String schemaId) { return referencedDbmsIfPresent(project, dbmsId) .flatMap(dbms -> dbms.schemas().filter(schema -> schemaId.equals(schema.getId())) .findAny() ); }
public static Schema referencedSchema(Project project, String dbmsId, String schemaId) { return referencedDbms(project, dbmsId) .schemas().filter(schema -> schemaId.equals(schema.getId())) .findAny().orElseThrow(() -> new SpeedmentConfigException( "Could not find referenced " + Schema.class.getSimpleName() + " with name '" + schemaId + "'." )); }
/** * Returns {@code true} if the two specified documents represents the same * element in the database. Two documents are considered same if they have * the same name and type and their parents are considered same. * * @param first the first document * @param second the second document * @return {@code true} if same, else {@code false} */ public static boolean isSame(Schema first, Schema second) { if (first.getId().equals(second.getId())) { final Dbms firstParent = first.getParentOrThrow(); final Dbms secondParent = second.getParentOrThrow(); return isSame(firstParent, secondParent); } else { return false; } }
.orElseThrow(() -> new IllegalArgumentException( "Could not find dbms: '" + dbmsId + "'.")) .schemas().filter(s -> schemaId.equals(s.getId())).findAny() .orElseThrow(() -> new IllegalArgumentException( "Could not find schema: '" + schemaId + "'."))
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())); }
@Override public BUILDER withSchema(String schemaName) { requireNonNull(schemaName); with(Schema.class, s -> { // This makes sure that old json files with no id // first sets it id before the name is changed // Todo: Remove in next major API bumnp s.mutator().setId(s.getId()); s.mutator().setName(schemaName); }); return self(); }
@Override public BUILDER withSchema(String oldSchemaName, String schemaName) { requireNonNulls(oldSchemaName, schemaName); with(Schema.class, oldSchemaName, s -> { // This makes sure that old json files with no id // first sets it id before the name is changed // Todo: Remove in next major API bumnp s.mutator().setId(s.getId()); s.mutator().setName(schemaName); }); return self(); }
.add(Constructor.of().protected_() .add("this.tableIdentifier = " + TableIdentifier.class.getSimpleName() + ".of(" + Stream.of(getSupport().dbmsOrThrow().getId(), getSupport().schemaOrThrow().getId(), getSupport().tableOrThrow().getId()) .map(s -> "\"" + s + "\"").collect(joining(", ")) + ");")
+ Stream.of( getSupport().dbmsOrThrow().getId(), getSupport().schemaOrThrow().getId(), getSupport().tableOrThrow().getId() ).map(s -> "\"" + s + "\"").collect(joining(", "))
.add(returnString(getSupport().schemaOrThrow().getId()))
/** * Returns the catalog lookup name used when calling * connection.getMetaData().getXxxx(catalogLookupName, ...) methods. * * @param schema to use * @return the catalog lookup name used when calling * connection.getMetaData().getXxxx(catalogLookupName, ...) methods */ protected String jdbcCatalogLookupName(Schema schema) { return schema.getId(); }
@Override public BUILDER withSchema(String schemaName) { requireNonNull(schemaName); with(Schema.class, s -> { // This makes sure that old json files with no id // first sets it id before the name is changed // Todo: Remove in next major API bumnp s.mutator().setId(s.getId()); s.mutator().setName(schemaName); }); return self(); }
@Override public BUILDER withSchema(String oldSchemaName, String schemaName) { requireNonNulls(oldSchemaName, schemaName); with(Schema.class, oldSchemaName, s -> { // This makes sure that old json files with no id // first sets it id before the name is changed // Todo: Remove in next major API bumnp s.mutator().setId(s.getId()); s.mutator().setName(schemaName); }); return self(); }
+ Stream.of( getSupport().dbmsOrThrow().getId(), getSupport().schemaOrThrow().getId(), getSupport().tableOrThrow().getId() ).map(s -> "\"" + s + "\"").collect(joining(", "))
.add(Constructor.of().protected_() .add("this.tableIdentifier = " + TableIdentifier.class.getSimpleName() + ".of(" + Stream.of(getSupport().dbmsOrThrow().getId(), getSupport().schemaOrThrow().getId(), getSupport().tableOrThrow().getId()) .map(s -> "\"" + s + "\"").collect(joining(", ")) + ");")
.add(returnString(getSupport().schemaOrThrow().getId()))