HHH-9876 - Ability to filter objects from Database for schema tooling

This commit is contained in:
Steve Ebersole 2016-01-25 10:18:27 -06:00
parent acab6c579b
commit af2d642cf6
4 changed files with 65 additions and 6 deletions

View File

@ -1,3 +1,9 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.tool.schema.internal;
import org.hibernate.boot.model.relational.Namespace;
@ -5,6 +11,9 @@ import org.hibernate.boot.model.relational.Sequence;
import org.hibernate.mapping.Table;
import org.hibernate.tool.schema.spi.SchemaFilter;
/**
* Default implementation of the SchemaFilter contract, which is to just include everything.
*/
public class DefaultSchemaFilter implements SchemaFilter {
public static final DefaultSchemaFilter INSTANCE = new DefaultSchemaFilter();

View File

@ -1,10 +1,19 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.tool.schema.internal;
import org.hibernate.tool.schema.spi.SchemaFilter;
import org.hibernate.tool.schema.spi.SchemaFilterProvider;
/**
* Default implementation of the SchemaFilterProvider contract, which returns
* {@link DefaultSchemaFilter} for all filters.
*/
public class DefaultSchemaFilterProvider implements SchemaFilterProvider {
public static final DefaultSchemaFilterProvider INSTANCE = new DefaultSchemaFilterProvider();
@Override

View File

@ -1,15 +1,50 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.tool.schema.spi;
import org.hibernate.boot.model.relational.Namespace;
import org.hibernate.boot.model.relational.Sequence;
import org.hibernate.mapping.Table;
/**
* Defines a filter for Hibernate's schema tooling.
*/
public interface SchemaFilter {
/**
* Should the given namespace (catalog+schema) be included? If {@code true}, the
* namespace will be further processed; if {@code false}, processing will skip this
* namespace.
*
* @param namespace The namespace to check for inclusion.
*
* @return {@code true} to include the namespace; {@code false} otherwise
*/
boolean includeNamespace(Namespace namespace);
boolean includeNamespace( Namespace namespace );
boolean includeTable( Table table );
/**
* Should the given table be included? If {@code true}, the
* table will be further processed; if {@code false}, processing will skip this
* table.
*
* @param table The table to check for inclusion
*
* @return {@code true} to include the table; {@code false} otherwise
*/
boolean includeTable(Table table);
/**
* Should the given sequence be included? If {@code true}, the
* sequence will be further processed; if {@code false}, processing will skip this
* sequence.
*
* @param sequence The sequence to check for inclusion
*
* @return {@code true} to include the sequence; {@code false} otherwise
*/
boolean includeSequence(Sequence sequence);
boolean includeSequence( Sequence sequence );
}

View File

@ -1,3 +1,9 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.tool.schema.spi;
/**