HHH-7038 - Define sources for filters, filter-defs, type-defs, fetch-profiles

This commit is contained in:
Steve Ebersole 2012-02-08 13:11:20 -06:00
parent a096b1c874
commit b847b0598a
6 changed files with 320 additions and 0 deletions

View File

@ -0,0 +1,45 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2012, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.spi.source;
/**
* Defines a source of configuration value.
*
* @author Steve Ebersole
*/
public interface ConfigurationValueSource {
/**
* Get the configuration name.
*
* @return The configuration name
*/
public String getName();
/**
* Get the configuration value
*
* @return The configuration value.
*/
public String getValue();
}

View File

@ -0,0 +1,73 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2012, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.spi.source;
import org.hibernate.annotations.FetchMode;
/**
* Defines a source of fetch profile information
*
* @author Steve Ebersole
*/
public interface FetchProfileSource {
/**
* Defines a source of an association fetch information within a fetch profile
*/
public static interface AssociationOverrideSource {
/**
* Retrieve the name of the entity containing the association.
*
* @return The entity name.
*/
public String getEntityName();
/**
* Retrieve the name of the association attribute on the entity.
*
* @return The attribute name
*/
public String getAttributeName();
/**
* Retrieve the fetch mode to be applied to the association as part of this profile.
*
* @return the fetch mode.
*/
public FetchMode getFetchMode();
}
/**
* Retrieve the name of the profile.
*
* @return The profile name.
*/
public String getName();
/**
* Retrieve the association fetching overrides associated with this profile.
*
* @return The association fetching overrides
*/
public Iterable<AssociationOverrideSource> getAssociationOverrides();
}

View File

@ -0,0 +1,60 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2012, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.spi.source;
/**
* Describe the source of filer def information. Generally either {@code <filter-def/>} or
* {@link org.hibernate.annotations.FilterDef @FilterDef}
*
* @author Steve Ebersole
*/
public interface FilterDefSource {
/**
* Retrieve the name of the filter. Would match the related {@link FilterSource#getName}
*
* @return The filter name
*
* @see FilterSource#getName
*/
public String getName();
/**
* Retrieve the condition specified as part of the def. Defines the condition to use
* in related filters when {@link FilterSource#getCondition} is null.
*
* @return The "default" condition for associated filters.
*
* @see FilterSource#getCondition
*/
public String getCondition();
/**
* Retrieve parameter sources associated with this filer def.
*
* @return The parameter sources. Can be null.
*
* @see FilterSource#getParameterSources()
*/
public Iterable<FilterParameterSource> getParameterSources();
}

View File

@ -0,0 +1,45 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2012, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.spi.source;
/**
* Describes the source of filter parameter information
*
* @author Steve Ebersole
*/
public interface FilterParameterSource {
/**
* Retrieve the name of the parameter being described.
*
* @return The name
*/
public String getParameterName();
/**
* The Hibernate type name that can be used to handle bound parameter values.
*
* @return the type
*/
public String getParameterValueTyeName();
}

View File

@ -0,0 +1,60 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2012, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.spi.source;
/**
* Defines the source of filter information. May have an associated {@link FilterDefSource}.
* Relates to both {@code <filter/>} and {@link org.hibernate.annotations.Filter @Filter}
*
* @author Steve Ebersole
*/
public interface FilterSource {
/**
* Get the name of the filter being described.
*
* @return The name.
*/
public String getName();
/**
* Get the condition associated with the filter. Can be {@code null} in the case of a filter described
* further by a "filter def" which contains the condition text.
*
* @return The condition defined on the filter.
*
* @see {@link org.hibernate.metamodel.spi.source.FilterDefSource#getCondition()}
*/
public String getCondition();
/**
* Retrieves the defined sources of parameter information pertaining to this filer.
* <p/>
* Will be <b>merged</b> with parameter sources associated with matching "filter def"
*
* @return The parameter sources defined on the filter.
*
* @see {@link org.hibernate.metamodel.spi.source.FilterDefSource#getParameterSources()}
*/
public Iterable<FilterParameterSource> getParameterSources();
}

View File

@ -0,0 +1,37 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2012, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.spi.source;
/**
* Describes the source of a custom type description. For example, {@code <type-def/>} or
* {@link org.hibernate.annotations.TypeDef @TypeDef}
*
* @author Steve Ebersole
*/
public interface TypeDescriptorSource {
public String getName();
public String getTypeImplementationClassName();
public Iterable<String> getRegistrationKeys();
public Iterable<ConfigurationValueSource> getConfigurationValueSources();
}