Search in sources :

Example 11 with Catalog

use of org.jooq.Catalog in project jOOQ by jOOQ.

the class CatalogMetaImpl method filterSchemas.

static final Meta filterSchemas(Configuration configuration, Set<Schema> schemas) {
    Map<Name, Catalog> c = new LinkedHashMap<>();
    Map<Name, List<Schema>> mapping = new LinkedHashMap<>();
    for (Schema schema : schemas) mapping.computeIfAbsent(nameOrDefault(schema.getCatalog()), k -> new ArrayList<>()).add(schema);
    for (Schema schema : schemas) c.computeIfAbsent(nameOrDefault(schema.getCatalog()), k -> new CatalogImpl(k) {

        @Override
        public List<Schema> getSchemas() {
            return mapping.get(getQualifiedName());
        }
    });
    return filterCatalogs(configuration, new LinkedHashSet<>(c.values())).filterSchemas(schemas::contains);
}
Also used : Arrays(java.util.Arrays) Predicate(java.util.function.Predicate) Name(org.jooq.Name) Set(java.util.Set) Table(org.jooq.Table) EMPTY_CATALOG(org.jooq.impl.Tools.EMPTY_CATALOG) Meta(org.jooq.Meta) ArrayList(java.util.ArrayList) QueryPart(org.jooq.QueryPart) LinkedHashMap(java.util.LinkedHashMap) Configuration(org.jooq.Configuration) List(java.util.List) Catalog(org.jooq.Catalog) AbstractNamed.nameOrDefault(org.jooq.impl.AbstractNamed.nameOrDefault) Map(java.util.Map) Schema(org.jooq.Schema) LinkedHashSet(java.util.LinkedHashSet) LinkedHashSet(java.util.LinkedHashSet) Schema(org.jooq.Schema) ArrayList(java.util.ArrayList) List(java.util.List) Catalog(org.jooq.Catalog) Name(org.jooq.Name) LinkedHashMap(java.util.LinkedHashMap)

Example 12 with Catalog

use of org.jooq.Catalog in project jOOQ by jOOQ.

the class CatalogImpl method accept.

@Override
public final void accept(Context<?> ctx) {
    Catalog mappedCatalog = getMappedCatalog(ctx, this);
    ctx.visit(mappedCatalog != null ? mappedCatalog.getUnqualifiedName() : getUnqualifiedName());
}
Also used : Tools.getMappedCatalog(org.jooq.impl.Tools.getMappedCatalog) Catalog(org.jooq.Catalog)

Aggregations

Catalog (org.jooq.Catalog)12 Schema (org.jooq.Schema)8 Table (org.jooq.Table)5 InformationSchema (org.jooq.util.xml.jaxb.InformationSchema)5 LinkedHashSet (java.util.LinkedHashSet)4 ArrayList (java.util.ArrayList)3 Name (org.jooq.Name)3 DSL.currentCatalog (org.jooq.impl.DSL.currentCatalog)3 List (java.util.List)2 Map (java.util.Map)2 Configuration (org.jooq.Configuration)2 Sequence (org.jooq.Sequence)2 FALSE (java.lang.Boolean.FALSE)1 TRUE (java.lang.Boolean.TRUE)1 BigInteger (java.math.BigInteger)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Collections.emptyList (java.util.Collections.emptyList)1 Comparator.comparing (java.util.Comparator.comparing)1 Comparator.comparingInt (java.util.Comparator.comparingInt)1