Package org.hibernate.search.annotations

Examples of org.hibernate.search.annotations.ProvidedId


    this.directoryProviders = directoryProviders;
    this.shardingStrategy = shardingStrategy;

    if ( idKeywordName == null ) {
      // if no DocumentId then check if we have a ProvidedId instead
      ProvidedId provided = findProvidedId( clazz, reflectionManager );
      if ( provided == null ) {
        throw new SearchException( "No document id in: " + clazz.getName() );
      }

      idBridge = BridgeFactory.extractTwoWayType( provided.bridge() );
      idKeywordName = provided.name();
    }
  }
View Full Code Here


    }
    return documentIdAnn;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = clazz.getSuperclass();
    }
View Full Code Here

  private PropertyMetadata providedIdMetadata(XClass clazz, ConfigContext context, ReflectionManager reflectionManager) {
    PropertyMetadata propertyMetadata = null;

    FieldBridge providedIdFieldBridge = null;
    String providedIdFieldName = null;
    ProvidedId provided = findProvidedId( clazz, reflectionManager );
    if ( provided != null ) {
      providedIdFieldBridge = BridgeFactory.extractTwoWayType( provided.bridge(), clazz, reflectionManager );
      providedIdFieldName = provided.name();
      idProvided = true;
    }
    else if ( context.isProvidedIdImplicit() ) {
      providedIdFieldBridge = new TwoWayString2FieldBridgeAdaptor( org.hibernate.search.bridge.builtin.StringBridge.INSTANCE );
      providedIdFieldName = ProvidedId.defaultFieldName;
View Full Code Here

  public FieldCacheCollectorFactory getIdFieldCacheCollectionFactory() {
    return idFieldCacheCollectorFactory;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = currentClass.getSuperclass();
    }
View Full Code Here

      boolean disableOptimizationsArg,
      PathsContext pathsContext) {
    List<XClass> hierarchy = ReflectionHelper.createXClassHierarchy( parseContext.getCurrentClass() );

    // Iterate the class hierarchy top down. This allows to override the default analyzer for the properties if the class holds one
    ProvidedId explicitProvidedIdAnnotation = null;
    XClass providedIdHostingClass = null;
    for ( XClass currentClass : hierarchy ) {
      if ( currentClass.getAnnotation( ProvidedId.class ) != null ) {
        explicitProvidedIdAnnotation = currentClass.getAnnotation( ProvidedId.class );
        providedIdHostingClass = currentClass;
View Full Code Here

   */
  public DocumentBuilderIndexedEntity(XClass clazz, TypeMetadata typeMetadata, ConfigContext context,
      ReflectionManager reflectionManager, Set<XClass> optimizationBlackList, InstanceInitializer instanceInitializer) {
    super( clazz, typeMetadata, reflectionManager, optimizationBlackList, instanceInitializer );

    ProvidedId providedIdAnnotation = findProvidedId( clazz, reflectionManager );
    if ( providedIdAnnotation != null || context.isProvidedIdImplicit() ) {
      idProvided = true;
    }

    if ( idPropertyMetadata == null ) {
View Full Code Here

  public FieldCacheCollectorFactory getIdFieldCacheCollectionFactory() {
    return idFieldCacheCollectorFactory;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = currentClass.getSuperclass();
    }
View Full Code Here

    initializeMembers( clazz, rootPropertiesMetadata, true, "", processedClasses, context );
    //processedClasses.remove( clazz ); for the sake of completness
    this.analyzer.setGlobalAnalyzer( rootPropertiesMetadata.analyzer );
    if ( idKeywordName == null ) {
      // if no DocumentId then check if we have a ProvidedId instead
      ProvidedId provided = clazz.getAnnotation( org.hibernate.search.annotations.ProvidedId.class );
      if ( provided == null ) throw new SearchException( "No document id in: " + clazz.getName() );

      //FIXME navssurtani use something similar to BridgeFactory.extractType(ClassBridge)
      idBridge = getProvidedIdBridge();
      idKeywordName = provided.name();


    }
    //if composite id, use of (a, b) in ((1,2)TwoWayString2FieldBridgeAdaptor, (3,4)) fails on most database
    //a TwoWayString2FieldBridgeAdaptor is never a composite id
View Full Code Here

    this.directoryProviders = directoryProviders;
    this.shardingStrategy = shardingStrategy;

    if ( idKeywordName == null ) {
      // if no DocumentId then check if we have a ProvidedId instead
      ProvidedId provided = findProvidedId( clazz, reflectionManager );
      if ( provided == null ) {
        throw new SearchException( "No document id in: " + clazz.getName() );
      }

      idBridge = BridgeFactory.extractTwoWayType( provided.bridge() );
      idKeywordName = provided.name();
    }
  }
View Full Code Here

    }
    return documentIdAnn;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = clazz.getSuperclass();
    }
View Full Code Here

TOP

Related Classes of org.hibernate.search.annotations.ProvidedId

Copyright © 2018 www.massapicom. 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.