org.hibernate.search.engine
Class DocumentBuilderContainedEntity<T>

java.lang.Object
  extended by org.hibernate.search.engine.DocumentBuilderContainedEntity<T>
All Implemented Interfaces:
DocumentBuilder
Direct Known Subclasses:
DocumentBuilderIndexedEntity

public class DocumentBuilderContainedEntity<T>
extends Object
implements DocumentBuilder

Set up and provide a manager for classes which are indexed via @IndexedEmbedded, but themselves do not contain the @Indexed annotation.

Author:
Gavin King, Emmanuel Bernard, Sylvain Vieujot, Richard Hallier, Hardy Ferentschik

Nested Class Summary
protected static class DocumentBuilderContainedEntity.PropertiesMetadata
          Wrapper class containing all the meta data extracted out of the entities.
 
Field Summary
protected  ScopedAnalyzer analyzer
           
protected  org.hibernate.annotations.common.reflection.XClass beanClass
           
protected  EntityState entityState
           
protected  boolean isRoot
           
protected  int level
           
protected  Set<Class<?>> mappedSubclasses
           
protected  int maxLevel
           
protected  DocumentBuilderContainedEntity.PropertiesMetadata metadata
           
protected  org.hibernate.annotations.common.reflection.ReflectionManager reflectionManager
           
protected  org.apache.lucene.search.Similarity similarity
           
 
Fields inherited from interface org.hibernate.search.engine.DocumentBuilder
CLASS_FIELDNAME
 
Constructor Summary
DocumentBuilderContainedEntity(org.hibernate.annotations.common.reflection.XClass clazz, InitContext context, org.hibernate.annotations.common.reflection.ReflectionManager reflectionManager)
          Constructor used on contained entities not annotated with @Indexed themselves.
 
Method Summary
 void addWorkToQueue(Class<T> entityClass, T entity, Serializable id, WorkType workType, List<LuceneWork> queue, SearchFactoryImplementor searchFactoryImplementor)
           
protected  void checkDocumentId(org.hibernate.annotations.common.reflection.XProperty member, DocumentBuilderContainedEntity.PropertiesMetadata propertiesMetadata, boolean isRoot, String prefix, InitContext context)
           
 org.apache.lucene.analysis.Analyzer getAnalyzer()
           
protected  org.apache.lucene.analysis.Analyzer getAnalyzer(Analyzer analyzerAnn, InitContext context)
           
protected  org.apache.lucene.analysis.Analyzer getAnalyzer(org.hibernate.annotations.common.reflection.XAnnotatedElement annotatedElement, InitContext context)
           
protected  Float getBoost(org.hibernate.annotations.common.reflection.XClass element)
           
protected  Float getBoost(org.hibernate.annotations.common.reflection.XProperty member, Field fieldAnn)
           
 EntityState getEntityState()
           
protected  String getIdAttributeName(org.hibernate.annotations.common.reflection.XProperty member, Annotation idAnnotation)
          Determines the property name for the document id.
protected  org.apache.lucene.document.Field.Index getIndex(Index index)
           
 Set<Class<?>> getMappedSubclasses()
           
 org.apache.lucene.search.Similarity getSimilarity()
           
protected  org.apache.lucene.document.Field.Store getStore(Store store)
           
protected  org.apache.lucene.document.Field.TermVector getTermVector(TermVector vector)
           
protected  void init(org.hibernate.annotations.common.reflection.XClass clazz, InitContext context)
           
protected  void initializeMemberLevelAnnotations(org.hibernate.annotations.common.reflection.XProperty member, DocumentBuilderContainedEntity.PropertiesMetadata propertiesMetadata, boolean isRoot, String prefix, Set<org.hibernate.annotations.common.reflection.XClass> processedClasses, InitContext context)
          Check for field and method level annotations.
 boolean isRoot()
           
 void postInitialize(Set<Class<?>> indexedClasses)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

metadata

protected final DocumentBuilderContainedEntity.PropertiesMetadata metadata

beanClass

protected final org.hibernate.annotations.common.reflection.XClass beanClass

mappedSubclasses

protected Set<Class<?>> mappedSubclasses

reflectionManager

protected org.hibernate.annotations.common.reflection.ReflectionManager reflectionManager

level

protected int level

maxLevel

protected int maxLevel

analyzer

protected final ScopedAnalyzer analyzer

similarity

protected org.apache.lucene.search.Similarity similarity

isRoot

protected boolean isRoot

entityState

protected EntityState entityState
Constructor Detail

DocumentBuilderContainedEntity

public DocumentBuilderContainedEntity(org.hibernate.annotations.common.reflection.XClass clazz,
                                      InitContext context,
                                      org.hibernate.annotations.common.reflection.ReflectionManager reflectionManager)
Constructor used on contained entities not annotated with @Indexed themselves.

Parameters:
clazz - The class for which to build a DocumentBuilderContainedEntity.
context - Handle to default configuration settings.
reflectionManager - Reflection manager to use for processing the annotations.
Method Detail

init

protected void init(org.hibernate.annotations.common.reflection.XClass clazz,
                    InitContext context)

isRoot

public boolean isRoot()

initializeMemberLevelAnnotations

protected void initializeMemberLevelAnnotations(org.hibernate.annotations.common.reflection.XProperty member,
                                                DocumentBuilderContainedEntity.PropertiesMetadata propertiesMetadata,
                                                boolean isRoot,
                                                String prefix,
                                                Set<org.hibernate.annotations.common.reflection.XClass> processedClasses,
                                                InitContext context)
Check for field and method level annotations.


getAnalyzer

protected org.apache.lucene.analysis.Analyzer getAnalyzer(org.hibernate.annotations.common.reflection.XAnnotatedElement annotatedElement,
                                                          InitContext context)

getAnalyzer

protected org.apache.lucene.analysis.Analyzer getAnalyzer(Analyzer analyzerAnn,
                                                          InitContext context)

getSimilarity

public org.apache.lucene.search.Similarity getSimilarity()

checkDocumentId

protected void checkDocumentId(org.hibernate.annotations.common.reflection.XProperty member,
                               DocumentBuilderContainedEntity.PropertiesMetadata propertiesMetadata,
                               boolean isRoot,
                               String prefix,
                               InitContext context)

getIdAttributeName

protected String getIdAttributeName(org.hibernate.annotations.common.reflection.XProperty member,
                                    Annotation idAnnotation)
Determines the property name for the document id. It is either the name of the property itself or the value of the name attribute of the idAnnotation.

Parameters:
member - the property used as id property.
idAnnotation - the id annotation
Returns:
property name to be used as document id.

getBoost

protected Float getBoost(org.hibernate.annotations.common.reflection.XProperty member,
                         Field fieldAnn)

getStore

protected org.apache.lucene.document.Field.Store getStore(Store store)

getTermVector

protected org.apache.lucene.document.Field.TermVector getTermVector(TermVector vector)

getIndex

protected org.apache.lucene.document.Field.Index getIndex(Index index)

getBoost

protected Float getBoost(org.hibernate.annotations.common.reflection.XClass element)

addWorkToQueue

public void addWorkToQueue(Class<T> entityClass,
                           T entity,
                           Serializable id,
                           WorkType workType,
                           List<LuceneWork> queue,
                           SearchFactoryImplementor searchFactoryImplementor)

getAnalyzer

public org.apache.lucene.analysis.Analyzer getAnalyzer()

postInitialize

public void postInitialize(Set<Class<?>> indexedClasses)

getEntityState

public EntityState getEntityState()

getMappedSubclasses

public Set<Class<?>> getMappedSubclasses()


Copyright © 2011 Hibernate. All Rights Reserved.