Examples of IndexedEmbedded


Examples of org.hibernate.search.annotations.IndexedEmbedded

      boolean disableOptimizations,
      TypeMetadata.Builder typeMetadataBuilder,
      ConfigContext configContext,
      PathsContext pathsContext,
      ParseContext parseContext) {
    IndexedEmbedded indexedEmbeddedAnnotation = member.getAnnotation( IndexedEmbedded.class );
    if ( indexedEmbeddedAnnotation == null ) {
      return;
    }

    parseContext.collectUnqualifiedCollectionRole( member.getName() );

    int oldMaxLevel = parseContext.getMaxLevel();
    int potentialLevel = depth( indexedEmbeddedAnnotation ) + parseContext.getLevel();
    // This is really catching a possible int overflow. depth() can return Integer.MAX_VALUE, which then can
    // overflow in case level > 0. Really this code should be rewritten (HF)
    if ( potentialLevel < 0 ) {
      potentialLevel = Integer.MAX_VALUE;
    }
    // HSEARCH-1442 recreating the behavior prior to PropertiesMetadata refactoring
    // not sure whether this is algorithmically correct though. @IndexedEmbedded processing should be refactored (HF)
    if ( potentialLevel < oldMaxLevel ) {
      parseContext.setMaxLevel( potentialLevel );
    }
    parseContext.incrementLevel();

    XClass elementClass;
    if ( void.class == indexedEmbeddedAnnotation.targetElement() ) {
      elementClass = member.getElementClass();
    }
    else {
      elementClass = reflectionManager.toXClass( indexedEmbeddedAnnotation.targetElement() );
    }

    if ( parseContext.getMaxLevel() == Integer.MAX_VALUE //infinite
        && parseContext.hasBeenProcessed( elementClass ) ) {
      throw new SearchException(
View Full Code Here

Examples of org.hibernate.search.annotations.IndexedEmbedded

      propertiesMetadata.containedInGetters.add( member );
    }
  }

  private void checkForIndexedEmbedded(XProperty member, PropertiesMetadata propertiesMetadata, String prefix, Set<XClass> processedClasses, InitContext context) {
    IndexedEmbedded embeddedAnn = member.getAnnotation( IndexedEmbedded.class );
    if ( embeddedAnn != null ) {
      int oldMaxLevel = maxLevel;
      int potentialLevel = embeddedAnn.depth() + level;
      if ( potentialLevel < 0 ) {
        potentialLevel = Integer.MAX_VALUE;
      }
      maxLevel = potentialLevel > maxLevel ? maxLevel : potentialLevel;
      level++;

      XClass elementClass;
      if ( void.class == embeddedAnn.targetElement() ) {
        elementClass = member.getElementClass();
      }
      else {
        elementClass = reflectionManager.toXClass( embeddedAnn.targetElement() );
      }
      if ( maxLevel == Integer.MAX_VALUE //infinite
          && processedClasses.contains( elementClass ) ) {
        throw new SearchException(
            "Circular reference. Duplicate use of "
View Full Code Here

Examples of org.hibernate.search.annotations.IndexedEmbedded

    }
  }

  private void checkForIndexedEmbedded(XClass classHostingMember, XProperty member, PropertiesMetadata propertiesMetadata, String prefix,
                     Set<XClass> processedClasses, ConfigContext context, Set<XClass> optimizationBlackList, boolean disableOptimizations) {
    IndexedEmbedded embeddedAnn = member.getAnnotation( IndexedEmbedded.class );
    if ( embeddedAnn != null ) {
      //collection role in Hibernate is made of the actual hosting class of the member (see HSEARCH-780)
      this.indexedEmbeddedCollectionRoles
          .add( StringHelper.qualify( classHostingMember.getName(), member.getName() ) );
      int oldMaxLevel = maxLevel;
      int potentialLevel = embeddedAnn.depth() + level;
      if ( potentialLevel < 0 ) {
        potentialLevel = Integer.MAX_VALUE;
      }
      maxLevel = potentialLevel > maxLevel ? maxLevel : potentialLevel;
      level++;

      XClass elementClass;
      if ( void.class == embeddedAnn.targetElement() ) {
        elementClass = member.getElementClass();
      }
      else {
        elementClass = reflectionManager.toXClass( embeddedAnn.targetElement() );
      }

      if ( maxLevel == Integer.MAX_VALUE //infinite
          && processedClasses.contains( elementClass ) ) {
        throw new SearchException(
View Full Code Here

Examples of org.hibernate.search.annotations.IndexedEmbedded

      boolean disableOptimizations,
      TypeMetadata.Builder typeMetadataBuilder,
      ConfigContext configContext,
      PathsContext pathsContext,
      ParseContext parseContext) {
    IndexedEmbedded indexedEmbeddedAnnotation = member.getAnnotation( IndexedEmbedded.class );
    if ( indexedEmbeddedAnnotation == null ) {
      return;
    }

    parseContext.collectUnqualifiedCollectionRole( member.getName() );

    int oldMaxLevel = parseContext.getMaxLevel();
    int potentialLevel = depth( indexedEmbeddedAnnotation ) + parseContext.getLevel();
    // This is really catching a possible int overflow. depth() can return Integer.MAX_VALUE, which then can
    // overflow in case level > 0. Really this code should be rewritten (HF)
    if ( potentialLevel < 0 ) {
      potentialLevel = Integer.MAX_VALUE;
    }
    // HSEARCH-1442 recreating the behavior prior to PropertiesMetadata refactoring
    // not sure whether this is algorithmically correct though. @IndexedEmbedded processing should be refactored (HF)
    if ( potentialLevel < oldMaxLevel ) {
      parseContext.setMaxLevel( potentialLevel );
    }
    parseContext.incrementLevel();

    XClass elementClass;
    if ( void.class == indexedEmbeddedAnnotation.targetElement() ) {
      elementClass = member.getElementClass();
    }
    else {
      elementClass = reflectionManager.toXClass( indexedEmbeddedAnnotation.targetElement() );
    }

    if ( parseContext.getMaxLevel() == Integer.MAX_VALUE //infinite
        && parseContext.hasBeenProcessed( elementClass ) ) {
      throw log.detectInfiniteTypeLoopInIndexedEmbedded(
          elementClass.getName(),
          typeMetadataBuilder.getIndexedType().getName(),
          buildEmbeddedPrefix( prefix, indexedEmbeddedAnnotation, member )
      );
    }

    String localPrefix = buildEmbeddedPrefix( prefix, indexedEmbeddedAnnotation, member );
    PathsContext updatedPathsContext = updatePaths( localPrefix, pathsContext, indexedEmbeddedAnnotation );

    boolean pathsCreatedAtThisLevel = false;
    if ( pathsContext == null && updatedPathsContext != null ) {
      //after this level if not all paths are traversed, then the paths
      //either don't exist in the object graph, or aren't indexed paths
      pathsCreatedAtThisLevel = true;
    }

    if ( !parseContext.isMaxLevelReached() || isInPath(
        localPrefix,
        updatedPathsContext,
        indexedEmbeddedAnnotation
    ) ) {
      parseContext.processingClass( elementClass ); //push

      EmbeddedTypeMetadata.Builder embeddedTypeMetadataBuilder =
          new EmbeddedTypeMetadata.Builder(
              reflectionManager.toClass( elementClass ),
              member,
              typeMetadataBuilder.getScopedAnalyzer()
          );

      embeddedTypeMetadataBuilder.boost( AnnotationProcessingHelper.getBoost( member, null ) );
      //property > entity analyzer
      Analyzer analyzer = AnnotationProcessingHelper.
          getAnalyzer(
              member.getAnnotation( org.hibernate.search.annotations.Analyzer.class ),
              configContext
          );
      if ( analyzer == null ) {
        analyzer = typeMetadataBuilder.getAnalyzer();
      }
      embeddedTypeMetadataBuilder.analyzer( analyzer );

      if ( disableOptimizations ) {
        typeMetadataBuilder.blacklistForOptimization( elementClass );
      }

      // about to do a recursion, keep parse state which needs resetting
      XClass previousClass = parseContext.getCurrentClass();
      parseContext.setCurrentClass( elementClass );
      boolean previousIncludeEmbeddedObjectId = parseContext.includeEmbeddedObjectId();
      parseContext.setIncludeEmbeddedObjectId( indexedEmbeddedAnnotation.includeEmbeddedObjectId() );
      initializeClass(
          embeddedTypeMetadataBuilder,
          false,
          localPrefix,
          parseContext,
View Full Code Here

Examples of org.hibernate.search.annotations.IndexedEmbedded

      boolean disableOptimizations,
      TypeMetadata.Builder typeMetadataBuilder,
      ConfigContext configContext,
      PathsContext pathsContext,
      ParseContext parseContext) {
    IndexedEmbedded indexedEmbeddedAnnotation = member.getAnnotation( IndexedEmbedded.class );
    if ( indexedEmbeddedAnnotation == null ) {
      return;
    }

    parseContext.collectUnqualifiedCollectionRole( member.getName() );

    int oldMaxLevel = parseContext.getMaxLevel();
    int potentialLevel = depth( indexedEmbeddedAnnotation ) + parseContext.getLevel();
    // This is really catching a possible int overflow. depth() can return Integer.MAX_VALUE, which then can
    // overflow in case level > 0. Really this code should be rewritten (HF)
    if ( potentialLevel < 0 ) {
      potentialLevel = Integer.MAX_VALUE;
    }
    // HSEARCH-1442 recreating the behavior prior to PropertiesMetadata refactoring
    // not sure whether this is algorithmically correct though. @IndexedEmbedded processing should be refactored (HF)
    if ( potentialLevel < oldMaxLevel ) {
      parseContext.setMaxLevel( potentialLevel );
    }
    parseContext.incrementLevel();

    XClass elementClass;
    if ( void.class == indexedEmbeddedAnnotation.targetElement() ) {
      elementClass = member.getElementClass();
    }
    else {
      elementClass = reflectionManager.toXClass( indexedEmbeddedAnnotation.targetElement() );
    }

    if ( parseContext.getMaxLevel() == Integer.MAX_VALUE //infinite
        && parseContext.hasBeenProcessed( elementClass ) ) {
      throw new SearchException(
View Full Code Here

Examples of org.hibernate.search.annotations.IndexedEmbedded

      propertiesMetadata.containedInGetters.add( member );
    }
  }

  private void checkForIndexedEmbedded(XProperty member, PropertiesMetadata propertiesMetadata, String prefix, Set<XClass> processedClasses, InitContext context) {
    IndexedEmbedded embeddedAnn = member.getAnnotation( IndexedEmbedded.class );
    if ( embeddedAnn != null ) {
      int oldMaxLevel = maxLevel;
      int potentialLevel = embeddedAnn.depth() + level;
      if ( potentialLevel < 0 ) {
        potentialLevel = Integer.MAX_VALUE;
      }
      maxLevel = potentialLevel > maxLevel ? maxLevel : potentialLevel;
      level++;

      XClass elementClass;
      if ( void.class == embeddedAnn.targetElement() ) {
        elementClass = member.getElementClass();
      }
      else {
        elementClass = reflectionManager.toXClass( embeddedAnn.targetElement() );
      }
      if ( maxLevel == Integer.MAX_VALUE //infinite
          && processedClasses.contains( elementClass ) ) {
        throw new SearchException(
            "Circular reference. Duplicate use of "
View Full Code Here

Examples of org.hibernate.search.annotations.IndexedEmbedded

  }

  private void checkForIndexedEmbedded(XClass classHostingMember, XProperty member, PropertiesMetadata propertiesMetadata, String prefix,
                     Set<XClass> processedClasses, ConfigContext context, Set<XClass> optimizationBlackList,
                     boolean disableOptimizations, PathsContext pathsContext ) {
    IndexedEmbedded embeddedAnn = member.getAnnotation( IndexedEmbedded.class );
    if ( embeddedAnn != null ) {
      //collection role in Hibernate is made of the actual hosting class of the member (see HSEARCH-780)
      this.indexedEmbeddedCollectionRoles
          .add( StringHelper.qualify( classHostingMember.getName(), member.getName() ) );
      int oldMaxLevel = maxLevel;
      int potentialLevel = depth( embeddedAnn ) + level;
      if ( potentialLevel < 0 ) {
        potentialLevel = Integer.MAX_VALUE;
      }
      maxLevel = potentialLevel > maxLevel ? maxLevel : potentialLevel;
      level++;

      XClass elementClass;
      if ( void.class == embeddedAnn.targetElement() ) {
        elementClass = member.getElementClass();
      }
      else {
        elementClass = reflectionManager.toXClass( embeddedAnn.targetElement() );
      }

      if ( maxLevel == Integer.MAX_VALUE //infinite
          && processedClasses.contains( elementClass ) ) {
        throw new SearchException(
View Full Code Here

Examples of org.hibernate.search.annotations.IndexedEmbedded

      boolean disableOptimizations,
      TypeMetadata.Builder typeMetadataBuilder,
      ConfigContext configContext,
      PathsContext pathsContext,
      ParseContext parseContext) {
    IndexedEmbedded indexedEmbeddedAnnotation = member.getAnnotation( IndexedEmbedded.class );
    if ( indexedEmbeddedAnnotation == null ) {
      return;
    }

    parseContext.collectUnqualifiedCollectionRole( member.getName() );

    int oldMaxLevel = parseContext.getMaxLevel();
    int potentialLevel = depth( indexedEmbeddedAnnotation ) + parseContext.getLevel();
    // This is really catching a possible int overflow. depth() can return Integer.MAX_VALUE, which then can
    // overflow in case level > 0. Really this code should be rewritten (HF)
    if ( potentialLevel < 0 ) {
      potentialLevel = Integer.MAX_VALUE;
    }
    // HSEARCH-1442 recreating the behavior prior to PropertiesMetadata refactoring
    // not sure whether this is algorithmically correct though. @IndexedEmbedded processing should be refactored (HF)
    if ( potentialLevel < oldMaxLevel ) {
      parseContext.setMaxLevel( potentialLevel );
    }
    parseContext.incrementLevel();

    XClass elementClass;
    if ( void.class == indexedEmbeddedAnnotation.targetElement() ) {
      elementClass = member.getElementClass();
    }
    else {
      elementClass = reflectionManager.toXClass( indexedEmbeddedAnnotation.targetElement() );
    }

    if ( parseContext.getMaxLevel() == Integer.MAX_VALUE //infinite
        && parseContext.hasBeenProcessed( elementClass ) ) {
      throw log.detectInfiniteTypeLoopInIndexedEmbedded(
          elementClass.getName(),
          typeMetadataBuilder.getIndexedType().getName(),
          buildEmbeddedPrefix( prefix, indexedEmbeddedAnnotation, member )
      );
    }

    String localPrefix = buildEmbeddedPrefix( prefix, indexedEmbeddedAnnotation, member );
    PathsContext updatedPathsContext = updatePaths( localPrefix, pathsContext, indexedEmbeddedAnnotation );

    boolean pathsCreatedAtThisLevel = false;
    if ( pathsContext == null && updatedPathsContext != null ) {
      //after this level if not all paths are traversed, then the paths
      //either don't exist in the object graph, or aren't indexed paths
      pathsCreatedAtThisLevel = true;
    }

    if ( !parseContext.isMaxLevelReached() || isInPath(
        localPrefix,
        updatedPathsContext,
        indexedEmbeddedAnnotation
    ) ) {
      parseContext.processingClass( elementClass ); //push

      EmbeddedTypeMetadata.Builder embeddedTypeMetadataBuilder =
          new EmbeddedTypeMetadata.Builder(
              reflectionManager.toClass( elementClass ),
              member,
              typeMetadataBuilder.getScopedAnalyzer()
          );

      embeddedTypeMetadataBuilder.boost( AnnotationProcessingHelper.getBoost( member, null ) );
      //property > entity analyzer
      Analyzer analyzer = AnnotationProcessingHelper.
          getAnalyzer(
              member.getAnnotation( org.hibernate.search.annotations.Analyzer.class ),
              configContext
          );
      if ( analyzer == null ) {
        analyzer = typeMetadataBuilder.getAnalyzer();
      }
      embeddedTypeMetadataBuilder.analyzer( analyzer );

      if ( disableOptimizations ) {
        typeMetadataBuilder.blacklistForOptimization( elementClass );
      }

      // about to do a recursion, keep parse state which needs resetting
      XClass previousClass = parseContext.getCurrentClass();
      parseContext.setCurrentClass( elementClass );
      boolean previousIncludeEmbeddedObjectId = parseContext.includeEmbeddedObjectId();
      parseContext.setIncludeEmbeddedObjectId( indexedEmbeddedAnnotation.includeEmbeddedObjectId() );
      initializeClass(
          embeddedTypeMetadataBuilder,
          false,
          localPrefix,
          parseContext,
View Full Code Here

Examples of org.hibernate.search.annotations.IndexedEmbedded

      propertiesMetadata.containedInGetters.add( member );
    }
  }

  private void checkForIndexedEmbedded(XProperty member, PropertiesMetadata propertiesMetadata, String prefix, Set<XClass> processedClasses, ConfigContext context) {
    IndexedEmbedded embeddedAnn = member.getAnnotation( IndexedEmbedded.class );
    if ( embeddedAnn != null ) {
      int oldMaxLevel = maxLevel;
      int potentialLevel = embeddedAnn.depth() + level;
      if ( potentialLevel < 0 ) {
        potentialLevel = Integer.MAX_VALUE;
      }
      maxLevel = potentialLevel > maxLevel ? maxLevel : potentialLevel;
      level++;

      XClass elementClass;
      if ( void.class == embeddedAnn.targetElement() ) {
        elementClass = member.getElementClass();
      }
      else {
        elementClass = reflectionManager.toXClass( embeddedAnn.targetElement() );
      }
      if ( maxLevel == Integer.MAX_VALUE //infinite
          && processedClasses.contains( elementClass ) ) {
        throw new SearchException(
            "Circular reference. Duplicate use of "
View Full Code Here

Examples of org.hibernate.search.annotations.IndexedEmbedded

          bindFieldAnnotation( member, propertiesMetadata, prefix, fieldAnn );
        }
      }
    }

    IndexedEmbedded embeddedAnn = member.getAnnotation( IndexedEmbedded.class );
    if ( embeddedAnn != null ) {
      int oldMaxLevel = maxLevel;
      int potentialLevel = embeddedAnn.depth() + level;
      if ( potentialLevel < 0 ) {
        potentialLevel = Integer.MAX_VALUE;
      }
      maxLevel = potentialLevel > maxLevel ? maxLevel : potentialLevel;
      level++;

      XClass elementClass;
      if ( void.class == embeddedAnn.targetElement() ) {
        elementClass = member.getElementClass();
      }
      else {
        elementClass = reflectionManager.toXClass( embeddedAnn.targetElement() );
      }
      if ( maxLevel == Integer.MAX_VALUE //infinite
          && processedClasses.contains( elementClass ) ) {
        throw new SearchException(
            "Circular reference. Duplicate use of "
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.