本文整理汇总了Java中org.hibernate.engine.spi.FilterDefinition类的典型用法代码示例。如果您正苦于以下问题:Java FilterDefinition类的具体用法?Java FilterDefinition怎么用?Java FilterDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FilterDefinition类属于org.hibernate.engine.spi包,在下文中一共展示了FilterDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseFilterDef
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
private static void parseFilterDef(Element element, Mappings mappings) {
String name = element.attributeValue( "name" );
LOG.debugf( "Parsing filter-def [%s]", name );
String defaultCondition = element.getTextTrim();
if ( StringHelper.isEmpty( defaultCondition ) ) {
defaultCondition = element.attributeValue( "condition" );
}
HashMap paramMappings = new HashMap();
Iterator params = element.elementIterator( "filter-param" );
while ( params.hasNext() ) {
final Element param = (Element) params.next();
final String paramName = param.attributeValue( "name" );
final String paramType = param.attributeValue( "type" );
LOG.debugf( "Adding filter parameter : %s -> %s", paramName, paramType );
final Type heuristicType = mappings.getTypeResolver().heuristicType( paramType );
LOG.debugf( "Parameter heuristic type : %s", heuristicType );
paramMappings.put( paramName, heuristicType );
}
LOG.debugf( "Parsed filter-def [%s]", name );
FilterDefinition def = new FilterDefinition( name, defaultCondition, paramMappings );
mappings.addFilterDefinition( def );
}
示例2: bind
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
private static void bind(MetadataImplementor metadata, AnnotationInstance filterDef) {
String name = JandexHelper.getValue( filterDef, "name", String.class );
Map<String, Type> prms = new HashMap<String, Type>();
for ( AnnotationInstance prm : JandexHelper.getValue( filterDef, "parameters", AnnotationInstance[].class ) ) {
prms.put(
JandexHelper.getValue( prm, "name", String.class ),
metadata.getTypeResolver().heuristicType( JandexHelper.getValue( prm, "type", String.class ) )
);
}
metadata.addFilterDefinition(
new FilterDefinition(
name,
JandexHelper.getValue( filterDef, "defaultCondition", String.class ),
prms
)
);
LOG.debugf( "Binding filter definition: %s", name );
}
示例3: bindFilterDef
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
private static void bindFilterDef(FilterDef defAnn, Mappings mappings) {
Map<String, org.hibernate.type.Type> params = new HashMap<String, org.hibernate.type.Type>();
for ( ParamDef param : defAnn.parameters() ) {
params.put( param.name(), mappings.getTypeResolver().heuristicType( param.type() ) );
}
FilterDefinition def = new FilterDefinition( defAnn.name(), defAnn.defaultCondition(), params );
LOG.debugf( "Binding filter definition: %s", def.getFilterName() );
mappings.addFilterDefinition( def );
}
示例4: processFilterDefinitions
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
private void processFilterDefinitions() {
if ( mappingRoot().getFilterDef() == null ) {
return;
}
for ( JaxbHibernateMapping.JaxbFilterDef filterDefinition : mappingRoot().getFilterDef() ) {
final String name = filterDefinition.getName();
final Map<String,Type> parameters = new HashMap<String, Type>();
String condition = null;
for ( Object o : filterDefinition.getContent() ) {
if ( o instanceof String ) {
// represents the condition
if ( condition != null ) {
// log?
}
condition = (String) o;
}
else if ( o instanceof JaxbHibernateMapping.JaxbFilterDef.JaxbFilterParam ) {
final JaxbHibernateMapping.JaxbFilterDef.JaxbFilterParam paramElement =
JaxbHibernateMapping.JaxbFilterDef.JaxbFilterParam.class.cast( o );
// todo : should really delay this resolution until later to allow typedef names
parameters.put(
paramElement.getName(),
metadata.getTypeResolver().heuristicType( paramElement.getType() )
);
}
else {
throw new MappingException( "Unrecognized nested filter content", origin() );
}
}
if ( condition == null ) {
condition = filterDefinition.getCondition();
}
metadata.addFilterDefinition( new FilterDefinition( name, condition, parameters ) );
}
}
示例5: addFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
@Override
public void addFilterDefinition(FilterDefinition def) {
if ( def == null || def.getFilterName() == null ) {
throw new IllegalArgumentException( "Filter definition object or name is null: " + def );
}
filterDefs.put( def.getFilterName(), def );
}
示例6: getFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public FilterDefinition getFilterDefinition(String filterName) throws HibernateException {
FilterDefinition def = filters.get( filterName );
if ( def == null ) {
throw new HibernateException( "No such filter configured [" + filterName + "]" );
}
return def;
}
示例7: buildSessionFactory
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
/**
* Registers the default Jspresso Filter.
* <p>
* {@inheritDoc}
*/
@Override
protected SessionFactory buildSessionFactory(LocalSessionFactoryBuilder sfb) {
Map<String, Type> filterParameters = new HashMap<>();
filterParameters.put(
HibernateBackendController.JSPRESSO_SESSION_GLOBALS_LOGIN, sfb
.getTypeResolver().heuristicType("string"));
filterParameters.put(
HibernateBackendController.JSPRESSO_SESSION_GLOBALS_LANGUAGE, sfb
.getTypeResolver().heuristicType("string"));
sfb.addFilterDefinition(new FilterDefinition(
HibernateBackendController.JSPRESSO_SESSION_GLOBALS, null,
filterParameters));
return super.buildSessionFactory(sfb);
}
示例8: addFilterDefinitions
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
private void addFilterDefinitions(FilterProvider provider, ConfigurationProvider configurationProvider) {
Configuration conf = configurationProvider.getConfiguration();
conf.buildMappings();
Map<?, ?> filterDefinitions = conf.getFilterDefinitions();
TypeResolver resolver = conf.getTypeResolver();
for (BasicFilterDefinition filterDef : provider.getFilterDefinitions()) {
Map<String, Type> paramMapConverted = new HashMap<String, Type>();
for (Entry<String, String> paramEntry : filterDef.getParameterTypeMap().entrySet()) {
Type type = resolver.heuristicType(paramEntry.getValue());
paramMapConverted.put(paramEntry.getKey(), type);
}
FilterDefinition definition = new FilterDefinition(filterDef.getName(), filterDef.getDefaultCondition(),
paramMapConverted);
LOG.debug("Registering new filter definition with name '{}'", definition.getFilterName());
if (filterDefinitions.containsKey(definition.getFilterName())) {
LOG.warn("The configuration already has filter definition with name '{}', overwriting.",
definition.getFilterName());
}
conf.addFilterDefinition(definition);
filterProviderMap.put(definition.getFilterName(), provider);
Iterator<PersistentClass> classIterator = conf.getClassMappings();
while (classIterator.hasNext()) {
PersistentClass persistentClass = classIterator.next();
provider.addFilterToClassIfNecesary(persistentClass, filterDef);
}
}
configurationProvider.invalidate();
}
示例9: getFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public FilterDefinition getFilterDefinition(String filterName)
throws HibernateException {
FilterDefinition def = filters.get(filterName);
if (def == null) {
throw new HibernateException("No such filter configured ["
+ filterName + "]");
}
return def;
}
示例10: getFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public FilterDefinition getFilterDefinition(String filterName)
throws HibernateException {
return sessionFactoryImplementor.getFilterDefinition(filterName);
}
示例11: reset
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
protected void reset() {
metadataSourceQueue = new MetadataSourceQueue();
createReflectionManager();
classes = new HashMap<String,PersistentClass>();
imports = new HashMap<String,String>();
collections = new HashMap<String,Collection>();
tables = new TreeMap<String,Table>();
namedQueries = new HashMap<String,NamedQueryDefinition>();
namedSqlQueries = new HashMap<String,NamedSQLQueryDefinition>();
sqlResultSetMappings = new HashMap<String, ResultSetMappingDefinition>();
namedEntityGraphMap = new HashMap<String, NamedEntityGraphDefinition>();
namedProcedureCallMap = new HashMap<String, NamedProcedureCallDefinition>( );
typeDefs = new HashMap<String,TypeDef>();
filterDefinitions = new HashMap<String, FilterDefinition>();
fetchProfiles = new HashMap<String, FetchProfile>();
auxiliaryDatabaseObjects = new ArrayList<AuxiliaryDatabaseObject>();
tableNameBinding = new HashMap();
columnNameBindingPerTable = new HashMap();
secondPasses = new ArrayList<SecondPass>();
propertyReferences = new ArrayList<Mappings.PropertyReference>();
extendsQueue = new HashMap<ExtendsQueueEntry, String>();
xmlHelper = new XMLHelper();
interceptor = EmptyInterceptor.INSTANCE;
properties = Environment.getProperties();
entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER;
sqlFunctions = new HashMap<String, SQLFunction>();
entityTuplizerFactory = new EntityTuplizerFactory();
// componentTuplizerFactory = new ComponentTuplizerFactory();
identifierGeneratorFactory = new DefaultIdentifierGeneratorFactory();
mappedSuperClasses = new HashMap<Class<?>, MappedSuperclass>();
metadataSourcePrecedence = Collections.emptyList();
namedGenerators = new HashMap<String, IdGenerator>();
joins = new HashMap<String, Map<String, Join>>();
classTypes = new HashMap<String, AnnotatedClassType>();
generatorTables = new HashMap<String, Properties>();
defaultNamedQueryNames = new HashSet<String>();
defaultNamedNativeQueryNames = new HashSet<String>();
defaultSqlResultSetMappingNames = new HashSet<String>();
defaultNamedProcedure = new HashSet<String>( );
defaultNamedGenerators = new HashSet<String>();
uniqueConstraintHoldersByTable = new HashMap<Table, List<UniqueConstraintHolder>>();
jpaIndexHoldersByTable = new HashMap<Table,List<JPAIndexHolder>>( );
mappedByResolver = new HashMap<String, String>();
propertyRefResolver = new HashMap<String, String>();
caches = new ArrayList<CacheHolder>();
namingStrategyDelegator = LegacyNamingStrategyDelegator.DEFAULT_INSTANCE;
setEntityResolver( new EJB3DTDEntityResolver() );
anyMetaDefs = new HashMap<String, AnyMetaDef>();
propertiesAnnotatedWithMapsId = new HashMap<XClass, Map<String, PropertyData>>();
propertiesAnnotatedWithIdAndToOne = new HashMap<XClass, Map<String, PropertyData>>();
specjProprietarySyntaxEnabled = System.getProperty( "hibernate.enable_specj_proprietary_syntax" ) != null;
}
示例12: addFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public void addFilterDefinition(FilterDefinition definition) {
filterDefinitions.put( definition.getFilterName(), definition );
}
示例13: getFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public FilterDefinition getFilterDefinition(String name) {
return filterDefinitions.get( name );
}
示例14: getFilterDefinitions
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public Iterable<FilterDefinition> getFilterDefinitions() {
return filterDefinitions;
}
示例15: addFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public void addFilterDefinition(FilterDefinition filterDefinition) {
filterDefinitions.add( filterDefinition );
}