Package org.hibernate.search.bridge.util.impl

Examples of org.hibernate.search.bridge.util.impl.ContextualException2WayBridge


      // FIXME for improved performance: avoid loading them in an early phase.
      return;
    }
    DocumentBuilderIndexedEntity docBuilder = entityIndexBinding.getDocumentBuilder();
    TwoWayFieldBridge idBridge = docBuilder.getIdBridge();
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge()
        .setClass(clazz)
        .setFieldName(docBuilder.getIdKeywordName())
        .setFieldBridge(idBridge);
    String idInString = contextualBridge.objectToString( id );
    //depending on the complexity of the object graph going to be indexed it's possible
    //that we hit the database several times during work construction.
    AddLuceneWork addWork = docBuilder.createAddWork( clazz, entity, id, idInString, sessionInitializer );
    backend.enqueueAsyncWork( addWork );
  }
View Full Code Here


      queue.add( createUpdateWork( entityClass, entity, id, idInString, this.classHelper ) );
    }
  }
 
  private String objectToString(TwoWayFieldBridge bridge, String fieldName, Object value) {
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge()
        .setClass( getBeanClass() )
        .setFieldBridge( bridge )
        .setFieldName( fieldName );
    return contextualBridge.objectToString( value );
  }
View Full Code Here

        .setFieldName( fieldName );
    return contextualBridge.objectToString( value );
  }

  private String objectToString(StringBridge bridge, String fieldName, Object value) {
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge()
        .setClass( getBeanClass() )
        .setStringBridge( bridge )
        .setFieldName( fieldName );
    return contextualBridge.objectToString( value );
  }
View Full Code Here

  public static Serializable getDocumentId(SearchFactoryImplementor searchFactoryImplementor, Class<?> clazz, Document document) {
    final DocumentBuilderIndexedEntity<?> builderIndexedEntity = getDocumentBuilder( searchFactoryImplementor, clazz );
    final TwoWayFieldBridge fieldBridge = builderIndexedEntity.getIdBridge();
    final String fieldName = builderIndexedEntity.getIdKeywordName();
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge();
    contextualBridge
        .setClass( clazz )
        .setFieldName( fieldName )
        .setFieldBridge( fieldBridge )
        .pushIdentifierMethod();
    return (Serializable) contextualBridge.get( fieldName, document );
  }
View Full Code Here

  public static Object[] getDocumentFields(SearchFactoryImplementor searchFactoryImplementor, Class<?> clazz, Document document, String[] fields) {
    DocumentBuilderIndexedEntity<?> builderIndexedEntity = getDocumentBuilder( searchFactoryImplementor, clazz );
    final int fieldNbr = fields.length;
    Object[] result = new Object[fieldNbr];
    Arrays.fill( result, NOT_SET );
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge();
    contextualBridge.setClass( clazz );
    if ( builderIndexedEntity.getIdKeywordName() != null ) {
      final XMember member = builderIndexedEntity.getIdGetter();
      final String fieldName = builderIndexedEntity.getIdKeywordName();
      int matchingPosition = getFieldPosition( fields, fieldName );
      if ( matchingPosition != -1 ) {
        if ( member != null ) {
          contextualBridge.pushMethod( member );
        }
        try {
          populateResult(
              fieldName,
              builderIndexedEntity.getIdBridge(),
              Store.YES,
              fields,
              result,
              document,
              contextualBridge,
              matchingPosition
              );
        }
        finally {
          if ( member != null ) {
            contextualBridge.popMethod();
          }
        }
      }
    }
View Full Code Here

      queue.add( createUpdateWork( entityClass, entity, id, idInString, this.instanceInitalizer ) );
    }
  }
 
  private String objectToString(TwoWayFieldBridge bridge, String fieldName, Object value) {
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge()
        .setClass( getBeanClass() )
        .setFieldBridge( bridge )
        .setFieldName( fieldName );
    return contextualBridge.objectToString( value );
  }
View Full Code Here

        .setFieldName( fieldName );
    return contextualBridge.objectToString( value );
  }

  private String objectToString(StringBridge bridge, String fieldName, Object value) {
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge()
        .setClass( getBeanClass() )
        .setStringBridge( bridge )
        .setFieldName( fieldName );
    return contextualBridge.objectToString( value );
  }
View Full Code Here

        searchFactoryImplementor,
        clazz
    );
    final TwoWayFieldBridge fieldBridge = builderIndexedEntity.getIdBridge();
    final String fieldName = builderIndexedEntity.getIdKeywordName();
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge();
    contextualBridge
        .setClass( clazz )
        .setFieldName( fieldName )
        .setFieldBridge( fieldBridge )
        .pushIdentifierMethod();
    return (Serializable) contextualBridge.get( fieldName, document );
  }
View Full Code Here

  public static Object[] getDocumentFields(SearchFactoryImplementor searchFactoryImplementor, Class<?> clazz, Document document, String[] fields) {
    DocumentBuilderIndexedEntity<?> builderIndexedEntity = getDocumentBuilder( searchFactoryImplementor, clazz );
    final int fieldNbr = fields.length;
    Object[] result = new Object[fieldNbr];
    Arrays.fill( result, NOT_SET );
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge();
    contextualBridge.setClass( clazz );
    if ( builderIndexedEntity.getIdKeywordName() != null ) {
      final XMember member = builderIndexedEntity.getIdGetter();
      final String fieldName = builderIndexedEntity.getIdKeywordName();
      int matchingPosition = getFieldPosition( fields, fieldName );
      if ( matchingPosition != -1 ) {
        if ( member != null ) {
          contextualBridge.pushMethod( member );
        }
        try {
          populateResult(
              fieldName,
              builderIndexedEntity.getIdBridge(),
              Store.YES,
              result,
              document,
              contextualBridge,
              matchingPosition
          );
        }
        finally {
          if ( member != null ) {
            contextualBridge.popMethod();
          }
        }
      }
    }
View Full Code Here

      // FIXME for improved performance: avoid loading them in an early phase.
      return;
    }
    DocumentBuilderIndexedEntity docBuilder = entityIndexBinding.getDocumentBuilder();
    TwoWayFieldBridge idBridge = docBuilder.getIdBridge();
    ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge()
        .setClass(clazz)
        .setFieldName(docBuilder.getIdKeywordName())
        .setFieldBridge(idBridge);
    String idInString = contextualBridge.objectToString( id );
    //depending on the complexity of the object graph going to be indexed it's possible
    //that we hit the database several times during work construction.
    AddLuceneWork addWork = docBuilder.createAddWork( clazz, entity, id, idInString, sessionInitializer );
    backend.enqueueAsyncWork( addWork );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.bridge.util.impl.ContextualException2WayBridge

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.