Examples of EntityIndexBinding


Examples of org.hibernate.search.engine.spi.EntityIndexBinding

  public boolean isEmbedded(Class<?> type, String... propertyPath) {
    if ( propertyPath.length == 0 ) {
      return false;
    }

    EntityIndexBinding entityIndexBinding = getIndexBinding( type );
    TypeMetadata metadata = entityIndexBinding.getDocumentBuilder().getMetadata();

    for ( int i = 0; i < propertyPath.length; i++ ) {
      List<EmbeddedTypeMetadata> embeddedTypeMetadata = metadata.getEmbeddedTypeMetadata();
      metadata = getEmbeddedTypeMetadata( embeddedTypeMetadata, propertyPath[i] );
      if ( metadata == null ) {
View Full Code Here

Examples of org.hibernate.search.engine.spi.EntityIndexBinding

  private EntityIndexBinding getIndexBinding(Class<?> type) {
    return getIndexBinding( searchFactory, type );
  }

  private EntityIndexBinding getIndexBinding(SearchFactoryIntegrator searchFactory, Class<?> type) {
    EntityIndexBinding entityIndexBinding = searchFactory.getIndexBinding( type );

    if ( entityIndexBinding == null ) {
      throw log.getNoIndexedEntityException( type.getCanonicalName() );
    }
View Full Code Here

Examples of org.hibernate.search.engine.spi.EntityIndexBinding

   *
   * @return the {@code DocumentBuilder} for the specified object
   */
  protected AbstractDocumentBuilder getDocumentBuilder(final Object instance) {
    Class<?> clazz = instance.getClass();
    EntityIndexBinding entityIndexBinding = searchFactoryImplementor.getIndexBinding( clazz );
    if ( entityIndexBinding != null ) {
      return entityIndexBinding.getDocumentBuilder();
    }
    else {
      return searchFactoryImplementor.getDocumentBuilderContainedEntity( clazz );
    }
  }
View Full Code Here

Examples of org.hibernate.search.engine.spi.EntityIndexBinding

    }
    return luceneDocument;
  }

  private String objectIdInString(Class<?> entityClass, Serializable id, ConversionContext conversionContext) {
    EntityIndexBinding indexBindingForEntity = searchFactory.getIndexBinding( entityClass );
    if ( indexBindingForEntity == null ) {
      throw new SearchException( "Unable to find entity type metadata while deserializing: " + entityClass );
    }
    DocumentBuilderIndexedEntity documentBuilder = indexBindingForEntity.getDocumentBuilder();
    return documentBuilder.objectToString( documentBuilder.getIdKeywordName(), id, conversionContext );
  }
View Full Code Here

Examples of org.hibernate.search.engine.spi.EntityIndexBinding

      return new EmbeddedLuceneQuery(searchManager, parsingResult, sort, startOffset, maxResults);
   }

   private PropertyMetadata getPropertyMetadata(Class<?> type, String propName) {
      EntityIndexBinding entityIndexBinding = ((SearchFactoryImplementor) searchManager.getSearchFactory()).getIndexBinding(type);
      if (entityIndexBinding == null) {
         throw new IllegalArgumentException("The type " + type.getName() + " is not an indexed entity.");
      }

      return entityIndexBinding.getDocumentBuilder().getMetadata().getPropertyMetadataForProperty(propName);
   }
View Full Code Here

Examples of org.hibernate.search.engine.spi.EntityIndexBinding

    }
    else {
      Set<Class<?>> involvedClasses = new HashSet<Class<?>>( indexedTargetedEntities.size() );
      involvedClasses.addAll( indexedTargetedEntities );
      for ( Class<?> clazz : indexedTargetedEntities ) {
        EntityIndexBinding indexBinder = builders.get( clazz );
        if ( indexBinder != null ) {
          DocumentBuilderIndexedEntity<?> builder = indexBinder.getDocumentBuilder();
          involvedClasses.addAll( builder.getMappedSubclasses() );
        }
      }

      for ( Class clazz : involvedClasses ) {
        EntityIndexBinding entityIndexBinding = builders.get( clazz );
        //TODO should we rather choose a polymorphic path and allow non mapped entities
        if ( entityIndexBinding == null ) {
          throw new SearchException( "Not a mapped entity (don't forget to add @Indexed): " + clazz );
        }
        DocumentBuilderIndexedEntity<?> builder = entityIndexBinding.getDocumentBuilder();
        if ( builder.getIdKeywordName() != null ) {
          idFieldNames.add( builder.getIdKeywordName() );
          allowFieldSelectionInProjection = allowFieldSelectionInProjection && builder.allowFieldSelectionInProjection();
        }
        searcherSimilarity = checkSimilarity( searcherSimilarity, entityIndexBinding.getSimilarity() );
        useFieldCacheOnClassTypes = useFieldCacheOnClassTypes || builder.getFieldCacheOption()
            .contains( FieldCacheType.CLASS );
        populateIndexManagers( targetedIndexes, entityIndexBinding.getSelectionStrategy() );
      }
      this.classesAndSubclasses = involvedClasses;
    }
    this.idFieldNames = idFieldNames;
View Full Code Here

Examples of org.hibernate.search.engine.spi.EntityIndexBinding

    Map<Class<?>, EntityIndexBinding> builders = searchFactoryImplementor.getIndexBindings();
    Set<FieldCacheCollectorFactory> allCollectors = new HashSet<FieldCacheCollectorFactory>();
    // we need all documentBuilder to agree on type, fieldName, and enabling the option:
    FieldCacheCollectorFactory anyImplementation = null;
    for ( Class<?> clazz : classesAndSubclasses ) {
      EntityIndexBinding docBuilder = builders.get( clazz );
      FieldCacheCollectorFactory fieldCacheCollectionFactory = docBuilder.getIdFieldCacheCollectionFactory();
      if ( fieldCacheCollectionFactory == null ) {
        // some implementation disable it, so we won't use it
        return null;
      }
      anyImplementation = fieldCacheCollectionFactory;
View Full Code Here

Examples of org.hibernate.search.engine.spi.EntityIndexBinding

  private boolean transactionExpected;

  @Override
  public void performWork(Work<?> work, TransactionContext transactionContext) {
    final Class<?> entityType = instanceInitializer.getClassFromWork( work );
    EntityIndexBinding indexBindingForEntity = factory.getIndexBinding( entityType );
    if ( indexBindingForEntity == null
        && factory.getDocumentBuilderContainedEntity( entityType ) == null ) {
      throw new SearchException( "Unable to perform work. Entity Class is not @Indexed nor hosts @ContainedIn: " + entityType );
    }
    work = interceptWork( indexBindingForEntity, work );
View Full Code Here

Examples of org.hibernate.search.engine.spi.EntityIndexBinding

      Map<Class<?>, EntityIndexBinding> documentBuildersIndexedEntities,
      Map<Class<?>, DocumentBuilderContainedEntity<?>> documentBuildersContainedEntities) {
    for ( XClass xClass : optimizationBlackListX ) {
      Class<?> type = classMappings.get( xClass );
      if ( type != null ) {
        EntityIndexBinding entityIndexBinding = documentBuildersIndexedEntities.get( type );
        if ( entityIndexBinding != null ) {
          log.tracef( "Dirty checking optimizations disabled for class %s", type );
          entityIndexBinding.getDocumentBuilder().forceStateInspectionOptimizationsDisabled();
        }
        DocumentBuilderContainedEntity<?> documentBuilderContainedEntity = documentBuildersContainedEntities.get( type );
        if ( documentBuilderContainedEntity != null ) {
          log.tracef( "Dirty checking optimizations disabled for class %s", type );
          documentBuilderContainedEntity.forceStateInspectionOptimizationsDisabled();
View Full Code Here

Examples of org.hibernate.search.engine.spi.EntityIndexBinding

    public final Set<Class<?>> mappedSubclasses;
    private final Criteria criteria;

    RootEntityMetadata(Class<?> rootEntity, SearchFactoryImplementor searchFactoryImplementor) {
      this.rootEntity = rootEntity;
      EntityIndexBinding provider = searchFactoryImplementor.getIndexBinding( rootEntity );
      if ( provider == null ) {
        throw new AssertionFailure("Provider not found for class: " + rootEntity);
      }
      this.mappedSubclasses = provider.getDocumentBuilder().getMappedSubclasses();
      this.criteria = null; //default
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.