本文整理汇总了Java中org.hibernate.engine.spi.FilterDefinition类的典型用法代码示例。如果您正苦于以下问题:Java FilterDefinition类的具体用法?Java FilterDefinition怎么用?Java FilterDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FilterDefinition类属于org.hibernate.engine.spi包,在下文中一共展示了FilterDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 );
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:HbmBinder.java
示例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 );
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:FilterDefBinder.java
示例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 );
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:AnnotationBinder.java
示例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 ) );
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:HibernateMappingProcessor.java
示例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 );
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:MetadataImpl.java
示例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;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:SessionFactoryImpl.java
示例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);
}
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:20,代码来源:JspressoLocalSessionFactoryBean.java
示例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();
}
开发者ID:frincon,项目名称:openeos,代码行数:29,代码来源:FilterConfigurator.java
示例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;
}
开发者ID:Gary-zhouxianjun,项目名称:hibernate-dynamic-dialects,代码行数:10,代码来源:SessionFactoryImpl.java
示例10: getFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public FilterDefinition getFilterDefinition(String filterName)
throws HibernateException {
return sessionFactoryImplementor.getFilterDefinition(filterName);
}
开发者ID:zhaojunfei,项目名称:lemon,代码行数:5,代码来源:SessionFactoryWrapper.java
示例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;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:64,代码来源:Configuration.java
示例12: addFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public void addFilterDefinition(FilterDefinition definition) {
filterDefinitions.put( definition.getFilterName(), definition );
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:Configuration.java
示例13: getFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public FilterDefinition getFilterDefinition(String name) {
return filterDefinitions.get( name );
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:Configuration.java
示例14: getFilterDefinitions
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public Iterable<FilterDefinition> getFilterDefinitions() {
return filterDefinitions;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:EntityBinding.java
示例15: addFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public void addFilterDefinition(FilterDefinition filterDefinition) {
filterDefinitions.add( filterDefinition );
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:EntityBinding.java
示例16: getFilterDefinitions
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public Iterable<FilterDefinition> getFilterDefinitions() {
return filterDefs.values();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:MetadataImpl.java
示例17: getFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public FilterDefinition getFilterDefinition() {
return definition;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:FilterImpl.java
示例18: bindRoot
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
/**
* Binds a root class (one with no super classes) to the runtime meta model
* based on the supplied Grails domain class
*
* @param entity The Grails domain class
* @param mappings The Hibernate Mappings object
* @param sessionFactoryBeanName the session factory bean name
*/
public void bindRoot(HibernatePersistentEntity entity, InFlightMetadataCollector mappings, String sessionFactoryBeanName) {
if (mappings.getEntityBinding(entity.getName()) != null) {
LOG.info("[GrailsDomainBinder] Class [" + entity.getName() + "] is already mapped, skipping.. ");
return;
}
RootClass root = new RootClass(this.metadataBuildingContext);
root.setAbstract(entity.isAbstract());
final MappingContext mappingContext = entity.getMappingContext();
final java.util.Collection<PersistentEntity> children = mappingContext.getDirectChildEntities(entity);
if (children.isEmpty()) {
root.setPolymorphic(false);
}
bindClass(entity, root, mappings);
Mapping m = getMapping(entity);
bindRootPersistentClassCommonValues(entity, root, mappings, sessionFactoryBeanName);
if (!children.isEmpty()) {
boolean tablePerSubclass = m != null && !m.getTablePerHierarchy();
if (!tablePerSubclass) {
// if the root class has children create a discriminator property
bindDiscriminatorProperty(root.getTable(), root, mappings);
}
// bind the sub classes
bindSubClasses(entity, root, mappings, sessionFactoryBeanName);
}
if(entity.isMultiTenant()) {
TenantId tenantId = entity.getTenantId();
if(tenantId != null) {
String filterCondition = getMultiTenantFilterCondition(sessionFactoryBeanName, entity);
root.addFilter(GormProperties.TENANT_IDENTITY,filterCondition, true, Collections.<String, String>emptyMap(), Collections.<String, String>emptyMap());
mappings.addFilterDefinition(new FilterDefinition(
GormProperties.TENANT_IDENTITY,
filterCondition,
Collections.singletonMap(GormProperties.TENANT_IDENTITY, root.getProperty(tenantId.getName()).getType())
));
}
}
mappings.addEntityBinding(root);
}
开发者ID:grails,项目名称:gorm-hibernate5,代码行数:56,代码来源:GrailsDomainBinder.java
示例19: getFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public FilterDefinition getFilterDefinition(String filterName) throws HibernateException {
return null;
}
开发者ID:apache,项目名称:ignite,代码行数:5,代码来源:CacheHibernateStoreFactorySelfTest.java
示例20: getFilterDefinition
import org.hibernate.engine.spi.FilterDefinition; //导入依赖的package包/类
public FilterDefinition getFilterDefinition(String filterName)
throws HibernateException {
return getHibernateSessionFactory().getFilterDefinition(filterName);
}
开发者ID:hyberbin,项目名称:hyberbin-osgi,代码行数:5,代码来源:DynamicSessionFactory.java
注:本文中的org.hibernate.engine.spi.FilterDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论